Reputation: 301
I am trying to get RGB matrices for an image. When my image is 1200x1600, the following code
I=imread('testme.jpg');
I=im2double(I);
yields a 1200x1600x3 matrix and I can get RGB matrices but when the image is a screenshot of a part of this image, the code below
I=imread('testme_subpic.jpg');
I=im2double(I);
yields 167x228 matrix and I can't get the RGB matrices.
Likely, when I write
I=imread('testme.png');
I=im2double(I);
lines give me a 1200x1600 matrix.
My question is why can't I get a 3-dimensional matrix with the png or the smaller-sized jpg and how do I get it?
Upvotes: 1
Views: 78
Reputation: 1490
It is all about the way the images were saved. Check wikipedia for some extra info about png pixel formats. To avoid this issue you can try to use MATLAB itself to write your images, that way you have control over pixel formats (imwrite)
Upvotes: 2