-
Notifications
You must be signed in to change notification settings - Fork 1
/
ll_still.py
executable file
·105 lines (70 loc) · 2.77 KB
/
ll_still.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import threading, os, signal
from os import system
from time import sleep
from decimal import Decimal
import argparse
from os import path
#example usage:
#python3 ll_still.py --ss 1000 --iso 100 --awbg 3,2
# Instantiate the parser
parser = argparse.ArgumentParser(description='Optional app description')
parser.add_argument('--mode', type=str,
help='Auto mode')
parser.add_argument('--ss', type=str,
help='Shutter Speed')
parser.add_argument('--iso', type=int,
help='ISO')
parser.add_argument('--awbg', type=str,
help='blue and green values')
parser.add_argument('--filename', type=str,
help='name of file to output')
parser.add_argument('--raw', type=str, help='capture raw image in JPEG')
args = parser.parse_args()
if path.isdir("stills") == True :
print("preview directory created")
else :
system("mkdir stills")
#sleep(2)
#d=RPICAM2DNG()
# -r = append raw file for later processing
# ISO - Set capture ISO (100 - 800)
# -ss 6000000 = shutter speed 6 seconds, 200000000 (i.e. 200s)
# --awb = off
# --hflip, -hf Set horizontal flip
# --vflip, -vf Set vertical flip
# --rotation, -rot Set image rotation ( 0, 90, 180, and 270)
# --awbgains, -awbg e.g. -awbg 1.5,1.2 Sets blue and red gains (as floating point numbers) to be applied when -awb off is set e.g. -awbg 1.5,1.2
# -ex = explosure
# -ev -10 to +10
#print(args.pos_arg)
userInputs = ""
if args.mode == "auto":
print("capture in auto mode")
else :
exposureInput = Decimal(args.ss)
#print("Exposure INPUT Time: ")
#print(Decimal(args.ss_arg))
exposureTime = (exposureInput)
userParams = "-ISO "+str(args.iso)+" -ss "+str(exposureTime) + " -co -10"
jpegDimensions = " -w 2400 -h 1800"
includeRaw = ""
if args.raw == "true":
includeRaw = " -r "
whiteBalance = ""
# awbg : blue,red
if args.awbg != "auto":
whiteBalance = " -awb off -awbg "+args.awbg
#1.7,1.5 = ok
userInputs = userParams+jpegDimensions + whiteBalance + includeRaw
#print("Exposure INPUT Time: "+str(exposureInput))
outputPathAndFilename = "/home/pi/letslapse/stills/"+args.filename
#print("/"+outputPathAndFilename)
raspistillCommand = "raspistill --verbose -t 1 --thumb 640:480:40 -o "+outputPathAndFilename+" "+userInputs
print(raspistillCommand)
system(raspistillCommand)
#pull out the thumbnail for more efficient usage
exifCommand = "exiftool -b -ThumbnailImage "+outputPathAndFilename+" > "+outputPathAndFilename.replace(".jpg", "_thumb.jpg")
#exifProcess = subprocess.check_output(exifCommand, shell=True)
system(exifCommand)
#burst mode:
#raspistill --verbose -t 10000 -tl 1000 -o image%04d.jpg -ISO 100 -ss 0.0008 -co -10 -drc high