From b528288d22d5e6487dbd85f3796744a23eeaee1e Mon Sep 17 00:00:00 2001 From: Austin Van Blanton Date: Fri, 23 Aug 2013 14:07:49 -0400 Subject: [PATCH] Put multiple bboxes in a single presentation element --- scripts/writeINRIAPersonSigset.sh | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/scripts/writeINRIAPersonSigset.sh b/scripts/writeINRIAPersonSigset.sh index a32a861..b3aac66 100755 --- a/scripts/writeINRIAPersonSigset.sh +++ b/scripts/writeINRIAPersonSigset.sh @@ -1,26 +1,16 @@ #!/bin/bash -# prints out a element -# additional arguments after the first two are rectangle coordinates -# from that, it will create a nested element (from the ViPER standard) -# http://viper-toolkit.sourceforge.net/docs/file/ -writePresentation() +# prints out a element from rectangle coordinates +# (from the ViPER standard: http://viper-toolkit.sourceforge.net/docs/file/) +printBBox() { - pres="\t\t" - pres="$pres\n\t\t" - else - pres="$pres />" - fi - printf "$pres\n" + width=$(($3-$1)) + height=$(($4-$2)) + echo -e "\t\t\t" } -# export writePresentation so xargs can call it using bash -c below -export -f writePresentation -SEDREGEX='s/.*(\([0-9]*\), \([0-9]*\)) - (\([0-9]*\), \([0-9]*\))/writeIt \1 \2 \3 \4/' +# 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 '' @@ -32,12 +22,15 @@ for fullpath in INRIAPerson/$1/pos/*; do 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 "writePresentation $1 $filename \$@" - # otherwise, just the normal presentation + grep 'Bounding box' $annotation | sed "$SEDREGEX" | xargs -n 5 bash -c 'printBBox $@' + echo -e "\t\t" + # otherwise, just end the presentation else - writePresentation $1 $filename + echo " />" fi echo -e '\t' -- libgit2 0.21.4