Ricoh Theta V: Livestreaming with Jetson Xavier, ROS, OpenCV, NUC

:camera: OpenCV


It seems that the problem is the pipeline from gstream to OpenCV. For now I will just be focusing in obtaining in make this connection using the simple code you suggested:


import numpy as np
import cv2

cap = cv2.VideoCapture(7, cv2.CAP_GSTREAMER)

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()

    # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    # Display the resulting frame
    cv2.imshow('frame',gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

But I am getting the following error:

[ WARN:0] global /home/spacer/Downloads/opencv-4.5.3/modules/videoio/src/cap_gstreamer.cpp (2057) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.
[ WARN:0] global /home/spacer/Downloads/opencv-4.5.3/modules/videoio/src/cap_gstreamer.cpp (1034) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/spacer/Downloads/opencv-4.5.3/modules/videoio/src/cap_gstreamer.cpp (597) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
Traceback (most recent call last):
  File "test.py", line 11, in <module>
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.5.3) /home/spacer/Downloads/opencv-4.5.3/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

I also tried the following and the outcome was the same:

gst = "omxh264dec ! gldownload ! glimagesink ! videoconvert n-thread=0 ! video/x-raw,format=I420 ! identity drop-allocation=true ! v4l2sink device=/dev/video7 qos=false sync=false"

and

gst = "v4l2src device=/dev/video7 ! video/x-raw,width=1920,height=1080,format=I420,framerate=30/1 ! videoconvert ! video/x-raw,format=BGR ! appsink"

in

cap = cv2.VideoCapture(gst, cv2.CAP_GSTREAMER)