Cuda support in opencv - blob detection

I want to perform a blob detection on a Jetson Nano.
I have a 1280x720@120fps video-input and want to find the largest blobs of three different colors.
It is easy with opencv without cuda : hsv, blur, threshold, binary images, finding contours, finding centeroid.
The problem is, without GPU usage I get 10-12 fps.
I need 60+ fps, so I want to do this with cuda support.
I installed opencv4.0.0 with cuda support and it is running so far.
I am programming in c++ with gcc.

But there is no “finding contours” in cv::cuda::

I managed to read the video, convert it to HSV, split into 3 channels, “find” (I can see them) blobs with threshold but I just do not know how to get the x,y,width and height of the rectangle enclosing the biggest blob.
Without the “finding” of theses values I am up to 70-80 fps, which is great,
but without getting these numbers it is useless.

I am sure, I am not the first one with this scenario and I would be glad if anyone could help me.



Not all the function in OpenCV has CUDA implementation.
But since OpenCV is an open source library, you can implement it directly on your own.


Hi AastaLLL,
Thanks for your answer.

Ans by the way, thanks for your script to install opencv4.0.0 on github!

I know that not all the function has CUDA implementation, but I still hope there is a fast way to get the dimensions of blobs with the functions already provided.
I am new to GPU programming and writing my own CUDA::findcontours is probably above my skill level.

I just hope that someone reads this topic and says “I did this last week, so I can give an answer…”.
I cannot imagine that I am the only one wanting a GPU blobdetection.



Maybe you can try if HoughCircles helps: