Back to Aurora Vision Library website

You are here: Start » Function Reference » Computer Vision » 2D Edge Detection » DetectEdges_AsRegion

DetectEdges_AsRegion


Header: AVL.h
Namespace: avl
Module: FoundationBasic

Extracts a pixel-precise region of continuous edges.

Applications: Consistent detection of pixels that belong to contours of variable or unpredictable shape, e.g. screw thread outline or a custom piece of textile.

Syntax

C++
C#
 
void avl::DetectEdges_AsRegion
(
	const avl::Image& inImage,
	atl::Optional<const avl::Region&> inRoi,
	avl::EdgeFilter::Type inEdgeFilter,
	float inStdDevX,
	atl::Optional<float> inStdDevY,
	float inEdgeThreshold,
	float inEdgeHysteresis,
	float inMaxJoiningDistance,
	const int inMinBlobArea,
	avl::Region& outEdgeRegion,
	avl::Image& diagGradientMagnitudeImage
)

Parameters

Name Type Range Default Description
Input value inImage const Image& Image from which edges will be extracted
Input value inRoi Optional<const Region&> NIL Region of the image from which edges will be extracted
Input value inEdgeFilter EdgeFilter::Type Type of edge filter used for computing gradients
Input value inStdDevX float 0.0 - 2.0f Amount of horizontal smoothing used by the edge filter
Input value inStdDevY Optional<float> 0.0 - NIL Amount of vertical smoothing used by the edge filter
Input value inEdgeThreshold float 0.0 - 15.0f Sufficient edge strength; edges of that strength will always be detected
Input value inEdgeHysteresis float 0.0 - 5.0f Value by which the edge threshold is decreased for edge points neighboring with sufficiently strong edges
Input value inMaxJoiningDistance float 0.0 - 0.0f Maximal distance between edges that can be joined
Input value inMinBlobArea const int 0 - 1 Minimal area of an edge blob
Output value outEdgeRegion Region& Region of the found edges
Diagnostic input diagGradientMagnitudeImage Image& Visualization of the gradient magnitude

Description

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

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).

Hints

  • Connect an input image to the inImage input.
  • Start with inEdgeHysteresis = 0 and set inEdgeThreshold so that each important edge is at least partially detected. Then keep increasing inEdgeHysteresis until the edges are detected completely.
  • If the edges are rugged or there are too many false edges, then try increasing inStdDevX.
  • Do not change inEdgeFilter.

Examples

DetectEdges_AsRegion performed on the sample image with inEdgeFilter = Canny, inStdDevX = 2.0, inStdDevY = 2.0, inEdgeThreshold = 10, inEdgeHysteresis = 5.

Hardware Acceleration

This operation supports automatic parallelization for multicore and multiprocessor systems.

See Also

  • DetectEdges_AsPaths_Mask – Extracts subpixel-precise paths that represent continuous edges. Faster, yet less accurate version.