CannyEdgeDetector#

Functions#

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

Constructs an instance of the CannyEdgeDetector operator.

NVCVStatus pvaCannyEdgeDetectorSubmit(NVCVOperatorHandle handle, cudaStream_t stream, cupvaCmdStatus_t *cmdStatus, NVCVTensorHandle image, NVCVTensorHandle edgeMap, const int32_t thresholdStrong, const int32_t thresholdWeak)

Submits the CannyEdgeDetector operator to a CUDA stream.

NVCVStatus pvaCannyEdgeDetectorSubmit(NVCVOperatorHandle handle, cupvaStream_t stream, cupvaCmdStatus_t *cmdStatus, NVCVTensorHandle image, NVCVTensorHandle edgeMap, const int32_t thresholdStrong, const int32_t thresholdWeak)

Submits the CannyEdgeDetector operator to a cuPVA stream.

Functions#

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

Constructs an instance of the CannyEdgeDetector operator.

Limitations: Edge tracking by hysteresis uses the CCL (Connected Component Labeling) approach. The maximum number of labels is limited to 65536. If the number of labels exceeds this limit, the operator will return CUPVA_VPU_APPLICATION_ERROR.

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 edgeMap 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,
cudaStream_t stream,
cupvaCmdStatus_t *cmdStatus,
NVCVTensorHandle image,
NVCVTensorHandle edgeMap,
const int32_t thresholdStrong,
const int32_t thresholdWeak,
)#

Submits the CannyEdgeDetector operator to a CUDA stream.

Note

CUDA stream support requirements:

  • PVA SDK 2.7.0 or later

  • Jetpack 7 or later

  • DriveOS 7 or later

  • x86 Emulator is not supported

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

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

  • cmdStatus[in] Pointer to the array of cuPVA command status.

  • image[in] Input tensor handle of image.

  • edgeMap[out] Output tensor handle of linked edges.

  • thresholdStrong[in] Strong threshold for the edge hysteresis procedure.

  • thresholdWeak[in] Weak threshold for the edge hysteresis procedure.

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.

NVCVStatus pvaCannyEdgeDetectorSubmit(
NVCVOperatorHandle handle,
cupvaStream_t stream,
cupvaCmdStatus_t *cmdStatus,
NVCVTensorHandle image,
NVCVTensorHandle edgeMap,
const int32_t thresholdStrong,
const int32_t thresholdWeak,
)#

Submits the CannyEdgeDetector operator to a cuPVA stream.

Value

Description

0

Non-edge

255

Edge

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

    • Must not be NULL.

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

  • cmdStatus[in] Pointer to the array of cuPVA command status. Used to track the execution status of the operation. If the runtime labels in the CCL stage exceed the limit (65536 labels), command status will return CUPVA_VPU_APPLICATION_ERROR.

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

  • edgeMap[out] Output tensor handle of linked edges. Data Type: NVCV_DATA_TYPE_U8 Data Layout: [CHW], [NCHW] only when C = 1 and N = 1 Each pixel in the edgeMap tensor has one of the following values:

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