import numpy as np
import cv2
import time
import datetime as dt
import time
cap = cv2.VideoCapture(0)
pip = 0
time = dt.datetime.now()
time_15 = time+dt.timedelta(seconds=15)
while True:
time.sleep(15)
_, image = cap.read()
pip += 1
height, width = image.shape[0], image.shape[1]
if time <= time_15:
cv2.imwrite(f'{pip}.png', image)
time = dt.datetime.now()
time_15 = time+dt.timedelta(seconds=15)
else:
continue
cv2.imshow("Web-Kamera", image)
cv2.waitKey(5)
cv2.destroyAllWindows()
cap.release()