I’m trying to read from the onboard camera with opencv and even after following many other solutions online, can not get it to work. When I try with code like:
cam = cv2.VideoCapture(“nvarguscamersrc ! video/x-raw(memory:NVMM), width=(int)640, height=(int)480, format=(string)I420, framerate=(fraction)30/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)I420 ! videoconvert ! video/x-raw, format=(string)BGR ! appsink”)
_, img = cam.read()
I get the following error on imshow:
cv2.error: /build/opencv-XDqSFW/opencv-3.2.0+dfsg/modules/highgui/src/window.cpp:304: error: (-215) size.width>0 && size.height>0 in function imshow
Which I believe means the camera isn’t starting.
I can start the camera from command line with gst-launch-1.0 and v4l2-ctl --list-devices shows the following:
vi-output, ov5693 2-0036 (platform:15700000.vi:2):
I have also tried the code from Capture and display video from either IP CAM, USB webcam, or the Tegra X2/X1 onboard camera. · GitHub and it fails to open the camera as well.
My cv2.version is 3.2.0
Any idea to what my problem could possibly be?