Automatic commit. Thu Sep 13 12:00:07 WST 2012
[matches/honours.git] / research / TCS / pressure / get_pressure.sh
1 #!/bin/bash
2
3 imgdir="/home/sam/Documents/University/honours/pressure_imgs"
4
5 get_digits=/home/sam/Documents/University/honours/research/TCS/pressure/get_digits.py
6 process_digits=/home/sam/Documents/University/honours/research/TCS/pressure/process_digits.py
7
8 mkdir -p $imgdir 2>/dev/null
9 name=$(date +%F-%H%M%S.jpg)
10 fswebcam --device /dev/video0 -r 640x480 --jpeg 85 $imgdir/$name 2>/dev/null # NOTE: Need to make sure we use the right /dev/videoX
11                                                                                 # Otherwise images may come from the laptop's shitty inbuilt webcam
12 $get_digits $imgdir/$name $imgdir/$name 2>/dev/null
13
14 if [ "$1" != "" ]; then
15         eog $imgdir/$name
16 fi
17
18 out=$($process_digits $imgdir/$name)
19
20 count=0
21 while [ "$out" == "?" ]; do
22         sleep 1
23         out=$($process_digits $imgdir/$name)
24         count=$(( $count + 1 ))
25         if [ "$count" == "5" ]; then
26                 echo "#?"
27                 exit 0
28         fi
29 done
30 rm -f $imgdir/$name
31 echo $out

UCC git Repository :: git.ucc.asn.au