How does secondary GIE crop and resize objects?

SGIE will crop the object from NvStreamMux buffer using the object’s bbox detected by the Primary GIE.

The crop is then scaled/converted to the network resolution/color format.

For example, if the NvStreamMux resolution is 1920x1080, SGIE will crop using object bbox co-ordinates

(e.g. x=1000, y=20, w=400, y=500) from the 1920x1080 image and then scale it to the SGIE network resolution (say 224x224).

In practice, the object crop + scaling + color conversion happens in one go.

 

How to save frames from GstBuffer?

To save frames from gst buffer you need to Map gst buffer using gst_buffer_map () API.

Here is the pseudo code:

GstMapInfo in_map_info;
NvBufSurface *surface = NULL;

memset(&in_map_info, 0, sizeof(in_map_info));
if (!gst_buffer_map(inbuf, &in_map_info, GST_MAP_READ)) {
    g_print ("Error: Failed to map gst buffer\n");
}
surface = (NvBufSurface*)in_map_info.data;

Now that you have access to NvBufSurface structure, you can access actual frame memory and save it.

At the end you need to unmap gst buffer using gst_buffer_unmap (inbuf, &in_map_info)

For more details, see gst_dsexample_transform_ip() in gst-dsexample plugin source code.

 

 

 

 

 

'C, C++ > DeepStream' 카테고리의 다른 글

Install DeepStream 6.1.1 on WSL2  (0) 2022.11.08

+ Recent posts