AdjustPathArraysToEdges


Translates, rotates and scales multiple contour sets (PathArray), each separately, to the edges of the input image with subpixel precision.

Applications:Fine-tune results of edge-based template matching.

Syntax

C++
C#
Python
 
def AdjustPathArraysToEdges(
	inImage: Image,
	inPaths: list[ list[Path] ],
	/,
	*,
	inPointSpacing: float | None = None,
	inAlignments: list[CoordinateSystem2D] | None = None,
	inAttractionRadius: float = 2.0,
	inAdjustmentMetric: AdjustmentMetric = AdjustmentMetric.SegmentDistance,
	inAdjustTranslation: bool = True,
	inAdjustRotation: bool = True,
	inAdjustScale: bool = False,
	inIterationCount: int = 6,
	inBaseGradient: float = 1.0
)
-> (
	outAdjustedPaths: list[ list[Path] ],
	outAlignments: list[CoordinateSystem2D],
	diagAttractionVectors: list[ list[Segment2D] ]
)

Parameters

Name Type Range Default Description
Input value inImage Image Input image.
Input value inPaths list[ list[Path] ] Paths to be adjusted. For sparse, synthetic paths the inPointSpacing needs to be specified.
Input value inPointSpacing float | None 1.0 - None If set, sampling points of the input path will be equidistant with specified spacing. Useful for increasing density of synthetic, sparse paths.
Input value inAlignments list[CoordinateSystem2D] | None None Alignments to be corrected, usually connect to outObjects.Alignment[] of LocateObjects:Multiple filter.
Input value inAttractionRadius float 0.1 - 2.0 Expected initial distance between inPaths and edges of the input image.
Input value inAdjustmentMetric AdjustmentMetric AdjustmentMetric.SegmentDistance Metric used for path attraction. The SegmentDistance minimizes distances along path normal vectors, and thus adjustment is more accurate. PointDistance_* minimize euclidean distance, adjustment tends to be more stable.
Input value inAdjustTranslation bool True Compute the translation part of adjustment transform. Must be true when using AttractPathTangents estimation method.
Input value inAdjustRotation bool True Compute the rotation part of adjustment transform.
Input value inAdjustScale bool False Compute the scale part of adjustment transform.
Input value inIterationCount int 0 - 100 6 Number of iterations of internal adjustment algorithm.
Input value inBaseGradient float 0.1 - 1.0 Threshold for suppression of weak input image gradients. Increase for very noisy images.
Output value outAdjustedPaths list[ list[Path] ] Adjusted output paths.
Output value outAlignments list[CoordinateSystem2D] Corrected alignments - inAlignments input modified with estimated adjustment parameters.
Diagnostic input diagAttractionVectors list[ list[Segment2D] ] Attraction vectors from first iteration.

Hardware Acceleration

This operation is optimized for SSSE3 technology for pixels of type: UINT8.

This operation is optimized for AVX2 technology for pixels of type: UINT8.

This operation is optimized for NEON technology for pixels of type: UINT8.

This operation supports automatic parallelization for multicore and multiprocessor systems.