FloatImg4PythonBinding/scripts/shoot.sh

65 lines
1.2 KiB
Bash
Raw Normal View History

2019-11-29 20:40:29 +01:00
#!/bin/bash
2020-02-13 12:13:07 +01:00
# change this to point to your installed binary
#
2019-11-29 20:40:29 +01:00
GVS=${HOME}/Devel/FloatImg/v4l2/grabvidseq
# ------------------------------------
# set some default values
DEV=/dev/video2
SZ=640x480
NBRE=320
PERIOD=0.0
COUNT=compteur
2020-01-25 16:58:45 +01:00
OPTIONS=" -v "
2020-01-28 21:57:02 +01:00
SHOW="no"
2020-02-13 12:13:07 +01:00
# output format can be of those types:
# .pnm .fimg or .png
2020-01-28 21:57:02 +01:00
OFORMAT="P_%04d.pnm"
2019-11-29 20:40:29 +01:00
2020-02-21 12:54:10 +01:00
# ces parametres peuvent etre surcharges avec
# un fichier nomme "reglages" dans le repertoire
# de travail.
2020-02-13 12:13:07 +01:00
2019-11-29 20:40:29 +01:00
# ------------------------------------
# overide parameters from $PWD
if [ -r ./reglages ]
then
source ./reglages
fi
# ------------------------------------
# get the current picture number
if [ -r $COUNT ]
then
numero=$( head -1 $COUNT )
else
numero=1
fi
# ------------------------------------
# make the output filename
if [ 1 -eq $# ]
then
outfile="$1"
else
2020-01-28 21:57:02 +01:00
outfile=$( printf ${OFORMAT} $numero )
2019-11-29 20:40:29 +01:00
fi
# ------------------------------------
2020-04-11 23:18:33 +02:00
# grab and display the fancy picture
2019-11-29 20:40:29 +01:00
$GVS -d $DEV -n $NBRE -p $PERIOD $OPTIONS -s $SZ -o $outfile
if [ ${SHOW} == "yes" ]
then
display $outfile &
fi
# ------------------------------------
# increment and save the picture number
numero=$(( numero + 1 ))
echo $numero > $COUNT