Save tiled "videowall" to numpy array np / cv.mat

• Hardware Platform (Jetson )
• DeepStream Version 5.0
• JetPack Version (4.5)
• TensorRT Version 7.1.3

• Issue Type( questions)

I am wondering if there is a method to save the entire tiled output from deepstream to a numpy array / opencv mat.

I know in the multistream example we “pyds.get_nvds_buf_surface”

n_frame = pyds.get_nvds_buf_surface(hash(gst_buffer), frame_meta.batch_id)
# convert python array into numy array format.
frame_image = np.array(n_frame, copy=True, order='C')
# covert the array into cv2 default color format
frame_image = cv2.cvtColor(frame_image, cv2.COLOR_RGBA2BGRA)

Is there maybe another function like this for furtherdown the pipeline?

regards Andrew

The same method can be used with tiled output. Do you want the output with bbox on the image or not?

If you don’t need the bbox, you can add nvvideoconverter after nvmultistreamtiler and transfer the tiled video to RGBA format, then you can add probe function with this nvvideoconverter src pad to get the surface with the code you listed.

If you need the bbox, you can add probe function to nvdsosd src pad, the output is already RGBA format.

1 Like

a 1920x1080 image with all the graphics that have been drawn and that would be displayed on nveglglessink. so it would need to be after the tiler I assume. Thanks for the direction ill give it an attempt and get back to you

I am looking for the tiled_output as a single image.

pyds.get_nvds_buf_surface(arg0: int, arg1: int) → numpy.ndarray[uint8]
arg input

address of the Gstbuffer which contains NvBufSurface

arg input1

batch_id of the frame to be processed. This indicates the frame’s index within NvBufSurfacebut "n_frame = pyds.get_nvds_buf_surface(hash(gst_buffer), frame_meta.batch_id)"

requires the frame index. I just want a 1920x1080 image with all the current drawings as a mat/ np array

After nvmultistreamtiler, the batch size becomes 1, so you can always use 0 as the batch index.

okay great thanks for that

works like a charm!