How to calculate the different color area from RGB image
7 views (last 30 days)
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?
0 Comments
Answers (2)
Walter Roberson
on 3 Oct 2011
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.
0 Comments
Image Analyst
on 4 Oct 2011
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
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!