Я пытаюсь преобразовать изображение в длинный двумерный массив (nrow * ncol, nband) со следующим кодом:
new_shape = (img.shape[0] * img.shape[1], img.shape[2] - 1)
img_as_array = img[:, :, :7].reshape(new_shape)
print('Reshaped from {o} to {n}'.format(o=img.shape,
n=img_as_array.shape))
В результате получается следующая ошибка:
ValueError Traceback (most recent call last)
<ipython-input-205-9de646941a34> in <module>
2 new_shape = (img.shape[0] * img.shape[1], img.shape[2] - 1)
3
----> 4 img_as_array = img[:, :, :7].reshape(new_shape)
5 print('Reshaped from {o} to {n}'.format(o=img.shape,
6 n=img_as_array.shape))
ValueError: cannot reshape array of size 71696520 into shape (17924130,3)