calculate the percentage of B&W image
조회 수: 20 (최근 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!