Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
How to change this image to binary
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I want to convert this image. the red colour part become black and other part become white?? Is there any way to do it??
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/149868/image.jpeg)
0 comentarios
Respuestas (1)
Walter Roberson
el 6 de Mayo de 2015
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;
0 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!