DeepStream 5.0, best way to surround and object's rectangle with color?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version

I’m trying to highlight a single object by adding an opaque color to the entire frame except for the object of interest.

I’ve been able to achieve the desired effect by adding 4 rectangles to the frame surrounding the object.

This little trick fails to work well, however, if scaling the stream before the on-screen display, …using a Tiler for example… with intermittent frames showing

I’m hoping there is a better, more appropriate way?


Let me know if tuning following parameters of object of interest directly can meet your requirement

rect_params->has_bg_color = 1;
rect_params-> = 0.8;
rect_params-> = 0.2;
rect_params-> = 0.2;
rect_params->bg_color.alpha = 0.9;

Thanks @bcao, I’m also capturing/converting the object within the bounding box to a jpeg image on demand, so I really need to have the object highlighted without altering its image. I was hoping there might be a way to achieve the affect above… perhaps using open-CV or something similar.

You can use opencv to download the image, and also you can refer deepstream_image_meta_test.c.
For highlight the object, not sure if you can try above code, I think you can tune the alpha parameter to see the result.

@bcao, I have the image capture and download all working, and I have lots of working examples of shading/highlighting objects directly…

I was really looking for a solution to what I’ve accomplished with the four added rectangles… to where it looks exactly like the first picture in the post…

Highlighting an object by darkening everything else seems like a very common practice in videos… by the media when highlighting individuals in a crowd for example,

If you’re not aware of another way, then we can close this… and thanks for the suggestions…