Workflow
The workflow of the connected components module is:
- Create connected components handle.
inputProps.
width = width;
inputProps.height = height;
DW_API_PUBLIC dwStatus dwConnectedComponents_initialize(dwConnectedComponentsHandle_t *ccl, dwImageProperties const *inputDesc, dwContextHandle_t context)
Initializes connected components.
struct dwConnectedComponentsObject * dwConnectedComponentsHandle_t
A pointer to the opaque handle for Connected Components.
uint32_t width
Specifies the width of the image in pixels.
@ DW_IMAGE_FORMAT_R_UINT8
Defines the properties of the image.
- Create input and output images.
outputProps.
width = width;
outputProps.height = height;
dwImageHandle labelsImageHandle;
struct dwImageObject * dwImageHandle_t
DW_API_PUBLIC dwStatus dwImage_create(dwImageHandle_t *const image, dwImageProperties properties, dwContextHandle_t const ctx)
Creates and allocates resources for a dwImageHandle_t based on the properties passed as input.
@ DW_IMAGE_FORMAT_RGBA_UINT8
dwConnectedComponents_bindOutput(labelImage, ccl);
DW_API_PUBLIC dwStatus dwConnectedComponents_process(dwConnectedComponentsHandle_t ccl)
Performs image labeling.
DW_API_PUBLIC dwStatus dwConnectedComponents_setThreshold(uint8_t threshold, dwConnectedComponentsHandle_t ccl)
Specifies threshold to binarize input image.
DW_API_PUBLIC dwStatus dwConnectedComponents_bindInput(dwImageCUDA const *image, dwConnectedComponentsHandle_t ccl)
Specifies input image to be processed.
DW_API_PUBLIC dwStatus dwImage_getCUDA(dwImageCUDA **const imageCUDA, dwImageHandle_t const image)
Retrieves the dwImageCUDA of a dwImageHandle_t.
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.