xdem.coreg.CPD

Contents

xdem.coreg.CPD#

class xdem.coreg.CPD(weight=0, only_translation=False, max_iterations=100, tolerance=0.01, standardize=True, subsample=5000.0)[source]#

Coherent Point Drift coregistration, based on Myronenko and Song (2010), https://doi.org/10.1109/TPAMI.2010.46.

Estimate translations and rotations.

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__(weight=0, only_translation=False, max_iterations=100, tolerance=0.01, standardize=True, subsample=5000.0)[source]#

Instantiate a CPD coregistration object.

Parameters:
  • weight (float) – Weight contribution of the uniform distribution to account for outliers, from 0 (inclusive) to 1 (exclusive).

  • only_translation (bool) – Whether to solve only for a translation, otherwise solves for both translation and rotation as default.

  • 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 (int | float) – Subsample the input for speed-up. <1 is parsed as a fraction. >1 is a pixel count.

Methods

__init__([weight, only_translation, ...])

Instantiate a CPD 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_affine

Check if the transform be explained by a 3D affine transform.

is_translation

meta

Metadata dictionary of the coregistration.