Gray Scale to Pseudo Color Transformation in MATLAB
The principle behind the pseudo color transformation is to map the intensity value in the image to the result of three distinct transformations—RED, BLUE, and GREEN—on a grayscale or intensity image. Now we can see an example of this procedure using Matlab.
Example 1:
Matlab
X = imread( 'GeeksForGeeks.tif' );
Output = zeros([size(X,1) size(X,2) 3]);
map = colormap(jet(256));
Red = map(:,1);
Green = map(:,2);
Blue= map(:,3);
Output(:,:,1) = Red(X);
Output(:,:,2) = Green(X);
Output(:,:,3) = Blue(X);
Output = im2uint8(Output);
imshow(Output);
Save the image as either a PNG or a JPEG.
imwrite(Output, 'pseudo_color.jpg' );
|
Output:
input image
output image
Last Updated :
29 Dec, 2022
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...