CannyEdgeDetector#

Functions#

NVCVStatus pvaCannyEdgeDetectorCreate(NVCVOperatorHandle *handle, const NVCVTensorRequirements *imageParams, const int32_t gradientSize)

Constructs an instance of the CannyEdgeDetector (excluding edge hysteresis) operator.

NVCVStatus pvaCannyEdgeDetectorSubmit(NVCVOperatorHandle handle, cupvaStream_t stream, NVCVTensorHandle image, NVCVTensorHandle edgeType, const int32_t thresholdStrong, const int32_t thresholdWeak)

Executes the CannyEdgeDetector operation, excluding edge hysteresis.

Functions#

NVCVStatus pvaCannyEdgeDetectorCreate(
NVCVOperatorHandle *handle,
const NVCVTensorRequirements *imageParams,
const int32_t gradientSize,
)#

Constructs an instance of the CannyEdgeDetector (excluding edge hysteresis) operator.

Limitations:

Image: Data Layout: [CHW], [NCHW] only when C: [1] N: [1]

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

No

16bit Unsigned

No

16bit Signed

No

32bit Unsigned

No

32bit Signed

No

32bit Float

No

64bit Float

No

The output edgeType NVCVTensorRequirements could be deduced from input imageParams.

Input/Output Dependency:

Property

Input == Output

Data Layout

Yes

Data Type

Yes

Number

Yes

Channels

Yes

Width

Yes

Height

Yes

Parameters:
  • handle[out] Where the operator instance handle will be written to.

    • Must not be NULL.

  • imageParams[in] Pointer to the NVCVTensorRequirements structure which contains [in] image Tensor rank, shape, layout and data type information.

  • gradientSize[in] The Sobel kernel size. Must be 3 or 5 or 7.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Handle is null.

  • NVCV_ERROR_OUT_OF_MEMORY – No enough memory to create the operator.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus pvaCannyEdgeDetectorSubmit(
NVCVOperatorHandle handle,
cupvaStream_t stream,
NVCVTensorHandle image,
NVCVTensorHandle edgeType,
const int32_t thresholdStrong,
const int32_t thresholdWeak,
)#

Executes the CannyEdgeDetector operation, excluding edge hysteresis.

Parameters:
  • handle[in] Handle to the operator.

    • Must not be NULL.

  • stream[in] Handle to a valid CUPVA stream.

  • image[in] Input tensor handle of image. Data Type: NVCV_DATA_TYPE_U8 Data Layout: [CHW], [NCHW] only when C = 1 and N = 1

  • edgeType[out] Output tensor handle of edge type. Data Type: NVCV_DATA_TYPE_U8 Data Layout: [CHW], [NCHW] only when C = 1 and N = 1 Each pixel in the edgeType tensor has one of the following values: ———–— | ———-— 0 | Non-edge 1 | Weak edge 2 | Strong edge

  • thresholdStrong[in] Strong threshold for the edge hysteresis procedure. If gradient intensity is larger than the strong threshold, edge type is set to strong.

  • thresholdWeak[in] Weak threshold for the edge hysteresis procedure. If gradient intensity is larger than the weak threshold and less than or equal to the strong threshold, edge type is set to weak. Weak edges are used for edge linking. If gradient intensity is less than or equal to the weak threshold, edge type is set to non-edge. Reasonble values for double thresholding are thresholdStrong > thresholdWeak > 0.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Some parameter is outside the valid range.

  • NVCV_ERROR_INTERNAL – Internal error in the operator, invalid types passed in.

  • NVCV_SUCCESS – Operation executed successfully.