Debian Codegraph @

doc/html-original/ALE/download/ale-0.6.0-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 performing coordinate transformations and memory accesses at every pixel
45 can be expensive. Sections in this page describe the motivation for Monte
46 Carlo alignment, the ratio calculations used, the sampling algorithm, cache
47 behavior for the algorithm, randomization approaches, typical deviations from
48 the specified ratios, special handling of level-of-detail, and practical
49 observations regarding the use of Monte Carlo alignment.
50
51 <h2>Motivation</h2>
52
53 Performing large numbers of coordinate transformations and memory accesses in
54 order to determine alignment error can be computationally expensive. One
55 approach to mitigating this expense is to use reduced level-of-detail.
56 However, using reduced level-of-detail can also reduce alignment precision. In
57 particular, reducing the level of detail by a factor of two can make impossible
58 the task of precisely aligning a horizontal line one pixel high. However, if
59 just a few pixels from the line are sampled at full detail, exact alignment is
60 possible.
61
62 <h2>Ratio Calculations</h2>
63
64 <p>In Monte Carlo alignment, a ratio
65
66 <blockquote>
67 <i>s = (expected # of pixel
68 samples) / (# of total pixels in the accumulated image)</i>
69 </blockquote>
70
71 is specified. From this ratio, a new ratio
72
73 <blockquote>
74 <i>u = (expected # of unsampled pixels) / (expected # of sampled pixels)</i>
75 </blockquote>
76
77 is calculated. Pixels are sampled in such a manner that <i>u</i> is
78 approximately satisified.
79
80 <p>At this stage, the region of overlap with the new frame is not considered.
81 With a limited area of overlap, the number of actual samples contributing to
82 the final error value will typically be reduced proportionally. (Angelo Pesce
83 has pointed out that better approaches may be possible, wherein explicit
84 calculation of overlapping areas reduces the number of coordinate
85 transformations performed.)
86
87 <h2>Sampling Algorithm</h2>
88
89 <p>Pixels are considered in order of index, where the accumulated image pixel
90 at position <i>(i, j)</i> is numbered with an index <i>(i * width + j)</i>.
91 In order of index, we skip and sample pixels in such a manner that the
92 expected size of a run of consecutive skipped pixels preceding a sampled pixel
93 is <i>u</i>. We select the size of each run of consecutive skipped pixels as
94 follows:
95
96 <p>If <i>2 * u</i> is an integer, then we draw uniformly from integer values in
97 the interval <i>[0,2u]</i>. If it is not an integer, then we draw from integer values in
98 the interval <i>[0,2u + 1]</i> in such a manner that integer values in
99 <i>[0,2u]</i> are equally likely to be chosen. (There is only one probability
100 distribution of this kind that satisfies the expected value <i>u</i>. Version
101 0.4.3 deviates slightly from this distribution, and so a deviation in the
102 expected value of <i>s</i> occurs, as outlined in this <a
103 href="ratios/">table</a>. This problem is fixed in version 0.4.4.)
104
105 <p>(Also, see the section below on interaction with level-of-detail.)
106
107 <h2>Cache behavior</h2>
108
109 <p>Since indices are monotonically increasing in memory address, this approach
110 to sampling may make effective use of memory cache where other approaches (e.g.
111 repeated random draws from the entire index space) would not.
112
113 <h2>Randomization</h2>
114
115 ALE versions 0.4.7 and earlier do not reseed the pseudorandom number generator,
116 and so a new random subset is selected every time the error function is
117 evaluated. Hence, as more or fewer of the pixels critical to alignment are
118 sampled, the reported alignment can worsen or improve even in the absence of
119 any change in transformation.
120
121 <p>With this approach, since many transformations are inspected during the
122 alignment of any given frame, it is likely, especially with greater precision
123 of alignment, that some measured differences between transformations are due to
124 a difference in sample sets rather than a difference in alignment accuracy.
125
126 <p>By reseeding the pseudorandom number generator, ALE versions 0.4.8 and later
127 instead use a consistent set of pixels from the accumulated image when
128 comparing two transformations. Tests sampling 3% of pixels from a set of
129 320x240 frames indicate that this approach improves alignment.
130
131 <h2>Sampling characteristics</h2>
132
133 For an image with 100,000 pixels and specified
134 <i>s</i> in the interval <i>[0.005,0.995]</i>, ALE's sampling method results in
135 a ratio <i>s</i> within 0.000003 of the specified <i>s</i>. This number
136 improves with image size. These results are outlined in the <a href="ratios/">table</a> linked
137 above. However, note that s only represents an expected value, and the actual number
138 of sampled pixels may vary by more than the numbers given here.
139
140 <h2>Interaction with level-of-detail</h2>
141
142 <p>When reduced level-of-detail is used, the number of reduced-detail pixels
143 sampled is taken to be a percentage of the total number of pixels in the
144 full-detail image, rather than as a percentage of the total number of pixels in
145 the reduced-detail image. (When this fraction of pixels in the full-detail
146 image is more than the number of reduced-detail pixels available, all
147 reduced-detail pixels are used.) This may improve the likelihood of successful
148 alignment, but may also add overhead to the alignment process.
149
150 <h2>Use of Monte Carlo Alignment</h2>
151
152 <p> If it is not known in advance what settings will work well for a series of
153 frames, it may be desirable to begin by sampling a small percentage of pixels,
154 saving the results of alignment, and then, if the output suggests that proper
155 alignment is occuring, performing more precise alignment with a larger
156 percentage of pixels on later passes, using smaller perturbation upper bounds.
157 If alignment problems occur on the first pass, the percentage of pixels can be
158 increased and alignment performed again.</p>
159
160 <br><br>
161
162 <hr>
163 <i>Copyright 2002, 2003, 2004 <a href="mailto:[email protected]">David Hilvert</a></i>
164 <p>Verbatim copying and distribution of this entire article is permitted in any
165 medium, provided this notice is preserved.
166 </body>
167 </html>