A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Functions
canny
ArrayFire Functions | ArrayFire Functions by Category » Image Processing » Filters

Canny Edge Detector More...

## Functions
AFAPI array | canny (const array &in, const cannyThreshold thresholdType, const float lowThresholdRatio, const float highThresholdRatio, const unsigned sobelWindow=3, const bool isFast=false)
| C++ Interface for canny edge detector.
AFAPI af_err | af_canny (af_array *out, const af_array in, const af_canny_threshold threshold_type, const float low_threshold_ratio, const float high_threshold_ratio, const unsigned sobel_window, const bool is_fast)
| C Interface for canny edge detector.

## Detailed Description

Canny Edge Detector

The Canny edge detector is an edge detection operator that uses a multi-stage algorithm to detect a wide range of edges in images. A more in depth discussion on it can be found here.

## Function Documentation

## ◆ af_canny()

AFAPI af_err af_canny | ( | af_array * | out,
|  | const af_array | in,
|  | const af_canny_threshold | threshold_type,
|  | const float | low_threshold_ratio,
|  | const float | high_threshold_ratio,
|  | const unsigned | sobel_window,
|  | const bool | is_fast )

C Interface for canny edge detector.

Parameters

  [out] | out | is an binary array containing edges
  [in] | in | is the input image
  [in] | threshold_type | determines if user set high threshold is to be used or not. It can take values defined by the enum af_canny_threshold
  [in] | low_threshold_ratio | is the lower threshold % of the maximum or auto-derived high threshold
  [in] | high_threshold_ratio | is the higher threshold % of maximum value in gradient image used in hysteresis procedure. This value is ignored if AF_CANNY_THRESHOLD_AUTO_OTSU is chosen as af_canny_threshold
  [in] | sobel_window | is the window size of sobel kernel for computing gradient direction and magnitude
  [in] | is_fast | indicates if L1 norm(faster but less accurate) is used to compute image gradient magnitude instead of L2 norm.

Returns
  AF_SUCCESS if the moment calculation is successful, otherwise an appropriate error code is returned.

## ◆ canny()

AFAPI array canny | ( | const array & | in,
|  | const cannyThreshold | thresholdType,
|  | const float | lowThresholdRatio,
|  | const float | highThresholdRatio,
|  | const unsigned | sobelWindow = 3,
|  | const bool | isFast = false )

C++ Interface for canny edge detector.

Parameters

  [in] | in | is the input image
  [in] | thresholdType | determines if user set high threshold is to be used or not. It can take values defined by the enum af_canny_threshold
  [in] | lowThresholdRatio | is the lower threshold % of maximum or auto-derived high threshold
  [in] | highThresholdRatio | is the higher threshold % of maximum value in gradient image used in hysteresis procedure. This value is ignored if AF_CANNY_THRESHOLD_AUTO_OTSU is chosen as af_canny_threshold
  [in] | sobelWindow | is the window size of sobel kernel for computing gradient direction and magnitude
  [in] | isFast | indicates if L1 norm(faster but less accurate) is used to compute image gradient magnitude instead of L2 norm.

Returns
  binary array containing edges