Hi,
Sorry for a late reply
I do not have this flicker issue, I attached the whole function code, did you have other changes? btw, i am using deepstream-app, config source4***, model is the default within package
static void
attach_metadata_full_frame (GstDsExample * dsexample, NvDsFrameMeta *frame_meta,
gdouble scale_ratio, DsExampleOutput * output, guint batch_id)
{
NvDsBatchMeta *batch_meta = frame_meta->base_meta.batch_meta;
NvDsObjectMeta *object_meta = NULL;
NvDsDisplayMeta *display_meta = NULL;
static gchar font_name = “Serif”;
GST_DEBUG_OBJECT (dsexample, “Attaching metadata %d\n”, output->numObjects);
display_meta = nvds_acquire_display_meta_from_pool(batch_meta);
NvOSD_LineParams *line_params = display_meta->line_params;
display_meta->num_lines = 2;
line_params[0].x1 = 30;
line_params[0].y1 = 50;
line_params[0].x2 = 150;
line_params[0].y2 = 150;
line_params[1].x1 = 50;
line_params[1].y1 = 110;
line_params[1].x2 = 150;
line_params[1].y2 = 150;
line_params[0].line_width = 2;
line_params[0].line_color = (NvOSD_ColorParams){1.0, 0.0, 0.0, 0.5};
line_params[1].line_width = 2;
line_params[1].line_color = (NvOSD_ColorParams){1.0, 0.0, 0.0, 0.5};
nvds_add_display_meta_to_frame (frame_meta, display_meta);
for (gint i = 0; i < output->numObjects; i++) {
DsExampleObject *obj = &output->object[i];
object_meta = nvds_acquire_obj_meta_from_pool(batch_meta);
NvOSD_RectParams & rect_params = object_meta->rect_params;
NvOSD_TextParams & text_params = object_meta->text_params;
// Assign bounding box coordinates
rect_params.left = obj->left;
rect_params.top = obj->top;
rect_params.width = obj->width;
rect_params.height = obj->height;
// Semi-transparent yellow background
rect_params.has_bg_color = 0;
rect_params.bg_color = (NvOSD_ColorParams) {
1, 1, 0, 0.4};
// Red border of width 6
rect_params.border_width = 3;
rect_params.border_color = (NvOSD_ColorParams) {
1, 0, 0, 1};
// Scale the bounding boxes proportionally based on how the
//object/frame was
// scaled during input
rect_params.left /= scale_ratio;
rect_params.top /= scale_ratio;
rect_params.width /= scale_ratio;
rect_params.height /= scale_ratio;
GST_DEBUG_OBJECT (dsexample, “Attaching rect%d of batch%u”
" left->%u top->%u width->%u"
" height->%u label->%s\n", i, batch_id, rect_params.left,
rect_params.top, rect_params.width, rect_params.height, obj->label);
object_meta->object_id = UNTRACKED_OBJECT_ID;
g_strlcpy (object_meta->obj_label, obj->label, MAX_LABEL_SIZE);
// display_text required heap allocated memory
text_params.display_text = g_strdup (obj->label);
// Display text above the left top corner of the object
text_params.x_offset = rect_params.left;
text_params.y_offset = rect_params.top - 10;
// Set black background for the text
text_params.set_bg_clr = 1;
text_params.text_bg_clr = (NvOSD_ColorParams) {
0, 0, 0, 1};
// Font face, size and color
text_params.font_params.font_name = font_name;
text_params.font_params.font_size = 11;
text_params.font_params.font_color = (NvOSD_ColorParams) {
1, 1, 1, 1};
nvds_add_obj_meta_to_frame(frame_meta, object_meta, NULL);
}
}