Is it possible to access CuPy array directly within cuda_GpuMat

Is it possible to access CuPy array/memory directly within cuda_GpuMat to support CudaArrayInterface?

Implemented a wrapper of CudaArrayInterface works fine to move GpuMat memory directly to CuPy. However, it failed with moving from CuPy array to GpuMat.

Reference below link
rapidsai/cucim#329 (comment)

if initiated cuda_GpuMat with CuPy array pointer, the result is not as expected, it seems cv2.cuda_GpuMat calls some default allocator and does not use the passed pointer memory.

img_cv2_cu = cv2.cuda_GpuMat(img_cp.cuda_array_interface[‘shape’],
cv2.CV_8U, # or cv2.CV_8UC1

Is there anyone can help to check this ? any guidance on how to do this?

See my reply to the thread you linked to.