I have a streaming video application and I’m doing image processing in the GPU using OpenCV’s cuda support. Is there an example in Python for doing zero-copy between CPU and GPU?
You can find a C++ zero copy memory allocation sample here:
If python interface is preferred, please compile it into library and use it like this:
Thanks for your suggestion. I just spent the morning reading about, installing, and trying jetson-utils. You’ve done a lot good work! I ran the zero-copy Python example and verified that there is no HtoD or DtoH copy.
I think I’m going to need lower-level access than jetson-utils will give me. For example, I need to design my own Gstreamer pipeline and I need to do a broader set of image processing operations, such as Hough transforms, conntour detection, background subtraction, template matching, etc.
From what I can see, OpenCV’s HostMem class is what I should be using but I can’t get it to work for me. For example, I can specify page locked memory but the memory HostMem allocates for me isn’t page locked. Also, I can’t figure out how to get a GpuMat to the allocated host memory so that I can pass that to the OpenCV CUDA functions. I may need to open a separate topic for my HostMem problems.