how to perform false coloring without gray scale conversion?

 Accepted 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;

2 Comments

Can you please suggest some color palette that gives best result when reverse false coloring is performed

Sign in to comment.

More Answers (1)

More clarification needed, though I am trying to figure out what you looking for. %You can directly force the particular value in the respective color plane. %Say if you want all pixel values less than 124 then you can be forced all pixel values should be red color in any plane
rgb_image=imread('test.jpg');
figure, imshow(rgb_image);
R=rgb_image(:,:,1);
G=rgb_image(:,:,2);
B=rgb_image(:,:,3);
R=R<=124;
G=G>124;
G=G<230;
B=B>230;
And cat displays all three planes. Also, you can force any specific two colors to zero, the third one will remain.
G(:,:)>124==0;
B(:,:)>124==0;

1 Comment

Thank you!!
I want to perform false coloring without color-to-gray conversion.For each color value I(x, y) in the original image, the corresponding false color value FI(x, y) need to compute
FI(x, y) = Pc [I(x, y)]
where Pc denotes the cth channel of the color palette P.

Sign in to comment.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!