Error trying to convert x * y * 3 matrix to image in MATLAB? -


i have x*y*3 matrix in matlab i'm trying convert image (layer 1 r intensity, layer 2 g intensity, layer 3 b intensity.

i'm using imwrite function convert it, resulting image in black , white. because calculations rely on matrix being 3 layers can't compress down 1 , use ind2rgb function , map, can i?

i'm pretty lost, advice appreciated. please , thank you!

it possible values of image out of range.

you can try either uint8():

imwrite(uint8(i), 'file.png'); 

or, mat2gray():

imwrite(mat2gray(i),'file.png'); 

assuming i image data.


Comments