mymesh.register.Point2Point#

mymesh.register.Point2Point(points1, points2, T0=None, bounds=None, transform='rigid', metric='icp', method='icp', decimation=1, transform_args={}, optimizer_args=None, verbose=True)[source]#

Point cloud-to-point cloud alignment. points2 will be aligned to points1.

Parameters:
  • points1 (array_like) – Fixed points that points2 will be registered to

  • points2 (array_like) – Moving points that will be registered to points1

  • T0 (array_like or NoneType, optional) – Initial transformation to apply to points2, by default, None. This can serve as an ‘initial guess’ of the alignment.

  • bounds (array_like or NoneType, optional) – Optimization bounds, formatted as [(min,max),…] for each parameter. If None, bounds are selected that should cover most possible transformations, by default None. Not used by all optimizers.

  • transform (str, optional) –

    Transformation model, by default ‘rigid’.

    • ’rigid’: translations and rotations

    • ’similarity: translations, rotations, and uniform scaling

    • ’affine’: translations, rotations, triaxial scaling, shearing

  • metric (str, optional) – Similarity metric to compare the two point clouds, by default ‘closest_point_MSE’

  • method (str, optional) – Optimization method, by default ‘direct’. See optimize() for details.

  • decimation (float, optional) – Scalar factor in the range (0,1] used to reduce the size of the point set, by default 1. decimation = 1 uses the full point sets, numbers less than one will reduce the size of both point sets by that factor by randomly selecting a set of points to use. For example decimation = 0.5 will use only half of the points of each set. A random seed of 0 is used for repeatable results. Note that if verbose=True, the final score will be reported for the full point set, not the decimated point set used during optimization.

  • transform_args (dict, optional) – Additional arguments for the chosen transformation model, by default {}. See rigid(), similarity(), or affine().

  • optimizer_args (dict, optional) – Additional arguments for the chosen optimizer, by default None. See optimize() for details.

  • verbose (bool, optional) – Verbosity, by default True. If True, iteration progress will be printed.

Returns:

  • new_points (np.ndarray) – Transformed coordinate array of points2 registered to points1.

  • T (np.ndarray) – Affine transformation matrix (shape=(4,4)) to transform points2 to new_points. new_points = transform_points(points2, T)