필터 지우기
필터 지우기

Extracting the red channel of an image

조회 수: 2 (최근 30일)
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2012년 4월 9일
이동: DGM 2023년 12월 29일
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

채택된 답변

Image Analyst
Image Analyst 2012년 4월 9일
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 colormap if you want to each to make it appear in it's original shade as explained in http://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.

추가 답변 (1개)

Razvan
Razvan 2012년 4월 9일
v contains only one color plane, so imshow(v) treats it as a grayscale image. You have there the actual red intensities.
If you want to show the image as red, you need to do something like
v = zeros(size(i));
v(:,:,1) = i(:,:,1);
imshow(v)

카테고리

Help CenterFile Exchange에서 Explore and Edit Images with Image Viewer App에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by