rigid_body_motion.iterative_closest_point

rigid_body_motion.iterative_closest_point(v1, v2, dim=None, axis=None, init_transform=None, max_iterations=20, tolerance=0.001)[source]

Iterative closest point algorithm matching two arrays of vectors.

Finds the rotation r and the translation t such that:

\[v_2 \simeq rot(r, v_1) + t\]
Parameters
v1: array_like, shape (…, 3, …)

The first array of vectors.

v2: array_like, shape (…, 3, …)

The second array of vectors.

dim: str, optional

If the first array is a DataArray, the name of the dimension representing the spatial coordinates of the vectors.

axis: int, optional

The axis of the arrays representing the spatial coordinates of the vectors. Defaults to the last axis of the arrays.

init_transform: tuple, optional

Initial guess as (translation, rotation) tuple.

max_iterations: int, default 20

Maximum number of iterations.

tolerance: float, default 1e-3

Abort if the mean distance error between the transformed arrays does not improve by more than this threshold between iterations.

Returns
translation: array_like, shape (3,)

Translation of transform.

rotation: array_like, shape (4,)

Rotation of transform.

Notes

For points with known correspondences (e.g. timeseries of positions), it is recommended to interpolate the points to a common sampling base and use the best_fit_transform method.

References

Adapted from https://github.com/ClayFlannigan/icp