Plane fitting using PCA or princomp
2 次查看(过去 30 天)
显示 更早的评论
hi i am trying to a fit plane to point clouds (x y z coordinates) to work out the orientation (of the points) based on the normal of the plane and the direction cosine to the Z axis (0 0 1)
i have a few thousand of these 'cluster' of points.
i find that the direction cosine (from [0 0 1]) of the normals are between 0 and 135 degrees as opposed to between 0 and 180 degrees . i have tried a variety of datasets showing the same anomaly. when i checked the minimum and maximum of the of the normal vectors matrix i found them to be [-0.7071 -0.7071 -0.7071] and [1 1 1] instead of +-[1 1 1].
does anyone have clue as to why this is happening?
I under that impression that PCA rotates and centers the points prior to fitting. does this mean i need to apply a transform on the normals?
Please help! thanks, S
plane fitting code:-
% do fit [coeff,score,roots] = pca(data);
% Get unit normal of fitted plane pc_normal(i,:) = coeff(:,3)'; %fill with normal vector
% calculate direction cosine from Z (vertical) axis pc_rads(i,1) = acos(dot(pc_normal(i,:), [0 0 1]));
0 个评论
回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!