Plane fitting using 3D points

33 Ansichten (letzte 30 Tage)
Ashicka Banu Mubarak
Ashicka Banu Mubarak am 26 Mär. 2019
Kommentiert: VIGNESH BALAJI am 21 Jul. 2023
I have my 3D points(lidar data) as a text file. can anyone suggest me a method for fitting the plane.

Akzeptierte Antwort

Star Strider
Star Strider am 26 Mär. 2019
Try this:
P = bsxfun(@times, rand(49, 3), [1 10 100]); % Create Matrix [x, y, z]
B = [P(:,1), P(:,2), ones(size(P,1),1)] \ P(:,3); % Linear Regression
xv = [min(P(:,1)) max(P(:,1))];
yv = [min(P(:,2)) max(P(:,2))];
zv = [xv(:), yv(:), ones(2,1)] * B; % Calculate Regression Plane
figure
stem3(P(:,1), P(:,2), P(:,3), '.')
hold on
patch([min(xv) min(xv) max(xv) max(xv)], [min(yv) max(yv) max(yv) min(yv)], [min(zv) min(zv) max(zv) max(zv)], 'r', 'FaceAlpha',0.5)
hold off
grid on
xlabel('X')
ylabel('Y')
producing (with this set of random data):
Plane fitting using 3D points - 2019 03 26.png
  7 Kommentare
Ashicka Banu Mubarak
Ashicka Banu Mubarak am 28 Mär. 2019
Orthoimage
VIGNESH BALAJI
VIGNESH BALAJI am 21 Jul. 2023
@Star Strider When I use your method, the plane fit for a 3D dataset is not a good fit, maybe because instead of regression you can calculate mean of the points and find a basis of the plane and fit the plane to the data.
When I used Plane Fit (Affine fit function to fit the data) https://nl.mathworks.com/matlabcentral/fileexchange/43305-plane-fit . I got a better fit

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by