Commit 10d6fd414e9c4cd06aee93b1ae228ec1c121c0df

Authored by Austin Van Blanton
1 parent 01a923b2

Add comments to INRIAPerson sigset generator script

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/
3 7 writePresentation()
4 8 {
5 9 pres="\t\t<presentation Label=\"pos\" file-name=\"$1/pos/$2\""
... ... @@ -14,27 +18,37 @@ writePresentation()
14 18 fi
15 19 printf "$pres\n"
16 20 }
17   -# for xargs calling bash below
  21 +# export writePresentation so xargs can call it using bash -c below
18 22 export -f writePresentation
19 23 SEDREGEX='s/.*(\([0-9]*\), \([0-9]*\)) - (\([0-9]*\), \([0-9]*\))/writeIt \1 \2 \3 \4/'
20 24  
21 25 echo '<?xml version="1.0" encoding="UTF-8"?>'
22 26 echo '<biometric-signature-set>'
  27 +
  28 +# print out the positive image sigs
23 29 for fullpath in INRIAPerson/$1/pos/*; do
  30 + # get just the filename, minus the path
24 31 filename=$(basename "$fullpath")
25 32 echo -e "\t<biometric-signature name=\"${filename%.*}\">"
  33 +
  34 + # if this folder has annotations, add bounding boxes
26 35 if [ -d INRIAPerson/$1/annotations ]; then
27 36 annotation="INRIAPerson/$1/annotations/${filename%.*}.txt"
28 37 grep 'Bounding box' $annotation | sed "$SEDREGEX" | xargs -n 5 bash -c "writePresentation $1 $filename \$@"
  38 + # otherwise, just the normal presentation
29 39 else
30 40 writePresentation $1 $filename
31 41 fi
  42 +
32 43 echo -e '\t</biometric-signature>'
33 44 done
  45 +
  46 +# print out the negative image sigs
34 47 for fullpath in INRIAPerson/$1/neg/*; do
35 48 filename=$(basename "$fullpath")
36 49 echo -e "\t<biometric-signature name=\"${filename%.*}\">"
37 50 echo -e "\t\t<presentation Label=\"neg\" file-name=\"$1/neg/$filename\" />"
38 51 echo -e '\t</biometric-signature>'
39 52 done
  53 +
40 54 echo '</biometric-signature-set>'
... ...