필터 지우기
필터 지우기

How to remove G from RGB image

조회 수: 12 (최근 30일)
Feynman
Feynman 2013년 10월 4일
댓글: Image Analyst 2013년 10월 5일
How would you remove G from an RGB image?
  댓글 수: 2
Image Analyst
Image Analyst 2013년 10월 5일
What does this mean? Do you want to set the entire green channel to zero, like Walter did? Do you want to set green looking objects in the image to black? Do you want to go from a 3D color array with 3 color channels to a 3D array with only two color channels? Do you want to extract (segment) the green objects in the image and place them in a new, separate image? Please explain what you want to do so we can remove the uncertainty in your question.
Walter Roberson
Walter Roberson 2013년 10월 5일
Are you "green screening" ?

댓글을 달려면 로그인하십시오.

채택된 답변

Feynman
Feynman 2013년 10월 5일
This is for a project and the purpose of this specific task is to see the effects of removing a channel from an image. My professor asks that we create a new matrix that does not include the green color values I am not sure whether he means complete removal of the channel or setting it to 0. He gives an example of what the image is suppose to look like before and after and once he creates the new image (picture of a man), the man is purple.
  댓글 수: 2
dk
dk 2013년 10월 5일
when you remove all green by setting the green layer to 0, the image will look purple-ish as red + blue is roughly purple.
Image Analyst
Image Analyst 2013년 10월 5일
This is what Walter correctly guessed that you meant. His code does that - did you try it yet? Please try it and then mark his answer "Accepted".
You can't display anything except a one color channel image or a three color channel image. If you want anything else (2 colors, 4, 5, 6, etc. hyperspectral image), then you're going to have to figure out some way to get it into a 3 channel true color image. So I doubt he meant to remove the second color channel and almost certainly meant to just set it to 0, which is what Walter's code does.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2013년 10월 5일
YourImage = imread('TheImage.jpg');
YourImage(:,:,2) = 0;
image(YourImage);
imwrite(YourImage, 'TheNewImage.jpg');

Community Treasure Hunt

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

Start Hunting!

Translated by