How to calculate the different color area from RGB image
Show older comments
Hi everybody, Now i have a RGB image, red, white, black(background). Now i can move the black background from picture,and how can i calculate the each red and white area ratio?
Answers (2)
Walter Roberson
on 3 Oct 2011
0 votes
To detect the white area, the easiest way would be to extract the green or blue channels, threshold on that, and then sum(sum(TheArray))) to get the area of the white portion. Then, threshold on the red channel and turn off any pixel that occurs in the first thresholded result (e.g., Red & ~Green), and sum(sum()) to get the area of the red portion.
Do not simply threshold on red, as white has equal components of red, green, and blue, so any white area will show up strongly on the red channel.
Image Analyst
on 4 Oct 2011
0 votes
I have several color segmentation demos on my File Exchange. If you understand those, you will see how to answer your question. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Categories
Find more on Images in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!