Python cuda_GpuMat and custom allocator

asked 2020-11-09 22:30:13 -0500

No luck finding an answer to this one from my searches.. My software exposes a Python interface created via the C Python API. Currently I have a function that returns a CUDA memory pointer that I allocate/fill, for the end-user to use in Python. They've been able to do this in cupy well, and I'd like to be able to extend this to OpenCV's CUDA functionality in Python as well. It seems like the GpuMat constructor that takes an existing CUDA pointer isn't exposed in the Python interface. If the OpenCV C Python API was exposed (like how NumPy's is) I'd use that to just return a GpuMat directly. Doesn't seem like that is done though. So the last solution I can think of is having a custom allocator that just returns the already-allocated memory when requested. I can't seem to get this to work though. Are there any examples of creating a custom allocator in Python I can pass into the constructor of GpuMat? Thanks

edit retag flag offensive close merge delete