How to Draw points or circle on frame nvosd

Setup:

• Hardware Platform (Jetson / GPU) GPU
• DeepStream Version 5.1
• TensorRT Version 7.2.3
• NVIDIA GPU Driver Version (valid for GPU only) 455

I have a list of points Points : [[538.0, 806.0], [537.0, 268.0]] after processing the BBox info at frame_level in nvosd_probe.
I want to draw the circles/ points corresponding to those points.

@kayccc @Morganh

We do not have function to draw points, but you can draw line to limit the line length to simulate the points? below for draw two lines:
//how to get batch_meta you can refer test1 sample function osd_sink_pad_buffer_probe
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};

draw circle:
display_meta = nvds_acquire_display_meta_from_pool (batch_meta);
NvOSD_CircleParams *circle_params = display_meta->circle_params;
for ( int j=0; j < 1; j++ )
{
circle_params[j].xc = (int)obj.left;
circle_params[j].yc = (int)obj.top;
circle_params[j].radius = (int)obj.width / 2;
circle_params[j].circle_color = (NvOSD_ColorParams){0.0, 1.0, 0.0, 1.0};
display_meta->num_circles ++;
g_print(“xc = %d, yc = %d, xc-radius = %d, yc - radius = %d, radius = %d\n”, (int)obj.left, (int)obj.top, (int)obj.left - (int)obj.width / 2, (int)obj.top - (int)obj.width / 2, (int)obj.width / 2);
}
nvds_add_display_meta_to_frame (frame_meta, display_meta);

1 Like