OpenCV With CUDA

Exploring this as an alternative to VPI.

There’s also CVCUDA, but it doesn’t even have ORB detectors.

This website has good basics https://www.simonwenkel.com/notes/software_libraries/opencv/opencv-cuda-integration.html

import numpy as np
import cv2
 
 
img = np.random.randint(0, # min value (left closed interval)
                        256, # max value - 1 (right open interval)
                        (720,1280,3), # dimension (HWC for OpenCV)
                        dtype=np.uint8 # 8 bit image
                        )
# automatic allocation on GPU (VRAM)
img_cv2_cu = cv2.cuda_GpuMat(img)
 
# do something with img_cuda
# ...
 
# return the image to host
img_host = img_cv2_cu.download()