fotobox/capture.py
2023-05-28 18:13:05 +02:00

27 lines
526 B
Python
Executable File

#!/usr/bin/python3
import cv2
import sys
import time
cap = cv2.VideoCapture(0)
cap.set(3, 1280)
cap.set(4, 720)
cap.set(cv2.CAP_PROP_FPS, 30) # Setze die Framerate auf 30 fps
print("Starting")
doSave = 0
while True:
ret, frame = cap.read()
#cv2.imshow('frame', frame)
# Speichern des Frames als JPEG-Bild
file_name = f'./temp/picture.jpg'
cv2.imwrite(file_name, frame)
print("wrote_frame")
sys.stdout.flush() # Leere den Ausgabepuffer
time.sleep(5)
cap.release()
cv2.destroyAllWindows()