FloatImg4PythonBinding/scripts/shoot.sh

65 lines
1.2 KiB
Bash
Raw Normal View History

2019-11-30 06:40:29 +11:00
#!/bin/bash
2020-02-13 22:13:07 +11:00
# change this to point to your installed binary
#
2019-11-30 06:40:29 +11: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-26 02:58:45 +11:00
OPTIONS=" -v "
2020-01-29 07:57:02 +11:00
SHOW="no"
2020-02-13 22:13:07 +11:00
# output format can be of those types:
# .pnm .fimg or .png
2020-01-29 07:57:02 +11:00
OFORMAT="P_%04d.pnm"
2019-11-30 06:40:29 +11:00
# ces paramètres peuvent être surchargés avec
# un fichier nommé "reglages" dans le répertoire
# de travail.
2020-02-13 22:13:07 +11:00
2019-11-30 06:40:29 +11: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-29 07:57:02 +11:00
outfile=$( printf ${OFORMAT} $numero )
2019-11-30 06:40:29 +11:00
fi
# ------------------------------------
# take and display the fancy picture
$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