Something wrong with alpha parameter background color of rect_params

Hi,

When I set rect_params->bg_color.alpha to anything other than 1.0 or 0.0 I get the following error:

NvOsd ERR----line = 430 -2

I saw in the documentation that https://docs.nvidia.com/jetson/archives/l4t-multimedia-archived/l4t-multimedia-271/group__ee__nvosd__group.html#ga2c9a8f3383fd6f59163c1f9a25643ac6 Nv_OSD_Mode does not take alpha parameter into account when it is set to MODE_HW, can this be the issue? I also noticed a method “nvosd_draw_rectangles”, but I cannot find it anywhere in the Deepstream code.

Hope you can help me.

HI
Check this header file, /opt/nvidia/deepstream/deepstream-4.0/sources/includes/nvll_osd_struct.h
from deepstream package,

typedef enum {
MODE_CPU, /< Selects CPU for OSD processing.
Works with RGBA data only */
MODE_GPU, /
< Selects GPU for OSD processing.
Yet to be implemented */
MODE_HW /**< Selects NV HW engine for rectangle draw and mask.
This mode works with both YUV and RGB data.
It does not consider alpha parameter.
Not applicable for drawing text. */
} NvOSD_Mode;

so you mentioned about “Nv_OSD_Mode does not take alpha parameter into account when it is set to MODE_HW”
it’s not a issue.

about you mentioned " “nvosd_draw_rectangles”, but I cannot find it anywhere in the Deepstream code."
OSD is not open sourced.

Hi Amycao,

I indeed found the header file, how should I resolve the issue I’m getting? Why does it error?

double alpha; /**< Holds alpha component of color.
Value must be in the range 0-1.*/

please make sure the value you set is within 0-1

I set it as 0.5, I’m having the same problem as these threads, but I was asked to open a new topic. https://devtalk.nvidia.com/default/topic/1062913/deepstream-sdk/-jetson-nano-bbox-bg-color-property-problem-in-deepstream-config-file/
https://devtalk.nvidia.com/default/topic/1062304/deepstream-sdk/something-wrong-with-background-color-of-rect_params/

We are checking internally, will get back to you

HI,
You are using Jetson platform from your description, right? if it’s the case, OSD plugin set NvOSD_Mode as MODE_HW, that’s why you get the error.

MODE_HW /**< Selects NV HW engine for rectangle draw and mask.
This mode works with both YUV and RGB data.
It does not consider alpha parameter.

–>> need to confirm, checking internally.

yes.

Hi,

Yes, indeed I’m using Jetson Nano. How can I change nvosd_mode?

Need to confirm the OSD mode by default, checking internally, will get back to you.

–>> by default, it use MODE_HW

In the next release we have support for HW blending, which should solve the issue you are facing,
In the deepstream-app config file you can change process-mode to CPU mode, blending will work,
0 is CPU and 2 is HW (VIC)

Hi,

Thank you for your help so far. I’ve added a config file with contents

[osd]
process-mode=0

And running it with ‘./vision -c config.txt’ but I’m still getting the same error message. It seems the config is not taken into consideration.

–>> seems you are using your customized code from your description, suggest you verify with deepstream-app first, and refer to the sample for how to use process-mode, the code for process-mode here,
sources/apps/apps-common/src/deepstream_config_file_parser.c: parse_osd

From the parser I find that the ‘mode’ is added to the config, but it’s not anywhere in deepstream_app.c from the example apps, I can only see a ‘create_osd_bin’ if I see what this contains ./sources/apps/apps-common/src/deepstream_osd_bin.c, it just adds the properties to the element.

g_object_set (G_OBJECT (bin->nvosd), "display-clock", config->enable_clock,
      "clock-font", config->font, "x-clock-offset", config->clock_x_offset,
      "y-clock-offset", config->clock_y_offset, "clock-color", clk_color,
      "clock-font-size", config->clock_text_size, "process-mode", config->mode, NULL);

So I added it to the element as such, but the error still remains.

nvosd = gst_element_factory_make ("nvdsosd", "nv-onscreendisplay");
g_object_set (G_OBJECT(nvosd), "process-mode", 0, NULL);

You also need to check this, sources/apps/apps-common/src/deepstream_config_file_parser.c: parse_osd

Yes I did, that’s what I meant with ‘parser’. In the parse_osd function, mode is set, but not used in deepstream_app.c, only in deepstream_osd_bin.c where it’s just added to the element.

I did that, but the error remains. I’ll keep digging.