for extracting red color alone of a color image input, i used the following code.
i=imread('football.jpg');
v=i(:,:,1);
imshow(v)
whether my code is doubt and if yes, why red color is not visible
Best Answer
You extracted the red channel of a color image. Each color channel is simply a 2D image with an intensity. Essentially each one is a monochrome image, and those are displayed in gray scale by default. You can apply a colormapif you want to each to make it appear in it's original shade as explained inhttp://www.mathworks.com/support/solutions/en/data/1-GNRWEH/index.html;jsessionid=523e8fb9a5651ebf4a0434578bbb but it's not really necessary and not usually done, or convert back to a color image again like Razvan did.
Those are three gray scale images. If they're uint8, they should use the original values. To be sure, you can use [0,255] in imshow
imshow(red, [0,255]);
imshow(green, [0,255]);
imshow(blue, [0,255]);
They will show up as grayscale. If you want them in their "original" colors, you have to either apply a colormap or convert them to an RGB image in the appropriate plane.
If you want to scale each image from its own min to its own max, use []:
The colon basically means "all" so imageArray(:,:,2) means all rows and all columns of the 2nd color plane in the image.
You're getting three images because you did not specify the color plane so you're getting the columns and color planes all combined into one image that's 3 times as wide. If you'd done v=i(:,:,2) you'd get only one image, not three.
By the way, we don't usually email private answers to questions asked here in this public forum. We give the answers here so everyone can learn from them.
Best Answer