how can i find the ratio of area of white color and black color area in binary image or the output images of edge detection filters

3 views (last 30 days)
Answered: Santhana Raj on 31 Mar 2017
I have done edge detection on an image and output image we get in binary or b&w image. I want to calculate the ratio of area covered by white color to black color. I also want to know the area of white color( I have calculated it but the number i get is like '1.4187e+04' , I need the unit to define it).

Answers (1)

Santhana Raj
Santhana Raj on 31 Mar 2017
When you get a binary image, You just add all the pixels in the image. Then you get the no of pixels with white. Subtract it with the total no of pixels (length x breadth), you get the no of black. You can take percentage, ratio or whatever you want now.
As for the area of the white pixels of the image, considering you have just counted the number of pixels, the unit will be (1)pixels (for a simple analysis) (2) if you want in SI units, then you have to multiply with the image sensor resolution which will give you the area in square meter.
Hope it helps.

Community Treasure Hunt

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

Start Hunting!