-
-
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
[VoxelGrid] Remove getLeafLayout #4897
Comments
For the index, we'd need to let the user find the size as well |
you mean the number of voxels in the filtered cloud? but #voxels = #points in the filtered cloud |
That's not necessarily true. In the new voxelgrid, you're making the voxel 0, but still not removing it from the map |
I mean use can for example get the size from the number of points in the PointCloud<PointXYZ> output;
VoxelGrid<PointXYZ> grid;
grid.setLeafSize (0.02f, 0.02f, 0.02f);
grid.setInputCloud (cloud);
grid.filter (output); Because the inline experimental::optional<PointT>
filterGrid(const iterator grid_it)
{
const auto& voxel = grid_it->second;
if (voxel.size() >= min_points_per_voxel_) {
if (save_leaf_layout_)
leaf_layout_[grid_it->first] = num_voxels_++;
return voxel.get();
}
return boost::none;
} But anyway we can do that easily by returning the following member in the new voxelgrid /** \brief Total number of voxels in the output cloud */
std::size_t num_voxels_; |
This clearly leaves some leaves which are not added during the filter operation |
Is your feature request related to a problem? Please describe.
Raised while refactoring VoxelGrid #4829 (review)
As we are upgrading point hash datatype from
int
tosize_t
, the APIstd::vector<int> getLeafLayout()
is not compatible anymoreContext
Reasons to upgrade to
size_t
: #4365 #585Expected behavior
Users can query the voxel index using point coordinate or point hash
Current Behavior
We can query the voxel index using point coordinate with
int getCentroidIndexAt(const Eigen::Vector3i&)
.But if we wanted to query using point hash, we will need to first get a large vector with
std::vector<int> getLeafLayout()
, and query with the vectorDescribe the solution you'd like
Use the following functions to replace
getLeafLayout()
to avoid return large vector when we upgrade tosize_t
.leaf_layout_
will be aunordered_map
Describe alternatives you've considered
Same as above, but
leaf_layout_
is avector<size_t>
The text was updated successfully, but these errors were encountered: