Further documentation for regionprops
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Mahesh Taparia
2020-7-13
编辑:Mahesh Taparia
2020-7-13
Hi
The centroid coordinate is the mean of the points coordinates (x and y coordinate values) of each connected component.
1 个评论
Walter Roberson
2020-7-13
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!