DeepStream: Draw Line Issues

Hello, NVIDIA developers,
I want to ask about drawing line in deepstream.

Here is my code to draw line and rectange:

#if 1
NvOSD_LineParams *line_params = display_meta->line_params;
line_params[0].x1 = 100;//for demonstration, user need to se these values
line_params[0].y1 = 100;
line_params[0].x2 = 100;
line_params[0].y2 = 300;
line_params[0].line_width = 3;
line_params[0].line_color = (NvOSD_ColorParams){1.0, 0.0, 0.0, 1.0};
display_meta->num_lines++;
#endif
NvOSD_RectParams *rect_params = display_meta->rect_params;
rect_params[0].left = 300;
rect_params[0].top = 300;
rect_params[0].width = 100;
rect_params[0].height = 100;
rect_params[0].border_width = 3;
rect_params[0].border_color = (NvOSD_ColorParams){1.0, 0.0, 0.0, 1.0};
display_meta->num_rects++;
nvds_add_display_meta_to_frame(nvds_get_nth_frame_meta (batch_meta->frame_meta_list, 0), display_meta);

And the drawn rectangle was fine but the line look strange. I attached the pictures. Please take a look and help me to solve this issue.

ThanksSelection_002

Hi,
I can not repro your issue, can you specify how can I repro your issue?

Above output is from x86 platform, which platform you met the flicker issue? if it’s on Jetson device, then it is a known issue and fix will be avaialble in the upcoming release.

Dear Mr. AmyCao
Sorry for late reply because of private issues.

I ran the experiment on Jetson Nano. The following code is probe callback function:

static GstPadProbeReturn osd_sink_pad_buffer_probe(GstPad* pad, GstPadProbeInfo* info, gpointer user_data)
{
GstBuffer* buf = (GstBuffer*)info->data;
NvDsObjectMeta* obj_meta = nullptr;
NvDsDisplayMeta* display_meta = nullptr;
GstMapInfo in_map_info;
NvBufSurface* surface = nullptr;
NvDsBatchMeta* batch_meta = gst_buffer_get_nvds_batch_meta(buf);
display_meta = nvds_acquire_display_meta_from_pool (batch_meta);

    auto _analyzer = (Analyze*)user_data;
    std::vector<uint64_t> current_obj_ids;

    memset(&in_map_info, 0, sizeof(in_map_info));
    gst_buffer_map(buf, &in_map_info, GST_MAP_READWRITE);
    surface = (NvBufSurface*) in_map_info.data;
    NvBufSurfaceMap(surface, -1, -1, NVBUF_MAP_READ_WRITE);
    NvBufSurfaceSyncForCpu(surface, -1, -1);
    int txt_index = 0;

    for(NvDsMetaList* frame = batch_meta->frame_meta_list; frame != nullptr; frame = frame->next)
    {
            NvDsFrameMeta* frame_meta = (NvDsFrameMeta*)(frame->data);
            // int offset = 0;
            gint frame_width = (gint)surface->surfaceList[frame_meta->batch_id].width;
            gint frame_height = (gint)surface->surfaceList[frame_meta->batch_id].height;
            void* frame_data = surface->surfaceList[frame_meta->batch_id].mappedAddr.addr[0];
            size_t frame_step = surface->surfaceList[frame_meta->batch_id].pitch;

            cv::Mat _frame = cv::Mat(frame_height, frame_width, CV_8UC4, frame_data, frame_step);

            for (NvDsMetaList* obj = frame_meta->obj_meta_list; obj != nullptr; obj = obj->next)
            {
                    obj_meta = (NvDsObjectMeta*)(obj->data);
                    NvOSD_RectParams rect = obj_meta->rect_params;
                    obj_meta->rect_params.border_color = (NvOSD_ColorParams){0, 1, 0, 1};

Is this issue resolved in DeepStream 5.0 ?

Hi hkada,

If you still met issue at DS5.0.1, please help to open a new topic, thanks.