Please provide complete information as applicable to your setup.
**• | x86_64 Ubuntu 18.04** |
---|---|
**• | Deepstream 4.0** |
**• | Driver 430.64** |
**• | CUDA 10.1** |
Hey!
So I’m using OpenCV to create a RGB image and then running it through gstreamer to convert the frame to NV12 for me. The problem is that I’m having trouble sending the NV12 frame as an input to the tracker and getting results from it. I think this is because I’m not transforming the NV12 frame properly to the pitch layout that NvBufSurface expects. How do I achieve this?
This is what I tried:
NvBufSurfaceCreateParams surfaceCreateParams;
surfaceCreateParams.layout = NVBUF_LAYOUT_PITCH;
surfaceCreateParams.colorFormat = NVBUF_COLOR_FORMAT_NV12;
surfaceCreateParams.width = 512;
surfaceCreateParams.height = 512;
surfaceCreateParams.isContiguous = true;
surfaceCreateParams.size = 0;
surfaceCreateParams.gpuId = 0;
surfaceCreateParams.memType = _query.memType;
auto _nvBufSurface = new NvBufSurface();
NvBufSurfaceCreate(&_nvBufSurface, 1, &surfaceCreateParams);
NvBufSurfaceMap(_nvBufSurface, 0, -1, NvBufSurfaceMemMapFlags::NVBUF_MAP_READ_WRITE);
// Then When I get a new NV12 frame in CPU space from gstreamer, I do:
cudaMemcpy2D(_nvBufSurface->surfaceList->mappedAddr.addr[0],
512,
nv12Data,
512,
512,
512,
cudaMemcpyHostToDevice);
// I have also tried doing a direct map like:
cudaMemcpy(_nvBufSurface->surfaceList->mappedAddr.addr[0],
nv12Data,
_nvBufSurface->surfaceList->dataSize,
cudaMemcpyHostToDevice);