Image preprocessing before nvinfer

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)
This is a continue topic on: Preprocessing between pgie and sgie
Is there a method to preprocess the image before pgie or sgie?
There’re some methods to do some simple preprocessing on network layer, such as normalization or transpose. But how can I do some more complex processes, which I need to process on image directly?
I found a link might help: Deepstream sample code snippet, but I didn’t quite understand the surface & opencv part and how does a image transferred between gstbuffer.

The way we did it was creating a custom GStreamer element based on GstVideoFilter that performs the custom operations in transform_frame_ip. We pass the element a custom library (.so) using a property, so the same element can be used for different operations.

@kobe2410811

I think you need to implement a GST plugin if you need a single component that can handle all transforms needed in preprocessing, for example, resize (keeping aspect ratio or not keeping), normalization, reshape or any other special transforms all together.

You can read this document if you don’t have a clear idea of how to create a GST plugin by yourself.
https://docs.nvidia.com/metropolis/deepstream/dev-guide/index.html#page/DeepStream_Development_Guide/deepstream_custom_plugin.html