EigenVectors and EigenValues from Regionprops3
3 次查看(过去 30 天)
显示 更早的评论
Hi
I am using regionprops3 to get eigenvectors and eigenvalues. Looks like the eigenvalues are sorted always. Am I right? The corresponding eigenvectors are in column or row?
Thanks.
3 个评论
Saurabh Patel
2018-9-21
编辑:Saurabh Patel
2018-9-21
Let us say, you want the orientation of some object in your image. You could essentially fit a line or plane to the set of points in that object and get the orientation of the line or plane. Matlab does better, RegionProps fits an ellipse or ellipsoid to the segmented object with conservation of second central moment. The major, intermediate, and minor axis radii of this ellipse are stored as eigenvalues. The orientation of these axes are stored in eigenvectors.
回答(1 个)
Matt J
2018-9-20
编辑:Matt J
2018-9-20
We can investigate whether the eigenvectors are rows or columns using the single slice ellipse image below. Applying regionprops3 gives,
>> S=regionprops3(A,'Eigenvector','EigenValues'); S{1,1}{:}, S{1,2}{:}
ans =
0.1738 -0.9848 0
0.9848 0.1738 0
0 0 1.0000
ans =
897.8691
156.9113
0.0833
The largest eigenvalue 897.8961 corresponds to the long axis of the ellipse, which is therefore either the first column or row of the above 3x3 eigenvector matrix. However, as we can see from the image, the long axis of the ellipse points in a direction whose coordinates are the same sign (regardless of whether x,y or i,j coordinates are being used). Therefore, its corresponding eigenvector would be the first column, not the first row of the matrix.
Also, the size of the different components tells us that the first coordinate is the vertical axis and the second coordinate is the horizontal axis, indicating that the coordinate system used by regionprops3 is (i,j)-oriented in 2D, not (x,y)-oriented. This is oddly inconsistent with the conventions of all the 2D image processing toolbox functions. On the other hand, this inconsistency is consistent with the inconsistency between meshgrid and ndgrid :-)
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!