Python - take snapshot from webcam
#Need to install pygame & download videocapture file "vidcap.pyd"
#from http://videocapture.sourceforge.net/ and save into your Python DLLs folder
#Example for Win7
import pygame
import pygame.camera
from pygame.locals import *
pygame.init()
pygame.camera.init()
cam = pygame.camera.Camera(0,(640,480),"RGB")
cam.start()
img = pygame.Surface((640,480))
cam.get_image(img)
pygame.image.save(img, "webcam.jpg")
cam.stop()
#from http://videocapture.sourceforge.net/ and save into your Python DLLs folder
#Example for Win7
import pygame
import pygame.camera
from pygame.locals import *
pygame.init()
pygame.camera.init()
cam = pygame.camera.Camera(0,(640,480),"RGB")
cam.start()
img = pygame.Surface((640,480))
cam.get_image(img)
pygame.image.save(img, "webcam.jpg")
cam.stop()
0 Comments:
Post a Comment
<< Home