How to decide the area bounded by contour, but only the ones whose centroid have been decided?
1 次查看(过去 30 天)
显示 更早的评论
I 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
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
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:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Segmentation and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!