DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

Connected Components Interface

Detailed Description

Defines 2D Connected Components Labeling algorithm.

Note
SW Release Applicability: These APIs are available in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

Typedefs

typedef struct dwConnectedComponentsObject * dwConnectedComponentsHandle_t
 A pointer to the opaque handle for Connected Components. More...
 
typedef struct dwConnectedComponentsObject *const dwConstConnectedComponentsHandle_t
 A constant pointer to the opaque handle for Connected Components. More...
 

Functions

DW_API_PUBLIC dwStatus dwConnectedComponents_bindInput (const dwImageCUDA *image, dwConnectedComponentsHandle_t ccl)
 Specifies input image to be processed. More...
 
DW_API_PUBLIC dwStatus dwConnectedComponents_bindOutputLabels (dwImageCUDA *labels, dwConnectedComponentsHandle_t ccl)
 Specifies output label image for ccl algorithm. More...
 
DW_API_PUBLIC dwStatus dwConnectedComponents_getCUDAStream (cudaStream_t *stream, dwConnectedComponentsHandle_t ccl)
 Returns CUDA stream where kernels are executed. More...
 
DW_API_PUBLIC dwStatus dwConnectedComponents_initialize (dwConnectedComponentsHandle_t *ccl, const dwImageProperties *inputDesc, dwContextHandle_t context)
 Initializes connected components. More...
 
DW_API_PUBLIC dwStatus dwConnectedComponents_process (dwConnectedComponentsHandle_t ccl)
 Performs image labeling. More...
 
DW_API_PUBLIC dwStatus dwConnectedComponents_release (dwConnectedComponentsHandle_t ccl)
 Releases connected components object. More...
 
DW_API_PUBLIC dwStatus dwConnectedComponents_reset (dwConnectedComponentsHandle_t ccl)
 Performs reset of connected components object. More...
 
DW_API_PUBLIC dwStatus dwConnectedComponents_setCUDAStream (cudaStream_t stream, dwConnectedComponentsHandle_t ccl)
 Specifies CUDA stream where kernels are executed. More...
 
DW_API_PUBLIC dwStatus dwConnectedComponents_setThreshold (uint8_t threshold, dwConnectedComponentsHandle_t ccl)
 Specifies threshold to binarize input image. More...
 

Typedef Documentation

◆ dwConnectedComponentsHandle_t

typedef struct dwConnectedComponentsObject* dwConnectedComponentsHandle_t

A pointer to the opaque handle for Connected Components.

Definition at line 60 of file ConnectedComponents.h.

◆ dwConstConnectedComponentsHandle_t

typedef struct dwConnectedComponentsObject* const dwConstConnectedComponentsHandle_t

A constant pointer to the opaque handle for Connected Components.

Definition at line 64 of file ConnectedComponents.h.

Function Documentation

◆ dwConnectedComponents_bindInput()

DW_API_PUBLIC dwStatus dwConnectedComponents_bindInput ( const dwImageCUDA image,
dwConnectedComponentsHandle_t  ccl 
)

Specifies input image to be processed.

Parameters
[in]imageA pointer to input image
[in]cclSpecifies the opaque connected components handle.
Returns
DW_INVALID_ARGUMENT - input image is null or does not match description provided on initialization
DW_INVALID_HANDLE
DW_SUCCESS

◆ dwConnectedComponents_bindOutputLabels()

DW_API_PUBLIC dwStatus dwConnectedComponents_bindOutputLabels ( dwImageCUDA labels,
dwConnectedComponentsHandle_t  ccl 
)

Specifies output label image for ccl algorithm.

Parameters
[in]labelsA pointer to output image containing labels
[in]cclSpecifies the opaque connected components handle.
Returns
DW_INVALID_ARGUMENT - output image does not match description provided on initialization
DW_INVALID_HANDLE
DW_SUCCESS

◆ dwConnectedComponents_getCUDAStream()

DW_API_PUBLIC dwStatus dwConnectedComponents_getCUDAStream ( cudaStream_t *  stream,
dwConnectedComponentsHandle_t  ccl 
)

Returns CUDA stream where kernels are executed.

Parameters
[in]streamSpecifies pointer where cuda stream will be returned. Should not be NULL
[in]cclSpecifies the opaque connected components handle.
Returns
DW_INVALID_HANDLE - if provided ccl handle is null
DW_SUCCESS

◆ dwConnectedComponents_initialize()

DW_API_PUBLIC dwStatus dwConnectedComponents_initialize ( dwConnectedComponentsHandle_t ccl,
const dwImageProperties inputDesc,
dwContextHandle_t  context 
)

Initializes connected components.

Must be initialized in a thread with valid CUDA context.

Parameters
[out]cclA pointer to the opaque connected components handle.
[in]inputDescDescription of input image.
[in]contextSpecifies the opaque handle of a dwContext.
Returns
DW_INVALID_ARGUMENT - if any of provided arguments is NULL or input image description contain invalid image size
DW_NOT_SUPPORTED - if input description contains attributes which are not supported
DW_CUDA_ERROR - if module could not create some of internal CUDA resources
DW_SUCCESS

◆ dwConnectedComponents_process()

DW_API_PUBLIC dwStatus dwConnectedComponents_process ( dwConnectedComponentsHandle_t  ccl)

Performs image labeling.

Parameters
[in]cclSpecifies the opaque connected components handle.
Returns
DW_CALL_NOT_ALLOWED - if input or output is not bound
DW_CUDA_ERROR - CUDA kernels failed to execute
DW_FAILURE - on generic failure
DW_INVALID_HANDLE
DW_SUCCESS
Note
The call is asynchronous. The user suppose to sync the stream to make sure all necessary work is done.

◆ dwConnectedComponents_release()

DW_API_PUBLIC dwStatus dwConnectedComponents_release ( dwConnectedComponentsHandle_t  ccl)

Releases connected components object.

Parameters
[in]cclA pointer to the opaque connected components handle.
Returns
DW_INVALID_HANDLE - if provided handle is NULL
DW_FAILURE
DW_SUCCESS

◆ dwConnectedComponents_reset()

DW_API_PUBLIC dwStatus dwConnectedComponents_reset ( dwConnectedComponentsHandle_t  ccl)

Performs reset of connected components object.

Parameters
[in]cclSpecifies the opaque connected components handle.
Returns
DW_INVALID_HANDLE
DW_SUCCESS

◆ dwConnectedComponents_setCUDAStream()

DW_API_PUBLIC dwStatus dwConnectedComponents_setCUDAStream ( cudaStream_t  stream,
dwConnectedComponentsHandle_t  ccl 
)

Specifies CUDA stream where kernels are executed.

Parameters
[in]streamSpecifies cuda stream.
[in]cclSpecifies the opaque connected components handle.
Returns
DW_INVALID_ARGUMENT - if provided pointer to ccl handle is null
DW_SUCCESS

◆ dwConnectedComponents_setThreshold()

DW_API_PUBLIC dwStatus dwConnectedComponents_setThreshold ( uint8_t  threshold,
dwConnectedComponentsHandle_t  ccl 
)

Specifies threshold to binarize input image.

Parameters
[in]threshold- 8-bit unsigned integer threshold value
[in]cclSpecifies the opaque connected components handle
Returns
DW_INVALID_HANDLE
DW_SUCCESS
Note
By default threshold is 127