# Revision history [back]

### cuda-based connected component labeling

Hi,

I am trying to identify/label blobs in an image. Given a binarized image like this:

I want the centroid, area and other morphological parameters of each of the white spots.

I currently have code that works well using findContours and ApproxPolyDP but I want to write code that uses GPU processing. I have tried using the Hough transform but, since my objects are not necessarily round, it does not perform very well.

I have a pretty good idea how to get the required parameters IF I could "paint" each of the spots a different "color" .

I have tried using cv::cuda::connectivityMask and cv::cuda::labelComponents to do this, but there seems to be no documentation at all regarding these routines, so I am guessing how to use them.

Invoking cv::cuda::connectivityMask(GPUBinaryImage, GPUConnectedComponentMask,0 ,2); I get the following image:

It appears that all pixels have a value of 15 except for those on the boundary of each blob which have lower values.

Invoking cv::cuda::labelComponents(GPUConnectedComponentMask, GPULabels,8); I get a 32bit image with the 1st and 2nd byte looking something like:

How should I be using these functions?

Is there anything better I should be using?

guy