xdem.coreg.ICP#
- class xdem.coreg.ICP(method='point-to-plane', picky=True, only_translation=False, fit_minimizer=<function least_squares>, fit_loss_func='linear', max_iterations=20, tolerance=0.01, standardize=True, subsample=500000.0)[source]#
Iterative closest point registration.
Estimates a rigid transform (rotation + translation) between two elevation datasets.
The ICP method can be:
Point-to-point of Besl and McKay (1992), https://doi.org/10.1117/12.57955, where the loss function is computed on the 3D distances of closest points (original method),
Point-to-plane of Chen and Medioni (1992), https://doi.org/10.1016/0262-8856(92)90066-C where the loss function is computed on the 3D distances of closest points projected on the plane normals (generally faster and more accurate, particularly for point clouds representing contiguous surfaces).
Other ICP options are:
Linearized approximation of the point-to-plane least-square optimization of Low (2004), https://www.cs.unc.edu/techreports/04-004.pdf (faster, only for rotations below 30° degrees),
Picky ICP of Zinsser et al. (2003), https://doi.org/10.1109/ICIP.2003.1246775, where closest point pairs matched to the same point in the reference point cloud are removed, keeping only the pair with the minimum distance (useful for datasets with different extents that won’t exactly overlap).
The estimated transform is stored in the self.meta[“outputs”][“affine”] key “matrix”, with rotation centered on the coordinates in the key “centroid”. The translation parameters are also stored individually in the keys “shift_x”, “shift_y” and “shift_z” (in georeferenced units for horizontal shifts, and unit of the elevation dataset inputs for the vertical shift).
- __init__(method='point-to-plane', picky=True, only_translation=False, fit_minimizer=<function least_squares>, fit_loss_func='linear', max_iterations=20, tolerance=0.01, standardize=True, subsample=500000.0)[source]#
Instantiate an ICP coregistration object.
- Parameters:
method (
Literal['point-to-point','point-to-plane']) – Method of iterative closest point registration, either “point-to-point” of Besl and McKay (1992) that minimizes 3D distances, or “point-to-plane” of Chen and Medioni (1992) that minimizes 3D distances projected on normals.picky (
bool) – Whether to use the duplicate removal for pairs of closest points of Zinsser et al. (2003).only_translation (
bool) – Whether to solve only for a translation, otherwise solves for both translation and rotation as default.fit_minimizer (
Callable[...,tuple[ndarray[tuple[Any,...],dtype[floating[Any]]],Any]] |Literal['lsq_approx']) – Minimizer for the coregistration function. Use “lsq_approx” for the linearized least-square approximation of Low (2004) (only available for “point-to-plane”).fit_loss_func (
Callable[[ndarray[tuple[Any,...],dtype[floating[Any]]]],floating[Any]] |str) – Loss function for the minimization of residuals (if minimizer is not “lsq_approx”).max_iterations (
int) – Maximum allowed iterations before stopping.tolerance (
float) – Residual change threshold after which to stop the iterations.standardize (
bool) – Whether to standardize input point clouds to the unit sphere for numerical convergence (tolerance is also standardized by the same factor).subsample (
float|int) – Subsample the input for speed-up. <1 is parsed as a fraction. >1 is a pixel count.
Methods
__init__([method, picky, only_translation, ...])Instantiate an ICP coregistration object.
apply(elev[, bias_vars, resample, ...])centroid()Get the centroid of the coregistration, if defined.
copy()Return an identical copy of the class.
fit(reference_elev, to_be_aligned_elev[, ...])Estimate the coregistration transform on the given DEMs.
fit_and_apply(reference_elev, to_be_aligned_elev)from_matrix(matrix)Instantiate a generic Coreg class from a transformation matrix.
from_rotations([x_rot, y_rot, z_rot, ...])Instantiate a generic Coreg class from a X/Y/Z rotation.
from_translations([x_off, y_off, z_off])Instantiate a generic Coreg class from a X/Y/Z translation.
info([as_str])to_matrix()Convert the transform to a 4x4 transformation matrix.
to_rotations([return_degrees])Extract X/Y/Z euler rotations (extrinsic convention) from the affine transformation matrix.
to_translations()Extract X/Y/Z translations from the affine transformation matrix.
Attributes
is_affineCheck if the transform be explained by a 3D affine transform.
is_translationmetaMetadata dictionary of the coregistration.