Generating a voxel grid without VoxelFilter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Generating a voxel grid without VoxelFilter

Yathindu Rangana
Hi all,

I have a point cloud and I want to generate a low resolution voxel grid representation of that point cloud. I need this grid to be a set size say 10 x 10 x 10 voxels. The box in the point cloud that I am interested in is also set. So I can calculate the dimensions of each voxel as boxSizeX/10. 

I tried using pcl::VoxelGrid to solve my problem. However the output was not what I expected. Some voxels seemed overlap others. So to sanity check I implemenented a voxel generator myself using pcl::CropBox to check whether there are any points in volume where each voxel would be. This outputted the result I expected and comparing the number of occupied voxels my brute force method produced and what pcl::VoxelGrid produces showed that pcl::VoxelGrid produces more voxels.

However my method is quite slow. 

I want this process to be faster. I was wondering whether I was perhaps not correctly using the pcl::VoxelGrid? Below is how I use it:

pcl::VoxelGrid<pcl::PointXYZ> sor;
    sor.setInputCloud(tempCloud.makeShared());
    sor.setLeafSize (0.1f,0.1f,0.1f);
    sor.setSaveLeafLayout(true);
    sor.filter(outCloud);

Thanks!
Yathi

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Generating a voxel grid without VoxelFilter

Yathindu Rangana
Hi again,

Solved it by replacing pcl::CropBox with pcl::getPointsInBox. That's much faster. 

On Fri, May 19, 2017 at 5:48 PM, Yathindu Rangana <[hidden email]> wrote:
Hi all,

I have a point cloud and I want to generate a low resolution voxel grid representation of that point cloud. I need this grid to be a set size say 10 x 10 x 10 voxels. The box in the point cloud that I am interested in is also set. So I can calculate the dimensions of each voxel as boxSizeX/10. 

I tried using pcl::VoxelGrid to solve my problem. However the output was not what I expected. Some voxels seemed overlap others. So to sanity check I implemenented a voxel generator myself using pcl::CropBox to check whether there are any points in volume where each voxel would be. This outputted the result I expected and comparing the number of occupied voxels my brute force method produced and what pcl::VoxelGrid produces showed that pcl::VoxelGrid produces more voxels.

However my method is quite slow. 

I want this process to be faster. I was wondering whether I was perhaps not correctly using the pcl::VoxelGrid? Below is how I use it:

pcl::VoxelGrid<pcl::PointXYZ> sor;
    sor.setInputCloud(tempCloud.makeShared());
    sor.setLeafSize (0.1f,0.1f,0.1f);
    sor.setSaveLeafLayout(true);
    sor.filter(outCloud);

Thanks!
Yathi


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users