How to select a region of interest (ROI) from 3-d point cloud data?
10 views (last 30 days)
Show older comments
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 Comments
wang rong
on 20 Jun 2019
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?
Answers (2)
Neil Guertin
on 2 Jan 2018
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
on 3 Aug 2021
Hello swati,
did you solve your problem?
i also have the same problem. would be nice if you share your solution.
Kind regards
Reza
See Also
Categories
Find more on Point Cloud Processing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!