Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU): jetson
• DeepStream Version: 6.01
**• JetPack Version (valid for Jetson only)**5.02
• TensorRT Version:8.4
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)
below is nvbufsurface info:
batchSize = 1
numFilled = 1
memType = 4
surfaceList[0]:
width = 800
height = 512
pitch = 832
layout = 1
colorFormat = 6
bufferDesc = 152
dataSize = 786432
dataPtr = 0xaaaacb25ec50
it’s NVBUF_COLOR_FORMAT_NV12!
NvBufSurfaceParams->planeParams:
num_planes = 2
width[0] = 800
height[0] = 512
pitch[0] = 832
offset[0] = 0
psize[0] = 524288
bytesPerPix[0] = 1
width[1] = 400
height[1] = 256
pitch[1] = 832
offset[1] = 524288
psize[1] = 262144
bytesPerPix[1] = 2
NvBufSurfaceParams->mappedAddr:
mappedAddr->addr[0] = (nil)
mappedAddr->addr[1] = (nil)
mappedAddr->addr[2] = (nil)
mappedAddr->addr[3] = (nil)
mappedAddr->eglImage is NULL
mappedAddr->addr[0] = 0xfffee25b7000
mappedAddr->addr[1] = 0xfffee2237000
mappedAddr->addr[2] = (nil)
mappedAddr->addr[3] = (nil)
I add following piece of code in preprocess.cpp didnot give correct image:
// Map CUDA Unified Memory to CPU memory
NvBufSurfaceMap(in_surf, 0, 0, NVBUF_MAP_READ);
NvBufSurfaceSyncForCpu(in_surf, 0, 0);
// Convert NV12 to grayscale
cv::Mat gray(in_surf->surfaceList[0].height, in_surf->surfaceList[0].width, CV_8UC1);
uchar *data = (guint8 *) in_surf->surfaceList[0].mappedAddr.addr[0];
guint stride = in_surf->surfaceList[0].pitch;
// (uchar *) mAddr->addr[0];
for (uint32_t j = 0; j < in_surf->surfaceList[0].height; j++) {
for (uint32_t i = 0; i < in_surf->surfaceList[0].width; i++) {
gray.at(j, i) = data[j * stride + i];
}
}
// Unmap CUDA Unified Memory
NvBufSurfaceUnMap(in_surf, 0, 0);
// Save grayscale image
cv::imwrite(“output_gray.png”, gray);
Please give me more advice, thank you.