How to costumize lines on the frame

Hi everyone,

jetson-nano
deepstream5.1

I’m trying to draw lines on the frame of the result from my opencv, using [gst-dsexample] of the gst-plugins specifying it
in my config txt file like :

[ds-example]
enable=1
processing-width=640
processing-height=480
full-frame=1
unique-id=15
gpu-id=0

and the code gstdsexample.cpp in the ds-example.

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);
}
}

I see the lines drawed in the frame but I cannot edit them, even so I modified the coordinates, restarting the deepstream module and verifying that the changes were saved correctly, the lines did not move nor did it allow me to customize them. How can I modify these lines so that they are like the lines in blue in the image, which is basically the polygon that I want to draw?

Thanks!

Regards,
Yusef

Hi,
The line you drawed are just two lines, you need to draw another two lines to draw polygon. the coordinates you set is constant, how did it move?