Arrow_params quantity limit

**• Hardware Platform (GPU) RTX 3060
**• DeepStream Version 6.3
• TensorRT Version
**• NVIDIA GPU Driver Version (valid for GPU only) CUDA12.0
• Issue Type (questions)

I used NvOSD_ArrowParams *arrow_params = display_meta->arrow_params; to draw arrows, but I found that I can only draw a maximum of 4 arrows. Is there a limit to the number of arrows that can be drawn? If I use regular lines or circles, they can be drawn normally.

In theory, one display meta can draw 16 elements. Then you can acquire a new display meta to draw more. Could you attach your source code?

Whenever I set more than four arrow_params, only a maximum of four will be displayed.

static gboolean
overlay_graphics(AppCtx *appCtx, GstBuffer *buf,
                 NvDsBatchMeta *batch_meta, guint index)
{
  int srcIndex = appCtx->active_source_index;
  if (srcIndex == -1)
    return TRUE;

  NvDsFrameLatencyInfo *latency_info = NULL;
  NvDsDisplayMeta *display_meta =
      nvds_acquire_display_meta_from_pool(batch_meta);

  display_meta->num_labels = 1;
  display_meta->text_params[0].display_text = g_strdup_printf("Source: %s",
                                                              appCtx->config.multi_source_config[srcIndex].uri);

  display_meta->text_params[0].y_offset = 20;
  display_meta->text_params[0].x_offset = 20;
  display_meta->text_params[0].font_params.font_color = (NvOSD_ColorParams){
      0, 1, 0, 1};
  display_meta->text_params[0].font_params.font_size =
      appCtx->config.osd_config.text_size * 1;
  display_meta->text_params[0].font_params.font_name = "Serif";
  display_meta->text_params[0].set_bg_clr = 1;
  display_meta->text_params[0].text_bg_clr = (NvOSD_ColorParams){
      0, 0, 0, 0.5};

  int i = 0;
  NvOSD_LineParams *line_params = display_meta->line_params;
  NvOSD_ArrowParams *arrow_params = display_meta->arrow_params;

  cv::Point points[] = {
      {0, 0}, {100, 100}, {200, 200}, {300, 300}, {400, 400}, {500, 500}, {600, 600}, {700, 700}, {800, 800}, {900, 900}, {900, 900}, {1000, 800}};

  NvOSD_ColorParams arrow_color = {1.0, 1.0, 0.0, 1.0};
  int arrow_width = 1;

  for (int j = 0; j < 12; j += 2)
  {
    arrow_params[i].x1 = points[j].x;
    arrow_params[i].y1 = points[j].y;
    arrow_params[i].x2 = points[j + 1].x;
    arrow_params[i].y2 = points[j + 1].y;
    arrow_params[i].arrow_width = arrow_width;
    arrow_params[i].arrow_color = arrow_color;
    arrow_params[i].arrow_head = END_HEAD;
    display_meta->num_arrows++;
    i++;
  }

  if (nvds_enable_latency_measurement)
  {
    g_mutex_lock(&appCtx->latency_lock);
    latency_info = &appCtx->latency_info[index];
    display_meta->num_labels++;
    display_meta->text_params[1].display_text = g_strdup_printf("Latency: %lf",
                                                                latency_info->latency);
    g_mutex_unlock(&appCtx->latency_lock);

    display_meta->text_params[1].y_offset = (display_meta->text_params[0].y_offset * 2) +
                                            display_meta->text_params[0].font_params.font_size;
    display_meta->text_params[1].x_offset = 20;
    display_meta->text_params[1].font_params.font_color = (NvOSD_ColorParams){
        0, 1, 0, 1};
    display_meta->text_params[1].font_params.font_size =
        appCtx->config.osd_config.text_size * 1.5;
    display_meta->text_params[1].font_params.font_name = "Arial";
    display_meta->text_params[1].set_bg_clr = 1;
    display_meta->text_params[1].text_bg_clr = (NvOSD_ColorParams){
        0, 0, 0, 1.0};
  }

  nvds_add_display_meta_to_frame(nvds_get_nth_frame_meta(batch_meta->frame_meta_list, 0), display_meta);
  return TRUE;
}

I have tried that with our deepstream-test1, it can draw more that 4 arrows. You can try that first.
Just for test: (add the patch below in the osd_sink_pad_buffer_probe for deepstream_test1_app.c)

        display_meta->num_arrows = 0;
        NvOSD_ColorParams arrow_color = {1.0, 0.0, 0.0, 1.0};
        int arrow_width = 3;

        for (int j = 0; j < 30; j++)
        {
            j++;
            display_meta->arrow_params[display_meta->num_arrows].x1 = (j+1)*20;
            display_meta->arrow_params[display_meta->num_arrows].y1 = (j+1)*20;
            display_meta->arrow_params[display_meta->num_arrows].x2 = (j+2)*20;
            display_meta->arrow_params[display_meta->num_arrows].y2 = (j+2)*20;
            display_meta->arrow_params[display_meta->num_arrows].arrow_width = arrow_width;
            display_meta->arrow_params[display_meta->num_arrows].arrow_color = arrow_color;
            display_meta->arrow_params[display_meta->num_arrows].arrow_head = END_HEAD;
            display_meta->num_arrows++;
        }

I tested your program, and it works. Thank you for your help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.