FRNN
FRNN copied to clipboard
What is the function of the grid points? Can it be used to subsample a point cloud in a voxel downsample way?
Hi,
Thank you for the great work!
Currently I need to find the k nearest neighbor for a point cloud, then I need to downsample the point cloud in a voxel downsample way, can the grid output be use for the downsampling?
Hi,
I hope I understand your question correctly. Here is the documentation for the returned grid structure:
https://github.com/lxxue/FRNN/blob/59a4c8fdc786c64afd991919af39f1a65d4ec2ff/frnn/frnn.py#L217-L223
In sorted_points2
, points are sorted according to their voxel index. Therefore, with pc2_grid_off
you will know the points inside one specific voxel (Here 2 are hard-coded for 2D points, you might want to change to 3):
https://github.com/lxxue/FRNN/blob/3e370d8d9073d4e130363faf87d2370598b5fbf2/frnn/csrc/grid/find_nbrs.cu#L50-L60
And then you can do whatever you want to downsample the points inside each voxel.
Thanks a lot! Are we allowed to change the initial grid size before fitting the knn?
Yes, the search radius r
and radius_cell_ratio
jointly determine the grid size:
https://github.com/lxxue/FRNN/blob/3e370d8d9073d4e130363faf87d2370598b5fbf2/frnn/frnn.py#L77
For KNN you should find a radius large enough so that you can find K neighbors within the radius for sure. When the radius_cell_ratio
is an integer, the method runs more efficiently since it search 2*ceil(radius_cell_ratio)+1
grids on one dimension.