Only analyze what is outlined in black in an image

2 ビュー (過去 30 日間)
Dinuri Rupasinghe
Dinuri Rupasinghe 2021 年 7 月 26 日
コメント済み: Dinuri Rupasinghe 2021 年 7 月 30 日
Hi, I have to write a code that only considers what is within a certain pattern of circles in a black and white image. To do this, I overlayed an image of a bracket of circles outlined in black over the picture that I want to analyze, and now I only want to get data about the parts of the picture that are within the circles. (Specifically, I want to count the number of black pixels vs white pixels within all the circles). Please let me know if there is a way to disregard the parts of the picture that are not outlined by the circles.
Thank you!

採用された回答

Matt J
Matt J 2021 年 7 月 26 日
If you have a binary mask of the circles, you can just do
numBlack = nnz( circles & ~BW );
numWhite = nnz( circles & BW);
  10 件のコメント
Matt J
Matt J 2021 年 7 月 30 日
I and BW need to be the same size.
Dinuri Rupasinghe
Dinuri Rupasinghe 2021 年 7 月 30 日
This worked. Thank you!

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by