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

5 views (last 30 days)
Frank M on 2 Aug 2019
Commented: Frank M on 6 Aug 2019
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.

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
Frank M on 2 Aug 2019
Thank you, will try!

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:

#### 1 Comment

Frank M on 6 Aug 2019
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?