Guest User

bgimage.py

a guest
May 30th, 2021
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import cv2
  2. cap=cv2.VideoCapture(0)
  3.  
  4. while cap.isOpened():
  5.     ret,frame=cap.read()
  6.     if ret:
  7.         cv2.imshow("Image",frame)
  8.         if cv2.waitKey(5)==ord('q'):
  9.             cv2.imwrite('background.jpg',frame)
  10.             break
  11.  
  12. cap.release()
  13. cv2.destroyAllWindows()
RAW Paste Data