I try to read through CSI in TX2 from camera signal throught custom board. I am using Opencv for image post process.
My HW (camera → custom board → CSI in TX2)
MY SW (CSI → Gstream → Opencv)
My program looks like showing first image and then freeze.
Here are partial my code in Python:
dev = 0
width = 1920
height = 1080
gst_str = ('v4l2src device=/dev/video{} ! '
'video/x-raw, width=3840, height=2160, framerate=30/1, format=UYVY ! '
'nvvidconv ! '
'video/x-raw(memory:NVMM), width={}, height={}, framerate=30/1, format=I420 ! '
'nvoverlaysink sync=true !'
'videoconvert ! appsink').format(dev, width, height)
cap = cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)
_, img = cap.read() # grab the next image frame from camera
Main error message:
(python3:3204): GStreamer-CRITICAL **:
Trying to dispose element pipeline0, but it is in PAUSED instead of the NULL state.
You need to explicitly set elements to the NULL state before
dropping the final reference, to allow them to clean up.
This problem may also be caused by a refcounting bug in the
application or some element.
OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /home/nvidia/src/opencv-3.4.0/modules/videoio/src/cap_gstreamer.cpp, line 890
VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised OpenCV exception:
/home/nvidia/src/opencv-3.4.0/modules/videoio/src/cap_gstreamer.cpp:890: error: (-2) GStreamer: unable to start pipeline
in function cvCaptureFromCAM_GStreamer
In the Terminal, I am able to see the video using the same script:
$ gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw, width=3840, height=2160, framerate=30/1, format=UYVY' ! nvvidconv ! 'video/x-raw(memory:NVMM), width=1920, height=1080, framerate=30/1, format=I420' ! nvoverlaysink sync=true
What could make the pipeline not launch?
System Spec:
OS: Ubuntu 16.04
Opencv 3.4
Python 3.5
HW: Nvidia TX2
Thanks.