Commit b528288d22d5e6487dbd85f3796744a23eeaee1e

Authored by Austin Van Blanton
1 parent 29337ed1

Put multiple bboxes in a single presentation element

scripts/writeINRIAPersonSigset.sh
1 1 #!/bin/bash
2 2  
3   -# prints out a <presentation> element
4   -# additional arguments after the first two are rectangle coordinates
5   -# from that, it will create a nested <data:bbox> element (from the ViPER standard)
6   -# http://viper-toolkit.sourceforge.net/docs/file/
7   -writePresentation()
  3 +# prints out a <data:bbox> element from rectangle coordinates
  4 +# (from the ViPER standard: http://viper-toolkit.sourceforge.net/docs/file/)
  5 +printBBox()
8 6 {
9   - pres="\t\t<presentation Label=\"pos\" file-name=\"$1/pos/$2\""
10   - if [ "$#" -eq 6 ]; then
11   - pres="$pres>"
12   - width=$(($5-$3))
13   - height=$(($6-$4))
14   - pres="$pres\n\t\t\t<data:bbox height=\"$height\" width=\"$width\" x=\"$3\" y=\"$4\" />"
15   - pres="$pres\n\t\t</presentation>"
16   - else
17   - pres="$pres />"
18   - fi
19   - printf "$pres\n"
  7 + width=$(($3-$1))
  8 + height=$(($4-$2))
  9 + echo -e "\t\t\t<data:bbox height=\"$height\" width=\"$width\" x=\"$1\" y=\"$2\" />"
20 10 }
21   -# export writePresentation so xargs can call it using bash -c below
22   -export -f writePresentation
23   -SEDREGEX='s/.*(\([0-9]*\), \([0-9]*\)) - (\([0-9]*\), \([0-9]*\))/writeIt \1 \2 \3 \4/'
  11 +# export printBBox so xargs can call it using bash -c below
  12 +export -f printBBox
  13 +SEDREGEX='s/.*(\([0-9]*\), \([0-9]*\)) - (\([0-9]*\), \([0-9]*\))/printBBox \1 \2 \3 \4/'
24 14  
25 15 echo '<?xml version="1.0" encoding="UTF-8"?>'
26 16 echo '<biometric-signature-set>'
... ... @@ -32,12 +22,15 @@ for fullpath in INRIAPerson/$1/pos/*; do
32 22 echo -e "\t<biometric-signature name=\"${filename%.*}\">"
33 23  
34 24 # if this folder has annotations, add bounding boxes
  25 + echo -en "\t\t<presentation Label=\"pos\" file-name=\"$1/pos/$filename\""
35 26 if [ -d INRIAPerson/$1/annotations ]; then
  27 + echo ">"
36 28 annotation="INRIAPerson/$1/annotations/${filename%.*}.txt"
37   - grep 'Bounding box' $annotation | sed "$SEDREGEX" | xargs -n 5 bash -c "writePresentation $1 $filename \$@"
38   - # otherwise, just the normal presentation
  29 + grep 'Bounding box' $annotation | sed "$SEDREGEX" | xargs -n 5 bash -c 'printBBox $@'
  30 + echo -e "\t\t</presentation>"
  31 + # otherwise, just end the presentation
39 32 else
40   - writePresentation $1 $filename
  33 + echo " />"
41 34 fi
42 35  
43 36 echo -e '\t</biometric-signature>'
... ...