Guest User

Untitled

a guest
May 24th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import cv2
  2.  
  3. def show_webcam(mirror=False):
  4. cam = cv2.VideoCapture(0)
  5. while True:
  6. ret_val, img = cam.read()
  7. if mirror:
  8. img = cv2.flip(img, 1)
  9. cv2.namedWindow("window", cv2.WND_PROP_FULLSCREEN)
  10. cv2.setWindowProperty("window",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
  11. cv2.imshow("window", img)
  12. if cv2.waitKey(1) == 27:
  13. break # esc to quit
  14. cv2.destroyAllWindows()
  15.  
  16. if __name__ == '__main__':
  17. show_webcam(mirror=True)
Add Comment
Please, Sign In to add comment