Skip to content

Commit d9b75ec

Browse files
authored
Update proj1.html
1 parent f186c16 commit d9b75ec

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

project-1/proj1.html

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
<body>
88

99
<h1>Project 1: Colorizing the Prokudin-Gorskii photo collection</h1>
10+
<div align="center">
11+
<p>
12+
by lesley330404
13+
</p>
14+
</div>
1015

1116
<!-- Section 1 -->
1217
<h2>Introduction</h2>
@@ -39,15 +44,16 @@ <h2>Naive Search</h2>
3944
<p>
4045
To find the best shift, the simplest way is to compute the NCC for every possible shift within the full image. However, not only is this inefficient, but the best shift would also just be (0, 0) for any image, since the crop would just be a copy of the original crop. To solve this issue, we need to limit how much the height can shift when aligning. Define <i>W</i> and <i>H</i> to be the width and height of the full image. Assume, for approximations, that each plate takes up exactly a third of the full image.<br>
4146
<br>
42-
Considering only the top/blue plate, we can start by setting the upper limit for the top edge to be <i>(0 + H/3) / 2 = H/6</i>, and the bottom edge to be <i>(2H / 3 + 1) / 2 = 5H / 6</i>. This means the top edge should be at least shifted down by <i>H/6 - 0 = H/6</i>, and the bottom edge by <i>5H / 6 - H/3 = H/2</i>. Therefore, a good place to start is a displacement of <i>(0, (H/6 + H/2) / 2) = (0, H/3)</i> with a search range of [<i>-H/6</i>, <i>H/6</i>]. For the bottom/red plate, the equivalent displacement is just <i>(0, -H/3)</i> with the same search range.<br>
47+
Considering only the top/blue plate, we can start by setting the upper limit for the top edge to be <i>(0 + H/3) / 2 = H/6</i>, and the bottom edge to be <i>(2H / 3 + H) / 2 = 5H / 6</i>. This means the top edge should be at least shifted down by <i>H/6 - 0 = H/6</i>, and the bottom edge by <i>5H / 6 - H/3 = H/2</i>. Therefore, a good place to start is a displacement of <i>(0, (H/6 + H/2) / 2) = (0, H/3)</i> with a search range of [<i>-H/6</i>, <i>H/6</i>]. For the bottom/red plate, the equivalent displacement is just <i>(0, -H/3)</i> with the same search range.<br>
4348
<br>
44-
Using a starting crop of {<i>(W/16, H/16), (W - W/16, H/3 - H/16)</i>} for the blue plate and a starting crop of {<i>(W/16, 2H / 3 + H/16), (W - W/16, H - H/16)</i>} for the blue plate, we can obtain the following best shifts:
49+
Using a starting crop of {<i>(W/16, H/16), (W - W/16, H/3 - H/16)</i>} for the blue plate and {<i>(W/16, 2H / 3 + H/16), (W - W/16, H - H/16)</i>} for the red plate, where the tuples are the upper left and lower right corner pixels in (<i>x</i>, <i>y</i>) form, we can obtain the following best shifts:
4550
</p>
4651

4752
<div class="two-up" style="display:flex;" role="group" aria-label="Image comparison">
4853

4954
<figure style="flex:1; text-align:center;">
5055
<div class="figure-wrap">
56+
<figcaption>cathedral.jpg</figcaption>
5157
<img class="media" src="images/cathedralNaive.jpg"
5258
alt="cathedralNaive.jpg" loading="lazy" width="50%"/>
5359
</div>
@@ -56,6 +62,7 @@ <h2>Naive Search</h2>
5662

5763
<figure style="flex:1; text-align:center;">
5864
<div class="figure-wrap">
65+
<figcaption>monastery.jpg</figcaption>
5966
<img class="media" src="images/monasteryNaive.jpg"
6067
alt="monasteryNaive.jpg" loading="lazy" width="50%"/>
6168
</div>
@@ -64,6 +71,7 @@ <h2>Naive Search</h2>
6471

6572
<figure style="flex:1; text-align:center;">
6673
<div class="figure-wrap">
74+
<figcaption>tobolsk.jpg</figcaption>
6775
<img class="media" src="images/tobolskNaive.jpg"
6876
alt="tobolskNaive.jpg" loading="lazy" width="50%"/>
6977
</div>
@@ -75,7 +83,9 @@ <h2>Naive Search</h2>
7583
<!-- Section 4 -->
7684
<h2>Image Pyramid</h2>
7785
<p>
78-
Unfortunately, because each crop has a dimension of <i>(7W / 8)</i> &times; <i>(5H / 24)</i>, the total number of NCC computations for each alignment is <i>((W - 7W / 8) + 1)</i> &times; <i>((H/3 - 5H / 24) + 1)</i> = <i>(W / 8 + 1)</i> &times; <i>(H / 8 + 1)</i> = <i>O(HW)</i>. Since each NCC computation requires <i>O(HW)</i> operations, aligning an image of dimensions <i>W</i> &times; <i>H</i> takes <i>O((HW)<sup>2</sup>)</i> time. Because the .tif files are about 9 &times; 9 = 81 times bigger than the .jpg files in dimension, performing the same search on these files will require 81<sup>2</sup> &approx; 6500x more time to compute, or 9-11 hours instead of 5-6 seconds. A more efficient method is required.
86+
Unfortunately, because each crop has a dimension of <i>(7W / 8)</i> &times; <i>(5H / 24)</i>, the total number of NCC computations for each alignment is <i>((W - 7W / 8) + 1)</i> &times; <i>((H/3 - 5H / 24) + 1)</i> = <i>(W / 8 + 1)</i> &times; <i>(H / 8 + 1)</i> = <i>O(HW)</i>. Since each NCC computation requires <i>O(HW)</i> operations, aligning an image of dimensions <i>W</i> &times; <i>H</i> takes <i>O((HW)<sup>2</sup>)</i> time using the naive search above. Because the .tif files are about 9 times bigger than the .jpg files in both dimensions, performing the same search on these files will take more than 6500x more time to compute (hours instead of seconds). A more efficient method is required.<br>
87+
<br>
88+
Instead of searching over the entire image, we can scale down the image to an appopriate size and
7989
</p>
8090
<div align="center">
8191
<img src="image4.jpg" alt="Description of image 4" width="400">

0 commit comments

Comments
 (0)