I followed the instructions from Install OpenCV on Jetson Nano - Q-engineering to install open cv with cuda support on my jetson orin nano. And after completing the all the steps, I include the following given code : include <opencv2/dnn/dnn.hpp>
…
// load some network
net = cv::dnn::readNetFromCaffe(“ResNet-50.prototxt”, “ResNet-50.caffemodel”);
// check
if(net.empty()){
std::cout << "init the model net error" << std::endl;
return -1;
}
// enable CUDA support
net.setPreferableBackend(cv::dnn::DNN_BACKEND_CUDA);
net.setPreferableTarget(cv::dnn::DNN_TARGET_CUDA);
… in my main project code in order to activate and test cuda support. However,
when I run the code, it returns “CUDA devices availability : 0” and “CUDA not available”.
And I have no idea what’s going on and I don’t know how to fix it.
Flip the image horizontally on the GPU (flipCode = 1)
gpu_flipped = cv2.cuda.flip(gpu_image, 1)
Download the flipped image from GPU to CPU
flipped_image = gpu_flipped.download()
Save the result as a new file
cv2.imwrite(output_file, flipped_image)
print(f"Flipped image saved to: {output_file}")
it returns this “Traceback (most recent call last):
File “/home/jetsonorin/Desktop/fira/ball_zone/testcudaforum.py”, line 14, in
gpu_image.upload(image)
cv2.error: OpenCV(4.12.0) /io/opencv/modules/core/include/opencv2/core/private.cuda.hpp:106: error: (-216:No CUDA support) The library is compiled without CUDA support in function ‘throw_no_cuda’”
it said there’s error regarding opencv(4.12.0) and chatgpt told me that I do not have open cv with cuda support. But on my jtop it said "opencv 4.10.0 with CUDA: YES "
I am really confused at this point and I am wondering is there any other online accessible library that will boost the fps of my camera?
It looks like you have multiple OpenCV versions in the environment.
The one with CUDA support is 4.10, and the one imported and reports “No CUDA support” is 4.12.
For other libraries, you can check Deesptream SDK below: