Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU) :T4
• DeepStream Version:5.0
• TensorRT Version:7.0.1
• NVIDIA GPU Driver Version (valid for GPU only):440.64
I have achieved save image in dsexample plugin, but I think it is a waste for doing only this thing, meanwhile it would get segmentation fault for a long time.
So I want to save image via osd sink/src pad prob in deepstream-app just like Access video frame and use opencv to draw on it in pad probe callback.
However I get error of nvbufsurface: mapping of memory type (0) not supported. Below is my probe code.
static GstPadProbeReturn
osd_bin_src_pad_prob (GstPad * pad, GstPadProbeInfo * info,
gpointer u_data)
{
GstBuffer *buf = (GstBuffer *) info->data;
GstMapInfo in_map_info;
NvBufSurface *surface = NULL;
NvDsBatchMeta *batch_meta = NULL;
NvDsMetaList *l_frame = NULL;
NvDsFrameMeta *frame_meta = NULL;
memset (&in_map_info, 0, sizeof (in_map_info));
if (gst_buffer_map (buf, &in_map_info, GST_MAP_READWRITE))
{
surface = (NvBufSurface *) in_map_info.data;
NvBufSurfaceMap(surface, -1, -1, NVBUF_MAP_READ_WRITE);
NvBufSurfaceSyncForCpu(surface, -1, -1);
batch_meta = gst_buffer_get_nvds_batch_meta(buf);
for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next)
{
frame_meta = (NvDsFrameMeta *)(l_frame->data);
gint frame_width = (gint)surface->surfaceList[frame_meta->batch_id].width;
gint frame_height = (gint)surface->surfaceList[frame_meta->batch_id].height;
void *frame_data = surface->surfaceList[frame_meta->batch_id].mappedAddr.addr[0];
size_t frame_step = surface->surfaceList[frame_meta->batch_id].pitch;
// cv::Mat frame = cv::Mat(frame_height, frame_width, CV_8UC4, frame_data, frame_step);
}
NvBufSurfaceUnMap(surface, -1, -1);
}
gst_buffer_unmap (buf, &in_map_info);
}
Please give me some advices for this problems, and which way is better to save image.
Thanks!