Drawing mask in deepstream-app

I like to draw mask on image in Deepstream.
I am using deepstream-app.
Initially gst-dsexample was used together with opencv and plot mask.
opencv has memory leak in Deepstream.

So I was thinking to use the following api to draw mask on image.


Who can successfully draw mask using the api?
May I have sample?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

Thanks this is setup infos.
• Hardware Platform (Jetson / GPU)
• DeepStream Version
5.1 (latest)
• JetPack Version (valid for Jetson only)
R32 (release), REVISION: 4.3, GCID: 21589087, BOARD: t186ref, EABI: aarch64, DATE: Fri Jun 26 04:34:27 UTC 2020
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)

I am exploring to add mask params. According to _NvOSD_MaskParams Struct Reference.

float * data inside the struct represents the whole mask area in image or just contour of mask?

_NvOSD_MaskParams a;

If push back custom maskparam to object_meta->mask_params, NvOSD can plot mask on image, right?

Any suggestion for this? please