Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Path Spatial Transforms » FitPathToPath

FitPathToPath


Rotates and shifts a path to minimize average distance between its points and a reference path.

Name Type Range Description
inPath Path Path to be aligned
inReferencePath Path Path to align to
inPathOrientationAlignment PathOrientationAlignment Determines how to align paths orientation before the main algorithm
inIterations Integer 1 - Number of algorithm steps
inFirstShift Real Magnitude of possible shift at the first step in pixels
inFirstRotation Real Magnitude of possible rotation at the first step in degrees
outPath Path Aligned path
outAlignment CoordinateSystem2D The coordinate system that geometrical objects defined in the context of the path should be aligned to
outPathDistance Real Average distance of characteristic points of the input path from the reference path

Description

The operations repeatedly performs shifts and rotations on the inPath minimizing the average distance between its characteristic points and inReferencePath.

Initially the inPath is shifted so that its mass center is equals the mass center of inReferencePath. Then the alignment is performed in inIterations steps. At each step the algorithm considers:

  1. Shifts of the processed path in four major directions by ShiftMagnitude pixels
  2. Rotations of the processed path in clockwise and counter-clockwise direction by RotationMagnitude degrees

At each substep the operation performs shift or rotation that produces the best distance minimization results. The initial value of ShiftMagnitude is inFirstShift and at each step it is divided by 2. Analogically the initial value of RotationMagnitude is inFirstRotation and at each step it is divided by 2.

Examples

Description of usage of this filter can be found in examples and tutorial: Capsules.

FitPathToPath run on the sample paths with inIterations = 5, inFirstShift = 10, inFirstRotation = 10. The inReferencePath plotted in grey, the inPath/outPath in black.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Empty path on input in FitPathToPath.

Complexity Level

This filter is available on Advanced Complexity Level.