MATLAB: The R G B component of a pic are not red green and blue

image processingr g b

HI, I am new with the image processing and need to do some processing on the R G B component of a color pic. I used the "image()" to show the R G B pic and it looks a little wired. The code and the result are as below: The first,second, and third pic corresponding to the R G B component of a pic of fourth pic. My question is why the R G B component of a pic are not red, green, and blue?
Any hint is appreciated.

Best Answer

The R, G and B channel of an RGB image do not have a color, but an intensity only. It is the intensity of the red, green and blue channel. You can display them in their color, but in your code example they are displayed in pseudo colors, which depend on the used coplormap.
Try this:
R = A(:,:,3);
figure;
image(R)
R3 = cat(3, R, R, R); % greyscale
figure
image(R3);
RR = zeros([size(R), 3]);
RR(:, :, 1) = R;
figure
image(RR);
Note: There is no reason for real(): Images do not habe imaginary parts.
Related Question