Debian Codegraph @

doc/html-original/ALE/download/ale-0.7.x-tech/ip_update_rule/index.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <title>ALE Irani-Peleg Update Rule</title>
5 <style type="text/css">
6 TABLE.ba { max-width: 678; text-align: center; padding-bottom: 15; padding-top: 5}
7 TABLE.inline { padding-right: 300; clear: left}
8 TD.text_table {padding-left: 2; padding-right: 2; border-width: 1}
9 H2 {clear: left}
10 P {max-width: none; padding-right: 300; clear: left}
11 BLOCKQUOTE {padding-right: 400 }
12 LI {max-width: 640; clear: left}
13 P.footer {max-width: none; width: auto; padding-left: 0}
14 P.header {max-width: none; width: auto; padding-left: 0}
15 HR.main {max-width: 640; clear: left; padding-left: 0; margin-left: 0}
16 HR.footer {clear: both}
17 </style>
18
19 </head>
20 <body>
21
22
23
24
25
26
27 <table align=right valign=top width=160>
28 <td valign=top height=600 width=160>
29 <a href="http://auricle.dyndns.org/ALE/">
30 <big>ALE</big>
31 <br>
32 Image Processing Software
33 <br>
34 <br>
35 <small>Deblurring, Anti-aliasing, and Superresolution.</small></a>
36 <br><br>
37 <big>
38 Local Operation
39 </big>
40 <hr>
41 localhost<br>
42 5393119533<br>
43 </table>
44
45
46
47
48 <p><b>[ <a href="../">Up</a> ]</b></p>
49 <h1>ALE Irani-Peleg Update Rule</h1>
50
51 The Irani-Peleg update operator <b>U</b> is used iteratively to update the
52 final output of incremental rendering:
53
54 <blockquote>
55 <b>J<sub>0</sub> = I<sub>final</sub></b>
56 <br>
57 <b>J<sub>1</sub> = UJ<sub>0</sub></b>
58 <br>
59 <b>J<sub>2</sub> = UJ<sub>1</sub></b>
60 <br>
61 .
62 <br>
63 .
64 <br>
65 .
66 <br>
67 <b>J<sub>k</sub> = UJ<sub>k-1</sub></b>
68 </blockquote>
69
70 <h2>Modeling of the imaging process</h2>
71
72 <p>Given transformations <b>P<sub>x</sub></b> and <b>B<sub>x</sub></b>, linear
73 exposure adjustment <b>E<sub>x</sub></b>, linear and non-linear convolutions
74 <b>L</b> and <b>N</b>, discretization operator <b>D</b>, and extension operator
75 <b>C</b>, the imaging process can be modeled, starting with <b>s</b>, a
76 discrete approximation of the scene, as:
77
78 <blockquote>
79 <b>d<sub>x</sub> = DNCGDLE<sub>x</sub>B<sub>x</sub>P<sub>x</sub>Cs</b>
80 </blockquote>
81
82 <p>Note the extension operator to the left of <b>s</b>, which was not present
83 in the similar equation appearing on the main page. Since we are using only a
84 discrete approximation of the scene, it must first be made continuous, in order
85 to fit within the framework developed on the main page. As noted before, the
86 second extension operator, between <b>G</b> and <b>N</b>, is included for
87 convenience of implementation, and does not restrict the generality of the model.
88
89 <h2>Pixel-to-pixel weighting</h2>
90
91 <p>Since pixel values in <b>DLE<sub>x</sub>B<sub>x</sub>P<sub>x</sub>Cs</b> are
92 linear in pixel values of <b>Cs</b>, and hence linear in pixel values of
93 <b>s</b>, and since, similarly, pixel values of <b>d<sub>x</sub></b> are linear
94 in pixel values of <b>GDLE<sub>x</sub>B<sub>x</sub>P<sub>x</sub>Cs</b>, we can
95 define arrays of values <b>a</b> and <b>b</b> such that:
96
97 <blockquote>
98 <b>DLE<sub>x</sub>B<sub>x</sub>P<sub>x</sub>Cs(i, j) = &sum;<sub>(i', j')</sub> a<sub>x,i,j,i',j'</sub> * s(i', j')</b>
99 <br><br>
100 <b>d<sub>x</sub>(i, j) = &sum;<sub>(i', j')</sub> b<sub>x,i,j,i',j'</sub> * GDLE<sub>x</sub>B<sub>x</sub>P<sub>x</sub>Cs(i', j')</b>
101 </blockquote>
102
103 Hence, using <b>G</b> as a gamma correction function:
104
105 <blockquote>
106 <b>d<sub>x</sub>(i, j) = &sum;<sub>(i', j')</sub> b<sub>x,i,j,i',j'</sub> * G(&sum;<sub>(i'', j'')</sub> a<sub>x,i',j',i'',j''</sub> * s(i'', j''))</b>
107 </blockquote>
108
109 Note that, since <b>G</b> is non-linear, the inner sum cannot be moved outside of the enclosing parentheses.
110
111 <h2>Error calculation</h2>
112
113 <p>Given the model described above, we now have two ways to calculate a pixel value <b>d<sub>x</sub>(i, j)</b>: directly, from the input frame, or indirectly, from the scene approximation <b>s</b>. Hence, we can calculate an error between the two methods:
114
115 <blockquote>
116 <b>e<sub>x</sub>(i, j) = d<sub>x</sub>(i, j) - &sum;<sub>(i', j')</sub> b<sub>x,i,j,i',j'</sub> * G(&sum;<sub>(i'', j'')</sub> a<sub>x,i',j',i'',j''</sub> * s(i'', j''))</b>
117 </blockquote>
118
119 <h2>Backprojection (single stage)</h2>
120
121 Assume for the moment that our model of <b>d<sub>x</sub></b> were restricted in the following way, using a scene approximation <b>s'</b>:
122
123 <blockquote>
124 <b>d<sub>x</sub>(i, j) = &sum;<sub>(i', j')</sub> b<sub>x,i,j,i',j'</sub> * s'(i', j')</b>
125 </blockquote>
126
127 <p>This includes, as a special case, the scenario originally outlined by Irani and
128 Peleg, which considered a single convolution step. In this case, we can use a
129 backprojection array <b>c</b> to produce an updated image <b>Us'</b>:
130
131 <blockquote>
132 <b>Us'(i, j) = s'(i, j) + (1 / x<sub>max</sub>) * &sum;<sub>x</sub> &sum;<sub>(i', j')</sub> c<sub>x,i,j,i',j'</sub> * e<sub>x</sub>(i', j')</b>
133 </blockquote>
134
135 <p>For certain limited cases, Irani and Peleg have proved this update rule to
136 converge exponentially to the original scene. However, since the model used by
137 ALE includes two convolution steps that cannot, in general, be combined, ALE
138 uses a different update rule.
139
140 <h2>Backprojection (two-stage)</h2>
141
142 <p>The two-stage backprojection rule below could easily be extended to any
143 arbitrary number of stages, but ALE currently supports only two stages, in
144 accordance with the two-colorspace imaging model outlined above. The rule,
145 using <b>G<sup>-1</sup></b> as an inverse gamma correction function, is:</p>
146
147 <blockquote>
148 <b>Us(i, j) = s(i, j) + (1 / x<sub>max</sub>) &sum;<sub>x</sub> &sum;<sub>(i', j')</sub> c<sub>x,i,j,i',j'</sub> * (G<sup>-1</sup>(GDLE<sub>x</sub>B<sub>x</sub>P<sub>x</sub>Cs(i', j') + &sum;<sub>(i'', j'')</sub> f<sub>x,i',j',i'',j''</sub> * e<sub>x</sub>(i'',j'')) - DLE<sub>x</sub>B<sub>x</sub>P<sub>x</sub>Cs(i', j'))</b>
149 </blockquote>
150
151 <p>Where <b>f</b> is a second backprojection array. Schematically, the update
152 process looks something like the diagram below, based on an excerpt from the
153 ALE source code. The exposure re-estimation step shown in the diagram has not
154 been described here, but is available for inspection in the source. Also,
155 since ALE stores images internally using a linear representation, they must
156 first be converted back to a non-linear representation, as shown at the very
157 bottom of the diagram.</p>
158
159 <table border><tr><td>
160 <pre>
161 * The algorithm in the paper by Irani and Peleg looks something like this
162 * (PSF' is the backprojection kernel, and corresponds to what the authors of
163 * the paper call AUX):
164 *
165 * ===============================================================
166 * Forward Backward Binary Operators
167 * ---------------------------------------------------------------
168 *
169 * scene(n) ------> scene(n+1) <--- summation
170 *
171 * | ^
172 * | |
173 * PSF PSF'
174 * | |
175 * | ---------+ <--- difference
176 * V / |
177 *
178 * simulated(n) real
179 *
180 * ===============================================================
181 *
182 * The above approach assumes a single colorspace representation. However,
183 * consumer cameras sometimes perform sharpening in non-linear colorspace,
184 * whereas lens and sensor blurring occurs in linear colorspace. Hence, there
185 * can be two colorspaces involved; ALE accounts for this with linear and
186 * non-linear colorspace PSFs. Hence, the algorithm we use looks something
187 * like:
188 *
189 * ===============================================================
190 * Forward Backward Binary Operators
191 * ---------------------------------------------------------------
192 *
193 * scene(n) -----> scene(n+1) <--- summation
194 *
195 * | ^
196 * | |
197 * LPSF LPSF'
198 * | |
199 * | ----------+ <--- difference,
200 * V / | exposure
201 * re-estimation
202 * lsimulated(n) lreal(n)
203 *
204 * | ^
205 * | |
206 * unlinearize linearize
207 * | |
208 * V |
209 *
210 * lsim_nl(n) -----> lreal_nl(n) <--- summation
211 *
212 * | ^
213 * | |
214 * NLPSF NLPSF'
215 * | |
216 * | ----------+ <--- difference
217 * V / |
218 *
219 * nlsimulated(n) real_nl
220 *
221 * ^
222 * |
223 * unlinearize
224 * |
225 * |
226 *
227 * real
228 *
229 * ===============================================================
230 </pre>
231 </td></tr></table>
232
233 <h2>Backprojection Arrays</h2>
234
235 <p>The rules used for calculating backprojection arrays <b>c</b> and <b>f</b> are as follows:</p>
236
237 <blockquote>
238 <b>c<sub>x,i,j,i',j'</sub> = Y * b<sub>x,i,j,i',j'</sub></b>
239 <br><br>
240 <b>f<sub>x,i,j,i',j'</sub> = Z * a<sub>x,i,j,i',j'</sub></b>
241 </blockquote>
242
243 <p>Such that:
244
245 <!-- Ka and Kb had been swapped. Fixed August 8, 2004 --dhilvert -->
246
247 <blockquote>
248 <b>Y = - 0.9 / (max<sub>&omega;</sub> |FK<sub>b</sub>(&omega;)|)</b>
249 <br><br>
250 <b>Z = - 0.9 / (max<sub>&omega;</sub> |FK<sub>a</sub>(&omega;)|)</b>
251 </blockquote>
252
253 <p>where <b>F</b> is the fourier transform, <b>K<sub>a</sub></b> is the convolution kernel for <b>a</b>
254 in its native coordinate system, and <b>K<sub>b</sub></b> is the convolution kernel for <b>b</b> in its native coordinate
255 system.
256
257 <h2>Convergence for special cases</h2>
258
259 <p>In cases where at least one of <b>L</b>, <b>N</b>, or <b>G</b> is the
260 identity operator, or if <b>G</b> is linear, the technique outlined above can
261 be expressed in terms of the original method by Irani and Peleg, and will
262 converge exponentially if it meets the convergence criteria outlined in their
263 paper. Note that ALE makes certain approximations to obtain projection and
264 backprojection arrays that may hinder convergence in some cases. In particular,
265 the calculation of overlap areas involving non-identity transformations is not
266 exact.</p>
267
268 <h2>Certainty</h2>
269
270 <p>ALE's implementation of certainty for Irani-Peleg rendering modifies the rule
271 described above. Write the original rule as:</p>
272
273 <blockquote>
274 <b>Us(i, j) = s(i, j) + (1 / x<sub>max</sub>) &sum;<sub>x</sub> correction<sub>x</sub>(i, j)</b>
275 </blockquote>
276
277 <p>where <b>correction<sub>x</sub></b> represents the back-projected correction
278 for frame <b>x</b>. Let the re-estimated linear value <b>comp_real</b>,
279 <code>lreal(n)</code> in the diagram above, be defined as:
280
281 <blockquote>
282 <b>comp_real<sub>x</sub>(i, j) = G<sup>-1</sup>(GDLE<sub>x</sub>B<sub>x</sub>P<sub>x</sub>Cs(i, j) + &sum;<sub>(i'', j'')</sub> f<sub>x,i,j,i'',j''</sub> * e<sub>x</sub>(i'',j''))</b>
283 </blockquote>
284
285 Then the certainty-based rule for versions 0.7.x is:
286
287 <blockquote>
288 <b>Us(i, j) = s(i, j) + &sum;<sub>x</sub> &Kappa;(correction<sub>x</sub>, E<sub>x</sub>comp_real<sub>x</sub>, i, j) * correction<sub>x</sub>(i, j) / &sum;<sub>x</sub> K(correction<sub>x</sub>, E<sub>x</sub>comp_real<sub>x</sub>, i, j)</b>
289 </blockquote>
290
291 <p>Where <b>&Kappa;</b> is the symmetrically one-sided <a href="../certainty/">certainty</a> function.
292
293 <p>For version 0.8.0, the rule is:</p>
294
295 <blockquote>
296 <b>Us(i, j) = s(i, j) + &sum;<sub>x</sub> &Kappa;'(correction<sub>x</sub>, s, i, j) * correction<sub>x</sub>(i, j) / &sum;<sub>x</sub> &Kappa;'(correction<sub>x</sub>, s, i, j)</b>
297 </blockquote>
298
299 <p>Where <b>&Kappa;'</b> is the asymmetrically one-sided <a href="../certainty/">certainty</a> function. Note that this expression substitutes <b>s</b> for <b>E<sub>x</sub>comp_real<sub>x</sub></b>, resulting in estimate-based certainty.
300
301
302 <br>
303 <hr>
304 <i>Copyright 2002, 2003, 2004 <a href="mailto:[email protected]">David Hilvert</a></i>
305 <p>Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
306
307
308 </body>
309 </html>