I am trying to divide a raw image into 8x8 overlapping blocks so I can do feature extraction later.
Here is my code:
new0 = np.zeros((heightimage0R, widthimage0R), np.uint8)
k = 0
for i in range(heightimage0R):
for j in range(widthimage0R):
crop_tmp0R = image0R[i:i+8,j:j+8]
new0[k, 0:64] = crop_tmp0R.flatten()
k = k + 1
However, when ever I run my code I get the following error:
Traceback (most recent call last):
File "<ipython-input-392-cf9c59842d3a>", line 6, in <module>
new0[k, 0:64] = crop_tmp0R.flatten()
IndexError: index 256 is out of bounds for axis 0 with size 256
I have tried widthimage0R-1 in the for loop but it still does not work.