-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHDRnow.sh
executable file
·126 lines (98 loc) · 3.32 KB
/
HDRnow.sh
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Copyright (C) 2013 Felix Passenberg
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# Autor:
# Felix Passenberg <fc.passenberg@gmail.com>
#
echo "erzeuge 'HDR' Bilder"
echo "convert to tif"
RAW=0
for file in $(ls ./*.NEF ); do
RAW="1"
echo "convert: $file"
ufraw-batch --wb=camera --gamma=0.45 --linearity=0.00 --exposure=0.0 --saturation=1.0 --rotate=camera --out-depth=16 --zip --out-type=tiff --overwrite --create-id=no $file
done
if [ $RAW != "1" ]
then
for file in $(ls ./*.JPG ); do
echo "convert: $file"
#convert "./zzz_verkleinern/$file" -resize '1920x1920>' -quality 88% "./zzz_verkleinern/klein/klein-$file"
convert "./$file" "./$file.tif"
done
fi
if [ $RAW -eq "1" ]
then
PREF="DSC_????"
else
PREF="DSC_????.JPG"
fi
echo "aligning"
align_image_stack -a align $PREF.tif
echo "generiere hdr mit enfuse"
enfuse -o enfuse.tif align????.tif
echo "convert back to jpg"
convert enfuse.tif -quality 95 hdr.jpg
echo "compressing enfuse"
convert enfuse.tif -compress zip enfuse.tif
touch hdr.jpg
echo "hdrgen"
touch hdrgen.hdrgen
I=0
if [ $RAW != "1" ]
then
#jpeg2hdrgen DSC*.JPG > hdrgen.hdrgen
for file in $(ls DSC*.JPG ); do
this=$(printf "%.4d" "$I")
dat=`echo $file | sed -e "s/DSC.*JPG/align$this.tif/" `
time=`exiftool -exposuretime $file | sed 's/.*: //g' | sed 's|1/||'`
blende=`exiftool -fnumber $file | sed 's/.*: //g' `
iso=`exiftool -iso $file | sed 's/.*: //g'`
toecho="$dat $time $blende $iso 0"
echo $toecho >> hdrgen.hdrgen
echo $toecho
I=$(($I+1))
done
pfsinhdrgen hdrgen.hdrgen | pfshdrcalibrate -b 8 -x | pfsout pfs.hdr
else
for file in $(ls *.NEF ); do
this=$(printf "%.4d" "$I")
dat=`echo $file | sed -e "s/DSC.*NEF/align$this.tif/" `
time=`exiftool -exposuretime $file | sed 's/.*: //g' | sed 's|1/||'`
blende=`exiftool -fnumber $file | sed 's/.*: //g'`
iso=`exiftool -iso $file | sed 's/.*: //g'`
toecho="$dat $time $blende $iso 0"
echo $toecho >> hdrgen.hdrgen
echo $toecho
I=$(($I+1))
done
pfsinhdrgen hdrgen.hdrgen | pfshdrcalibrate -b 16 -x | pfsout pfs.hdr
#dcraw2hdrgen DSC*.NEF | sed -e "s/NEF/tif/" > hdrgen.hdrgen
fi
echo "pfstmo"
pfsin pfs.hdr | pfstmo_mantiuk06 -e 1 -s 1 | pfsgamma --gamma 2.2 | pfsoutimgmagick pfstmo_mantiuk06.tif
pfsin pfs.hdr | pfstmo_fattal02 -s 1 | pfsoutimgmagick pfstmo_fattal02.tif
pfsin pfs.hdr | pfstmo_reinhard02 --key 0.5 --phi 1 -s 1 | pfsoutimgmagick pfstmo_reinhard02.tif
convert pfstmo_fattal02.tif -compress zip pfstmo_fattal02.tif
convert pfstmo_mantiuk06.tif -compress zip pfstmo_mantiuk06.tif
convert pfstmo_reinhard02.tif -compress zip pfstmo_reinhard02.tif
for file in $(ls ./DSC*.tif ); do
rm $file
done
rm *.ufraw
rm align*
rm hdrgen.hdrgen
echo "finish"