measuring jack themes technologies tooltips linux measuring jack themes technologies tooltip linux limejack claim limejack limejack

Start | Sprache  de en fr | Menü | Übersicht | Suche

Sie befinden sich hier: start » de » education » pc_meas » project-005

Project 005 : Goal counter

  • Leading Person: Julian
  • necessary software: bash, mplayer, mencoder, ImageMagick, espeak

Data Acquisition

motiontracker.sh
#!/bin/bash

readonly frames='3'
readonly limes='100'

echo 'Setup ...'
TOR=0;
mkdir tmp-mtrack
cd tmp-mtrack

while true
do
  echo 'Aufnahme ...'
  tor=0
  mplayer -vo jpeg tv:// -frames ${frames}

  echo 'Bearbeite Bild ...'
  background=`ls *.jpg | sort | head -n1`;
  for bild in *.jpg
  do
    echo "  $bild ..."
    compare -fuzz 20% "$bild" "$background"  -highlight-color  Red  -lowlight-color Black tmp-hallo.jpg
    red=`convert tmp-hallo.jpg -format %c histogram:info:- | grep '#FF' | wc -l`
    mv tmp-hallo.jpg "$background"
    background="$bild"

    if [ "$red" -gt "$limes" ]
    then
      tor=$(( $tor + 1))
    fi
  done

  if [ "$tor" -gt 1 ]
  then
    TOR=$(( $TOR + 1 ))
    echo "Tor :  $TOR"
    espeak -v de 'Tor!' 2> /dev/null
    sleep 5;
  fi

  echo 'Aufräumen ...'
  rm *.jpg
done

exit 0

#echo 'Bearbeite video ...'
#mencoder mf://*.jpg -mf w=800:h=600:fps=10:type=jpg -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o output.avi
#mplayer output.avi

#echo 'Aufräumen ...'
#cd ..
#rm -r tmp-mtrack
Disclaimer | Impressum | Privacy | Copyleft