convert gray image back to rgb
804 views (last 30 days)
Image Analyst on 14 Mar 2013
If you have a color map - a mapping of what intensity should go to what color, like what imread() or rgb2ind() can give you - then you can use ind2rgb.
rgbImage = ind2rgb(grayImage, colormap);
rgbImage = cat(3, grayImage, grayImage, grayImage);
grayImage needs to be in the range 0-255 uint8 if you want to display it.
More Answers (3)
Shaun VanWeelden on 14 Mar 2013
rgb=img(:,:,[1 1 1]); does the same thing as Jan's, but is a little shorter maybe and easier to remember. img is your image you want to convert to rgb obviously
Jan on 14 Mar 2013
Asking Google for "Matlab gray2rgb" would be a good idea.
But a general method is:
RGB = cat(3, Gray, Gray, Gray);