#!/bin/bash # prints out a element from rectangle coordinates # (from the ViPER standard: http://viper-toolkit.sourceforge.net/docs/file/) printBBox() { width=$(($3-$1)) height=$(($4-$2)) echo -e "\t\t\t" } # export printBBox so xargs can call it using bash -c below export -f printBBox SEDREGEX='s/.*(\([0-9]*\), \([0-9]*\)) - (\([0-9]*\), \([0-9]*\))/printBBox \1 \2 \3 \4/' echo '' echo '' # print out the positive image sigs for fullpath in INRIAPerson/$1/pos/*; do # get just the filename, minus the path filename=$(basename "$fullpath") echo -e "\t" # if this folder has annotations, add bounding boxes echo -en "\t\t" annotation="INRIAPerson/$1/annotations/${filename%.*}.txt" grep 'Bounding box' $annotation | sed "$SEDREGEX" | xargs -n 5 bash -c 'printBBox $@' echo -e "\t\t" # otherwise, just end the presentation else echo " />" fi echo -e '\t' done # print out the negative image sigs for fullpath in INRIAPerson/$1/neg/*; do filename=$(basename "$fullpath") echo -e "\t" echo -e "\t\t" echo -e '\t' done echo ''