Hi,
I’m trying to sample fixed number of random points from each voxel of a point cloud to generate a another point cloud. More specifically I wish to randomly sample a fixed number of points from those voxels in a point cloud that contain more than a number of points. The pcl::RandomSample picks out a fixed number of random points from the entire point cloud. However, I need to do the same for each of the voxels in the grid. Is there a way to do this? Thanks _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
You can try with voxel grid sampling where the points within the voxel is replaced by it's centroid.
On Thursday, January 4, 2018, Pramit Mallick <[hidden email]> wrote: Hi, -- Regards Somnath Dutta Wissenschaftlicher Mitarbeiter Technische Universität Dresden Fakultät Informatik Lehrstuhl für Computergraphik und Visualisierung _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
Yes, but here again the voxel points are being reduced to a single point, i.e
centroid. I wish to sample a fixed number of random points though. Any clue? -- Sent from: http://www.pcl-users.org/ _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
Sounds to me a bit like what is described in PoTree as Poisson-Disk subsampling... Quote from reference below: "Poisson-disk samples can be created by a class of algorithms that are referred to as dart throwing." See p17 and following of https://www.cg.tuwien.ac.at/research/publications/2016/SCHUETZ-2016-POT/SCHUETZ-2016-POT-thesis.pdf Implemented this for myself, but probably also available somewhere in PCL... Anyone? On 04-Jan-18 06:53, Pramit Mallick
wrote:
Yes, but here again the voxel points are being reduced to a single point, i.e centroid. I wish to sample a fixed number of random points though. Any clue? -- Sent from: http://www.pcl-users.org/ _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users Kind regards, --
_______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
In reply to this post by Pramit Mallick
Hi,
I’m new here, and to PCL, but it seems to me your description is a solution. - for each voxel - collect points in a container - generate n random indices where n is the number of points desired - copy indexed points to final cloud container. This is somewhat brute force, but if you section your data you could probably parallelize this. Rick Frank Dominion Software, Inc. 825 Beacon Street Newton, MA 02459 Medical, Scientific, and Industrial Software >> > > Hi, > I’m trying to sample fixed number of random points from each voxel of a point cloud to generate a another point cloud. More specifically I wish to randomly sample a fixed number of points from those voxels in a point cloud that contain more than a number of points. > The pcl::RandomSample picks out a fixed number of random points from the entire point cloud. However, I need to do the same for each of the voxels in the grid. > Is there a way to do this? > > Thanks > >> [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
This brute force might be possible, but I can't seem to be able to iterate
over the voxels that are generated through VoxelGrid. If this were possible, I might be able to get each voxel as a separate point cloud, get random sample points using RandomSample and merge all of them into a resulting point cloud. However, I can't seem to get this to work. Any help would be appreciated. -- Sent from: http://www.pcl-users.org/ _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
In reply to this post by Richard Frank
Hey Rick, This would correspond to one of the described sampling strategies
in the thesis I mentioned previously. A screenshot from the corresponding page where the sampling strategies are compared: (Source: "Potree: Rendering Large Point Clouds in Web
Browsers", Markus Schuetz, link posted in previous mail) On 04-Jan-18 11:47, Richard Frank
wrote:
Hi, I’m new here, and to PCL, but it seems to me your description is a solution. - for each voxel - collect points in a container - generate n random indices where n is the number of points desired - copy indexed points to final cloud container. This is somewhat brute force, but if you section your data you could probably parallelize this. Rick Frank Dominion Software, Inc. 825 Beacon Street Newton, MA 02459 Medical, Scientific, and Industrial SoftwareHi, I’m trying to sample fixed number of random points from each voxel of a point cloud to generate a another point cloud. More specifically I wish to randomly sample a fixed number of points from those voxels in a point cloud that contain more than a number of points. The pcl::RandomSample picks out a fixed number of random points from the entire point cloud. However, I need to do the same for each of the voxels in the grid. Is there a way to do this? Thanks_______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users --
_______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
In reply to this post by Pramit Mallick
I wonder if VoxelGrid is the correct class to use. It seems to be oriented as a filter to downsample a point cloud.
Perhaps what’s needed is a similar class one might call RandomSampleGrid. One could use VoxelGrid as a starting point and instead of down sampling do the random sample. This creates a new filter class that could be used elsewhere. Rick Frank Dominion Software, Inc. 825 Beacon Street Newton, MA 02459 Medical, Scientific, and Industrial Software > On Jan 4, 2018, at 7:20 AM, "[hidden email]" <[hidden email]> wrote: > > Sample random points from each voxel of a point cloud _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
In reply to this post by Filip Rooms
2018-01-04 10:05 GMT+00:00 Filip Rooms <[hidden email]>:
I wouldn't be so sure about that. At least it's not something I read about in the past years in this mailing list. Contributions welcome :) Cheers Sérgio _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
In reply to this post by Pramit Mallick
If I understand you correctly, then what you need is
octree::OctreePointCloud<PointXYZINormal> and use the octree::OctreePointCloud<PointXYZINormal>::LeafNodeIterator to iterate over all voxels. An simple skeleton example: std::mt19937 rnd{ std::random_device{}() }; octree::OctreePointCloud<PointXYZINormal> tree(resolution); tree.setInputCloud(cloud); tree.defineBoundingBox(); tree.addPointsFromInputCloud(); octree::OctreePointCloud<PointXYZINormal>::LeafNodeIterator itLeafs; for(itLeafs = tree.leaf_begin(); itLeafs != tree.leaf_end(); itLeafs++) { std::vector<int> indices; itLeafs.getLeafContainer().getPointIndices(indices); // check if there are enough points in indices // Sample the indices // in the end you can use ExtractIndices<PointXYZ> to extract a cloud from the indices } Pramit Mallick wrote > I’m trying to sample fixed number of random points from each voxel of a > point cloud to generate a another point cloud. More specifically I wish to > randomly sample a fixed number of points from those voxels in a point > cloud that contain more than a number of points. > The pcl::RandomSample picks out a fixed number of random points from the > entire point cloud. However, I need to do the same for each of the voxels > in the grid. > Is there a way to do this? -- Sent from: http://www.pcl-users.org/ _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
Free forum by Nabble | Edit this page |