Further documentation for regionprops

2 vues (au cours des 30 derniers jours)
Veena Chatti
Veena Chatti le 9 Juil 2020
Commenté : Walter Roberson le 13 Juil 2020
Hi!
I'm looking for more detailed documentation on the mathematical definition of the Centroid property returned by regionprops. Does anyone know where I can find further information or references?
The MATLAB documentation says that it's the center of mass of a region within a bounding box. I am looking for the precise equation this definition uses.
Thanks,
Veena

Réponses (1)

Mahesh Taparia
Mahesh Taparia le 13 Juil 2020
Modifié(e) : Mahesh Taparia le 13 Juil 2020
Hi
The centroid coordinate is the mean of the points coordinates (x and y coordinate values) of each connected component.
  1 commentaire
Walter Roberson
Walter Roberson le 13 Juil 2020
Not exactly .
When regionprops is passed a binary matrix, it does connected component detection based upon the binary values. Each connected component detected will have its properties measured. For centroid, the mean of the coordinate values is taken, as Mahesh describes.
When regionprops is passed a label matrix, it rounds down values, ignores locations that are negative or 0, and then for each unique positive integer, all locations in the image with the same (rounded) value are treated as one object. The difference against the binary image case is that objects designated by the same matrix do not need to be connected.
For example if you bwthresh an image and the take double() of the binary array, then that would be a label array in which all of the entries that are 1 are the same object, and so allowing you to get the centroid of everything at the same time.

Connectez-vous pour commenter.

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by