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
% READ A IMAGE INSTALLED X = imread( 'GeeksForGeeks.tif' );
%PREFACE A MATRIX Output = zeros([size(X,1) size(X,2) 3]); %Characterize a colormap map = colormap(jet(256)); %Assign 1-D RED, GREEN, and BLUE to the columns. Red = map(:,1); Green = map(:,2); Blue= map(:,3); %MAP THE COLORS IN RELATION TO THE IMAGE'S INTENSITY Output(:,:,1) = Red(X); Output(:,:,2) = Green(X); Output(:,:,3) = Blue(X); Output = im2uint8(Output); % SHOW THE IMAGES imshow(Output); Save the image as either a PNG or a JPEG. imwrite(Output, 'pseudo_color.jpg' );
|
Output: