GpuMat from input GstBuffer and Mat/GpuMat to output GstBuffer

The DeepStream SDK plugin example shows how to get a Mat from an input GstBuffer.

Are there examples for how to get

  1. A GpuMat from an input GstBuffer

In the case of a non-in-place, non-passthrough plugin

  1. Write a Mat to an output GstBuffer

  2. Write a GpuMat to an output GstBuffer

Hi frederickk,

We don’t have plugin to do this.Here are some suggestion about how to do.

  1. A GpuMat from an input GstBuffer

you can use EGLImage + cuGraphicsResourceGetMappedEglFrame to get GPU address.
DMA buf can be used by both CPU and GPU.
In the case of a non-in-place, non-passthrough plugin

  1. Write a Mat to an output GstBuffer

    Here you must use memory copy to GstBuffer.

  2. Write a GpuMat to an output GstBuffer

    Use method in comment 1 to get gstbuffer’s GPU address, then use cuda memory copy.

BTW, different plugin output different GSTbuffer(some with raw buffer, some output dmabuf(Memory:NVMM)), so you have to know what kind of buffer gst-plugin output.

Thanks
wayne zhu

hi,wayne zhu.
is there demo for suggestion(1)?