0

I have my code written in c++ and I used openCV functions for Image processing tasks.

I want to run my code in GPU (using cuda) to read a camera/stream inputs and do the image processing tasks in each frame in parallel.

I've read somewhere that I can't include the openCV functions in a .cu code, since the NVCC can't compile openCv functions (please correct me if this is not true)

I found the openCV gpu module in the openCV documentation, but I don't want to run the whole function in parallel, I want the whole algorithm to be processed in parallel ( in other way, include openCv in cuda not vise versa), so I've thought about writing all of my openCV functions in cuda, But I'm newbie to cuda. My questions:

1- Are there cuda functions that can be used instead of openCv following functions :

  • split, inRange
  • fillHoles
  • Morphology (erosion, dilation, closing)
  • Countours (findContours, moments, boundingRect, approxPolyDP)
  • Drawing function (drawContours, rectangle, circle)
  • kmeans (or any other function for clustering)

I found some of them in Github, but still didn't test any, any documentation will be highly appreciated.

2- Does cuda reads only .pgm image format, and should I convert the .jpg frames before copying them to the device? Is it impossible to read the camera input directly to GPU global memory?

3- Do you suggest keeping my code in openCV and use another libraries for parallel processing like openCL? or use CPU (instead of GPU) for parallel processing using OpenMP? what might be the best option I should go with?

1 Answer 1

1

Before you begin down this route, i would recommend that you go through the first few lessons in this tutorial:

https://www.udacity.com/course/cs344

Then you will have a better idea about if a GPU is suitable for what your application requires.

In any case, openCV 1.0 is mostly in C, and cuda kernels are in C, so maybe you could try wrapping some of those into cuda kernels

Cheers

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your answer and the tutorial, I've used openCV 2.4.4 in my code, do you think I should go back to v. 1.0 ? and which version of cuda I should use then?
@Nada hi, in general it is better to use the newer versions. However the new version is written in c++ and cuda kernels are in C, thus it may be easier for you to play around with those c functions in the old opencv first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.