Skip to content

[VoxelGridFilter] Use different LeafSize for different axes #5581

@mszuyx

Description

@mszuyx

Describe the bug

I am trying to use a non-cubical grid when downsampling a pointcloud. (i.e., use different leaf size setting for x, y, and z axis)
For example:

pcl::VoxelGrid<pcl::PointXYZ> sor;
sor.setInputCloud (cloud);
sor.setLeafSize (float (0.05),float (1),float (0.05));
sor.filter (*cloud);

Ideally I will get a filtered pointcloud with less density in y axis as I used a "long" grid in the corresponding axis.
But I can tell any difference between the "cubic" grid and the "long" grid settings (the pointcloud density is always uniform in all axes despite the following settings):
sor.setLeafSize (float (0.05),float (0.05),float (0.05));
VS
sor.setLeafSize (float (0.05),float (1),float (0.05));

I wonder if there are some hidden rules inside VoxelGrid that automatically corrects the Leaf size setting as it always "expect" the input to be cubical. Or, maybe my assumption about "larger leaf size = lower density in the corresponding axis" is wrong.

If my assumption is wrong, is there another function I can use to reduce pointcloud density/resolution in a specific axis?

Thanks!,
Yu

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions