Can we specify an "outward" direction to normal obtained from pcfitplane approach?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Manish Kumar Nayak
le 2 Sep 2024
Commenté : William Rose
le 3 Sep 2024
I would like to fit a plane to a set of 3d points, but I have a general idea of direction towards which the plane normal should point to. For eg., if the planes represent the faces of a cuboid, it should point away from the centre or if I am fitting the surface of the ground, then it should point upwards, etc.
I can see that pcfitplane has a reference vector option, but that's too restrictive. Is there some other way where I can somehow provide such constraints to the normal vector? As of now, since it's ransac in the background, the final normal vector randomly points in either direction, whereas I would like a consistent output.
0 commentaires
Réponse acceptée
William Rose
le 2 Sep 2024
Assume n is the normal vector returned by pcfitplane.
If you want n to point generally up from the ground, then you must know z, the vector that points vertically up. So you do
if dot(n,z)<0
n=-n;
end
If you want n to point away from the center of a cube, then you must know cc, a vector for the approximate center of the cube, and vector cp, which is the centroid of the ponts that were used to fit the plane. (The centroid of the points used to fit the plane will always be in the fitted plane.) Then do
if dot(n,cp-cc)<0
n=-n;
end
Good luck.
2 commentaires
Plus de réponses (1)
Matt J
le 2 Sep 2024
I doubt you can, but it shouldn't matter. If the normal is pointing the wrong way, just post-process the fit by flipping its direction. A constraint on the direction shouldn't affect the quality of the fit, if that's what you were worried about.
Voir également
Catégories
En savoir plus sur Point Cloud Processing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!