Can we specify an "outward" direction to normal obtained from pcfitplane approach?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Manish Kumar Nayak
il 2 Set 2024
Commentato: William Rose
il 3 Set 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 Commenti
Risposta accettata
William Rose
il 2 Set 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 Commenti
Più risposte (1)
Matt J
il 2 Set 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.
Vedere anche
Categorie
Scopri di più su Point Cloud Processing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!