How to decide the area bounded by contour, but only the ones whose centroid have been decided?

1 次查看(过去 30 天)
untitled.pngI have a stack of binary images just like the frame I've shown above. I'm tracking the movement and size of the clusters. I did the tracking in another program, ImageJ. Because I tracked the movement with certain criteria (the cluster must exist for at least 8 consecutive frames to be recorded), many of the visible clusters in this frame are actually discarded in my tracking process. In the end, I have the location of the centroids in every frame.
However, I am also interested in the sizes of the clusters. MATLAB's built in Image Region Analyzer is no good because many of the clusters have been discarded during the tracking process. Is there a way to measure the area of the regions enclosed by outlines whose centroids are calculated? In other words, regions of interest are only the ones noted by my centroids.
  2 个评论
Walter Roberson
Walter Roberson 2019-8-2
regionprops and ask for convex hull and size information, and discard the entries where the convex hull does no enclose one of the centroids. You could pre-pass by doing bounding box checks as a first filter before doing the more detailed check of convex hull

请先登录,再进行评论。

回答(1 个)

Shashwat Bajpai
Shashwat Bajpai 2019-8-6
编辑:Shashwat Bajpai 2019-8-6
I would also use regionpropsto get the statistics of the binary image. The following lines of code find the area of all the centroids found by regionprops.
s = regionprops(im,'centroid');
centroids = cat(1,s.Centroid);
plot(centroids(:,1),centroids(:,2),'b*')
ar = regionprops(im,'area');
For your application you can feed the centroids found by your algorithm to this function and get the areas of the corresponding clusters.
Hope this helps!
You can refer to the documentation for regionprops for further information about its properties:
  1 个评论
Frank M
Frank M 2019-8-6
Thank you Shashwat. As I plotted the centroids from regionprops and compared them with the centroid from my tracking, I found that the centroids of supposedly the same cluster may sometimes be slightly off. Thus, I cannot easily match and pair them together. As shown in the plot below, the blue astericks are from regionprops, and the red ones are from my tracking. Do you have any suggestions?untitled.png

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by