forked from somakeit/smib-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
enhance.sh
executable file
·24 lines (24 loc) · 1 KB
/
enhance.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
echo "say cheese" | festival --tts
sleep 5;
FILENAME="shot-`date +%F.%H-%M-%S`.jpg"
FILE="/tmp/$FILENAME"
echo "Ca-cheek" | festival --tts &
/opt/vc/bin/raspistill --nopreview -t 3 -w 1280 -h 960 -o $FILE.1.jpg
if [ "$?" != "0" ]; then exit 1; fi
curl -o $FILE.2.jpg http://10.0.0.64:8080/latest.jpg
if [ "$?" == "0" ]; then
convert $FILE.2.jpg -resize 1280x960 $FILE.3.jpg
convert $FILE.1.jpg $FILE.3.jpg +append $FILE
else
mv $FILE.1.jpg $FILE
fi
rm $FILE.1.jpg
rm $FILE.2.jpg
rm $FILE.3.jpg
#Set the white level to the mean level plus one standard deviation
/usr/bin/mogrify -level 0%,$(bc <<< "$(identify -verbose $FILE | grep -A 7 'Image statistics' | tr \) \( | grep 'mean' | cut -d \( -f 2) * 100 + $(identify -verbose $FILE | grep -A 7 'Image statistics' | tr \) \( | grep 'standard deviation' | cut -d \( -f 2) * 100")% $FILE
/usr/bin/scp -p $FILE [email protected]:www
if [ "$?" != "0" ]; then exit 1; fi
echo "Enhanced: http://irccat.somakeit.org.uk/$FILENAME"
rm $FILE