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
I have figured this out.
It turns out that there were several errors in the CUDA kernels used by
cv::cuda::labelComponents()
I have fixed them and now have a working version which was tweaked for my application. I would be willing to share this with others but am not sure how.guy
You could publish it in your own github fork of opencv.
Could you please share your solution, I am facing the same issue with the CUDA based CCL method. Thanks!
Hey Guyygarty,
I have the same question as Woking-34. Is it possible that you provide the code or instructions how to repair the labelcomponents method.
Best
Mondi
Is this solution currently posted somewhere? Thanks!