이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
extract planes from point cloud
조회 수: 3 (최근 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 (한국어)

