Projection of 3D points on plane
14 views (last 30 days)
Show older comments
Hello, my name is Ralf and I work in a neurosurgical clinic. For a research project I am trying to project a 3D point cloud onto a calculated plane, which I found with the function mentioned below. But now I am not able (with also some limited mathematical knowledge) to find out how to project the original points onto the found plane, so that the original distances between the points are kept as correct as possible. The goal would be again a matrix with the points / the coordinates, which I can then take for example for the calculation of a convexhull. If someone has a tip or a link to a solution I would be very grateful. In my research, I could not find anything clear and in particular I fail in how to deal with the plane, which is determined by pcfitplane, or how I can access the individual points of this plane again.
Thank you so much for your help!
Greetings,
Ralf
Code:
M = readmatrix("file.txt");
x = M(:,1);
y = M(:,2);
z = M(:,3);
PTC = pointCloud(M)
MD = 5;
[model1, inlierI, outlierI] = pcfitplane(PTC,MD)
plane = select(PTC,inlierI)
rest = select(PTC,outlierI)
figure
pcshow(plane)
figure
pcshow(rest)
0 Comments
Answers (1)
John D'Errico
on 9 Mar 2022
Edited: John D'Errico
on 9 Mar 2022
Why do you think the original distances between the points should be the same after a projection? NOT SO!!!!!!! In fact, it is trivial to give a counter-example. Consider this trivial case.
I'll work in 2-dimensions, so it will be trivial to see what happens and to show why your goal is impossible.
The projection plane will be the line x+y == 0. It has a slope of -1, and passes through the origin.
Now, consider the points at {(-1,-1), (-10,-10), (1,1), (10,10)}.
Do you see they all lie along the line y - x == 0? In fact, the interesting thing is the orthogonal projection to the line of interest just happens to leave them all at the origin. ALL four points project onto the origin. So while they were originally fairly distance from each other, after the orthogonal projection, they all lie at EXACTLY the same point. The distance after projection is now ZERO.
(Do I really need to do the mathematics here?)
The original distance between points has little to do with the distances between points after projection. If you think there should be some way to do the projection so that is not the case, then you would be wrong. An orthogonal projection is actually a pretty simple thing, and there are not many ways you can do it.
3 Comments
John D'Errico
on 11 Mar 2022
Yes, but that is part of my point. Accuracy of reproducing the original distances is irrelevant. If you are going to do an orthogonal projection onto a plane, then there is only one way to accomplish the projection. The points end up where they must go, because the orthogonal projection is a well-posed operation. There is no potential ambiguity.
What matters is only the normal vector to the plane, nothing else. If the original distance between two points has a large component in the direction of that normal vector, then that component disappears after projection. This is not something where any choice is made. You project the points, and they end up where you sent them, regardless of your desire.
See Also
Categories
Find more on Point Cloud Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!