MATLAB: How to perform false coloring without gray scale conversion

falsecoloringimage processing

Best Answer

This is done by the function rgb2ind(). You can make up whatever colormap you want.
indexedImage = rgb2ind(rgbImage, myColorMap);
If you want to see your image as an RGB image again, looking posterized/pseudocolored if your colormap doesn't have too many rows in it:
rgbPosterizedImage = ind2rgb(indexedImage, myColorMap);
Or you can display it as an indexed image with the colormap:
imshow(indexedImage);
colormap(myColorMap);
colorbar;