Advertisement
Guest User

camera2.py

a guest
Nov 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. import cv2
  2. import time
  3.  
  4. cap = cv2.VideoCapture(0)
  5. val = 0
  6. while(True):
  7. filename = 'capture' + str(val) + '.jpg'
  8. ret, frame = cap.read()
  9. rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)
  10. out = cv2.imwrite(filename, frame)
  11. print('File: ' + filename)
  12. val += 1
  13. if(val > 10)
  14. break
  15. time.sleep(5)
  16.  
  17. cap.release()
  18. cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement