-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess-all.bash
executable file
·60 lines (48 loc) · 1.24 KB
/
process-all.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
#
# Runs every PNG file found under the current directory through the filter
declare topDir="${1:-.}";
shift;
declare -i found=0;
declare -i missed=0;
declare missing_files="";
is_output_file() {
# If no "-" in file name then OK
if [ "${f//-/}" == "${f}" ]; then
return 1;
fi
# If it has -step somewhere in the name, assume it is an output file
if [ "${f//-step/}" != "${f}" ]; then
return 0;
fi
# Specific name checks
for e in "-blurred" "-bw" "-contours" "-cropped" "-dialate" "-erode" \
"-hsv" "-orig.png" "-polygons" \
"-red.png" "-yellow.png"; do
if [ "${f//${e}/}" != "${f}" ]; then
# File name contained one of the common output names, consider as output file
return 0;
fi
done
return 1;
}
for f in $(find ${topDir} -name "*.png" | sort); do
if is_output_file "${f}"; then
continue;
fi
echo -e "\nProcessing: ${f} ";
if ./avc-vision -f ${f} "${@}"; then
found=$((found + 1));
else
missed=$((missed + 1));
missing_files="${missing_files} $f";
fi
done
declare -i total=$((found + missed));
echo "
Found stanchion in ${found} of the ${total} images (missed ${missed})
"
for f in ${missing_files}; do
echo " $f";
done
exit ${missed};