You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
382 B
18 lines
382 B
import pygame
|
|
import pygame.camera
|
|
import time
|
|
|
|
|
|
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()
|
|
return './capture.jpg'
|
|
|
|
|