Advertisement
trashatkivy

Untitled

Dec 30th, 2020 (edited)
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. Cameratest.py: (does not function)
  2.  
  3. import cv2
  4. print(cv2.__version__)
  5. width=1280
  6. height=720
  7. flip=2
  8. #camSet='nvarguscamerasrc sensor-id=0 ! video/x-raw(memory:NVMM), width=1280, height=720, framerate=30/1,format=NV12 ! nvvidconv flip-method='+str(flip)+' ! video/x-raw, width='+str(width)+', height='+str(height)+', format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink'
  9. camSet='v4l2src device=/dev/video0 ! video/x-raw, width=1280, height=720, framerate=30/1,format=YUYV442 ! nvvidconv flip-method='+str(flip)+' ! video/x-raw, width='+str(width)+', height='+str(height)+', format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink'
  10. #camSet ='v4l2src device=/dev/video0 ! video/x-raw,width='+str(width)+',height='+str(height)+',framerate=30/1 ! videoconvert ! appsink'
  11. #camSet ='v4l2src device=/dev/video0 ! video/x-raw,width='+str(width)+',height='+str(height)+',framerate=30/1 ,format=YUY2 ! videoconvert ! appsink'
  12. #camSet = 'v4l2src device =dev ! image/jpeg, width=120, height=720 ! jpegparse ! jpegdec ! video/x-raw, format=I420 !appsink max-buffers=1 drop=true'
  13. cam=cv2.VideoCapture(camSet)
  14. while True:
  15. _, frame = cam.read()
  16. cv2.imshow('myCam',frame)
  17. cv2.moveWindow('myCam',0,0)
  18. if cv2.waitKey(1)==ord('q'):
  19. break
  20. cam.release()
  21. cv2.destroyAllWindows()
  22.  
  23.  
  24.  
  25. Error code:
  26.  
  27. /home/nyp/.virtualenvs/py3cv4/bin/python /home/nyp/.virtualenvs/py3cv4/untitled/cameratest.py
  28. 4.1.2
  29. [ WARN:0] global /home/nyp/opencv/modules/videoio/src/cap_gstreamer.cpp (711) open OpenCV | GStreamer warning: Error opening bin: could not link v4l2src0 to nvvconv0, neither element can handle caps video/x-raw, width=(int)1280, height=(int)720, framerate=(fraction)30/1, format=(string)YUYV442
  30. [ WARN:0] global /home/nyp/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
  31. [ERROR:0] global /home/nyp/opencv/modules/videoio/src/cap.cpp (116) open VIDEOIO(CV_IMAGES): raised OpenCV exception:
  32.  
  33. OpenCV(4.1.2) /home/nyp/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): v4l2src device=/dev/video0 ! video/x-raw, width=1280, height=720, framerate=30/1,format=YUYV442 ! nvvidconv flip-method=2 ! video/x-raw, width=1280, height=720, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink in function 'icvExtractPattern'
  34.  
  35.  
  36. Traceback (most recent call last):
  37. File "/home/nyp/.virtualenvs/py3cv4/untitled/cameratest.py", line 14, in <module>
  38. cv2.imshow('myCam',frame)
  39. cv2.error: OpenCV(4.1.2) /home/nyp/opencv/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'
  40.  
  41.  
  42. Process finished with exit code 1
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement