I’ve recently updated to 24.1 64bit because a project I am working on needs to use the onboard camera. I successfully flashed the entire package with JetPack. However, OpenCV segfaults every time when I try to use the camera. I’m using Nvidia’s OpenCV4tegra libraries. This simple program does not run:
python -c "import numpy as np; import cv2; cap = cv2.VideoCapture(0); ret,frame = cap.read()"
The segfault occurs when the very last line runs. What am I doing wrong here? I am extremely disappointed in the fact that the camera does not work. This issue has been dogging me all weekend.
On an unrelated note, my system occasionally hard locks now and firefox no longer works.
Hello nbech, the latter two issues may be related to a memory leak that we are working on, but the issue with the onboard camera has a workaround that involves installing OpenCV 3.1.0.
See this thread for more details: https://devtalk.nvidia.com/default/topic/943129/jetson-tx1/highgui-error-v4l-v4l2-while-opening-camera-with-opencv4tegra-l4t-r24/post/4921383/#4921383
Sorry for the delayed response, I’ve had to put this project on hold.
I flashed my Jetson with the latest version of JetPack. I then compiled and installed OpenCV 3.1.0 from source. However, the simple program from above still does not work. cap.read() returns False and a NoneType object rather than a frame. I tried just running
nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)I420, framerate=(fraction)24/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink
in the command line to bring up the camera stream, but Bash throws an error: syntax error near unexpected token `(’
I also ran gst-install, but it had no effect. What am I doing wrong?
This might be worthwhile as well. Running “gst-launch-1.0 nvcamerasrc” returns this from stderr:
ERROR: from element/GstPipeline:pipeline0/GstNvCameraSrc:nvcamerasrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2943): gst_base_src_loop (): /GstPipeline:pipeline0/GstNvCameraSrc:nvcamerasrc0:
streaming task paused, reason not-linked (-1)
For opencv on-board camera, you can refer to https://devtalk.nvidia.com/default/topic/943129/jetson-tx1/highgui-error-v4l-v4l2-while-opening-camera-with-opencv4tegra-l4t-r24/post/4921383/#4921383
For GST camera failure, please paste your full pipeline.
The following simple pipeline can work:
gst-launch-1.0 nvcamerasrc ! tee ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1920, height=1080, format=(string)I420' ! nvhdmioverlaysink