-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset_exposure.sh
More file actions
executable file
·69 lines (55 loc) · 1.83 KB
/
reset_exposure.sh
File metadata and controls
executable file
·69 lines (55 loc) · 1.83 KB
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
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
#
# Resets exposure and tint for all images in a panorama.
#
###############################################################################
# CONFIG
###############################################################################
if [[ -s "pano.conf" ]]; then
source "pano.conf" # Local overrides
fi
pushd ${BASH_SOURCE%/*} > /dev/null
if [[ -s "pano.conf" ]]; then
source "pano.conf" # General overrides
fi
: ${PTO:="$1"}
: ${EXPOSURE:="$2"}
: ${EXPOSURE:="14.0"}
popd > /dev/null
function usage() {
cat <<EOF
Usage: ./reset_exposure.sh <pto_file> [exposure] > <new_pto>
pto_file: A PTO file from Hugin or similar.
exposure: The wanted exposure value. Default is 14.0
Sample: ./reset_exposure.sh strange_colors.pto 14.5 > okay.pto
Resets exposure (Eev) for all images to the same value and resets tint
adjustment (Er and Eb) to 1.0. Normally used if the auto-exposure failed
and made some images very bright, dark or strangely colored.
(As of 2020-09-22 Hugin does not seem to have a build-in reset function)
EOF
exit $1
}
check_parameters() {
if [[ "-h" == "$PTO" ]]; then
usage
fi
if [[ -z "$PTO" ]]; then
>&2 echo "Error: No pto_file specified"
usage 2
fi
if [[ ! -s "$PTO" ]]; then
>&2 echo "Error: Unable to locate $PTO"
usage 3
fi
}
################################################################################
# FUNCTIONS
################################################################################
process() {
sed -e "s/Eev1[0-9]\?[.][0-9]\+/Eev${EXPOSURE}/" -e 's/Er[0-9][.][0-9]\+/Er1.0/' -e 's/Eb[0-9][.][0-9]\+/Eb1.0/' "$PTO"
}
###############################################################################
# CODE
###############################################################################
check_parameters "$@"
process