Greetings, for a school project I need to detect if there are nonwhite colors in this image.
http://radar.weather.gov/ridge/RadarImg/N0R/JUA_N0R_0.gif
If there are colors apart from white in the image I need to transmit a signal to a controller telling it to start working.
How do I detect colors and transmit the signal?

 Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 7 Mär. 2011

1 Stimme

in a unsigned 8bit integer image (uint8) (just example)
I = your_image
assert(isa(I,'uint8'),'For this example I is expected to be uint8');
if(any(I(:)~=255))
fprintf('There are non white areas');
else
fprintf('All white!');
end

Weitere Antworten (2)

Walter Roberson
Walter Roberson am 7 Mär. 2011

1 Stimme

First you have to define "white" for your purposes. If a pixel is (254, 254, 254) then is that white? How about (255,255,254) ? How about (128,128,128) ?
Jose
Jose am 7 Mär. 2011

0 Stimmen

Thank You very much Sean de... It worked. Walter Roberson, you are also right, the program was not working because 255 was not the value of white for that image, I clicked on the variable matrix of the image and it was 9, after I changed the value, it worked perfectly.

Kategorien

Mehr zu Convert Image Type finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by