How can I write a code to count the black pixels and the white pixels in a binary image?

 채택된 답변

Turlough Hughes
Turlough Hughes 2019년 12월 15일

1 개 추천

Let's say you have a binary image B. You can get the number of black pixels by:
numBlack=nnz(~B);
and the number of white pixels by:
numWhite=nnz(B);

댓글 수: 2

Turlough Hughes
Turlough Hughes 2019년 12월 15일
Fatema, did this help/work?
fatema ali
fatema ali 2019년 12월 15일
Yes it did, thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

질문:

2019년 12월 15일

댓글:

2019년 12월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by