calculate the percentage of B&W image
11 次查看(过去 30 天)
显示 更早的评论
I have a black and white image, how do I calculate the percentage of the white area over the black area?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191547/image.png)
0 个评论
回答(2 个)
Nithin Banka
2018-6-29
If 'BW' is your binary threshold image,
pix = size(BW);
no_of_pix = pix(1)*pix(2);
no_of_white_pix = sum(sum(BW==1));
percent_of_white_pix = no_of_white_pix*100/no_of_pix; %This gives the percentage of white in the image.
0 个评论
另请参阅
类别
在 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!