I want to differentially recognize circular spots within a binary image.
I also want to count how many pixels are inside each individually recognized spot.
Is there a way?

 採用された回答

Image Analyst
Image Analyst 2021 年 5 月 30 日

0 投票

I do exactly this in my Image Segmentation Tutorial with the standard coins demo image:
Please study it. Basically
props = regionprops(mask, 'Area');
allAreas = [props.Area] % Areas of all blobs in pixels.
but there's more to it so look over my well commented tutorial.

6 件のコメント

HJ
HJ 2021 年 5 月 30 日
Thank you. I will study this.
I have one more question.
I am wondering if I can find the center of a point and calculate the distance between the centers.
Is there a function or example suitable for this problem?
Image Analyst
Image Analyst 2021 年 5 月 30 日
Not sure what "the center of a point" means, but you can use pdist2() to find the distances between lists of (x,y) coordinates.
distances = pdist2(xySet1, xySet2);
pdist2() is in the Statistics and Machine Learning Toolbox. xySet is an N by 2 list of (x,y) coordinates for N points. Set1 and Set2 do not have to have the same number of points in them.
HJ
HJ 2021 年 5 月 30 日
Sorry for not clarifying the question.
1. I want to find the number of individual pixels in each cluster (dot) in a binary image like picture. (Image like the picture below)
2. I also want to find the centroid of each cluster and find all distances between nearby centroids.
Image Analyst
Image Analyst 2021 年 5 月 30 日
It's still not clarified. For one, you didn't attach your photo. Secondly you have not said why my Image Segmentation Tutorial did not work with your image, or if you even tried it at all. So I don't have anything else to add to my answer. Just call regionprops() as my tutorial does, and walks you through step by step.
HJ
HJ 2021 年 5 月 31 日
編集済み: HJ 2021 年 5 月 31 日
Thanks for the advice.
I followed the tutorial and verified that the coin was detected using the regionprops function.
However, there are problems that are not recognized in some coins. I wonder if I can lower the coin detection sensitivity.
Image Analyst
Image Analyst 2021 年 5 月 31 日
What problems? Were they supposed to be recognized? What steps did you take to recognize/detect those problems?

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

その他の回答 (1 件)

Matt J
Matt J 2021 年 5 月 29 日

0 投票

Yes, regionprops(___,'Area')

製品

リリース

R2021a

質問済み:

HJ
2021 年 5 月 29 日

コメント済み:

2021 年 5 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by