Own server for Java programms to use the NVidia GPU

I use OpenCV under Java, I wanted to ask whether I can also use performance gains there if I compile OpenCV like this.

And the next question: Are all operations then shifted to the GPU, for example

SURF detector = SURF.create(…




Are “normal” matrix operations also outsourced to the GPU?

And since the Tesla C2050 is no longer available, what do you buy for it today?

unfortunately, no (or, not so easy)
you need to use special api’s / classes to use CUDA/OpenCL code, which are not exposed to the java api

IF you’re good with c++, you can still wrap your gpu pipeline into JNI code, and call that from java

this is cpu only, to use the CUDA optimization, you need a different api – but again, no java bindings ;(

I use the official API:

// C++: void cv::Feature2D::detectAndCompute(Mat image, Mat mask, vector_KeyPoint& keypoints, Mat& descriptors, bool useProvidedKeypoints = false)

So I have to write my own JNI so that I can access it via Java and then use these functions instead of the “official” ones?

that’s still the CPU API (you need GPUMat instead, look e.g. here:

What do I have to consider specifically when I go NonFree?

Switch from
cv::Feature2D Class Reference
[2D Features Framework] » [Feature Detection and Description]


cv::cuda::SURF_CUDA Class Reference
[Extra 2D Features Framework] » [Non-free 2D Features Algorithms]

you have to enable the nonfree code at build time of the libs:


(and ofc. need to build with the contrib repo, where all CUDA code was moved)

Thanks for the tip, I will try it out in the next few weeks.

Ok, technically I know, I mean legally, if I don’t publish parts of my software but I want to use these non-public routines myself?