Debian Codegraph @

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

raw
1 <html>
2 <title>Monte Carlo Error</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
17 </head>
18 <body>
19
20
21
22
23
24
25 <table align=right valign=top width=160>
26 <td valign=top height=600 width=160>
27 <a href="http://auricle.dyndns.org/ALE/">
28 <big>ALE</big>
29 <br>
30 Image Processing Software
31 <br>
32 <br>
33 <small>Deblurring, Anti-aliasing, and Superresolution.</small></a>
34 <br><br>
35 <big>
36 Local Operation
37 </big>
38 <hr>
39 localhost<br>
40 5393119533<br>
41 </table>
42
43
44
45
46 <p><b>[ <a href="../">Up</a> ]</b></p>
47 <h1>Monte Carlo Error</h1>
48
49 <p>Use of Monte Carlo error can decrease the time required to align large images,
50 since performing coordinate transformations and memory accesses at every pixel
51 can be expensive. Sections in this page describe the motivation for Monte
52 Carlo alignment, the ratio calculations used, the sampling algorithm, cache
53 behavior for the algorithm, randomization approaches, typical deviations from
54 the specified ratios, special handling of level-of-detail, and practical
55 observations regarding the use of Monte Carlo error.
56
57 <h2>Motivation</h2>
58
59 <p>Performing large numbers of coordinate transformations and memory accesses in
60 order to determine alignment error can be computationally expensive. One
61 approach to mitigating this expense is to use reduced level-of-detail.
62 However, using reduced level-of-detail can also reduce alignment precision. In
63 particular, reducing the level of detail by a factor of two can make impossible
64 the task of precisely aligning a horizontal line one pixel high. However, if
65 just a few pixels from the line are sampled at full detail, exact alignment is
66 possible.
67
68 <h2>Ratio Calculations</h2>
69
70 <p>In Monte Carlo alignment, a ratio
71
72 <blockquote>
73 <i>s = (expected # of pixel
74 samples) / (# of total pixels in the accumulated image)</i>
75 </blockquote>
76
77 is specified. From this ratio, a new ratio
78
79 <blockquote>
80 <i>u = (expected # of unsampled pixels) / (expected # of sampled pixels)</i>
81 </blockquote>
82
83 is calculated. Pixels are sampled in such a manner that <i>u</i> is
84 approximately satisified.
85
86 <p>At this stage, the region of overlap with the new frame is not considered.
87 With a limited area of overlap, the number of actual samples contributing to
88 the final error value will typically be reduced proportionally. (Angelo Pesce
89 has pointed out that better approaches may be possible, wherein explicit
90 calculation of overlapping areas reduces the number of coordinate
91 transformations performed.)
92
93 <h2>Sampling Algorithm</h2>
94
95 <p>Pixels are considered in order of index, where the accumulated image pixel
96 at position <i>(i, j)</i> is numbered with an index <i>(i * width + j)</i>.
97 In order of index, we skip and sample pixels in such a manner that the
98 expected size of a run of consecutive skipped pixels preceding a sampled pixel
99 is <i>u</i>. We select the size of each run of consecutive skipped pixels as
100 follows:
101
102 <p>If <i>2 * u</i> is an integer, then we draw uniformly from integer values in
103 the interval <i>[0,2u]</i>. If it is not an integer, then we draw from integer values in
104 the interval <i>[0,2u + 1]</i> in such a manner that integer values in
105 <i>[0,2u]</i> are equally likely to be chosen.
106
107 <p>(Also, see the section below on interaction with level-of-detail.)
108
109 <h2>Cache behavior</h2>
110
111 <p>Since indices are monotonically increasing in memory address, this approach
112 to sampling may make effective use of memory cache where other approaches (e.g.
113 repeated random draws from the entire index space) would not.
114
115 <h2>Randomization</h2>
116
117 <p>ALE versions 0.4.7 and earlier do not reseed the pseudorandom number generator,
118 and so a new random subset is selected every time the error is evaluated.
119 Hence, as more or fewer of the pixels critical to alignment are sampled, the
120 reported alignment can worsen or improve even in the absence of any change in
121 transformation.
122
123 <p>With this approach, since many transformations are inspected during the
124 alignment of any given frame, it is likely, especially with greater precision
125 of alignment, that some measured differences between transformations are due to
126 a difference in sample sets rather than a difference in alignment accuracy.
127
128 <p>By reseeding the pseudorandom number generator, ALE versions 0.4.8 and later
129 instead use a consistent set of pixels from the accumulated image when
130 comparing two transformations. Tests sampling 3% of pixels from a set of
131 320x240 frames indicate that this approach improves alignment.
132
133 <h2>Sampling characteristics</h2>
134
135 <p>For an image with 100,000 pixels and specified
136 <i>s</i> in the interval <i>[0.005,0.995]</i>, ALE's sampling method results in
137 a ratio <i>s</i> within 0.000003 of the specified <i>s</i>. This number
138 improves with image size. (The results are outlined in a <a
139 href="ratios/">table</a>.) However, note that s only represents an expected
140 value, and the actual number of sampled pixels may vary by more than the
141 numbers given here.
142
143 <h2>Interaction with level-of-detail</h2>
144
145 <p>When reduced level-of-detail is used, the number of reduced-detail pixels
146 sampled is taken to be a percentage of the total number of pixels in the
147 full-detail image, rather than as a percentage of the total number of pixels in
148 the reduced-detail image. (When this fraction of pixels in the full-detail
149 image is more than the number of reduced-detail pixels available, all
150 reduced-detail pixels are used.) This may improve the likelihood of successful
151 alignment, but may also add overhead to the alignment process.
152
153 <br><br>
154
155 <hr>
156 <i>Copyright 2002, 2003, 2004 <a href="mailto:[email protected]">David Hilvert</a></i>
157 <p>Verbatim copying and distribution of this entire article is permitted in any
158 medium, provided this notice is preserved.
159 </body>
160 </html>