Please provide complete information as applicable to your setup.
**• Hardware Platform (Jetson / GPU)**Orin
• DeepStream Version 7.0
**• JetPack Version (valid for Jetson only)**6.0
I am trying to display a ploygon in deepstream-app using osd_sink_pad_buffer_probe.
The code is as follows. Multiple line will be displayed later. Now is plotting one line only.
No line is displayed. Where is mistake?
/* osd_sink_pad_buffer_probe will extract metadata received from OSD
* and update params for drawing rectangle, object information etc. */
static GstPadProbeReturn
osd_sink_pad_buffer_probe(GstPad *pad, GstPadProbeInfo *info,
gpointer u_data)
{
GstBuffer *buf = (GstBuffer *)info->data;
guint num_rects = 0;
NvDsObjectMeta *obj_meta = NULL;
NvDsMetaList *l_frame = NULL;
NvDsMetaList *l_obj = NULL;
NvDsDisplayMeta *display_meta = NULL;
gboolean is_first_object = TRUE;
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)
{
is_first_object = TRUE;
NvDsFrameMeta *frame_meta = (NvDsFrameMeta *)(l_frame->data);
display_meta = nvds_acquire_display_meta_from_pool(batch_meta);
NvOSD_LineParams *line_params = &display_meta->line_params[1];
line_params->x1 = 10;
line_params->y1 = 10;
line_params->x2 = 500;
line_params->y2 = 500;
line_params->line_width = 6;
line_params->line_color.red = 0.0;
line_params->line_color.green = 0.0;
line_params->line_color.blue = 1.0;
line_params->line_color.alpha = 1.0;
nvds_add_display_meta_to_frame(frame_meta, display_meta);
}
return GST_PAD_PROBE_OK;
}
The whole deepstream_app.c is attached. File extension .c is changed to .txt.
deepstream_app.txt (73.8 KB)
Because you only specified the coordinates of one line and did not specify the number of lines, please refer to the following code
NvOSD_LineParams *line_params = &display_meta->line_params[0];
line_params->x1 = 10;
line_params->y1 = 10;
line_params->x2 = 10;
line_params->y2 = 200;
line_params->line_width = 2;
line_params->line_color.red = 0.0;
line_params->line_color.green = 0.0;
line_params->line_color.blue = 1.0;
line_params->line_color.alpha = 1.0;
line_params = &display_meta->line_params[1];
line_params->x1 = 10;
line_params->y1 = 200;
line_params->x2 = 500;
line_params->y2 = 500;
line_params->line_width = 2;
line_params->line_color.red = 0.0;
line_params->line_color.green = 0.0;
line_params->line_color.blue = 1.0;
line_params->line_color.alpha = 1.0;
line_params = &display_meta->line_params[2];
line_params->x1 = 500;
line_params->y1 = 500;
line_params->x2 = 800;
line_params->y2 = 800;
line_params->line_width = 2;
line_params->line_color.red = 0.0;
line_params->line_color.green = 0.0;
line_params->line_color.blue = 1.0;
line_params->line_color.alpha = 1.0;
line_params = &display_meta->line_params[3];
line_params->x1 = 800;
line_params->y1 = 800;
line_params->x2 = 10;
line_params->y2 = 10;
line_params->line_width = 2;
line_params->line_color.red = 0.0;
line_params->line_color.green = 0.0;
line_params->line_color.blue = 1.0;
line_params->line_color.alpha = 1.0;
display_meta->num_lines = 4;
No need to add osd_sink_pad_buffer_probe by yourself, just modify the configuration file and specify active_source_index. The following code works well
diff --git a/samples/configs/deepstream-app/source2_1080p_dec_infer-resnet_demux_int8.txt b/samples/configs/deepstream-app/source2_1080p_dec_infer-resnet_demux_int8.txt
index b0a13fa..fdca8a8 100644
--- a/samples/configs/deepstream-app/source2_1080p_dec_infer-resnet_demux_int8.txt
+++ b/samples/configs/deepstream-app/source2_1080p_dec_infer-resnet_demux_int8.txt
@@ -15,6 +15,20 @@ enable-perf-measurement=1
perf-measurement-interval-sec=5
#gie-kitti-output-dir=streamscl
+[tiled-display]
+enable=1
+rows=1
+columns=1
+width=1920
+height=1080
+gpu-id=0
+#(0): nvbuf-mem-default - Default memory allocated, specific to particular platform
+#(1): nvbuf-mem-cuda-pinned - Allocate Pinned/Host cuda memory, applicable for Tesla
+#(2): nvbuf-mem-cuda-device - Allocate Device cuda memory, applicable for Tesla
+#(3): nvbuf-mem-cuda-unified - Allocate Unified cuda memory, applicable for Tesla
+#(4): nvbuf-mem-surface-array - Allocate Surface Array memory, applicable for Jetson
+nvbuf-memory-type=0
+
[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
@@ -29,7 +43,7 @@ gpu-id=0
cudadec-memtype=0
[source1]
-enable=1
+enable=0
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=3
uri=file://../../streams/sample_1080p_h264.mp4
@@ -62,7 +76,7 @@ source-id=0
[sink1]
#source1 output as filesink
-enable=1
+enable=0
type=3
#1=mp4 2=mkv
container=1
diff --git a/sources/apps/sample_apps/deepstream-app/deepstream_app_main.c b/sources/apps/sample_apps/deepstream-app/deepstream_app_main.c
index 1156cdd..059ee43 100644
--- a/sources/apps/sample_apps/deepstream-app/deepstream_app_main.c
+++ b/sources/apps/sample_apps/deepstream-app/deepstream_app_main.c
@@ -523,6 +523,51 @@ overlay_graphics (AppCtx * appCtx, GstBuffer * buf,
display_meta->text_params[0].text_bg_clr = (NvOSD_ColorParams) {
0, 0, 0, 1.0};
+ NvOSD_LineParams *line_params = &display_meta->line_params[0];
+ line_params->x1 = 10;
+ line_params->y1 = 10;
+ line_params->x2 = 10;
+ line_params->y2 = 200;
+ line_params->line_width = 2;
+ line_params->line_color.red = 0.0;
+ line_params->line_color.green = 0.0;
+ line_params->line_color.blue = 1.0;
+ line_params->line_color.alpha = 1.0;
+
+ line_params = &display_meta->line_params[1];
+ line_params->x1 = 10;
+ line_params->y1 = 200;
+ line_params->x2 = 500;
+ line_params->y2 = 500;
+ line_params->line_width = 2;
+ line_params->line_color.red = 0.0;
+ line_params->line_color.green = 0.0;
+ line_params->line_color.blue = 1.0;
+ line_params->line_color.alpha = 1.0;
+
+ line_params = &display_meta->line_params[2];
+ line_params->x1 = 500;
+ line_params->y1 = 500;
+ line_params->x2 = 800;
+ line_params->y2 = 800;
+ line_params->line_width = 2;
+ line_params->line_color.red = 0.0;
+ line_params->line_color.green = 0.0;
+ line_params->line_color.blue = 1.0;
+ line_params->line_color.alpha = 1.0;
+
+ line_params = &display_meta->line_params[3];
+ line_params->x1 = 800;
+ line_params->y1 = 800;
+ line_params->x2 = 10;
+ line_params->y2 = 10;
+ line_params->line_width = 2;
+ line_params->line_color.red = 0.0;
+ line_params->line_color.green = 0.0;
+ line_params->line_color.blue = 1.0;
+ line_params->line_color.alpha = 1.0;
+
+ display_meta->num_lines = 4;
if(nvds_enable_latency_measurement) {
g_mutex_lock (&appCtx->latency_lock);
@@ -654,7 +699,7 @@ main (int argc, char *argv[])
appCtx[i]->person_class_id = -1;
appCtx[i]->car_class_id = -1;
appCtx[i]->index = i;
- appCtx[i]->active_source_index = -1;
+ appCtx[i]->active_source_index = 0;
if (show_bbox_text) {
appCtx[i]->show_bbox_text = TRUE;
}
@@ -682,6 +727,7 @@ main (int argc, char *argv[])
}
for (i = 0; i < num_instances; i++) {
+ printf("create pipeline \n");
if (!create_pipeline (appCtx[i], NULL,
all_bbox_generated, perf_cb, overlay_graphics)) {
NVGSTDS_ERR_MSG_V ("Failed to create pipeline");
2.If you need to add a probe function yourself, please make sure your code is actually executed. This requires modifying the configuration file. Please debug it yourself
[tiled-display]
enable=2
[sink0]
link-to-demux=1
system
Closed
January 24, 2025, 9:36am
6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.