필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to change this image to binary

조회 수: 1 (최근 30일)
nurul hafizah
nurul hafizah 2015년 5월 6일
마감: MATLAB Answer Bot 2021년 8월 20일
I want to convert this image. the red colour part become black and other part become white?? Is there any way to do it??

답변 (1개)

Walter Roberson
Walter Roberson 2015년 5월 6일
too_dark_for_red = YourImage(:,:,1) < some_low_red_threshold;
too_light_for_black = YourImage(:,:,2) > some_low_green_threshold | YourImage(:,:,3) > some_low_blue_threshold;
isnt_red = too_dark_for_red | too_light_for_black;
The locations that will become false (0) are those where there is enough "red" for it not to be "noise" in the sensor, and there is not enough green or blue for it to be a grey pixel.
Another potential approach would be to check to see if the red component of a pixel is "enough" greater than the blue or green component. shades of grey (white) are those where the components are close to equal, so if the components are sufficiently unequal then there will be a redder cast (if it is red that is the notably stronger component.)
If we make the optimization that the only colors are red or shades of grey then we do not need to check both the green and blue panes: in the locations where there are shades of grey then the two will be nearly equal. So we can make the test:
isnt_red = YourImage(:,:,1) < YourImage(:,:,2) + red_cast_threshold;

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by