I am trying to open an image which has 960 (width) x 640 (height) pixels as a matrix in python.
For some reason, after running the following lines:
originalImage = Image.open('fat_zack.jpg')
originalImageMatrix = numpy.asarray(originalImage)
originalImageMatrix is of size (640, 960, 3) and I have to access its elements by providing column coordinate prior to row coordinate
If I try to do something like: originalImageMatrix[959][1][1] I get the following error:
IndexError: index 959 is out of bounds for axis 0 with size 640
Do you've any idea what am I missing?
Fixed it with Matt Pitkin's solution -> originalImageMatrix.swapaxes(0, 1)
What causes this problem is still unknown to me, though.