-
Notifications
You must be signed in to change notification settings - Fork 8
/
cam.py
51 lines (40 loc) · 1.28 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import time
import picamera
from datetime import datetime
import sys
import subprocess
def photo(path):
subprocess.call(["raspistill", "-t", "1500", "-w", "640", "-h", "480", "-o", path])
def photo_cam(path):
with picamera.PiCamera() as camera:
#camera.start_preview()
#camera.resolution = (2592, 1944)
#camera.framerate = (1, 1)
camera.sharpness = 0
camera.contrast = 0
camera.brightness = 50
camera.saturation = 0
camera.ISO = 0
camera.video_stabilization = False
camera.exposure_compensation = 0
camera.exposure_mode = 'auto'
camera.meter_mode = 'average'
camera.awb_mode = 'auto'
camera.image_effect = 'none'
camera.color_effects = None
camera.rotation = 0
camera.hflip = False
camera.vflip = False
camera.crop = (0.0, 0.0, 1.0, 1.0)
camera.capture(path)
#camera.stop_preview()
if __name__ == '__main__':
fname = None
if len(sys.argv) > 1:
fname = sys.argv[1]
if fname is None:
tmt = datetime.now().strftime('%d%m%Y-%H%M%S')
fname = "img/" + tmt + ".jpg"
time.sleep(0.5)
photo(fname)
print ("Saved photo", fname)