You are here: Start » AVL.NET » Function Reference » Computer Vision » 2D Edge Detection » AVL.DetectEdges_AsPaths

AVL.DetectEdges_AsPaths

Extracts subpixel-precise paths that represent continuous edges.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void DetectEdges_AsPaths
(
	AvlNet.Image inImage,
	NullableRef<AvlNet.Region> inRoi,
	AvlNet.EdgeFilter inEdgeFilter,
	float inStdDevX,
	float? inStdDevY,
	float inEdgeThreshold,
	float inEdgeHysteresis,
	float? inMaxJoiningDistance,
	float inMaxJoiningAngle,
	float inJoiningDistanceBalance,
	float? inJoiningEndingLength,
	float inMinEdgeLength,
	IList<AvlNet.Path> outEdges,
	AvlNet.Image diagGradientMagnitudeImage,
	AvlNet.Region diagEdgeRegion
)

Parameters

Name Type Range Default Description
inImageAvlNet.ImageImage from which edges will be extracted.
inRoiAvlNet.NullableRef<AvlNet.Region>Region of the image from which edges will be extracted. Default value: atl::NIL.
inEdgeFilterAvlNet.EdgeFilterType of edge filter used for computing gradients.
inStdDevXfloat<0.0f, INF>2.0fAmount of horizontal smoothing used by the edge filter. Default value: 2.0f.
inStdDevYfloat?<0.0f, INF>Amount of vertical smoothing used by the edge filter (Auto = inStdDevX). Default value: atl::NIL.
inEdgeThresholdfloat<0.0f, INF>15.0fSufficient edge strength; edges of that strength will always be detected. Default value: 15.0f.
inEdgeHysteresisfloat<0.0f, INF>5.0fValue by which the edge threshold is decreased for edge points neighboring with sufficiently strong edges. Default value: 5.0f.
inMaxJoiningDistancefloat?<0.0f, INF>Maximal distance between edges that can be joined. Default value: atl::NIL.
inMaxJoiningAnglefloat<0.0f, 180.0f>30.0fMaximal allowed angle between edges being joined. Default value: 30.0f.
inJoiningDistanceBalancefloat<0.0f, 1.0f>0.0fDetermines how important distance between edges is according to their angle difference. Default value: 0.0f.
inJoiningEndingLengthfloat?<1.0f, INF>Determines the length of the edge end used for edge angle computing. Default value: atl::NIL.
inMinEdgeLengthfloat<0.0f, INF>0.0fMinimal length of an edge. Default value: 0.0f.
outEdgesSystem.Collections.Generic.IList<AvlNet.Path>Paths representing found edges.
diagGradientMagnitudeImageAvlNet.ImageVisualization of the gradient magnitude.
diagEdgeRegionAvlNet.RegionRegion representing found edges.

Description

The operation extracts edges from the inRoi region in the inImage image and stores the result in the array of paths outEdges. The extraction process is the same as in DetectEdges_AsRegion, the only difference being the data type of the result. This filter returns an array of subpixel-precise paths rather than region computed by DetectEdges_AsRegion.

The extraction process starts from gradient computing. Depending on which edge filter is chosen, gradients are computed using recursive (Deriche or Lanser) or standard non-recursive filter proposed by Canny. The inStdDevX and inStdDevY parameters control size of the filter mask. The greater their values are, the larger this size is. It should be noted that the execution time of the non-recursive filter depends greatly on the size of the filter mask, while the recursive filters execution time is independent of it.

On the so computed gradient image threshold with hysteresis (as in ThresholdImage_Hysteresis) is performed with inEdgeThreshold and inEdgeHysteresis parameters. After this step only gradients which are strong enough are present. The resulting edge region can be much too thick, thus it has to be thinned. To achieve this, the non-maximum suppression is used. Every pixel with at least one of its neighbors having larger gradient is no longer considered to be an edge pixel (only neighbors in the direction of pixel's gradient matter).

The positions of found edges are then determined with subpixel precision. The so extracted edges can then undergo further post-processing, if necessary. An edge can be joined with another one in its vicinity, but only if the distance between them is not greater than inMaxJoiningDistance and neither of them forms an angle greater than inMaxJoiningAngle with the segment connecting their endings. The inJoiningEndingLength parameter determines what part of the edge ending is used to determine above mentioned turn angle. If it is set to Nil, only the last edge segment is decisive. Sometimes two or more edges can be joined with an edge. Because only one of them can be, each of the candidates is evaluated based on the distance from the fixed edge's ending and the turn angle associated with their connection. The greater inJoiningDistanceBalance is, the less influence on the evaluation score the latter value has. After the joining phase, edges that are shorter than inMinEdgeLength are removed from the final results.

Examples

DetectEdges_AsPaths performed on the sample image with inEdgeFilter = Canny, inStdDevX = 2.5, inStdDevY = 2.5, inEdgeThreshold = 10, inEdgeHysteresis = 5, inMinEdgeLength = 1000.

Hardware Acceleration

This operation supports automatic parallelization for multicore and multiprocessor systems.

Hardware acceleration settings may be manipulated with Settings class.

Function Overrides

See also