Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » OpenCV » Feature Detection » cvCanny

cvCanny


Module: OpenCV

Finds edges in an image using Canny algorithm.

Name Type Range Description
inImage Image Single-channel UINT8 input image.
inThreshold1 Real First threshold for the hysteresis procedure.
inThreshold2 Real Second threshold for the hysteresis procedure.
inApertureSize Integer 3 - 7 Aperture size for the Sobel operator.
inL2gradient Bool Flag indicating whether a more accurate norm should be used to compute the image gradient magnitude.
outEdges Image Output edge map.

Description

The operation detects edges in the input image and marks them on the outEdges image, setting pixel value to 255 for edges' pixels, and 0 otherwise. Canny algorithm works as follows:

  • calculates gradients in the image using sobel operator
  • detects strong edges, as pixels which have gradient value higher than inThreshold1
  • extends strong edges as long as neighbour pixels have gradient value higher than inThreshold2
  • narrows edges, as they could get quite wide in previous step, applying non-maxima suppression

Examples

cvCanny performed on the sample image with inThreshold1 = 140, inThreshold2 = 70, inApertureSize = 3.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError inApertureSize must be 3, 5 or 7 in cvCanny.
DomainError Input image must be single-channel UINT8 in cvCanny.

Complexity Level

This filter is available on Basic Complexity Level.