I have an image typed double in Matlab. How can I imshow
it? Thanks.
load('file.mat');
b=d.l{2,1}.a{1,1}; %//b is an image <96x96x4 double>
imshow(b);
I have an image typed double in Matlab. How can I imshow
it? Thanks.
load('file.mat');
b=d.l{2,1}.a{1,1}; %//b is an image <96x96x4 double>
imshow(b);
As @rayryeng suggests, imshow
does not like 4 channel images. Thus:
If your image is NxMx3
, and you made a typo in the comment, use imshow(b,[])
to auto-adjust the limits of the imshow
function.
If your 4th channel is alpha, then either ignore the alpha: imshow(b(:,:,1:3),[])
Or, convert your image from RGBA to the closest representation in RGB. You can do that with something called alpha blending, and you have a nice answer (in another programming language) in this SO post: Convert RGBA color to RGB
If neither of these is your case, then you may want to give more information.