extract planes from point cloud
9 次查看(过去 30 天)
显示 更早的评论
fatinOriell
2019-10-1
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 个评论
fatinOriell
2019-10-2
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.
darova
2019-10-2
You want to set some plane and indificate which points belong to it? Is it correct?
采纳的回答
darova
2019-10-3
Here is my attempt
Here is what it produces:
See the attached script
33 个评论
fatinOriell
2019-10-4
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?
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
2019-10-4
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
fatinOriell
2019-10-8
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,
but when i plot the points on plane only it became like this
and only can form a circle when i rotate it and view from z-axis
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
fatinOriell
2019-10-9
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
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
2019-10-9
Just sort them
[t,r] = cart2pol(x,y);
[~,ix] = sort(t); % sort angle
plot3(x(ix),y(ix),z(ix))
fatinOriell
2019-10-10
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
2019-10-10
[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
2019-10-10
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.
fatinOriell
2019-10-16
[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
2019-10-16
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
fatinOriell
2019-11-21
[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..
fatinOriell
2019-12-11
i have new question. should I ask here or open a new question?
it's about the profile curves i already extracted..
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
2020-1-14
You have these curves
And get this surface
How can you get this surface?
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
2020-1-15
Your codes are so long. I'm just lost. Don't know what to check
Can you be more specific?
fatinOriell
2020-6-22
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.
fatinOriell
2020-6-23
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
2020-6-23
Change this line
% [x0,y0] = meshgrid([min(x(:)) max(x(:))]);
[x0,y0] = meshgrid([min(x(:)) max(x(:))],[min(y(:)) max(y(:))]);
fatinOriell
2020-6-23
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?
fatinOriell
2020-6-24
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
2020-6-24
- 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
2020-6-25
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
fatinOriell
2020-7-1
I don't think it's working. Only the axes changes, no change in plotting points/line
fatinOriell
2020-7-1
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
2020-7-1
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))
M.S. Khan
2020-8-27
Fatin, can you explain please, how have you done it. i have a cone. i want to extract planes. please guide me.
Thanh
2022-11-11
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!
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Point Cloud Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)