How to calculate the area of only white part in the image
9 次查看(过去 30 天)
显示 更早的评论
I want to calculate the area of only white part as shown in the figure. I had used - bwarea(image). But I am not sure whether its calculating correct area or not. As I just need the white portion area.
Any help is much appreciated.
Thank you in advance!!
2 个评论
Jonas
2021-4-22
you could count the white pixels, divide it by overall number of pixels and multiply it with the real size of the image
采纳的回答
Image Analyst
2021-4-23
You simply use nnz on your binary image to get the area in pixels
whiteArea = nnz(mask)
or you could use bwarea() - it uses a somewhat different algorithm for determining area (it's not just counting pixels).
whiteArea = bwarea(mask)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Segmentation and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!