Debian Codegraph @

doc/html-original/ALE/download/ale-0.5.1-tech/alignment/error/mc/index.html

raw
1 <html>
2 <title>Monte Carlo Error Function</title>
3 <style type="text/css">
4 TABLE.ba { max-width: 678; text-align: center; padding-bottom: 15; padding-top: 5}
5 TABLE.inline { padding-right: 300; clear: left}
6 TD.text_table {padding-left: 2; padding-right: 2; border-width: 1}
7 H2 {clear: left}
8 P {max-width: none; padding-right: 300; clear: left}
9 BLOCKQUOTE {padding-right: 400 }
10 LI {max-width: 640; clear: left}
11 P.footer {max-width: none; width: auto; padding-left: 0}
12 P.header {max-width: none; width: auto; padding-left: 0}
13 HR.main {max-width: 640; clear: left; padding-left: 0; margin-left: 0}
14 HR.footer {clear: both}
15 </style>
16 </head><body>
17
18
19
20 <table align=right valign=top width=160>
21 <td valign=top height=600 width=160>
22 <a href="http://auricle.dyndns.org/ALE/">
23 <big>ALE</big>
24 <br>
25 Image Processing Software
26 <br>
27 <br>
28 <small>Deblurring, Anti-aliasing, and Superresolution.</small></a>
29 <br><br>
30 <big>
31 Local Operation
32 </big>
33 <hr>
34 localhost<br>
35 5393119533<br>
36 </table>
37
38
39
40 <p><b>[ <a href="../">Up</a> ]</b></p>
41 <h1>Monte Carlo Error Function</h1>
42
43 Monte Carlo alignment can decrease the time required to align large images,
44 since calculating transformations for every pixel is usually expensive.
45 Sections in this page describe the motivation for Monte Carlo alignment, the
46 ratio calculations used, the sampling algorithm, cache behavior for the
47 algorithm, randomization approaches, typical deviations from the specified
48 ratios, special handling of level-of-detail, and practical observations
49 regarding the use of Monte Carlo alignment.
50
51 <h2>Motivation</h2>
52
53 Transforming large numbers of points in order to determine alignment error can
54 be very computationally expensive. One approach to mitigating this expense is
55 to use reduced level-of-detail. However, using reduced level-of-detail can
56 also reduce alignment precision. In particular, reducing the level of detail
57 by a factor of two can make impossible the task of precisely aligning a
58 horizontal line one pixel high. However, if just a few pixels from the line
59 are sampled at full detail, exact alignment is possible.
60
61 <h2>Ratio Calculations</h2>
62
63 <p>In Monte Carlo alignment, a ratio
64
65 <blockquote>
66 <i>s = (expected # of pixel
67 samples) / (# of total pixels in the accumulated image)</i>
68 </blockquote>
69
70 is specified. From this ratio, a new ratio
71
72 <blockquote>
73 <i>u = (expected # of unsampled pixels) / (expected # of sampled pixels)</i>
74 </blockquote>
75
76 is calculated. Pixels are sampled in such a manner that <i>u</i> is
77 approximately satisified.
78
79 <h2>Sampling Algorithm</h2>
80
81 <p>Pixels are considered in order of index, where the accumulated image pixel
82 at position <i>(i, j)</i> is numbered with an index <i>(i * width + j)</i>.
83 In order of index, we skip and sample pixels in such a manner that the
84 expected size of a run of consecutive skipped pixels preceding a sampled pixel
85 is <i>u</i>. We select the size of each run of consecutive skipped pixels as
86 follows:
87
88 <p>If <i>2 * u</i> is an integer, then we draw uniformly from integer values in
89 the interval <i>[0,2u]</i>. If it is not an integer, then we draw from integer values in
90 the interval <i>[0,2u + 1]</i> in such a manner that integer values in
91 <i>[0,2u]</i> are equally likely to be chosen. (There is only one probability
92 distribution of this kind that satisfies the expected value <i>u</i>. Version
93 0.4.3 deviates slightly from this distribution, and so a deviation in the
94 expected value of <i>s</i> occurs, as outlined in this <a
95 href="ratios/">table</a>. This problem is fixed in version 0.4.4.)
96
97 <p>(Also, see the section below on interaction with level-of-detail.)
98
99 <h2>Cache behavior</h2>
100
101 <p>Since indices are monotonically increasing in memory address, this approach
102 to sampling may make effective use of memory cache where other approaches (e.g.
103 repeated random draws from the entire index space) would not.
104
105 <h2>Randomization</h2>
106
107 ALE versions 0.4.7 and earlier do not reseed the pseudorandom number generator,
108 and so a new random subset is selected every time the error function is
109 evaluated. Hence, as more or fewer of the pixels critical to alignment are
110 sampled, the reported alignment can worsen or improve even in the absence of
111 any change in transformation.
112
113 <p>With this approach, since many transformations are inspected during the
114 alignment of any given frame, it is likely, especially with greater precision
115 of alignment, that some measured differences between transformations are due to
116 a difference in sample sets rather than a difference in alignment accuracy.
117
118 <p>By reseeding the pseudorandom number generator, ALE versions 0.4.8 and later
119 instead use a consistent set of pixels from the accumulated image when
120 comparing two transformations. Tests sampling 3% of pixels from a set of
121 320x240 frames indicate that this approach improves alignment.
122
123 <h2>Sampling characteristics</h2>
124
125 For an image with 100,000 pixels and specified
126 <i>s</i> in the interval <i>[0.005,0.995]</i>, ALE's sampling method results in
127 a ratio <i>s</i> within 0.000003 of the specified <i>s</i>. This number
128 improves with image size. These results are outlined in the <a href="ratios/">table</a> linked
129 above. However, note that s only represents an expected value, and the actual number
130 of sampled pixels may vary by more than the numbers given here.
131
132 <h2>Interaction with level-of-detail</h2>
133
134 <p>When reduced level-of-detail is used, the number of reduced-detail pixels
135 sampled is taken to be a percentage of the total number of pixels in the
136 full-detail image, rather than as a percentage of the total number of pixels in
137 the reduced-detail image. (When this fraction of pixels in the full-detail
138 image is more than the number of reduced-detail pixels available, all
139 reduced-detail pixels are used.) This may improve the likelihood of successful
140 alignment, but may also add overhead to the alignment process.
141
142 <h2>Use of Monte Carlo Alignment</h2>
143
144 <p> If it is not known in advance what settings will work well for a series of
145 frames, it may be desirable to begin by sampling a small percentage of pixels,
146 saving the results of alignment, and then, if the output suggests that proper
147 alignment is occuring, performing more precise alignment with a larger
148 percentage of pixels on later passes, using smaller perturbation upper bounds.
149 If alignment problems occur on the first pass, the percentage of pixels can be
150 increased and alignment performed again.</p>
151
152 <br><br>
153
154 <hr>
155 <i>Copyright 2002, 2003 <a href="mailto:[email protected]">David Hilvert</a></i>
156 <p>Verbatim copying and distribution of this entire article is permitted in any
157 medium, provided this notice is preserved.
158 </body>
159 </html>