VPI - Vision Programming Interface

3.0 Release

Canny Edge Detector

Runs the canny edge detector algorithm over the input image. More...

Data Structures

struct  VPICannyEdgeDetectorParams
 Structure that defines the parameters for vpiSubmitCannyEdgeDetector. More...
 

Functions

VPIStatus vpiCreateCannyEdgeDetector (uint64_t backends, int32_t imageWidth, int32_t imageHeight, VPIPayload *payload)
 Creates payload for vpiSubmitCannyEdgeDetector. More...
 
VPIStatus vpiInitCannyEdgeDetectorParams (VPICannyEdgeDetectorParams *params)
 Initialize vpiInitCannyEdgeDetectorParams with default values. More...
 
VPIStatus vpiSubmitCannyEdgeDetector (VPIStream stream, uint64_t backend, VPIPayload payload, VPIImage input, VPIImage output, float thresholdStrong, float thresholdWeak, float edgeValue, float nonEdgeValue, const VPICannyEdgeDetectorParams *params)
 Runs the canny edge detector algorithm over an image. More...
 

Detailed Description

Runs the canny edge detector algorithm over the input image.

Refer to Canny edge detector for more details and usage examples.


Data Structure Documentation

◆ VPICannyEdgeDetectorParams

struct VPICannyEdgeDetectorParams

Structure that defines the parameters for vpiSubmitCannyEdgeDetector.

Definition at line 107 of file CannyEdges.h.

+ Collaboration diagram for VPICannyEdgeDetectorParams:
Data Fields
VPINormType normType Determine the norm to calculate the gradient intensity.
VPIGradientMethod gradMethod Specify the method used to generate gradient from the input image.
int32_t gradientSize Gradient window size.
  • Must be 3, 5 or 7.

Function Documentation

◆ vpiCreateCannyEdgeDetector()

VPIStatus vpiCreateCannyEdgeDetector ( uint64_t  backends,
int32_t  imageWidth,
int32_t  imageHeight,
VPIPayload payload 
)

#include </opt/nvidia/vpi3/include/vpi/algo/CannyEdges.h>

Creates payload for vpiSubmitCannyEdgeDetector.

Parameters
[in]backendsVPI backends that are eligible to execute the algorithm.
[in]imageWidth,imageHeightInput image dimensions.
  • Must be >= 1x1.
[out]payloadPointer to the payload variable that receives the created handle.
Return values
VPI_ERROR_INVALID_ARGUMENTpayload is NULL.
VPI_ERROR_INVALID_ARGUMENTimageWidth and imageHeight outside valid range.
VPI_ERROR_INVALID_ARGUMENTbackends refers to an invalid backend.
VPI_ERROR_INVALID_OPERATIONBackend isn't enabled in current context.
VPI_ERROR_NOT_IMPLEMENTEDCanny edge detector algorithm is not supported by given backend.
VPI_ERROR_INVALID_CONTEXTCurrent context is destroyed.
VPI_ERROR_OUT_OF_MEMORYCannot allocate required resources.
VPI_SUCCESSOperation executed successfully.

◆ vpiInitCannyEdgeDetectorParams()

VPIStatus vpiInitCannyEdgeDetectorParams ( VPICannyEdgeDetectorParams params)

#include </opt/nvidia/vpi3/include/vpi/algo/CannyEdges.h>

Initialize vpiInitCannyEdgeDetectorParams with default values.

Default values:

  • normType: VPI_NORM_L2
  • gradMethod: GEN_GRADIENT_SOBEL
  • gradientSize: 3
Parameters
[out]paramsStructure to be filled with default values.
Returns
an error code on failure else VPI_SUCCESS.

◆ vpiSubmitCannyEdgeDetector()

VPIStatus vpiSubmitCannyEdgeDetector ( VPIStream  stream,
uint64_t  backend,
VPIPayload  payload,
VPIImage  input,
VPIImage  output,
float  thresholdStrong,
float  thresholdWeak,
float  edgeValue,
float  nonEdgeValue,
const VPICannyEdgeDetectorParams params 
)

#include </opt/nvidia/vpi3/include/vpi/algo/CannyEdges.h>

Runs the canny edge detector algorithm over an image.

Parameters
[in]streamA stream handle where the operation will be queued into.
  • Must not be NULL.
  • Stream must have enabled the backends that will execute the algorithm.
[in]backendBackend that will execute the algorithm.
[in]payloadPointer to the payload variable that receives the created handle.
[in]inputInput image.
[out]outputOutput image where the result is written to.
  • Must not be NULL.
  • It must have same dimensions as input image.
  • Image must have enabled the backends that will execute the algorithm.
  • The accepted formats are the same as input
[in]thresholdStrongStrong threshold for the hysteresis procedure.
[in]thresholdWeakWeak threshold for the hysteresis procedure.
[in]edgeValueValue used to mark edge.
  • This value should be different than nonEdgeValue.
  • This value will be clamped if it exceeds the value range of the output image.
[in]nonEdgeValueValue used to mark non-edge.
  • This value should be different than edgeValue.
  • This value will be clamped if it exceeds the value range of the output image.
[in]paramsControl parameters of the canny edge detector algorithm.
Return values
VPI_ERROR_INVALID_ARGUMENTstream is NULL.
VPI_ERROR_INVALID_ARGUMENTinput or output are NULL.
VPI_ERROR_INVALID_ARGUMENTinput or output image dimensions ouside valid range.
VPI_ERROR_INVALID_ARGUMENTbackend is invalid or unknown.
VPI_ERROR_INVALID_IMAGE_FORMATinput or output image format not supported.
VPI_ERROR_INVALID_OPERATIONBackend hardware is not available.
VPI_ERROR_INVALID_OPERATIONThe needed backends aren't enabled in stream, input or output.
VPI_ERROR_NOT_IMPLEMENTEDCanny edge detector algorithm is not supported by given backend.
VPI_SUCCESSOperation executed successfully.