How does regionprops compute for the centroid?

5 Ansichten (letzte 30 Tage)
Phantom.i7
Phantom.i7 am 19 Sep. 2015
Beantwortet: Matthew Eicholtz am 21 Mär. 2016
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.

Antworten (2)

Image Analyst
Image Analyst am 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?

Matthew Eicholtz
Matthew Eicholtz am 21 Mär. 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.

Community Treasure Hunt

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

Start Hunting!

Translated by