Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Shape Adjustment » AdjustPathArrayToEdges

AdjustPathArrayToEdges


Module: FoundationPro

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

Name Type Range Description
inImage Image Input image.
inPaths PathArray Paths to be adjusted. For sparse, synthetic paths the inPointSpacing needs to be specified.
inPointSpacing Real* 1.0 - If set, sampling points of the input path will be equidistant with specified spacing. Useful for increasing density of synthetic, sparse paths.
inAlignment CoordinateSystem2D* Alignment to be corrected, usually connects to outObject.Alignment of LocateObjects filter.
inAttractionRadius Real 0.1 - Expected initial distance between inPaths and edges of the input image.
inAdjustmentMetric AdjustmentMetric 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 Compute the translation part of adjustment transform. Must be true when using AttractPathTangents estimation method.
inAdjustRotation Bool Compute the rotation part of adjustment transform.
inAdjustScale Bool Compute the scale part of adjustment transform.
inIterationCount Integer 0 - 100 Number of iterations of internal adjustment algorithm.
inBaseGradient Real 0.1 - Threshold for suppression of weak input image gradients. Increase for very noisy images.
outAdjustedPaths PathArray Adjusted output paths.
outAlignment CoordinateSystem2D Corrected alignment - the inAlignment input modified with estimated adjustment parameters.
diagAttractionVectors Segment2DArray Attraction vectors from first iteration.

Applications

Fine-tune results of edge-based template matching.

Hints

  • In order to use the filter to fine-tune the results of template matching, connect the outObjectEdges output of the template matching filter to the inPaths input, outObject.Alignment to inAlignment and the same input image to the inImage input.
  • When using template matching with AdjustPathArrayToEdges filter, you may try to speed up template matching by increasing its inMinPyramidLevel parameter. The potential loss of template matching precision should be mitigated by the AdjustPathArrayToEdges filter.
  • The inAttractionRadius should be set to the average initial distance between inPaths and edges of the input image. Although the filter tolerance to this parameter is high, setting it too low may result in adjustment failure, setting it too high will result in reduced accuracy. The parameter directly influences attraction vectors, which may be observed via diagnostic output diagAttractionVectors.
  • SegmentDistance is the default value of inAdjustmentMetric parameter and usually it is the best choice. However, in some special cases one should consider other options:
    • inImage contains glares – the PointDistance_Median method may perform better as the median error metric is more robust than least squares.
    • inPaths is a degenerate path array, such as a 1D straight line – the SegmentDistance could fail, the PointDistance_* methods may work.

    Please note that you need to increase inIterationCount to 10 when using PointDistance_* adjustment metrices, as the default value of 6 is fine-tuned to the SegmentDistance metric.

  • Increasing inIterationCount may result in more accurate results, however gains are diminishing quickly. The only downside of increasing inIterationCount in higher computation time.
  • Sparse paths - with a low amount of points - need to be densened to obtain acceptable accuracy and stability of the filter. Set the inPointSpacing parameter to a desired distance between consecutive path points.
  • For paths with large amount of points, the filter execution may be considerably accelerated without perceivable influence on the accuracy. Set the inPointSpacing parameter to a value higher than average spacing of input paths.
  • Noise on the input image may introduce false adjustment vectors, reducing accuracy. To mitigate the influence of noise, the inBaseGradient parameter may be used, which governs suppression of weak input image gradients. In order to tune the parameter, observe the diagAttractionVectors output. Note that its better to have some noise in attraction vectors directions than to considerably reduce their strength.
  • When dealing with multiple objects on a single image, use the AdjustPathArraysToEdges for improved performance.

Examples

Improving results of template matching. Blue – input paths, orange – attraction vectors, green – corrected paths.

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.

Complexity Level

This filter is available on Advanced Complexity Level.

See Also

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