Back to Adaptive Vision Library website

You are here: Start » Function Reference » Computer Vision » Shape Adjustment » AdjustPathArraysToEdges

AdjustPathArraysToEdges


Header: AVL.h
Namespace: avl
Module: FoundationPro

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#
 
void avl::AdjustPathArraysToEdges
(
	const avl::Image& inImage,
	const atl::Array<atl::Array<avl::Path>>& inPaths,
	atl::Optional<float> inPointSpacing,
	atl::Optional<const atl::Array<avl::CoordinateSystem2D>&> inAlignments,
	float inAttractionRadius,
	avl::AdjustmentMetric::Type inAdjustmentMetric,
	bool inAdjustTranslation,
	bool inAdjustRotation,
	bool inAdjustScale,
	int inIterationCount,
	float inBaseGradient,
	atl::Array<atl::Array<avl::Path>>& outAdjustedPaths,
	atl::Array<avl::CoordinateSystem2D>& outAlignments,
	atl::Array<atl::Array<avl::Segment2D>>& diagAttractionVectors
)

Parameters

Name Type Range Default Description
inImage const Image& Input image.
inPaths const Array<Array<Path>>& Paths to be adjusted. For sparse, synthetic paths the inPointSpacing needs to be specified.
inPointSpacing Optional<float> 1.0 - NIL If set, sampling points of the input path will be equidistant with specified spacing. Useful for increasing density of synthetic, sparse paths.
inAlignments Optional<const Array<CoordinateSystem2D>&> NIL Alignments to be corrected, usually connect to outObjects.Alignment[] of LocateObjects:Multiple filter.
inAttractionRadius float 0.1 - 2.0f Expected initial distance between inPaths and edges of the input image.
inAdjustmentMetric AdjustmentMetric::Type 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.
inAdjustTranslation bool True Compute the translation part of adjustment transform. Must be true when using AttractPathTangents estimation method.
inAdjustRotation bool True Compute the rotation part of adjustment transform.
inAdjustScale bool False Compute the scale part of adjustment transform.
inIterationCount int 0 - 100 6 Number of iterations of internal adjustment algorithm.
inBaseGradient float 0.1 - 1.0f Threshold for suppression of weak input image gradients. Increase for very noisy images.
outAdjustedPaths Array<Array<Path>>& Adjusted output paths.
outAlignments Array<CoordinateSystem2D>& Corrected alignments - inAlignments input modified with estimated adjustment parameters.
diagAttractionVectors Array<Array<Segment2D>>& Attraction vectors from first iteration.

Hints

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.

Errors

List of possible exceptions:

Error type Description
DomainError inPaths and inAlignments have different size
DomainError To use SegmentDistance adjustment metric, inAdjustTranslation must be enabled.

See Also

  • AdjustPathArrayToEdges – Translates, rotates and scales the given contour set to the edges of the input image with subpixel precision.