How does regionprops compute for the centroid?
5 views (last 30 days)
Show older comments
Hi,
Im wondering on how does regionprops computer for its centroid properties? It says that
'Centroid' – 1-by-Q vector that specifies the center of mass of the region. Note that the first element of Centroid is the horizontal coordinate (or x-coordinate) of the center of mass, and the second element is the vertical coordinate (or y-coordinate). All other elements of Centroid are in order of dimension.
This figure illustrates the centroid and bounding box for a discontiguous region. The region consists of the white pixels; the green box is the bounding box, and the red dot is the centroid.
Its not really detailed. I wanna know how it computes for the centroid on step by step process. Thank you for your answer.
0 Comments
Answers (2)
Image Analyst
on 19 Sep 2015
It's probably the usual definition where it's the mean of all the x and y coordinates of the blob. Are you finding some discrepancy with that?
0 Comments
Matthew Eicholtz
on 21 Mar 2016
You can actually look at the function directly if you want!
open regionprops
In R2016a, the ComputeCentroid function starts at line 501. As Image Analyst suggested, it is indeed computed by taking the mean x and y values for pixels in the blob.
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!