Counting black pixels in a binary image

조회 수: 16 (최근 30일)
fatema ali
fatema ali 2019년 12월 15일
댓글: fatema ali 2019년 12월 15일
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일
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개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by