Welcome to small_gicp’s documentation!
small_gicp module
Efficient and parallel algorithms for point cloud registration
- class small_gicp.DistanceRejector(self: small_gicp.DistanceRejector) None
Bases:
pybind11_builtins.pybind11_object
Correspondence rejection based on the distance between points.
- set_max_distance(self: small_gicp.DistanceRejector, dist: float) None
Set maximum correspondence distance.
- Parameters
dist (float) – Maximum correspondence distance.
- class small_gicp.GICPFactor(self: small_gicp.GICPFactor) None
Bases:
pybind11_builtins.pybind11_object
Generalized ICP per-point factor based on distribution-to-distribution distance.
References
Segal et al., “Generalized-ICP”, RSS2005
- linearize(self: small_gicp.GICPFactor, target: small_gicp.PointCloud, source: small_gicp.PointCloud, kdtree: small_gicp.KdTree, T: numpy.ndarray[numpy.float64[4, 4]], source_index: int, rejector: small_gicp.DistanceRejector) Tuple[bool, numpy.ndarray[numpy.float64[6, 6]], numpy.ndarray[numpy.float64[6, 1]], float]
Linearize the factor for the i-th source point.
- Parameters
target (PointCloud) – Target point cloud. Must have covariances.
source (PointCloud) – Source point cloud. Must have covariances.
kdtree (KdTree) – KdTree for the target point cloud.
T (numpy.ndarray) – Transformation matrix. (4x4)
source_index (int) – Index of the source point.
rejector (DistanceRejector) – Correspondence rejector.
- Returns
success (bool) – Success flag. If false, the correspondence is rejected.
H (numpy.ndarray) – Hessian matrix (6x6).
b (numpy.ndarray) – Gradient vector (6,).
e (float) – Error.
- class small_gicp.GaussianVoxelMap(self: small_gicp.GaussianVoxelMap, leaf_size: float) None
Bases:
pybind11_builtins.pybind11_object
Construct a Incremental voxelmap.
Notes
This class supports incremental point cloud insertion and LRU-based voxel deletion that removes voxels that are not recently referenced. It can handle arbitrary number of voxels and arbitrary range of voxel coordinates (in 32-bit int range).
- Parameters
leaf_size (float) – Voxel size.
- insert()
insert(self: small_gicp.GaussianVoxelMap, points: small_gicp.PointCloud, T: numpy.ndarray[numpy.float64[4, 4]] = array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]])) -> None
Insert a point cloud into the voxel map and delete voxels that are not recently accessed.
If this class is based on FlatContainer (i.e., IncrementalVoxelMap*), input points are ignored if 1) there are too many points in the cell or 2) the input point is too close to existing points in the cell.
- points
PointCloud
Input source point cloud.
- Tnumpy.ndarray, optional
Transformation matrix to be applied to the input point cloud (i.e., T_voxelmap_source). (default: identity)
- points
- set_lru(self: small_gicp.GaussianVoxelMap, horizon: int = 100, clear_cycle: int = 10) None
Set the LRU cache parameters.
- Parameters
horizon (int, optional) – LRU horizon size. Voxels that have not been accessed for lru_horizon steps are deleted. (default: 100)
clear_cycle (int, optional) – LRU clear cycle. Voxel deletion is performed every lru_clear_cycle steps. (default: 10)
- size(self: small_gicp.GaussianVoxelMap) int
Get the number of voxels.
- Returns
num_voxels – Number of voxels.
- Return type
int
- voxel_covs(self: small_gicp.GaussianVoxelMap) numpy.ndarray[numpy.float64[m, n]]
Get the voxel normals.
- Returns
voxel_covs – Voxel covariance matrices. (Nx4x4)
- Return type
list of numpy.ndarray
- voxel_points(self: small_gicp.GaussianVoxelMap) numpy.ndarray[numpy.float64[m, n]]
Get the voxel points.
- Returns
voxel_points – Voxel points. (Nx4)
- Return type
numpy.ndarray
- class small_gicp.ICPFactor(self: small_gicp.ICPFactor) None
Bases:
pybind11_builtins.pybind11_object
ICP per-point factor based on the conventional point-to-point distance.
References
Zhang, “Iterative Point Matching for Registration of Free-Form Curve”, IJCV1994
- linearize(self: small_gicp.ICPFactor, target: small_gicp.PointCloud, source: small_gicp.PointCloud, kdtree: small_gicp.KdTree, T: numpy.ndarray[numpy.float64[4, 4]], source_index: int, rejector: small_gicp.DistanceRejector) Tuple[bool, numpy.ndarray[numpy.float64[6, 6]], numpy.ndarray[numpy.float64[6, 1]], float]
Linearize the factor for the i-th source point.
- Parameters
target (
PointCloud
) – Target point cloud.source (PointCloud) – Source point cloud.
kdtree (KdTree) – KdTree for the target point cloud.
T (numpy.ndarray) – Transformation matrix. (4x4)
source_index (int) – Index of the source point.
rejector (DistanceRejector) – Correspondence rejector.
- Returns
success (bool) – Success flag. If false, the correspondence is rejected.
H (numpy.ndarray) – Hessian matrix (6x6).
b (numpy.ndarray) – Gradient vector (6,).
e (float) – Error.
- class small_gicp.IncrementalVoxelMap(self: small_gicp.IncrementalVoxelMap, leaf_size: float) None
Bases:
pybind11_builtins.pybind11_object
Construct a Incremental voxelmap.
Notes
This class supports incremental point cloud insertion and LRU-based voxel deletion that removes voxels that are not recently referenced. It can handle arbitrary number of voxels and arbitrary range of voxel coordinates (in 32-bit int range).
- Parameters
leaf_size (float) – Voxel size.
- insert()
insert(self: small_gicp.IncrementalVoxelMap, points: small_gicp.PointCloud, T: numpy.ndarray[numpy.float64[4, 4]] = array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]])) -> None
Insert a point cloud into the voxel map and delete voxels that are not recently accessed.
If this class is based on FlatContainer (i.e., IncrementalVoxelMap*), input points are ignored if 1) there are too many points in the cell or 2) the input point is too close to existing points in the cell.
- points
PointCloud
Input source point cloud.
- Tnumpy.ndarray, optional
Transformation matrix to be applied to the input point cloud (i.e., T_voxelmap_source). (default: identity)
- points
- set_lru(self: small_gicp.IncrementalVoxelMap, horizon: int = 100, clear_cycle: int = 10) None
Set the LRU cache parameters.
- Parameters
horizon (int, optional) – LRU horizon size. Voxels that have not been accessed for lru_horizon steps are deleted. (default: 100)
clear_cycle (int, optional) – LRU clear cycle. Voxel deletion is performed every lru_clear_cycle steps. (default: 10)
- size(self: small_gicp.IncrementalVoxelMap) int
Get the number of voxels.
- Returns
num_voxels – Number of voxels.
- Return type
int
- voxel_points(self: small_gicp.IncrementalVoxelMap) numpy.ndarray[numpy.float64[m, n]]
Get the voxel points.
- Returns
voxel_points – Voxel points. (Nx4)
- Return type
numpy.ndarray
- class small_gicp.IncrementalVoxelMapCov(self: small_gicp.IncrementalVoxelMapCov, leaf_size: float) None
Bases:
pybind11_builtins.pybind11_object
Construct a Incremental voxelmap.
Notes
This class supports incremental point cloud insertion and LRU-based voxel deletion that removes voxels that are not recently referenced. It can handle arbitrary number of voxels and arbitrary range of voxel coordinates (in 32-bit int range).
- Parameters
leaf_size (float) – Voxel size.
- insert()
insert(self: small_gicp.IncrementalVoxelMapCov, points: small_gicp.PointCloud, T: numpy.ndarray[numpy.float64[4, 4]] = array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]])) -> None
Insert a point cloud into the voxel map and delete voxels that are not recently accessed.
If this class is based on FlatContainer (i.e., IncrementalVoxelMap*), input points are ignored if 1) there are too many points in the cell or 2) the input point is too close to existing points in the cell.
- points
PointCloud
Input source point cloud.
- Tnumpy.ndarray, optional
Transformation matrix to be applied to the input point cloud (i.e., T_voxelmap_source). (default: identity)
- points
- set_lru(self: small_gicp.IncrementalVoxelMapCov, horizon: int = 100, clear_cycle: int = 10) None
Set the LRU cache parameters.
- Parameters
horizon (int, optional) – LRU horizon size. Voxels that have not been accessed for lru_horizon steps are deleted. (default: 100)
clear_cycle (int, optional) – LRU clear cycle. Voxel deletion is performed every lru_clear_cycle steps. (default: 10)
- size(self: small_gicp.IncrementalVoxelMapCov) int
Get the number of voxels.
- Returns
num_voxels – Number of voxels.
- Return type
int
- voxel_covs(self: small_gicp.IncrementalVoxelMapCov) numpy.ndarray[numpy.float64[m, n]]
Get the voxel normals.
- Returns
voxel_covs – Voxel covariance matrices. (Nx4x4)
- Return type
list of numpy.ndarray
- voxel_points(self: small_gicp.IncrementalVoxelMapCov) numpy.ndarray[numpy.float64[m, n]]
Get the voxel points.
- Returns
voxel_points – Voxel points. (Nx4)
- Return type
numpy.ndarray
- class small_gicp.IncrementalVoxelMapNormal(self: small_gicp.IncrementalVoxelMapNormal, leaf_size: float) None
Bases:
pybind11_builtins.pybind11_object
Construct a Incremental voxelmap.
Notes
This class supports incremental point cloud insertion and LRU-based voxel deletion that removes voxels that are not recently referenced. It can handle arbitrary number of voxels and arbitrary range of voxel coordinates (in 32-bit int range).
- Parameters
leaf_size (float) – Voxel size.
- insert()
insert(self: small_gicp.IncrementalVoxelMapNormal, points: small_gicp.PointCloud, T: numpy.ndarray[numpy.float64[4, 4]] = array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]])) -> None
Insert a point cloud into the voxel map and delete voxels that are not recently accessed.
If this class is based on FlatContainer (i.e., IncrementalVoxelMap*), input points are ignored if 1) there are too many points in the cell or 2) the input point is too close to existing points in the cell.
- points
PointCloud
Input source point cloud.
- Tnumpy.ndarray, optional
Transformation matrix to be applied to the input point cloud (i.e., T_voxelmap_source). (default: identity)
- points
- set_lru(self: small_gicp.IncrementalVoxelMapNormal, horizon: int = 100, clear_cycle: int = 10) None
Set the LRU cache parameters.
- Parameters
horizon (int, optional) – LRU horizon size. Voxels that have not been accessed for lru_horizon steps are deleted. (default: 100)
clear_cycle (int, optional) – LRU clear cycle. Voxel deletion is performed every lru_clear_cycle steps. (default: 10)
- size(self: small_gicp.IncrementalVoxelMapNormal) int
Get the number of voxels.
- Returns
num_voxels – Number of voxels.
- Return type
int
- voxel_normals(self: small_gicp.IncrementalVoxelMapNormal) numpy.ndarray[numpy.float64[m, n]]
Get the voxel normals.
- Returns
voxel_normals – Voxel normals. (Nx4)
- Return type
numpy.ndarray
- voxel_points(self: small_gicp.IncrementalVoxelMapNormal) numpy.ndarray[numpy.float64[m, n]]
Get the voxel points.
- Returns
voxel_points – Voxel points. (Nx4)
- Return type
numpy.ndarray
- class small_gicp.IncrementalVoxelMapNormalCov(self: small_gicp.IncrementalVoxelMapNormalCov, leaf_size: float) None
Bases:
pybind11_builtins.pybind11_object
Construct a Incremental voxelmap.
Notes
This class supports incremental point cloud insertion and LRU-based voxel deletion that removes voxels that are not recently referenced. It can handle arbitrary number of voxels and arbitrary range of voxel coordinates (in 32-bit int range).
- Parameters
leaf_size (float) – Voxel size.
- insert()
insert(self: small_gicp.IncrementalVoxelMapNormalCov, points: small_gicp.PointCloud, T: numpy.ndarray[numpy.float64[4, 4]] = array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]])) -> None
Insert a point cloud into the voxel map and delete voxels that are not recently accessed.
If this class is based on FlatContainer (i.e., IncrementalVoxelMap*), input points are ignored if 1) there are too many points in the cell or 2) the input point is too close to existing points in the cell.
- points
PointCloud
Input source point cloud.
- Tnumpy.ndarray, optional
Transformation matrix to be applied to the input point cloud (i.e., T_voxelmap_source). (default: identity)
- points
- set_lru(self: small_gicp.IncrementalVoxelMapNormalCov, horizon: int = 100, clear_cycle: int = 10) None
Set the LRU cache parameters.
- Parameters
horizon (int, optional) – LRU horizon size. Voxels that have not been accessed for lru_horizon steps are deleted. (default: 100)
clear_cycle (int, optional) – LRU clear cycle. Voxel deletion is performed every lru_clear_cycle steps. (default: 10)
- size(self: small_gicp.IncrementalVoxelMapNormalCov) int
Get the number of voxels.
- Returns
num_voxels – Number of voxels.
- Return type
int
- voxel_covs(self: small_gicp.IncrementalVoxelMapNormalCov) numpy.ndarray[numpy.float64[m, n]]
Get the voxel normals.
- Returns
voxel_covs – Voxel covariance matrices. (Nx4x4)
- Return type
list of numpy.ndarray
- voxel_normals(self: small_gicp.IncrementalVoxelMapNormalCov) numpy.ndarray[numpy.float64[m, n]]
Get the voxel normals.
- Returns
voxel_normals – Voxel normals. (Nx4)
- Return type
numpy.ndarray
- voxel_points(self: small_gicp.IncrementalVoxelMapNormalCov) numpy.ndarray[numpy.float64[m, n]]
Get the voxel points.
- Returns
voxel_points – Voxel points. (Nx4)
- Return type
numpy.ndarray
- class small_gicp.KdTree(*args, **kwargs)
Bases:
pybind11_builtins.pybind11_object
Overloaded function.
__init__(self: small_gicp.KdTree, points: numpy.ndarray[numpy.float64[m, n]], num_threads: int = 1) -> None
KdTree(points: numpy.ndarray, num_threads: int = 1)
Construct a KdTree from a numpy array.
- points
numpy.ndarray
, shape (n, 3) or (n, 4) The input point cloud.
- num_threadsint, optional
The number of threads to use for KdTree construction. Default is 1.
- points
__init__(self: small_gicp.KdTree, points: small_gicp.PointCloud, num_threads: int = 1) -> None
KdTree(points: PointCloud, num_threads: int = 1)
Construct a KdTree from a small_gicp.PointCloud.
- points
PointCloud
The input point cloud.
- num_threadsint, optional
The number of threads to use for KdTree construction. Default is 1.
- points
- batch_knn_search(self: small_gicp.KdTree, pts: numpy.ndarray[numpy.float64[m, n]], k: int, num_threads: int = 1) Tuple[List[List[int]], List[List[float]]]
Find the k nearest neighbors for a batch of points.
- Parameters
pts (numpy.ndarray, shape (n, 3) or (n, 4)) – The input points.
k (int) – The number of nearest neighbors to search for.
num_threads (int, optional) – The number of threads to use for the search. Default is 1.
- Returns
k_indices (list of numpy.ndarray, shape (n,)) – The list of indices of the k nearest neighbors for each input point. If a neighbor was not found, the index is -1.
k_sq_dists (list of numpy.ndarray, shape (n,)) – The list of squared distances to the k nearest neighbors for each input point (sorted in ascending order).
- batch_nearest_neighbor_search(self: small_gicp.KdTree, pts: numpy.ndarray[numpy.float64[m, n]], num_threads: int = 1) Tuple[List[int], List[float]]
Find the nearest neighbors for a batch of points.
- Parameters
pts (numpy.ndarray, shape (n, 3) or (n, 4)) – The input points.
num_threads (int, optional) – The number of threads to use for the search. Default is 1.
- Returns
k_indices (numpy.ndarray, shape (n,)) – The indices of the nearest neighbors for each input point. If a neighbor was not found, the index is -1.
k_sq_dists (numpy.ndarray, shape (n,)) – The squared distances to the nearest neighbors for each input point.
- knn_search(self: small_gicp.KdTree, pt: numpy.ndarray[numpy.float64[3, 1]], k: int) Tuple[List[int], List[float]]
Find the k nearest neighbors to a given point.
- Parameters
pt (numpy.ndarray, shape (3,)) – The input point.
k (int) – The number of nearest neighbors to search for.
- Returns
k_indices (numpy.ndarray, shape (k,)) – The indices of the k nearest neighbors in the point cloud. If a neighbor was not found, the index is -1.
k_sq_dists (numpy.ndarray, shape (k,)) – The squared distances to the k nearest neighbors (Sorted in ascending order).
- nearest_neighbor_search(self: small_gicp.KdTree, pt: numpy.ndarray[numpy.float64[3, 1]]) Tuple[int, int, float]
Find the nearest neighbor to a given point.
- Parameters
pt (numpy.ndarray, shape (3,)) – The input point.
- Returns
found (int) – Whether a neighbor was found (1 if found, 0 if not).
k_index (int) – The index of the nearest neighbor in the point cloud. If a neighbor was not found, the index is -1.
k_sq_dist (float) – The squared distance to the nearest neighbor.
- class small_gicp.PointCloud(self: small_gicp.PointCloud, points: numpy.ndarray[numpy.float64[m, n]]) None
Bases:
pybind11_builtins.pybind11_object
PointCloud(points: numpy.ndarray)
Construct a PointCloud from a numpy array.
- Parameters
points (numpy.ndarray, shape (n, 3) or (n, 4)) – The input point cloud.
- cov(self: small_gicp.PointCloud, i: int) numpy.ndarray[numpy.float64[4, 4]]
Get the i-th covariance matrix.
- Parameters
i (int) – Index of the point.
- Returns
cov – Covariance matrix.
- Return type
numpy.ndarray, shape (4, 4)
- covs(self: small_gicp.PointCloud) List[numpy.ndarray[numpy.float64[4, 4]]]
Get the covariance matrices as a list of 4x4 matrices.
- Returns
covs – Covariance matrices.
- Return type
list of numpy.ndarray
- empty(self: small_gicp.PointCloud) bool
Check if the point cloud is empty
- Returns
empty – True if the point cloud is empty.
- Return type
bool
- normal(self: small_gicp.PointCloud, i: int) numpy.ndarray[numpy.float64[4, 1]]
Get the i-th normal.
- Parameters
i (int) – Index of the point.
- Returns
normal – Normal.
- Return type
numpy.ndarray, shape (4,)
- normals(self: small_gicp.PointCloud) numpy.ndarray[numpy.float64[m, n]]
Get the normals as a Nx4 matrix.
- Returns
normals – Normals.
- Return type
numpy.ndarray
- point(self: small_gicp.PointCloud, i: int) numpy.ndarray[numpy.float64[4, 1]]
Get the i-th point.
- Parameters
i (int) – Index of the point.
- Returns
point – Point.
- Return type
numpy.ndarray, shape (4,)
- points(self: small_gicp.PointCloud) numpy.ndarray[numpy.float64[m, n]]
Get the points as a Nx4 matrix.
- Returns
points – Points.
- Return type
numpy.ndarray
- size(self: small_gicp.PointCloud) int
Get the number of points.
- Returns
num_points – Number of points.
- Return type
int
- class small_gicp.PointToPlaneICPFactor(self: small_gicp.PointToPlaneICPFactor) None
Bases:
pybind11_builtins.pybind11_object
Point-to-plane ICP per-point factor based on the point-to-plane distance.
References
Zhang, “Iterative Point Matching for Registration of Free-Form Curve”, IJCV1994
- linearize(self: small_gicp.PointToPlaneICPFactor, target: small_gicp.PointCloud, source: small_gicp.PointCloud, kdtree: small_gicp.KdTree, T: numpy.ndarray[numpy.float64[4, 4]], source_index: int, rejector: small_gicp.DistanceRejector) Tuple[bool, numpy.ndarray[numpy.float64[6, 6]], numpy.ndarray[numpy.float64[6, 1]], float]
Linearize the factor for the i-th source point.
- Parameters
target (PointCloud) – Target point cloud. Must have normals.
source (PointCloud) – Source point cloud.
kdtree (KdTree) – KdTree for the target point cloud.
T (numpy.ndarray) – Transformation matrix. (4x4)
source_index (int) – Index of the source point.
rejector (DistanceRejector) – Correspondence rejector.
- Returns
success (bool) – Success flag. If false, the correspondence is rejected.
H (numpy.ndarray) – Hessian matrix (6x6).
b (numpy.ndarray) – Gradient vector (6,).
e (float) – Error.
- class small_gicp.RegistrationResult
Bases:
pybind11_builtins.pybind11_object
- property H
Final Hessian matrix (6x6)
- Type
NDArray[np.float64]
- property T_target_source
Final transformation matrix (4x4). This transformation brings a point in the source cloud frame to the target cloud frame.
- Type
NDArray[np.float64]
- property b
Final information vector (6,)
- Type
NDArray[np.float64]
- property converged
Convergence flag
- Type
bool
- property error
Final error
- Type
float
- property iterations
Number of iterations
- Type
int
- property num_inliers
Number of inliers
- Type
int
- small_gicp.align(*args, **kwargs)
Overloaded function.
- align(target_points: numpy.ndarray[numpy.float64[m, n]], source_points: numpy.ndarray[numpy.float64[m, n]], init_T_target_source: numpy.ndarray[numpy.float64[4, 4]] = array([[1., 0., 0., 0.],
[0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), registration_type: str = ‘GICP’, voxel_resolution: float = 1.0, downsampling_resolution: float = 0.25, max_correspondence_distance: float = 1.0, num_threads: int = 1, max_iterations: int = 20, verbose: bool = False) -> small_gicp.RegistrationResult
Align two point clouds using various ICP-like algorithms. This function first performs preprocessing (downsampling, normal estimation, KdTree construction) and then estimates the transformation.
See also:
voxelgrid_sampling
estimate_normals
preprocess_points
- target_points
numpy.ndarray[np.float64]
Nx3 or Nx4 matrix representing the target point cloud.
- source_pointsnumpy.ndarray[np.float64]
Nx3 or Nx4 matrix representing the source point cloud.
- init_T_target_sourcenumpy.ndarray[np.float64]
4x4 matrix representing the initial transformation from target to source.
- registration_typestr = ‘GICP’
Type of registration algorithm to use (‘ICP’, ‘PLANE_ICP’, ‘GICP’, ‘VGICP’).
- voxel_resolutionfloat = 1.0
Resolution of voxels used for correspondence search (used only in VGICP).
- downsampling_resolutionfloat = 0.25
Resolution for downsampling the point clouds. Input points out of the 21bit range after discretization will be ignored (See also:
voxelgrid_sampling
).- max_correspondence_distancefloat = 1.0
Maximum distance for matching points between point clouds.
- num_threadsint = 1
Number of threads to use for parallel processing.
- max_iterationsint = 20
Maximum number of iterations for the optimization algorithm.
- verbosebool = False
If True, print debug information during the optimization process.
- result
RegistrationResult
Object containing the final transformation matrix and convergence status.
- target_points
- align(target: small_gicp.PointCloud, source: small_gicp.PointCloud, target_tree: small_gicp.KdTree = None, init_T_target_source: numpy.ndarray[numpy.float64[4, 4]] = array([[1., 0., 0., 0.],
[0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), registration_type: str = ‘GICP’, max_correspondence_distance: float = 1.0, num_threads: int = 1, max_iterations: int = 20, verbose: bool = False) -> small_gicp.RegistrationResult
Align two point clouds using specified ICP-like algorithms, utilizing point cloud and KD-tree inputs. Input point clouds are assumed to be preprocessed (downsampled, normals estimated, KD-tree built). See also:
voxelgrid_sampling
estimate_normals
preprocess_points
- target
PointCloud
Target point cloud.
- source
PointCloud
Source point cloud.
- target_tree
KdTree
, optional KdTree for the target point cloud. If not given, a new KdTree is built.
- init_T_target_sourcenumpy.ndarray[np.float64]
4x4 matrix representing the initial transformation from target to source.
- registration_typestr = ‘GICP’
Type of registration algorithm to use (‘ICP’, ‘PLANE_ICP’, ‘GICP’).
- max_correspondence_distancefloat = 1.0
Maximum distance for corresponding point pairs.
- num_threadsint = 1
Number of threads to use for computation.
- max_iterationsint = 20
Maximum number of iterations for the optimization algorithm.
- verbosebool = False
If True, print debug information during the optimization process.
- result
RegistrationResult
Object containing the final transformation matrix and convergence status.
- target
- align(target_voxelmap: small_gicp.GaussianVoxelMap, source: small_gicp.PointCloud, init_T_target_source: numpy.ndarray[numpy.float64[4, 4]] = array([[1., 0., 0., 0.],
[0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), max_correspondence_distance: float = 1.0, num_threads: int = 1, max_iterations: int = 20, verbose: bool = False) -> small_gicp.RegistrationResult
Align two point clouds using voxel-based GICP algorithm, utilizing a Gaussian Voxel Map. Input source point cloud is assumed to be preprocessed (downsampled, normals estimated, KD-tree built). See also:
voxelgrid_sampling
estimate_normals
preprocess_points
- target_voxelmap
GaussianVoxelMap
Voxel map constructed from the target point cloud.
- source
PointCloud
Source point cloud to align to the target.
- init_T_target_sourcenumpy.ndarray[np.float64]
4x4 matrix representing the initial transformation from target to source.
- max_correspondence_distancefloat = 1.0
Maximum distance for corresponding point pairs.
- num_threadsint = 1
Number of threads to use for computation.
- max_iterationsint = 20
Maximum number of iterations for the optimization algorithm.
- verbosebool = False
If True, print debug information during the optimization process.
- result
RegistrationResult
Object containing the final transformation matrix and convergence status.
- target_voxelmap
- small_gicp.estimate_covariances(points: small_gicp.PointCloud, tree: small_gicp.KdTree = None, num_neighbors: int = 20, num_threads: int = 1) None
Estimate point covariances. If a sufficient number of neighbor points (5 points) is not found, an identity matrix is set to the point.
- Parameters
points (
PointCloud
) – Input point cloud. Covariances will be estimated in-place. (in/out)tree (
KdTree
, optional) – Nearest neighbor search. If None, create a new KdTree (default: None)num_neighbors (int, optional) – Number of neighbors. (default: 20)
num_threads (int, optional) – Number of threads. (default: 1)
- small_gicp.estimate_normals(points: small_gicp.PointCloud, tree: small_gicp.KdTree = None, num_neighbors: int = 20, num_threads: int = 1) None
Estimate point normals. If a sufficient number of neighbor points (5 points) is not found, a zero vector is set to the point.
- Parameters
points (
PointCloud
) – Input point cloud. Normals will be estimated in-place. (in/out)tree (
KdTree
, optional) – Nearest neighbor search. If None, create a new KdTree (default: None)num_neighbors (int, optional) – Number of neighbors. (default: 20)
num_threads (int, optional) – Number of threads. (default: 1)
- small_gicp.estimate_normals_covariances(points: small_gicp.PointCloud, tree: small_gicp.KdTree = None, num_neighbors: int = 20, num_threads: int = 1) None
Estimate point normals and covariances. If a sufficient number of neighbor points (5 points) is not found, a zero vector and an identity matrix is set to the point.
- Parameters
points (
PointCloud
) – Input point cloud. Normals and covariances will be estimated in-place. (in/out)tree (
KdTree
, optional) – Nearest neighbor search. If None, create a new KdTree (default: None)num_neighbors (int, optional) – Number of neighbors. (default: 20)
num_threads (int, optional) – Number of threads. (default: 1)
- small_gicp.preprocess_points(*args, **kwargs)
Overloaded function.
preprocess_points(points: numpy.ndarray[numpy.float64[m, n]], downsampling_resolution: float = 0.25, num_neighbors: int = 10, num_threads: int = 1) -> Tuple[small_gicp.PointCloud, small_gicp.KdTree]
Preprocess point cloud (Downsampling and normal/covariance estimation). See also:
voxelgrid_sampling()
,estimate_normals_covariances()
.- points[np.float64]
Input point cloud. Nx3 or Nx4.
- downsampling_resolutionfloat, optional
Resolution for downsampling the point clouds. Input points out of 21bit range after discretization are ignored (See also:
voxelgrid_sampling()
). (default: 0.25)- num_neighborsint, optional
Number of neighbors used for attribute estimation. (default: 10)
- num_threadsint, optional
Number of threads. (default: 1)
PointCloud
Downsampled point cloud.
KdTree
KdTree for the downsampled point cloud.
preprocess_points(points: small_gicp.PointCloud, downsampling_resolution: float = 0.25, num_neighbors: int = 10, num_threads: int = 1) -> Tuple[small_gicp.PointCloud, small_gicp.KdTree]
Preprocess point cloud (Downsampling and normal/covariance estimation). See also:
voxelgrid_sampling()
,estimate_normals_covariances()
.- points
PointCloud
Input point cloud.
- downsampling_resolutionfloat, optional
Resolution for downsampling the point clouds. Input points out of 21bit range after discretization are ignored (See also:
voxelgrid_sampling()
). (default: 0.25)- num_neighborsint, optional
Number of neighbors used for attribute estimation. (default: 10)
- num_threadsint, optional
Number of threads. (default: 1)
PointCloud
Downsampled point cloud.
KdTree
KdTree for the downsampled point cloud.
- points
- small_gicp.read_ply(filename: str) small_gicp.PointCloud
Read PLY file. This function can only read simple point clouds with XYZ properties for testing purposes. Do not use this for general PLY IO.
- small_gicp.voxelgrid_sampling(*args, **kwargs)
Overloaded function.
voxelgrid_sampling(points: small_gicp.PointCloud, downsampling_resolution: float, num_threads: int = 1) -> small_gicp.PointCloud
Voxelgrid downsampling.
When multi-threading is enabled, this function has minor run-by-run non-deterministic behavior due to parallel data collection that results in a deviation of the number of points in the downsampling results (up to 10% increase from the single-thread version).
Discretized voxel coords must be in 21bit range [-1048576, 1048575]. For example, if the downsampling resolution is 0.01 m, point coordinates must be in [-10485.76, 10485.75] m. Points outside the valid range will be ignored.
- points
PointCloud
Input point cloud.
- resolutionfloat
Voxel size.
- num_threadsint, optional
Number of threads. (default: 1)
PointCloud
Downsampled point cloud.
- points
voxelgrid_sampling(points: numpy.ndarray[numpy.float64[m, n]], downsampling_resolution: float, num_threads: int = 1) -> small_gicp.PointCloud
Voxelgrid downsampling.
When multi-threading is enabled, this function has minor run-by-run non-deterministic behavior due to parallel data collection that results in a deviation of the number of points in the downsampling results (up to 10% increase from the single-thread version).
Discretized voxel coords must be in 21bit range [-1048576, 1048575]. For example, if the downsampling resolution is 0.01 m, point coordinates must be in [-10485.76, 10485.75] m. Points outside the valid range will be ignored.
- points[np.float64]
Input point cloud. Nx3 or Nx4.
- resolutionfloat
Voxel size.
- num_threadsint, optional
Number of threads. (default: 1)
PointCloud
Downsampled point cloud.