Read Frames

• Hardware Platform (Jetson / GPU) GTX 1650
• DeepStream Version 5
• TensorRT Version 7.0.0.11
• NVIDIA GPU Driver Version (valid for GPU only) 450.51
• Issue Type( questions, new requirements, bugs) question

I want to read the original frame from the input stream and draw on it with opencv. I see that deepstream-imagedata-multistream test already has the code that does that

        # Getting Image data using nvbufsurface
        # the input should be address of buffer and batch_id
        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)

But I got this error

Pipeline construction from main()



I found someone pointing to this solution, but I don’t know how to update the current code according to it.

1 Like

Which sample code are you using? Can you upload your code?

@Fiona.Chen
Please find the code here. I am using test with name deepstream-imagedata-multistream from python app

code.zip (8.0 KB)

In your code, the tiler_sink_pad_buffer_probe() is attached to nvinfer src pad, so the color format in buf_surface is NV12 or I420 but not RGBA. Please refer to the original deepstream-imagedata-multistream script.