Hardware Platform (Jetson / GPU) NX
• DeepStream Version 6.11
• JetPack Version (valid for Jetson only) 5.02
• TensorRT Version 8.4
Modifying the preprocess. I want to configure my own ROI, so I need to obtain gray value of current frame.
below is part of my function.
gint* calc_roi (GstNvDsPreProcess * nvdspreprocess, NvDsPreProcessBatch *batch,
NvBufSurface * outsurf)
{
// cv::Mat in_mat, out_mat;
static guint cnt = 0; // guint src_id = G_MAXUINT; // guint roi_cnt = 0;
static gint x_roi[4];
// Map the buffer so that it can be accessed by CPU
gint i = 0;
if (NvBufSurfaceMap (outsurf, i, 0, NVBUF_MAP_READ) != 0) {
GST_ELEMENT_ERROR (nvdspreprocess, STREAM, FAILED,
(“%s:buffer map to be accessed by CPU failed”, func), (NULL));
return FALSE;
}
// sync mapped data for CPU access
NvBufSurfaceSyncForCpu (outsurf, i,0);
I donnot know how to obtain gray value from outsurf, please help.