How to calculate the area of only white part in the image
3 ビュー (過去 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!!![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/592690/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/592690/image.jpeg)
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 で Denoising and Compression についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!