Automatic commit. Thu Sep 20 00:00:02 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
13 $get_digits $imgdir/$name $imgdir/$name 2>/dev/null
14
15 if [ "$1" != "" ]; then
16         eog $imgdir/$name
17 fi
18
19 out=$($process_digits $imgdir/$name)
20
21 count=0
22 while [ "$out" == "?" ]; do
23         sleep 1
24         out=$($process_digits $imgdir/$name)
25         count=$(( $count + 1 ))
26         if [ "$count" == "5" ]; then
27                 echo "#?"
28                 exit 0
29         fi
30 done
31 rm -f $imgdir/$name
32 echo $out

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