2019-02-09 09:05:07 +00:00
|
|
|
import pygame
|
|
|
|
import pygame.camera
|
|
|
|
|
|
|
|
|
2019-02-09 09:50:39 +00:00
|
|
|
def capture(camera_stream = "/dev/video4"):
|
2019-02-09 09:05:07 +00:00
|
|
|
pygame.camera.init()
|
|
|
|
pygame.camera.list_cameras()
|
2019-02-09 09:50:39 +00:00
|
|
|
cam = pygame.camera.Camera(camera_stream, (640, 480))
|
2019-02-09 09:05:07 +00:00
|
|
|
cam.start()
|
|
|
|
img = cam.get_image()
|
|
|
|
pygame.image.save(img, './capture.jpg')
|
|
|
|
return './capture.jpg'
|
|
|
|
|
|
|
|
|