Files
python-backend/camera.py

18 lines
382 B
Python
Raw Normal View History

2019-02-09 03:05:07 -06:00
import pygame
import pygame.camera
2019-02-10 00:34:00 -06:00
import time
2019-02-09 03:05:07 -06:00
2019-02-10 01:44:46 -06:00
def capture(camera_stream = "/dev/video0", camera_res = (640, 480)):
pygame.camera.init()
pygame.camera.list_cameras()
cam = pygame.camera.Camera(camera_stream, camera_res)
cam.start()
time.sleep(5)
img = cam.get_image()
pygame.image.save(img, './capture.jpg')
cam.stop()
2019-02-09 03:05:07 -06:00
return './capture.jpg'