views:

46

answers:

1

I have a 3D matrix im which represents an RGB image. I can do

imshow(im)

to display the image.

I want to display only one of the RGB channels at a time: I want to display the red channel and I want it to appear red.

I've tried

imshow(im(:,:,1))

but it displays the grayscale image (which is not what I want).

How do I display the red channel and make it appear red?

+3  A: 

I have three proposals for you.

1. Use the imagesc function and choose a red color palette.

2. Clear the other color channels: im(:,:,2:3) = 0; imshow(im);

3. Use the ind2rgb function with a color map you build accordingly.

ypnos
Thanks. Chose option 2
snakile