Reputation: 1390
I'm trying to switch to python from matlab and i have this problem.
imgMosaic
is a an numpy array.
You can see down there that the file resolution is 2548 x 4000
i'm trying to access the first "mini-image" (resolution 28 x 40) from imgMosaic, but i'm getting a file with resolution 28x4000
instead of
28x40
and i don't understand why.
imgMosaic = np.asarray(cv2.imread('../data/images/image.jpeg', cv2.IMREAD_COLOR))
print imgMosaic.shape
>> (2548, 4000, 3)
print imgMosaic[0:28][0:40][:]
>> (28, 4000, 3)
Upvotes: 0
Views: 3212
Reputation: 11
Your indexing could be modified as:
imgMosaic[:28, :40, :]
First 28 row element, first 40 column elements and all elements in the last axis.
imgMosaic[:28, :40, :].shape
>>> (28,40,3)
Upvotes: 1