-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sampling function that limits the number of points in pointcloud #3620
Comments
You could try voxel grid, but have the leaf size adjust for each cloud, based on the bounds of the point cloud in such a way that, the number of voxels for both clouds remain the same. When the number of voxels are the same, since there is only one point per each voxel, i presume that the number of points should be the same for both clouds. If you don't want to get into all that, and don't mind random downsampling, then looping through the pointcloud once and deleting random points until a fixed number of points remain should be a pretty trivial task. |
There is at most one point per each voxel. Naturally, some voxels will be empty because the pointcloud is not covering the entire 3D space of the voxel grid.
That would be my suggestion too. I don't think we have a ready-made solution in PCL, but it's indeed very trivial to implement from scratch. |
@haritha-j @taketwo @kunaltyagi thank you so much for your reponses. Yes you guys are right, I tried random downsampling and it works for me because I am dealing with thousands of clouds and I can not check every single cloud by applying voxel grid filter. I wanted to apply one filter that should work on all the clouds. In my case, I don't have to downsampled huge number of points like from 10,000 to 2,000 only and for this, random downsampling is working fine without loosing much information. |
Yes, my apologies, a silly mistake on my part, that method wouldn't work, and random downsampling would indeed be the best way to proceed. @taketwo Just as a side note, I do think it would be useful to have a function implemented for random downsampling, since it's a pretty common use case. I personally have defaulted to using cloudCompare when i want to downsample something on the fly. @zubair1502 glad you managed to fix it. |
Agree. Closing since the question was resolved. |
Operation system : Windows
Compiler : VS2013
PCL version : all in one installer 1.8.0
Hello,
I am working on rgb-d data which i converted it into pointcloud by using PCL library after that, I extracted the ROI by using cropbox function. Now the cropped clouds are unorganised and contain variable number of points in each pointcloud.
I want to process these cropped clouds in such a way so that they contain equal number of points in all pointclouds. For this I can do either upsampling or downsampling.
I have checked the uniform mesh sampling function but I am confused that whether this function will work for me or not because it is for meshes and my pointclouds contain only vertices. When I tried this, visualization shows that the cloud now like a straight line.
I have tried also some downsampling functions like voxal grid but the problem still remain same.
for example :
After cropping, 1 cloud contain 2535 points and 2 cloud contain 4368 points.
I want any method that can limit the equal number of points in both cloud.
for example : for downsampling both cloud should contain 2000 points and in case of up sampling, both clouds should contain 6000 points.
Please any help, Thank you.
The text was updated successfully, but these errors were encountered: