Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU) Orin nano
• DeepStream Version 6.3
This time is for c program.
I tried to display rectangle on image in deepstream-app.
But it doesn’t display.
My code is as follows.
static void
write_kitti_output (AppCtx * appCtx, NvDsBatchMeta * batch_meta)
{
gchar bbox_file[1024] = { 0 };
FILE *bbox_params_dump_file = NULL;
//if (!appCtx->config.bbox_dir_path)
// return;
for (NvDsMetaList * l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next) {
NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) l_frame->data;
g_print("test print here\n");
NvDsDisplayMeta *disp_meta = nvds_acquire_display_meta_from_pool(batch_meta);
disp_meta->rect_params[0].left = 50;
disp_meta->rect_params[0].top = 50;
disp_meta->rect_params[0].width = 1000;
disp_meta->rect_params[0].height = 500;
disp_meta->rect_params[0].border_width = 2;
disp_meta->rect_params[0].border_color.red = 1.0;
disp_meta->rect_params[disp_meta->num_rects].border_color.green = 1.0;
disp_meta->rect_params[disp_meta->num_rects].border_color.blue = 0.0;
disp_meta->rect_params[disp_meta->num_rects].border_color.alpha = 0.5;
nvds_add_display_meta_to_frame (frame_meta, disp_meta);
}
}
Why a rectangle doesn’t display on image?
NvDsDisplayMeta *disp_meta = nvds_acquire_display_meta_from_pool(batch_meta);
disp_meta->num_rects = 1;
disp_meta->rect_params[0].left = 50;
In addition, we usually recommend adding displaymeta
to the osd sink pad probe function to avoid being dropped during metadata copy.
As suggested I am adding osd_sink_pad_buffer_probe
to deepstream_app.c. Implementation in deepstream_test1_app
is straightforward. All elements are added one by one. But in deepstream_app.c
is different.
Added the osd_sink_pad_buffer_probe
to deepstream_app.c
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;
guint vehicle_count = 0;
guint person_count = 0;
NvDsMetaList * l_frame = NULL;
NvDsMetaList * l_obj = NULL;
NvDsDisplayMeta *display_meta = 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);
nvds_add_display_meta_to_frame(frame_meta, display_meta);
}
return GST_PAD_PROBE_OK;
}
Then added
GstPad *osd_sink_pad = gst_element_get_static_pad (nvosd, "sink");
if (!osd_sink_pad)
g_print ("Unable to get sink pad\n");
else
gst_pad_add_probe (osd_sink_pad, GST_PAD_PROBE_TYPE_BUFFER,
osd_sink_pad_buffer_probe, NULL, NULL);
gst_object_unref (osd_sink_pad);
to static
gboolean
create_processing_instance (AppCtx * appCtx, guint index)
But I don’t have nvosd
made in deepstream_app.c
. How can I add osd probe in deepstream_app.c.
Refer to the overlay_graphics
functions in /opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-app/deepstream_app_main.c
system
Closed
September 11, 2024, 6:28am
6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.