Isn't there a OpenCV Cuda function similar to findContours?
There are several OpenCV CPU functions which have a direct (GPU) Cuda counterpart like cv::cvtColor & cv::cuda::cvtColor.
But I found no direct or indirect (GPU) Cuda counterpart for cv::findContours CPU.
Isn't there a OpenCV Cuda function similar to findContours? Or does findContours work on both cv::Mat and cv::cuda::GpuMat?
Nope, it is not there :)
Does findContours work on both cv::Mat and cv::cuda::GpuMat, @StevenPuttemans ?
No it does not ... if there is no CUDA implementation then you cannot call it on GpuMat. You might be able to try an OpenCL optimized version by supplying a UMat container.
Actually, there is but it doesn't work and is undocumented. It looks like somebody tried to write it and gave up during debugging - see here.
I futzed with it a bit and got it to work for my application. I will gladly share my code, with the caveat that it is not fully debugged and may not work properly for other scenarios.
Furthermore, In the tests I did, it was not actually faster than the non-GPU version. Connected component labeling is actually not very paralelizable for largish objects, since you need to trace a path from each pixel to an "origin" pixel in that blob. So the gains from going to GPU processing are not huge and do not justify the extra overhead and the slower "per CPU" speed.
guy
Ok, any nudging link for the said method documentation @StevenPuttemans. Actually, I've begun GPU porting for my entire project and this precisely is my bottle neck roadblocking pain point!
@Guyygarty, that seems exciting but why are you calling yourself 'somebody'? :) It'd be a pleasure if I could get to see how you did it. And btw, I'm not in this pursuit only for gains from this exact finding contours thing, but the overall gains from all the functions. :)
Surprisingly, findContours() doesn't give any compilation error even when the input is a GpuMat. I'm curious why.
@StevenPuttemans Are you sure about the cv::UMat and cv::findCountours part? i traced the code and there is no call for any OpenCL code? did I miss something? thanks
Did you read my post? Back in the day I said, you can
try
and see. I did not check the code at that time :D So I guess the answer is no.Oh :( I thought there is a hope