-
-
Save velolala/328a31f2b4b27684dcce848cd494b7ee to your computer and use it in GitHub Desktop.
Test Webcam on EYESY
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import pygame.camera | |
import time | |
import sys | |
pygame.camera.init() | |
CAM = ((pygame.camera.list_cameras() or [""])[0], (160, 120)) | |
camera = pygame.camera.Camera(*CAM) | |
camera.start() | |
snapshot = pygame.surface.Surface(CAM[-1], 0) | |
time.sleep(1) | |
if camera.query_image(): | |
snapshot = camera.get_image(snapshot) | |
print "camera is '%s' resolution '%s'" % CAM | |
else: | |
print "could not get an image" | |
camera.stop() | |
print "camera stop" | |
sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment