Function ouster::sdk::core::voxel_downsample¶
Defined in File voxel_hash_map.h
Function Documentation¶
-
AttributedPointCloud ouster::sdk::core::voxel_downsample(const Eigen::Ref<const ArrayX3dR> &xyz, double voxel_size, std::size_t max_points_per_voxel = VoxelHashMap::DEFAULT_MAX_POINTS_PER_VOXEL, std::size_t min_points_per_voxel = VoxelHashMap::DEFAULT_MIN_POINTS_PER_VOXEL, VoxelDownsampleStrategy strategy = VoxelHashMap::DEFAULT_STRATEGY, const AttributeLayout &attribute_layout = AttributeLayout(), const Eigen::Ref<const AttributeRecords> &records = AttributeRecords(), VHMInternalStorageMode internal_storage_mode = VoxelHashMap::DEFAULT_INTERNAL_STORAGE_MODE, std::size_t attribute_index = 0)¶
Downsample a pointcloud, with or without attributes; the recommended entry point.
Takes the parameters of voxel_downsample_xd() and returns the same result, choosing the implementation from
attribute_layout:positions-only input (an empty layout) goes to voxel_downsample_3d(), anything else to voxel_downsample_xd(). This is the downsampler the Python API exposes.- Parameters:
xyz[in] Row-major Nx3 array of point positions.
voxel_size[in] Edge length of each cubic voxel.
max_points_per_voxel[in] Maximum points kept per voxel (FIRST_N_POINT, LAST_N_POINT, RANDOM).
min_points_per_voxel[in] Minimum insertions before a voxel contributes.
strategy[in] The VoxelDownsampleStrategy selecting the per-voxel reduction.
attribute_layout[in] Types and widths of the per-point attributes; empty for positions only.
records[in]
xyz.rows()xattribute_layout.stride()packed attribute records, one row per point; empty whenattribute_layoutis.internal_storage_mode[in] How points are stored inside the voxels. AUTO picks fixed point for small voxels, which returns kept positions within a small fraction of the voxel size of the input; ABS returns them exactly.
attribute_index[in] Index into
attribute_layoutof the scalar attribute to rank by; ignored unlessstrategyis SMALLEST or LARGEST, where it must name a scalar attribute, andattribute_layoutmust not be empty.
- Throws:
std::invalid_argument – if
recordsis notxyz.rows()xattribute_layout.stride()(any records given without a layout included), for a non-positivevoxel_size, a zeromax_points_per_voxel, or an unknownstrategy, or (SMALLEST/LARGEST only) an emptyattribute_layoutor anattribute_indexthat does not name a scalar attribute of it.- Returns:
The downsampled points, their records, and
attribute_layout; with an empty layout the records have zero columns.