1pfstmo_fattal02(1) General Commands Manual pfstmo_fattal02(1)
2
3
4
6 pfstmo_fattal02 - Gradient domain high dynamic range compression
7
9 pfstmo_fattal02 [--alpha <val>] [--beta <val>] [--gamma <val>] [--satu‐
10 ration <val>] [--noise <val>] [--detail-level <val>] [--black-point
11 <val>] [--white-point <val>] [--multigrid] [--verbose] [--help]
12
14 This command implements a tone mapping operator as described in:
15
16 Gradient Domain High Dynamic Range Compression R. Fattal, D. Lischin‐
17 ski, and M. Werman In ACM Transactions on Graphics, 31(3), p. 249,
18 2002.
19
20 With respect to the original paper, this program provides additional
21 parameter which limits the amplification of noise. The noise is often
22 starkly amplified because of division by zero in one of the equations
23 in the paper. Extension contributed by Przemyslaw Bazarnik.
24
25 At the core of the programme is a Poisson PDE which as suggested in the
26 original paper is solved using a Full Multigrid Algorithm. However,
27 this is an iterative solver which seems to lose accuracy when applied
28 to higher resolution images resulting in halo effects and surreal look‐
29 ing images. For that reason a second solver has been implemented using
30 the discrete cosine transform as the underlying method and is consider‐
31 ably more accurate mainly because it is a direct solver. This solver is
32 the preferred method and is used by default. The old multigrid solver
33 can be selected with the --multigrid (-m) option.
34
36 --alpha <val>, -a <val>
37
38 Set alpha parameter. This parameter is depreciated as setting a
39 <val> other than 1.0 has only the effect of a global gamma
40 adjustment of the luminance channel which can be directly speci‐
41 fied using the --gamma option. See the paper for the definition
42 of alpha. It can be shown, although not mentioned in the paper,
43 that setting alpha other than 1.0 has the same effect as setting
44 gamma = alpha^(k*(1-beta)), where beta is the value as specified
45 by --beta and k is the number of levels of the Gaussian Pyramid
46 (see paper for details), which depends on the image pixel size
47 (smallest k so that 2^(k+detail_level) >=
48 min(width,height)/MSIZE, MSIZE see source code, e.g. 8 or 32).
49
50 --beta <val>, -b <val>
51
52 Set beta parameter. <val> sets the strength of gradient (local
53 contrast) modification. Suggested range is 0.8 to 0.96, default
54 is 0.9 (see paper for details). Value of 1 does not change con‐
55 trasts, values above 1 reverse the effect: local contrast is
56 stretched and details are attenuated. Values below 0.5 lead to
57 very strong amplification of small contrast, so consider using
58 --noise parameter to prevent noise.
59
60 --gamma <val>, -g <val>
61
62 Set luminance gamma adjustment. This can be described as a
63 global contrast enhancement and is applied after the local
64 enhancement as specified by the parameter --beta is performed.
65 Gamma adjustment or correction is defined by a power-law, in
66 this case
67 L_out(x,y) = L_in(x,y)^gamma, where L_in(x,y)=exp(I(x,y)) is
68 the luminance value after the local contrast enhancement (I is
69 the solution of the Poisson PDE). The suggested range for <val>
70 is 0.6 to 1.0, default is 0.8.
71
72 --saturation <val>, -s <val>
73
74 Amount of color saturation. Suggested range is 0.4 to 0.8.
75 Default value: 0.8.
76
77 --noise <val>, -n <val>
78
79 Reduces the gradient amplification value for gradients close to
80 0 and reduces noise as a result. <val> defines gradient value
81 (luminance difference of adjacent pixels) which is treated as
82 noise. Suggested range is 0.0 to the value of alpha. Default
83 value calculated based on alpha: 0.001*alpha.
84
85 --detail-level <val>, -d <val>
86
87 Specifies up to which detail level the local contrast enhance‐
88 ment should be performed. It basically means that local contrast
89 levels within small squares of pixel size 2^<val> are not
90 changed. In the implementation this corresponds to removing the
91 <val> finest levels of the Gaussian Pyramid as described in the
92 paper, i.e. the paper only considers <val>=0. Suggested values
93 are 1, 2 or 3; 3 for high resolution images. The default is 3
94 for --fftsolver, and 0 if the original multi-level solver is
95 used (to be consistent with the paper).
96
97
98 --white-point <val>, -w <val>
99
100 Specifies the percentage of pixels which are allowed to be over‐
101 exposed and therefore blown out. This can be useful for example
102 when there is a very bright object in the image like the sun and
103 details of it do not need to be resolved. As a result the over‐
104 all image will look brighter the greater <val> is. Default is
105 0.5.
106
107 --black-point <val>, -k <val>
108
109 Same as --white-point but for under-exposed pixels. Default is
110 0.1.
111
112 --multigrid, -m
113
114 Enable the use of the multigrid solver as suggested by the orig‐
115 inal paper. For accuracy the default fft solver is generally
116 recommended especially when using high resolution images. The
117 user will benefit by obtaining photo-realistic rather than sur‐
118 real looking images. The fft solver is also faster despite the
119 fact it is only O(n*log n) with n=width*height, as compared to
120 O(n) for the multigrid solver. The speed improvement is thanks
121 to the very efficient fftw3 library which is used to calculate
122 the discrete cosine transform.
123
124
125 --verbose
126
127 Print additional information during program execution.
128
129 --help
130
131 Print list of command line options.
132
134 pfsin memorial.hdr | pfstmo_fattal02 -v -t | pfsout memorial.png
135
136 Tone map image (using fft solver) and save it in png format.
137
138 pfsin memorial.hdr | pfstmo_fattal02 -v -t -b 0.85 -g 0.7 -w 2.0 \
139 | pfsout memorial.png
140
141 Tone map image (using fft solver) with stronger contrast modifi‐
142 cation than default, i.e. beta=0.85, gamma=0.7 and white point
143 2.0%.
144
145 pfsin memorial.hdr | pfstmo_fattal02 -v | pfsout memorial.png
146
147 Tone map image (old style) and save it in png format.
148
150 pfsin(1) pfsout(1) pfsview(1)
151
153 For stronger local contrast enhancements (beta<0.9) the fft solver
154 (--fftsolver) might produce slightly dark image corners. This can be
155 mitigated using bigger values for the --noise parameter.
156
157 With a value of --detail-level greater than 0, the internal implementa‐
158 tion could be made much more efficient as only a reduced sized PDE
159 would need to be solved, greatly improving speed.
160
162 Please report bugs and comments on implementation to the pfstools dis‐
163 cussion group (http://groups.google.com/group/pfstools). For bugs spe‐
164 cific to the FFT solver email Tino Kluge <tino.kluge@hrz.tu-chem‐
165 nitz.de>.
166
167
168
169 pfstmo_fattal02(1)