blob: 13c65ec3786cd03344eed7786bea3ea17b4be245 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import pygame
import pygame.camera
pygame.camera.init()
class Camara:
tam = (320, 240)
def __init__(self):
print "incio capturador"
camaras = pygame.camera.list_cameras()
self.cam = pygame.camera.Camera(camaras[0], self.tam, "YUV")
#self.cam.set_controls(True, False, 0)
def detener(self):
self.cam.stop()
def iniciar(self):
self.cam.start()
def fotoXO(self):
"""Toma una foto y devuelve la surface"""
try:
imageP = self.cam.get_image()
self.image = pygame.transform.flip(imageP, True, False)
except:
pass
return self.image
|