[GRASS-dev] v.decimate: point cloud decimation of native vector maps

Hi all,

I have added v.decimate to trunk in r66387 [1]. The current version can do count-based decimation in the same way as the current v.in.lidar module [2]. Additionally, a grid-based decimation is supported. The grid is 2D and the points are preserved based on z, category or count (within one cell).

The grid-based decimation requires to store whole output (but not input) in the memory, so it is not practical for large datasets. This will hopefully change in the future. One way would be to employ same mechanism as in r.in.lidar where we use small grid but we iterate multiple times over the input dataset. Another ways are allocation of the cells on demand (instead of whole grid based on region, perhaps necessary for 3D), keeping less information per point (e.g. only z sum and count), or store something to disk.

The module, especially at this stage, should be perhaps in addons rather than trunk. However, the module already has some code overlap with v.in.lidar and there is potential code overlap with other modules as well, e.g. r.in.lidar. So, the idea is that some code will be moved to lib/lidar and used by these modules. This v.decimate module is than a comfortable way how to test the library functions.

The module currently lacks tests and code documentation, but I’ve already prepared some user documentation [3].

Please comment and feel free to criticize the code quality etc. since I’m planning to put it into the library eventually.

Vaclav

[1] https://trac.osgeo.org/grass/changeset/66387
[2] https://lists.osgeo.org/pipermail/grass-dev/2015-September/076275.html
[3] https://grass.osgeo.org/grass71/manuals/v.decimate.html

PDAL-related: The PDAL’s counterpart to v.decimate is a the GridMinimum PCL Block filter [4, 5, 6] which according to the documentation preserves point with the minimum z value in each cell (as if r.in.lidar would have vector output, but preserved xy position). The other, perhaps more similar, filter in PDAL is voxelgrid [7] (based on PCL’s VoxelGrid [8, 9]) which can do a 3D grid or 2D grid (if z resolution is large enough value). The result is centroid of points within each grid cell/voxel (while v.decimate now preserves xyz and layers/cats of the input).

[4] http://www.pdal.io/stages/filters.pclblock.html
[5] http://www.pdal.io/tutorial/pcl_spec.html#gridminimum
[6] http://docs.pointclouds.org/trunk/classpcl_1_1_grid_minimum.html
[7] http://www.pdal.io/stages/filters.voxelgrid.html
[8] http://www.pdal.io/tutorial/pcl_spec.html#voxelgrid
[9] http://docs.pointclouds.org/trunk/classpcl_1_1_voxel_grid_3_01pcl_1_1_p_c_l_point_cloud2_01_4.html