- Centroid: Center of mass of the region, returned as a 1-by-Q vector. The first element of Centroid is the horizontal coordinate (or x-coordinate) of the center of mass. The second element is the vertical coordinate (or y-coordinate). All other elements of Centroid are in order of dimension.
- Image: Image the same size as the bounding box of the region, returned as a binary (logical) array. The on pixels correspond to the region, and all other pixels are off.
regionprops( aImage, 'Centroid', 'Image' ) vs regionprops( aImage, 'Centroid' );
3 views (last 30 days)
I am new to MatLab.
I am working with code harvested from the internet that lacks comments.
In one place there is a call:
x = regionprops( aImage, 'Centroid', 'Image' );
and in another place is a call
x = regionprops( aImage, 'Centroid' );
using the same image.
The Help for regionprops is extensive, but I cannot figure outwhat the difference would be between those two calls.
Can somebody fill me in? Is this something that needs to be documented?
Walter Roberson on 27 Mar 2020
Each option to regionprops() tells it another property to measure and return
Thus the first of the calls returns a struct into x that has fields Centroid and Image with values as described above, and the second of the calls returns a struct into x that has only field Centroid with value as described above.
The 'Image' option does not change the way that the centroid is computed: it says to also compute something more and return it.