How to decide the area bounded by contour, but only the ones whose centroid have been decided?
1 view (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 2 Aug 2019
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
Answers (1)
Shashwat Bajpai
on 6 Aug 2019
Edited: Shashwat Bajpai
on 6 Aug 2019
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:
See Also
Categories
Find more on Image Segmentation and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!