/
cam.py
32 lines (27 loc) · 836 Bytes
/
cam.py
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
28
29
30
from twisted.internet.defer import inlineCallbacks, returnValue
from autobahn import wamp
from autobahn.wamp.types import CallResult
from autobahn.twisted.wamp import ApplicationSession
from autobahn.twisted.util import sleep
import traceback
import math
import picamera
class CamCom(ApplicationSession):
def __init__(self, config = None):
ApplicationSession.__init__(self, config)
self.debug_app = True
self.traceback_app = True
@inlineCallbacks
def onJoin(self, details):
cam = picamera.PiCamera()
cam.contrast = 15
cam.saturation = 15
cam.awb_mode = "fluorescent"
cam.exposure_mode = "sports"
cam.exposure_compensation = 6
cam.resolution = (950, 535) #(1296, 730)
cam.rotation = 270
yield sleep(2)
while (True):
cam.capture("../cam/cam.png")
yield sleep(60)