How can I get GstNvDsOsd in deepstream-test5

• Hardware Platform (Jetson / GPU): Jetson
• DeepStream Version:5.1
• JetPack Version (valid for Jetson only):4.5

Hi. how can I handle GstNvDsOsd in deepstream-test5? becauseI want to chage analytic roi line color through GstNvDsOsd (which is defined in sources/gst-plugins/gst-nvdsosd/gstnvdsosd.h )

PS: I tried change roi line color through NvDsDisplayMeta
(got from nvds_acquire_display_meta_from_pool() ), but it can’t handle the roi line color, because when I handle display_meta->line_params, it draw new lines.
I found the roi line information should be handled by GstNvDsOsd, can you tell me how to handle GstNvDsOsd in test5?

struct _GstNvDsOsd
{
  /** Should be the first member when extending from GstBaseTransform. */
  GstBaseTransform parent_instance;

  /* Width of buffer. */
  gint width;
  /* Height of buffer. */
  gint height;

  /** Pointer to the nvdsosd context. */
  void *nvdsosd_context;
  /** Enum indicating how the objects are drawn,
      i.e., CPU, GPU or VIC (for Jetson only). */
  NvOSD_Mode nvdsosd_mode;

  /** Boolean value indicating whether clock is enabled. */
  gboolean show_clock;
  /** Structure containing text params for clock. */
  NvOSD_TextParams clock_text_params;

  /** List of strings to be drawn. */
  NvOSD_TextParams *text_params;
  /** List of rectangles to be drawn. */
  NvOSD_RectParams *rect_params;
  /** List of rectangles for segment masks to be drawn. */
  NvOSD_RectParams *mask_rect_params;
  /** List of segment masks to be drawn. */
  NvOSD_MaskParams *mask_params;
  /** List of lines to be drawn. */
  NvOSD_LineParams *line_params;
  /** List of arrows to be drawn. */
  NvOSD_ArrowParams *arrow_params;
  /** List of circles to be drawn. */
  NvOSD_CircleParams *circle_params;

  /** Number of rectangles to be drawn for a frame. */
  guint num_rect;
  /** Number of segment masks to be drawn for a frame. */
  guint num_segments;
  /** Number of strings to be drawn for a frame. */
  guint num_strings;
  /** Number of lines to be drawn for a frame. */
  guint num_lines;
  /** Number of arrows to be drawn for a frame. */
  guint num_arrows;
  /** Number of circles to be drawn for a frame. */
  guint num_circles;

  /** Structure containing details of rectangles to be drawn for a frame. */
  NvOSD_FrameRectParams *frame_rect_params;
  /** Structure containing details of segment masks to be drawn for a frame. */
  NvOSD_FrameSegmentMaskParams *frame_mask_params;
  /** Structure containing details of text to be overlayed for a frame. */
  NvOSD_FrameTextParams *frame_text_params;
  /** Structure containing details of lines to be drawn for a frame. */
  NvOSD_FrameLineParams *frame_line_params;
  /** Structure containing details of arrows to be drawn for a frame. */
  NvOSD_FrameArrowParams *frame_arrow_params;
  /** Structure containing details of circles to be drawn for a frame. */
  NvOSD_FrameCircleParams *frame_circle_params;

  /** Font of the text to be displayed. */
  gchar *font;
  /** Color of the clock, if enabled. */
  guint clock_color;
  /** Font size of the clock, if enabled. */
  guint clock_font_size;
  /** Border width of object. */
  guint border_width;
  /** Integer indicating the frame number. */
  guint frame_num;
  /** Boolean indicating whether text is to be drawn. */
  gboolean draw_text;
  /** Boolean indicating whether bounding is to be drawn. */
  gboolean draw_bbox;
  /** Boolean indicating whether instance mask is to be drawn. */
  gboolean draw_mask;
  /**Array containing color info for blending */
  NvOSD_Color_info color_info[MAX_BG_CLR];
  /** Boolean indicating whether hw-blend-color-attr is set. */
  gboolean hw_blend;
  /** Integer indicating number of detected classes. */
  int num_class_entries;
  /** Integer indicating gpu id to be used. */
  guint gpu_id;
  /** Pointer to the converted buffer. */
  void *conv_buf;
};

You can get from NvDsFrameMeta fileds display_meta_list, by adding probe function on osd sink pad, iterate each frame metadata, get the display meta list, iterate each of them, then you can get the line params to modify.
https://docs.nvidia.com/metropolis/deepstream/sdk-api/Meta/_NvDsFrameMeta.html

problem solved, thanks!
by the way, what is the difference between display_meta in NvDsFrameMeta and display_meta got from nvds_acquire_display_meta_from_pool() ?
it seems nvds_acquire_display_meta_from_pool() is used to add custom display info

nvds_acquire_display_meta_from_pool()
will create one new display meta for you.

Hi I meet another problem when I try to change roi line color.

as the line_params is a list, How can I get the lines corresponding to one roi area?

such as, I got 3 rois in one frame, every roi has different number of lines , when I want to change the second roi, how can get the lines in line_params ? Is there any param to note this corresponding relation

We do not have this corresponding relation.

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