image overlay

Hi team,

How can we add image overlay? example logo?

any code samples?

For more information, you would like to put a logo in JPG/PNG( such as ) on top-left( or other position ) of the screen?

Hi Dane,

Logo yes, also in our case, we detect a red car, etc, we would like to display on the screen.

The nvosd plugin should be able to mark detected red car in rectangle. Is it not good in your usecase?

we need to crop the image and display it on the live screen.

but if you can provide an example of image overlay, we will figure out rest.

There is no existing implementation for this. We suggest you use NvBufSurface APIs. The APIs offer complete access to the buffers. Please check


There is examples of using the APIs in dsexample. Also 2, 5 in FAQ. 2 is a sample of cropping the objects and saving into JPGs. For instant display, maybe you can try to replace cv::imwrite() with cv2.imgshow().

This too

NvBufSurfTransformComposite() can be called to composite a logo on video frames.

You can call cv::imread() to decode JPG/PNG, and put it into a NvBufSurface buffer.

//create a NvBufSurface buffer
// get CPU pointer
cv::Mat source = cv::imread();
/* copy cv::Mat source to the NvBufSurface */

Configure NvBufSurfTransformCompositeParams and call NvBufSurfTransformComposite().