#!/bin/bash
inputfolder=$1
bits=$2
height=$3
width=$4

echo "Order is inputfolder bits height width"

scriptdir="../"
echo "Extracting events and triggers from log.raw"
rosrun dual_setup extract -f $inputfolder

echo "Writing all events to single h5 file"
python $scriptdir/h5_chunks_to_single_file.py $inputfolder/events $inputfolder/events.h5

echo "Converting images to png"
python $scriptdir/raw_to_png.py $inputfolder/images $inputfolder/images_png --shape $width $height --bits $bits 
cp $inputfolder/images/timestamps.txt $inputfolder/images_png/timestamps.txt