Exemplo n.º 1
0
 def pixformat(format):
     """ Change the format of image """
     val = None
     if format == b"RGB565": val = camera.PIXFORMAT_RGB565
     if format == b"YUV422": val = camera.PIXFORMAT_YUV422
     if format == b"GRAYSCALE": val = camera.PIXFORMAT_GRAYSCALE
     if format == b"JPEG": val = camera.PIXFORMAT_JPEG
     if format == b"RGB888": val = camera.PIXFORMAT_RGB888
     if format == b"RAW": val = camera.PIXFORMAT_RAW
     if format == b"RGB444": val = camera.PIXFORMAT_RGB444
     if format == b"RGB555": val = camera.PIXFORMAT_RGB555
     if Camera.opened and val != None:
         print("Pixformat %s" % useful.tostrings(format))
         camera.pixformat(val)
     else:
         print("Pixformat not set")
Exemplo n.º 2
0
Arquivo: mth.py Projeto: marsex/asmon
def port3(cs, rq):
    rqp = rq[1].split('/')
    if rqp[1] == 'apikey':  # Must have /apikey/<REQ>
        if rqp[2] == 'flash':  # /apikey/flash/<what>
            if rqp[3] == 'on':
                flash_light.on()
            else:
                flash_light.off()
            cs.send(b'%s' % hdr['OK'])
        elif rqp[2] == 'fmt':
            w = int(rqp[3])
            if w >= 0 and w <= 2:
                camera.pixformat(w)
            cs.send(b'%s' % hdr['OK'])
        elif rqp[2] == 'pix':
            w = int(rqp[3])
            if w > 0 and w < 13:
                camera.framesize(w)
            cs.send(b'%s' % hdr['OK'])
        elif rqp[2] == 'qua':
            w = int(rqp[3])
            if w > 9 and w < 64:
                camera.quality(w)
            cs.send(b'%s' % hdr['OK'])
        elif rqp[2] == 'con':
            w = int(rqp[3])
            if w > -3 and w < 3:
                camera.contrast(w)
            cs.send(b'%s' % hdr['OK'])
        elif rqp[2] == 'sat':
            w = int(rqp[3])
            if w > -3 and w < 3:
                camera.saturation(w)
            cs.send(b'%s' % hdr['OK'])
        elif rqp[2] == 'bri':
            w = int(rqp[3])
            if w > -3 and w < 3:
                camera.brightness(w)
            cs.send(b'%s' % hdr['OK'])
        elif rqp[2] == 'ael':
            w = int(rqp[3])
            if w > -3 and w < 3:
                camera.aelevels(w)
            cs.send(b'%s' % hdr['OK'])
        elif rqp[2] == 'aev':
            w = int(rqp[3])
            if w >= 0 and w <= 1200:
                camera.aecvalue(w)
            cs.send(b'%s' % hdr['OK'])
        elif rqp[2] == 'agc':
            w = int(rqp[3])
            if w >= 0 and w <= 30:
                camera.agcgain(w)
            cs.send(b'%s' % hdr['OK'])
        elif rqp[2] == 'spe':
            w = int(rqp[3])
            if w >= 0 and w < 7:
                camera.speffect(w)
            cs.send(b'%s' % hdr['OK'])
        elif rqp[2] == 'wbl':
            w = int(rqp[3])
            if w >= 0 and w < 5:
                camera.whitebalance(w)
            cs.send(b'%s' % hdr['OK'])
        else:
            cs.send(b'%s' % hdr['none'])
    else:
        cs.send(b'%s' % hdr['err'])
    clean_up(cs)