How to crop one image to four images in deepstream

  1. I want to use deepstream to inference rtsp video stream. First decode h264 stream, crop one image to four images on gpu/dla (example input video resolution 1280x1024, crop and resize four image(640x640)), then inference model that has 4 batct size, encode four h264 stream with 640x640 resolution.
  2. I serach some resolution in Forums. Maybe the gstreamer plugins named Gst-nvvideoconvert implement by nvidia is one choice. I read the doc DeepStream SDK Development Guide ( The element just support crop one image. But I want to crop four images and resize the cropped image to 640x640, How to implement??

We currently do not have a ready-made implementation plugin. You can consider implementing the following solution yourself. Please refer to the preprocess plugin, and implement the function in this plugin yourself.

  1. The Deepstream is implemented in the Gstreamer. If I refer to the deepstream-app implementation and use the deepstream and gstreamer APIs to implement it directly instead of in plugin, is this easier to implement, such as calling cuda-cv or opencv using cuda in the deepstream-app ?
  2. I am run the deepstream-app in jetson agx orin developer kit

You can try to build the following pipeline

uridecodebin --> tee --> |--> nvvideoconvert(crop 0) -->|--> streammux (batchsize == 4)
                         |--> nvvideoconvert(crop 1) -->|
                         |--> nvvideoconvert(crop 2) -->|
                         |--> nvvideoconvert(crop 3) -->|

OK, that‘s is gstreamer usage. Could the nvvideoconvert element use gpu/dlc/vic ? My platform is nvidia jetson agx orin DK.

Both gpu and vic are supported, depending on the configuration.

 gst-inspect-1.0 nvvideoconvert

  compute-hw          : Compute Scaling HW
                        flags: readable, writable, controllable
                        Enum "GstNvComputeHWType" Default: 0, "Default"
                           (0): Default          - Default, GPU for Tesla, VIC for Jetson
                           (1): GPU              - GPU
                           (2): VIC              - VIC

thks, @junshengy

  1. crop one image to four images, Is the function that resizes the image for inference in gst-nvinfer plugin ?
  2. postprocess the batch images, Can it be encoded as an independent four channel H264 stream and then pushed out using Deepstream ?
  3. Is there sample that configures this plugins like deepstream-app ?

There is no update from you for a period, assuming this is not an issue anymore.
Hence we are closing this topic. If need further support, please open a new one.

When Images are built as batches via nvstreammux, they will be scaled to the size in the configuration file.

Yes, just like

                           | --> nvvideoconvert --> nvv4l2h264enc --> rtspsink
nvinfer --> nvstreamdemux  | --> nvvideoconvert --> nvv4l2h264enc --> rtspsink
                           | --> nvvideoconvert --> nvv4l2h264enc --> rtspsink
                           | --> nvvideoconvert --> nvv4l2h264enc --> rtspsink

No, I’m afraid I need you to modify deepstream-app yourself to achieve your goal

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.