-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_timelapse
53 lines (45 loc) · 1.64 KB
/
run_timelapse
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
#!/bin/bash
# Timelapse controller for Raspberry Pi
# directory containing this script: https://stackoverflow.com/a/246128/1404966
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
IMAGEDIR="images"
DELAY=54
ISUPLOAD=0
# Note: The total time interval between images is
# approximately $DELAY+5 seconds, since the camera module
# takes approximately 5 seconds to calibrate i
while getopts "i:d:u:" OPTION
do
case $OPTION in
i)
IMAGEDIR=$OPTARG
;;
d)
DELAY=$OPTARG
;;
u)
ISUPLOAD=$OPTARG
;;
esac
done
DROPBOX_UPLOADER_SCRIPT="$DIR/Dropbox-Uploader/dropbox_uploader.sh"
mkdir -p "$DIR/$IMAGEDIR"
## TODO (vtjeng): This is necessary to do the first time. Perhaps the script's mkdir has a -p flag?
# "$DROPBOX_UPLOADER_SCRIPT" mkdir "$IMAGEDIR"
# As of 13 Dec 2013,
# -sh, -co, -sa range from -100 to 100. Default at 0
# -br ranges from 0 to 100. Default at 50
# -ev officially ranges from -10 to 10 with a default at 0. However when you push to -20 you still see results.
# options for -ex: auto, night, nightpreview, backlight, spotlight, sports, snow, beach, verylong, fixedfps, antishake, fireworks
# options for -awb: off, auto, sun, cloudshade, tungsten, fluorescent, incandescent, flash, horizon
while true;
do
FILENAME=$(date +"%Y%m%d_%H%M-%S").jpg
OUTPUT_PATH="$DIR/$IMAGEDIR/$FILENAME"
raspistill --metering matrix --nopreview --output "$OUTPUT_PATH"
if [[ $ISUPLOAD == 1 ]]; then
# TODO (vtjeng): make this a proper flag
"$DROPBOX_UPLOADER_SCRIPT" upload "$OUTPUT_PATH" "$IMAGEDIR"
fi
sleep "$DELAY"
done