Unable to read MIPI CSI Camera images using SSH

I want to read MIPI CSI Camera, The image can be read normally when connected to the screen, but the image cannot be read normally using SSH.

The error infor:

(Argus) Error BadParameter: (propagating from src/eglstream/FrameConsumerImpl.cpp, function initialize(), line 89)
(Argus) Error BadParameter: (propagating from src/eglstream/FrameConsumerImpl.cpp, function create(), line 44)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadInitialize:320 Failed to create FrameConsumer
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadFunction:241 (propagating)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, waitRunning:203 Invalid thread state 3
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:806 (propagating)
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (935) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1

python code:

import cv2
import multiprocessing
import sys

def gstreamer_pipeline(
    sensor_id=0,
    capture_width=1280,
    capture_height=720,
    display_width=960,
    display_height=540,
    framerate=60,
    flip_method=0,
):
    return (
        "nvarguscamerasrc sensor-id=%d !"
        "video/x-raw(memory:NVMM), width=(int)%d, height=(int)%d, framerate=(fraction)%d/1 ! "
        "nvvidconv flip-method=%d ! "
        "video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! "
        "videoconvert ! "
        "video/x-raw, format=(string)BGR ! appsink"
        % (
            sensor_id,
            capture_width,
            capture_height,
            framerate,
            flip_method,
            display_width,
            display_height,
        )
    )

    

def main():
    print(gstreamer_pipeline(flip_method=0))
    cap = cv2.VideoCapture(gstreamer_pipeline(flip_method=0), cv2.CAP_GSTREAMER)
    print(True)
    frame = [None] * 1
    if cap.isOpened():
        try:
            while True:
                ret , frame[0] = cap.read()
                if ret:
                    #cv2.imshow("video", frame)
                    print(True)
                else:
                    print("Not read")
                
                keyCode = cv2.waitKey(10) & 0xFF    
                if keyCode == 27 or keyCode == ord('q'):
                    break    
        except KeyboardInterrupt:
            cap.release()
            cv2.destroyAllWindows()
            print("Bye")
            sys.exit()
        


if __name__ == "__main__":
    main()

What went wrong?

Need export the DISPLAY by below command.

export DISPLAY=:0

Thank you for your answer

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