Deepstream save image with bounding box


I’m using deepstream-test5-app. I enable dsexample plugin to save frames to file using this method

But it seems to save only original frame without bounding boxes. How to save frame with bounding boxes instead?

deepstream-test5-app is based on deepstream-app and you can check the architecture.
When you enable dsexample, it links like:

... ! nvinfer ! dsexample ! nvtracker ! ...

If you needs to have bounding boxes, you have to check the source code and customize it into

... ! nvdsosd ! dsexample ! nveglglessink

@DaneLLL thanks very much for helping.
Actually I want to draw bounding box on frames only when I need to. So far I use msgconv and msgbroker to send metadata to kafka, which has some unique key value like uuid or timestamp.
Is there any method to match uuid or timestamp with frames in dsexample? If so, I can draw bounding boxes by third party program .

I can access frame_meta->ntp_timestamp in dsexample, but it’s always 0. When will them frame meta get timestamp in the pipeline?

We have a new sample in DS5.0:


It is close to your usecase. Please take a look.

Can you suggest how to save the complete frame with bounding boxes instead of cropped objects. I am able to run deepstream-image-meta-test and generate the cropped images.

1 Like


You may add prob function in source pad of nvdsosd plugin. The buffer is in RGBA format and you can simply map it to cv::Mat.

Sample code of saving full frame:

For your usecase, you may ignore NV12 to RGBA conversion.

Thanks. Can you please high level steps so that I can give it a try. I am not sure where to put this code. Appreciate your help.


There is a prob function in source pad of nvdsanalytics. In first step, you can duplicate it to source pad of nvdsosd.