Created
August 3, 2015 19:46
-
-
Save maltzsama/015793d6f60cb7794624 to your computer and use it in GitHub Desktop.
Get image from webcam
This file contains hidden or 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 | |
| from pygame import camera | |
| pygame.init() | |
| pygame.camera.init() | |
| camList = pygame.camera.list_cameras() | |
| if camList: | |
| #for camComponent in camList: | |
| cam = pygame.camera.Camera(camList[0], (1280, 720)) | |
| cam.start() | |
| kind = ['RGB', 'YUV', 'HSV'] | |
| for n in kind: | |
| img = cam.get_image() | |
| pygame.image.save(img, n+".png") | |
| cam.stop() | |
| else: | |
| print ('no camera found') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment