Skip to content

Is it possible to access CuPy array directly within cuda_GpuMat? #818

@amanda-peng

Description

@amanda-peng

Is it possible to access CuPy array 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 move from CuPy array to GpuMat.

Reference below link
rapidsai/cucim#329 (comment)

if initiated cuda_GpuMat with CuPy array pointer, the results 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
img_cp.cuda_array_interface['data'][0])

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions