Fix UniformSampling filter by correcting distance calculation to voxel center#4328
Fix UniformSampling filter by correcting distance calculation to voxel center#4328mvieth merged 8 commits intoPointCloudLibrary:masterfrom
Conversation
| } | ||
|
|
||
| // Compute the voxel center | ||
| Eigen::Vector4f voxel_center((ijk[0] + 0.5) * leaf_size_[0], (ijk[1] + 0.5) * leaf_size_[1], (ijk[2] + 0.5) * leaf_size_[2], 1); |
There was a problem hiding this comment.
I don't know if you're supposed to use the voxel center, but if you are:
ijk[3] = 0.5;
const Eigen::Vector4f voxel_center = (ijk + 0.5) * leaf_size_;PS: Does voxel_center[3] have to be 1 or 0?
There was a problem hiding this comment.
Yours is the easier.
In theory, voxel_center[3] should be equal to 1 because of the following (data[3] = 1.0f;).
pcl/common/include/pcl/impl/point_types.hpp
Line 309 in 3cb0cf4
But if voxel_center[3] is equal to 0, you should also get the right results .
Regards,
There was a problem hiding this comment.
I tested the code you suggested, but it was compiled incorrectly and displayed scalar cannot be added to the Vector4i type. I modify the code, and commit it, please check it. @kunaltyagi
|
I'm just gonna add this here #4327 (comment)
There's no point in implementing what the documentation describes because the VoxelGrid filter already has that functionality. |
|
According to the source code, VoxelGrid uses the points' centroid in every voxel as the sampling point, and it is different from UniformSampling. |
|
Stack a |
Use an easier way to fix bugs
|
Marking this as stale due to 30 days of inactivity. Commenting or adding a new commit to the pull request will revert this. |
|
Closing and reopening to rerun checks ... |
UniformSampling uses the closest point to every voxel center as the sample point. But it uses the point closest to the voxel index as the sample point in the repo.
pcl/filters/include/pcl/filters/impl/uniform_sampling.hpp
Line 115 in 3cb0cf4