DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

Connected Components Workflow
SW Release Applicability: This tutorial is applicable to modules in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.


The workflow of the connected components module is:

  • Create connected components handle.
dwImageProperties inputProps{};
inputProps.width = width;
inputProps.height = height;
inputProps.type = DW_IMAGE_CUDA;
inputProps.format = DW_IMAGE_FORMAT_R_UINT8;
dwConnectedComponents_initialize(&ccl, &inputProps, cc);
  • Create input and output images.
dwImageHandle_t inputImageHandle;
dwImage_create(&inputImage, inputProps, cc);
// fill input image with actual data
// ...
dwImageProperties outputProps{};
outputProps.width = width;
outputProps.height = height;
outputProps.type = DW_IMAGE_CUDA;
outputProps.format = DW_IMAGE_FORMAT_RGBA_UINT8;
dwImageHandle labelsImageHandle;
dwImage_create(&labelsImageHandle, outputProps, cc);
  • Perform labeling.
dwImageCUDA* inputImage = nullptr;
dwImage_getCUDA(&inputImage, inputImageHandle);
dwImageCUDA* labelImage = nullptr;
dwImage_getCUDA(&labelImage, labelsImageHandle);
dwConnectedComponents_bindOutput(labelImage, ccl);

dwConnectedComponents_setThreshold is a function to define threshold for image binarization. Pixels which values are below the specified threshold are considered to be background pixels.

For a demonstration of this workflow, see Connected Components Sample.