8000 Is it possible to access CuPy array directly within cuda_GpuMat? · Issue #818 · opencv/opencv-python · GitHub
[go: up one dir, main page]

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

8000

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
amanda-peng opened this issue Mar 14, 2023 · 3 comments
Closed
Labels

Comments

@amanda-peng
Copy link

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?

@asmorkalov
Copy link
Collaborator

Please use https://forum.opencv.org. It has larger audience for such questions.

@amanda-peng
Copy link
Author

@amanda-peng
Copy link
Author

Thank you! With this fix, I can create the GpuMat with the passed GPU memory pointer what as I expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
0