0

I have installed opencv and Cuda.I have made some opencv code and now I wanna try to make it run faster using CUDA.The problem is that the opencv GPU module does not satisfy me. How can I make a CUDA code to include and use opencv libraries and functions exactly like my .cpp files?I include the needed .h files (cv.h highgui.h) that I moved to the "include" CUDA folder in my CUDA code but when I try to compile it using nvcc it says Undefined symbols for architecture i386:

"_cvLoadImage", referenced from: _main in tmpxft_000177b6_00000000-14_cuda.o ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status

which means that it does not understand the functions so the libraries are not included the right way as far as I can see.How can I make it work?

3 Answers 3

1

As far as I know, you can't just include OpenCV functions direclty in CUDA code. CUDA has its own way of programming and code made for CPU can't run on GPU directly.

I would suggest you to look at the documentation to understand how works CUDA.

If the gpu build of OpenCV does not satisfy you maybe you should make your own implementation of those functions.

OR

you just want to use openCV on CPU and also use CUDA for some other computation ?

In the case, I think you have to create a cpp file which wraps your CUDA functions. You will be able to use your wrapped functions as usual in your C or C++ code.

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

Comments

1

I think, the "Getting Started with GPU-accelerated Computer Vision using OpenCV and CUDA" webinar materials should help. You can find them here: link

1 Comment

your link is dead
0

You better not try to mix between opencv headers and nvcc compiler, this is a bad practice.

Opencv is built in library which was build using CMAKE (usually in windows under visual studio)

When you include an opencv header in nvcc compiler, you have to include all the "presents" you get from opencv, e.g: external dll, headers and extern function expected in opencv code.

What I find is the most appropriate solution in your case, would be to write a code which compiles in VS, refer to you CUDA code and Opencv's CUDA back and forth (you can always use primitives and extern functions).

1 Comment

It's been one year since you posted this comment and your comment -to me- seems to be the only one that is really relevant. Would yo mind showing what you mean by " refer to you CUDA code and Opencv's CUDA back and forth " ?

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.