How to select a region of interest (ROI) from 3-d point cloud data?

12 次查看(过去 30 天)
Hi,
I want to select a rectangular region from my 3-d point cloud data (.asc file format). I applied two approaches to do that as follows:
1. I select 4 corner points of the rectangular ROI and then select all points lying between xmin, xmax, ymin, ymax and zmin, zmax. But somehow some other points (outside the ROI) are also satisfying this condition, therefore this approach is not working well.
pos = (y >= ymin) & (y <= ymax) & (x >= xmin) & (x <= xmax) & (z >= zmin) & (z <= zmax);
arr = [y(pos), x(pos) ,z(pos)];
2. By applying 'inpolygon' function but unfortunately it works only for 2-d points, Is there any other function which can be used?
xv=[-40.5 -34.32 -23.78 -29.11 -40.5];
yv=[9.362 13.35 -0.3085 -4.247 9.362];
zv=[409.9 406.7 412.1 415.1 409.9];
in=inpolygon(x,y,z, xv,yv,zv);
figure;
plot3(xv,yv,zv,'-r','linewidth',2);
hold on
plot3(x(in),y(in),z(in),'*b');
hold off
Getting an error:
Error using inpolygon
Too many input arguments.
Could you please suggest any other way to do that? I am not able to attach 3-d point cloud data due to size issue. Figure with ROI is attached.
Thanks,
Swati
  2 个评论
wang rong
wang rong 2019-6-20
hello, I have this problem too. I'd like to extract a 3D ROI from 3D point cloud, Have you finally solved the problem? How did it work out? Can you share your idea with me?
Swati Jain
Swati Jain 2019-6-21
编辑:Swati Jain 2019-6-21
Hi, I still could not solve this issue. In my measurements I moslty have artiffact perpendicular to the axis of scanner and the code given below is working well if you have perpendicular situation.
pos = (y >= ymin) & (y <= ymax) & (x >= xmin) & (x <= xmax) & (z >= zmin) & (z <= zmax); %select coordinates of 4 corners and find min and max value of x, y and z
arr = [y(pos), x(pos) ,z(pos)];
However, I think we will have to select a cube around the ROI and then resolve it. Please let me know if you could resolve this issue.

请先登录,再进行评论。

回答(2 个)

Neil Guertin
Neil Guertin 2018-1-2
Your first approach seems like the right way to do this. However it looks like your ROI is not orthogonal to the axes, and therefore the condition may be more complicated than just providing bounds on x y and z individually.
It also appears that your ROI is a 2d rectangle inside a 3d space. Does this mean you are only interested in points that fall exactly on the rectangle's plane? On it within some tolerance? These are things that could be easily accounted for with this logical indexing approach but would not be built in to other tools like inpolygon or roipoly.
  1 个评论
Swati Jain
Swati Jain 2018-1-15
Thanks for your response. Actually ROI should be a cube but I am unable show it in that form. I mean some thickness is also there. About tolerance, I am mostly interested in the transition from lower to higher region and rectangular shape. I can not account this with logical indexing as the data is not sequential but random. We don't know which point is situated where.
Thanks, Swati

请先登录,再进行评论。


MoHa
MoHa 2021-8-3
Hello swati,
did you solve your problem?
i also have the same problem. would be nice if you share your solution.
Kind regards
Reza
  1 个评论
Swati Jain
Swati Jain 2021-8-20
Hi Reza,
My approach is correct and the only thing is that ROI should orthogonal to the axes.
Hope this helps.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Point Cloud Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by