Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU)Jetson • DeepStream VersionDS 5.1 • JetPack Version (valid for Jetson only)4.5.1
Hi, I would like to know how can I save the full image frame (uncropped) with bounding box shown as a jpeg image. I’ve seen the deepstream_image_meta_test source code and am currently using the codes but it only saves the raw images without the bounding box.
yes, my current codes modifies the object meta to save the full frame, the code is as below
static GstPadProbeReturn
pgie_src_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info, gpointer ctx)
{
GstBuffer *buf = (GstBuffer *) info->data;
GstMapInfo inmap = GST_MAP_INFO_INIT;
if (!gst_buffer_map (buf, &inmap, GST_MAP_READ)) {
GST_ERROR ("input buffer mapinfo failed");
return GST_FLOW_ERROR;
}
NvBufSurface *ip_surf = (NvBufSurface *) inmap.data;
gst_buffer_unmap (buf, &inmap);
NvDsObjectMeta *obj_meta = NULL;
NvDsMetaList *l_frame = NULL;
NvDsMetaList *l_obj = NULL;
NvDsBatchMeta *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)
{
NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
guint num_rects = 0;
for (l_obj = frame_meta->obj_meta_list; l_obj != NULL; l_obj = l_obj->next)
{
obj_meta = (NvDsObjectMeta *) (l_obj->data);
if (obj_meta->class_id == 0) {
num_rects++;
}
/* Conditions that user needs to set to encode the detected objects of
* interest. Here, by default all the detected objects are encoded.
* For demonstration, we will encode the first object in the frame */
if ( frame_meta->source_id == 0 && obj_meta->class_id == 0 && num_rects == 1 )
{
NvDsObjEncUsrArgs userData = { 0 };
/* To be set by user */
userData.saveImg = TRUE;
userData.attachUsrMeta = TRUE;
/* Set if Image scaling Required */
userData.scaleImg = FALSE;
userData.scaledWidth = 0;
userData.scaledHeight = 0;
/* Preset */
userData.objNum = num_rects;
obj_meta->rect_params.width = frame_meta->source_frame_width ;
obj_meta->rect_params.height = frame_meta->source_frame_height ;
obj_meta->rect_params.top = 0.0f ;
obj_meta->rect_params.left = 0.0f ;
nvds_obj_enc_process (ctx, &userData, ip_surf, obj_meta, frame_meta);
}
}
}
nvds_obj_enc_finish (ctx);
return GST_PAD_PROBE_OK;
}
both images saved in this function and in the osd_sink_pad_buffer_probe() function saves the full frame but without bounding boxes. would like to know how can I save the images with the bounding boxes.