Why does the rows and columns appear flipped while using 'regionprops3' function?

The 'regionprops3' function measures the properties of a 3-D volumetric image regions; however, it produces the rows and columns values which appear to be flipped. For instance, in the following lines of code the two output values of props.Centroid can be compared:
>>%% make 3d image
test_image = rand(3,15,9);
bin_image = test_image > 0.5;
idx = find(bin_image);
[row,col,dep] = ind2sub(size(test_image),idx);
props = regionprops3(bin_image);
%% Check the outputs from the following to see that things flipped
[max(row),max(col),max(dep)] >= props.Centroid
props.Centroid = props.Centroid(:,[2,1,3]);
[max(row),max(col),max(dep)] >= props.Centroid
 

 Accepted Answer

The 'regionprops3' function uses the image coordinate system where the top-left section of the image is considered the origin(0,0) and hence the (x,y) coordinate appears reversed.
Please run the below command in the command window of installed MATLAB R2019a version to get release specific documentation  on image coordinate system:
>> web(fullfile(docroot, 'images/image-coordinate-systems.html'))
In addition, please refer to the following MATLAB answers post by Walter Roberson: 
Please follow the below link to search for the required information regarding the current release:

More Answers (0)

Products

Release

R2019a

Community Treasure Hunt

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

Start Hunting!