Populate NvBufSurface from cv::Mat

Please note the buffer I created is named inf_buf, not in_buf. I’m not trying to alter this last one.

What I want, I guess thats the way to achieve what I’m seeking for, is to change

GstInferFrame frame;
frame.converted_frame_ptr = memory->frame_memory_ptrs[idx];
frame.scale_ratio_x = scale_ratio_x;
frame.scale_ratio_y = scale_ratio_y;
frame.obj_meta = (nvinfer->classifier_async_mode) ? nullptr : object_meta;
frame.frame_meta = frame_meta;
frame.frame_num = frame_num;
frame.batch_index = frame_meta->batch_id;
frame.history = obj_history;
frame.input_surf_params = (nvinfer->classifier_async_mode)
							? nullptr
							: (in_surf->surfaceList + frame_meta->batch_id);
batch->frames.push_back(frame);

to take the buffer from cv::Mat mat with additional adapted meta data, so that the buffer lying in mat is used for inference and not the buffer in in_buf and the tensor created from the inference is attached to the original object_meta.

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.

As far as I read and understood the cropping and resizing is not capable of the affine transformation I want to apply to the bbox as you can find in the linked thread.