How to add preprocess between a detector and a classifier in deepstream?

I am developing a demo using deepstream 4.0. The pipeline consists of a detector and a classifier. The detector works fine. bboxes are correctly drawed on the video. But my classification model needs some custom preprocess, like resize and crop. I just don’t know where to add resize and crop operation.Please help.

For example, resolution of the input video is 1920x1080. A detected bbox is {left:1166,top:155,width:85,height:179}. I want to resize the bbox to 256x256 and then crop to 224x224.224x224 is the size of input tensor of my classifier. Any idea how to implement these?

preprocess doc:

It supports resize, but does not support crop now.

You can try to modify detector bbox result in “attach_metadata_detector”

left = 1166 * (224/256)