#!/bin/csh -f

# Extracts video in the capture buffers in a directory

#check command line
if ( $#argv != 2 ) then 
  echo "Usage: extractall <capture_number> <path>";
  exit 1 
endif

#get the command line
set PATHIN=$argv[2]; #path
set CAPTURE=$argv[1]; #capture number

# grab
#set NUM_VIEWS=`cameras.csh`;#
set NUM_VIEWS=8
set i=0;
while ($i<$NUM_VIEWS)
  set GRABBER=`cameras.csh $i`;
  set VIDEOGRAB=$GRABBER[3];
  set SRCFILE=${PATHIN}/grab.${i}.${CAPTURE}
  set DESTFILE=${PATHIN}/grab.${i}.00000.png
  $VIDEOGRAB -i $SRCFILE -o $DESTFILE
  set i=`expr $i + 1`;
end

