I will first explain what I want to do. I have an image and I want to store the pixel values for a specific ROI. For that reason I implement the following loop(found in another topic of the site):
pixels = im.load()
all_pixels = []
for x in range(SpecificWidth):
for y in range(SpecificHeight):
cpixel = pixels[x, y]
all_pixels.append(cpixel)
However, it does not return a SpecificwidthXSpecificHeight matrix but one of length as much as the values. Because I want to keep the size of the matrix of the ROI I implement the following loop(much the same with the previous):
array=np.array(all_pixels)
roi_pixels = np.zeros((SpecificWidth,SpecificHeight))
for i in range(0,array.shape[0],width):
c_roi_pixels=all_pixels[i]
roi_pixels.append(c_roi_pixels)
And I have the error as it mentioned in the title.