I have a point cloud and I want to extract series of planes through which the data passes. for each such plane, one can identify the points from scan data which belong to the plane.
how i do that?

4 comentarios

darova
darova el 1 de Oct. de 2019
Please attach some, your attempts. Maybe an image with explanations
fatinOriell
fatinOriell el 2 de Oct. de 2019
downsampled points.png
this is how my point cloud looks like. 3x3 matrix with x,y,z coordinates.
I want series of planes that represents points in circle(curve). I expect to have many planes and layers of points in circle.
I tried using pcfitplane but it only shows 1 plane and the result is not good.
first plane.png
darova
darova el 2 de Oct. de 2019
You want to set some plane and indificate which points belong to it? Is it correct?
fatinOriell
fatinOriell el 3 de Oct. de 2019
yes. that's exactly what I want. do you have any idea how?

Iniciar sesión para comentar.

 Respuesta aceptada

darova
darova el 3 de Oct. de 2019

0 votos

Here is my attempt
Here is what it produces:
See the attached script

33 comentarios

thank you! I just want to ask how did you define the plane?
p0 = [0 0 0];
p1 = [2 2 2];
p2 = [0 3 3]
is this coordinate x,y,z or what?
9.png
i tried this code and i think it's going to work. i just have to make the plane horizontally set up.
thank you so much.
darova
darova el 4 de Oct. de 2019
I just want to ask how did you define the plane?
Exactly!
Don't forget about distance. It determines which points belong to plane
mindist = 0.2; % minumum distance to plane
a.png
As you can see, I set up the plane so that i can get points in circle on a plane.
because i want something like this (example) at the end,
boundary curves jadi.jpg
but when i plot the points on plane only it became like this
b.png
and only can form a circle when i rotate it and view from z-axis
c.PNG
p0 = [0 0 0];
p1 = [2 2 0];
p2 = [0 3 0];
plane that i made and mindist that i used is
mindist = 0.4;
why it became like this? do you have any idea? thanks in advance
darova
darova el 8 de Oct. de 2019
I think it is a scale. Try
zlim([ min(z) max(z) ])
fatinOriell
fatinOriell el 9 de Oct. de 2019
yeah it works well thanks you are my saviour!
also my next step is to connect the points to be a curve. but when i use plot3 command it became like this
r.png
it means the points are not arranged in sequence. to arrange the points in sequence, i read that i have to use nearest neighbour / travelling salesman problem.
but i really don't have any idea on that.
darova
darova el 9 de Oct. de 2019
Just sort them
[t,r] = cart2pol(x,y);
[~,ix] = sort(t); % sort angle
plot3(x(ix),y(ix),z(ix))
fatinOriell
fatinOriell el 10 de Oct. de 2019
oh my god it works! thanks!
I cannot resist to ask one last question because you are so good in this,
is it possible to set fixed number of points on a plane?
for example i want 90 points only on each plane?
darova
darova el 10 de Oct. de 2019
[t,r] = cart2pol(x,y);
[~,ix] = sort(t); % sort angle
n = length(ix);
ii = 1 : round(n/90) : n;
ii = min(ii,n); % just make sure the last point is ii=length(ix)
plot3(x(ix(ii)),y(ix(ii)),z(ix(ii)))
Or you want evenly distributed?
fatinOriell
fatinOriell el 10 de Oct. de 2019
Thank you!! Okay I didn't try the code yet I will do it tomorrow and update to you. I think it's a bonus if i can make the points evenly distributed too.
[t,r] = cart2pol(x,y);
[~,ix] = sort(t); % sort angle
n = length(ix);
ii = 1 : round(n/90) : n;
ii = min(ii,n); % just make sure the last point is ii=length(ix)
plot3(x(ix(ii)),y(ix(ii)),z(ix(ii)))
this did not work. I want to pick points on plane in a fixed number. not just for plotting.
I think maybe we should edit in the matlab code you gave me.
darova
darova el 16 de Oct. de 2019
It's because of this line:
ii = 1 : round(n/90) : n;
If you have mush less than 90 points (round(20/90) = 0)
Try:
clc,clear
t = rand(1,20)*2*pi;
[x,y] = pol2cart(t,1);
plot(x,y,'.b')
hold on
plot(x,y,'color',[1 1 1]/1.1)
[t,r] = cart2pol(x,y);
[~,ix] = sort(t); % sort angle
n = length(ix);
ii = 1 : round(n/20) : n;
ii = min(ii,n); % just make sure the last point is ii=length(ix)
plot(x(ix(ii)),y(ix(ii)))
hold off
[t,r] = cart2pol(x,y);
[~,ix] = sort(t); % sort angle
plot3(x(ix),y(ix),z(ix))
I'm sorry for asking but regarding this code to sort coordinates,
is it working on my data only (circle curves) or is it applicable to all type of freeform curves?
what if the data is not an easy curve (like mine..circle, ) like the body cars and such?
I really appreciate if you can answer this! thank you..
darova
darova el 21 de Nov. de 2019
Please show an example
fatinOriell
fatinOriell el 11 de Dic. de 2019
i have new question. should I ask here or open a new question?
it's about the profile curves i already extracted..
profile curves.png
next process i have to fit cubic spline to enable having:
1) smooth curve
2) equal number of curve points for each profile curve
no. 2 is more important to me now.. I tried using curve fitting apps but to no avail.. perhaps i can get some idea from you.
thanks in advance.
darova
darova el 11 de Dic. de 2019
Look HERE
darova
darova el 14 de En. de 2020
You have these curves
profile%20curves.png
And get this surface
surface%20bowl.png
How can you get this surface?
pasu.png
I don't know what is your script about. Can't run it, have no variables
C=[an_x1 an_x2 an_x3 an_x4;
darova
darova el 15 de En. de 2020
Your codes are so long. I'm just lost. Don't know what to check
Can you be more specific?
fatinOriell
fatinOriell el 22 de Jun. de 2020
Sorry for troubling you with the codes. I'm done with it. I got the results that I wanted. Thanks for your help.
I able to reconstruct the surface from point cloud data using the method I proposed.
But right now, I have a new point cloud data set of a ship hull. More complex object, I want to do the same thing as I did previously which is extracting planes from it. But it seems not working when I used the codes you helped me with.
Attached is my data set.
Appreciate if you can help me.
darova
darova el 22 de Jun. de 2020
Can you attach the points for creating the plane you used
p0 = [0 0 0];
p1 = [2 2 2];
p2 = [0 3 3];
but I already change to different points but still the plane are away from the object.
darova
darova el 23 de Jun. de 2020
Change this line
% [x0,y0] = meshgrid([min(x(:)) max(x(:))]);
[x0,y0] = meshgrid([min(x(:)) max(x(:))],[min(y(:)) max(y(:))]);
fatinOriell
fatinOriell el 23 de Jun. de 2020
Oh my GOD it works!! so it was a problem of grid?
but how about if I want the plane to change axis? so that the points on plane are like the red dots?
darova
darova el 23 de Jun. de 2020
Play with points
p0 = [0 0 0];
p1 = [2 2 2];
p2 = [0 3 3];
plot3(x6,y6,z6)
xlim([min(x) max(x)])
[t,r] = cart2pol(x6,y6);
[~,ix] = sort(t); % sort angle
plot3(x(ix),y(ix),z(ix))
okay this is x,y,z points on one of the planes I extracted.
as previously I want to sort points so I used like what you taught me. But it didn't work.
i want it to connect like this
darova
darova el 24 de Jun. de 2020
  • pick points in YZ plane
  • center the data
load x6.mat
load y6.mat
load z6.mat
plot3(x6,y6,z6,'.r')
[t,r] = cart2pol(y6-mean(y6),z6-mean(z6)); % make origin point (0,0) in the center
[~,ix] = sort(t); % sort angle
line(x6(ix),y6(ix),z6(ix))
fatinOriell
fatinOriell el 25 de Jun. de 2020
thank you. the points sorted well. But if I want it to be open curve not closed curve, how do I cut the points?
the bottom connecting line should not be there. Like this
darova
darova el 25 de Jun. de 2020
try this trick
fatinOriell
fatinOriell el 1 de Jul. de 2020
I don't think it's working. Only the axes changes, no change in plotting points/line
fatinOriell
fatinOriell el 1 de Jul. de 2020
how to define start point and end point? my plan is to do something like this. I feel like it's going to work
darova
darova el 1 de Jul. de 2020
flip axes (YZ ZY)
load x6.mat
load y6.mat
load z6.mat
plot3(x6,y6,z6,'.r')
[t,r] = cart2pol(z6-mean(z6),y6-mean(y6)); % make origin point (0,0) in the center
[~,ix] = sort(t); % sort angle
line(x6(ix),y6(ix),z6(ix))
fatinOriell
fatinOriell el 1 de Jul. de 2020
Thank you so much it works well. I've got so much to learn sorry.
M.S. Khan
M.S. Khan el 27 de Ag. de 2020
Fatin, can you explain please, how have you done it. i have a cone. i want to extract planes. please guide me.
Thanh
Thanh el 11 de Nov. de 2022
Dear sir,
I followed your instruction and extract a set of point from my point cloud data. However, my point cloud data is the Lidar scanning of a solid concrete object so the set of extracted points is densed as shown in the attached picture. I want to ask how can I sketch only the boundary of those extracted points? Thank you very much!

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 1 de Oct. de 2019

Comentada:

el 11 de Nov. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by