Device: Jetson Nano
My experience level: very low
My willingness to learn: very high
Code :
import cv2
print(cv2.__version__)
dispW=640
dispH=480
flip=2
#Uncomment These next Two Line for Pi Camera
camSet='nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12,
framerate=21/1 ! nvvidconv flip-method='+str(flip)+' ! video/x-raw, width='+str(dispW)+',
height='+str(dispH)+', format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink'
cam= cv2.VideoCapture(camSet)
#Or, if you have a WEB cam, uncomment the next line
#(If it does not work, try setting to '1' instead of '0')
#cam=cv2.VideoCapture(0)
while True:
ret, frame = cam.read()
cv2.imshow('nanoCam',frame)
if cv2.waitKey(1)==ord('q'):
break
cam.release()
cv2.destroyAllWindows()
error:
python3
Test2.py
4.5.1
[ERROR:0] global /tmp/pip-req-build-zuuo394f/opencv/modules/videoio/src/cap.cpp (140) open VIDEOIO(CV_IMAGES): raised OpenCV exception:
OpenCV(4.5.1) /tmp/pip-req-build-zuuo394f/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1 ! nvvidconv flip-method=2 ! video/x-raw, width=640, height=480, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink in function 'icvExtractPattern'
Traceback (most recent call last):
File "Test2.py", line 15, in <module>
cv2.imshow('nanoCam',frame)
cv2.error: OpenCV(4.5.1) /tmp/pip-req-build-zuuo394f/opencv/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'
Tutorial I'm following: https://www.youtube.com/watch?v=LXuFYRewBRY Camera module: "IMX219-77 Camera" I assume in function the same as a pi camera