Counting black pixels in a binary image

13 ビュー (過去 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 Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by