opencv with cuda support (solved)

Hello forum,
I am new to Cuda at all.
I built an opencv color detection routine on a raspberry Pi in c++ the other day.
With high resolution it is far to slow, so I want to use the GPU Power of the Jetson Nano.

I installed the standard jetson nano SD

I can compile opencv c++ programs.
As expected they are slower than the raspberry pi programs as the CPU is slower.

Now I want to use GPU power, but I cannot find the opencv2/gpu.hpp.
I expect the nvidia guys to have the gpu extension installed into the opencv2-system.
Is this wrong?

How do I procede now?

If anyone want to help me even further:
I want to do a color detection in a 1280x720@120fps stream coming from a CSI Cam.
I wanted to do it the standard way : blure, hsv, treshold, detect
and I wanted to do this on GPU instead of CPU.
This would only include using cv::gpu:GpuMat instead of CV::Mat , right?
But is this the best way?

I am sure, I am not the first one trying to do so.
So I would be glad if anyone helped me.


I expect the nvidia guys to have the gpu extension installed into the opencv2-system.
Is this wrong?

-> Sorry that this is wrong. The opencv from sdkmanager is w/o cuda.

Please follow up the installation from public openCV tutorial to enable cuda support.

Hi Wayne,
thanks for your answer.

I found tons of building instructions for opencv4 with cuda,
but I think you had a reason choosing opencv2.4 with the JetPack.

Can you give me a link to an “out of the box instruction” how to enable cuda on the standard opencv on the jetson nano?

Or would you recommend purgeing that all and start with a new opencv4 ?


The reason behind using cv2.4 is because old jetpack has used opencv2.4 for a long time. But we don’t recommend it anymore.

You could use below scripts to install it.

Hi Wayne, thanks again!

Ok, I will try do run this script.
There is no readme for this on github.

Do I need to “prepare” the nano first?
(like creating swap, using bigger SD Card, switching anything on or off?)

thank you!


I think you may require a bigger sdcard.

Ok, I have a 32GB card and I flashed a new image on it.
Do I need to do anything else?

sorry for beeing a newbee…


Ok, I made it.
I created a 6GB Swap drive and followed the script:

Works fine and opencv4 with cuda is working.

I have some more problems actually using it, but this is another topic.

This one can be closed.