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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168200/image.jpeg)
2 个评论
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?
回答(2 个)
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.
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
另请参阅
类别
在 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!