Populate NvBufSurface from cv::Mat

nvinfer has already implemented bbox cropping and resize, you don’t need to add the same function in this place, it will mess the flow. Please don’t touch ‘in_buf’ since you only want to do preprocessing for inference.

The crop and resize happens inside convert_batch_and_push_to_input_thread(), and please read the code carefully to make sure you know the correct data flow.

Currently we don’t have sample for how to add new pre-process in nvinfer, only a simple introduction of nvinfer flow. DeepStream SDK FAQ - Intelligent Video Analytics / DeepStream SDK - NVIDIA Developer Forums