|
3 | 3 | <head> |
4 | 4 | <meta charset="utf-8" /> |
5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
6 | | -<title>Image Processing Report</title> |
7 | | -<!-- Plain HTML template (no CSS). Replace placeholder text and image sources. --> |
| 6 | +<title>CS 180 Project 3A</title> |
8 | 7 | </head> |
9 | 8 | <body> |
10 | 9 | <header> |
11 | 10 | <h1>Project 3A: Image Wrapping and Mosaicing</h1> |
12 | 11 | <div align="center"> |
13 | 12 | <p> |
14 | | -by Daniel Cheng | October 1, 2025 |
| 13 | +by Author | Current Date |
15 | 14 | </p> |
16 | 15 | </div> |
17 | 16 | </header> |
@@ -93,9 +92,59 @@ <h3>Part 2</h3> |
93 | 92 |
|
94 | 93 | <h3>Part 3</h3> |
95 | 94 | <p> |
96 | | -Given the following image: |
| 95 | +With our homography matrix <i>H</i>, we can theoretically directly map the source image to the destination. However, the mapped pixels would not be all integers, which would result in pixels that are not mapped. TO solve this issue, we can use inverse mapping, by first starting with a destination pixel as a vector in the form [<i>u</i>, <i>v</i>, 1]<sup>T</sup> and multiplying the inverse <i>H<sup>-1</sup></i> to obtain the pixel from the source image that should be mapped to the destination pixel, and use 2 methods for computing the color of the pixel from the source: Nearest Neighbor and Bilinear Interpolation.<br> |
| 96 | +<br> |
| 97 | +To compute the bounds of where to take inverse mapping from, we can transform the coordinates (-0.5, -0.5), (<i>W</i> - 0.5, -0.5), (<i>W</i>, <i>H</i>), and (-0.5, <i>H</i> - 0.5), and round the result to the closest number in ℤ + 0.5, which is equivalent to casting the result to an integer, since we only need the integer coordinates. Below is a comparison of the 2 methods. |
97 | 98 | </p> |
98 | 99 |
|
| 100 | +<div align="center"> |
| 101 | +<figcaption style="margin-bottom:6px;">Original</figcaption> |
| 102 | +<img src="images/img_right.png" alt="img_right.png" width="50%"> |
| 103 | +</div> |
| 104 | + |
| 105 | +<div style="display:flex; flex-wrap:wrap; justify-content:center; text-align:center;"> |
| 106 | + |
| 107 | +<figure style="flex: 1 0 20%; margin:12px;"> |
| 108 | +<figcaption style="margin-bottom:6px;">Transformed using NN Interpolation</figcaption> |
| 109 | +<img src="images/imwraped_nearestneighborR.jpg" alt="imwraped_nearestneighborR.jpg" width="50%"> |
| 110 | +</figure> |
| 111 | + |
| 112 | +<figure style="flex: 1 0 20%; margin:12px;"> |
| 113 | +<figcaption style="margin-bottom:6px;">Transformed using Bilinear Interpolation</figcaption> |
| 114 | +<img src="images/imwraped_bilinearR.jpg" alt="imwraped_bilinearR.jpg" width="50%"> |
| 115 | +</figure> |
| 116 | +</div> |
| 117 | + |
| 118 | +<p> |
| 119 | +We can also perform image rectification using this tool by transforming a non-rectangular region into a rectangular one. Because we only care about the pixels in the selected region, we can precompute the final dimensions of the rectangle and only perform inverse mapping on the given region. Below are 2 examples of rectifying an image: |
| 120 | +</p> |
| 121 | + |
| 122 | +<div style="display:flex; flex-wrap:wrap; justify-content:center; text-align:center;"> |
| 123 | + |
| 124 | +<figure style="flex: 1 0 20%; margin:12px;"> |
| 125 | +<figcaption style="margin-bottom:6px;">Original</figcaption> |
| 126 | +<img src="images/evacuationplan.png" alt="evacuationplan.png" width="50%"> |
| 127 | +</figure> |
| 128 | + |
| 129 | +<figure style="flex: 1 0 20%; margin:12px;"> |
| 130 | +<figcaption style="margin-bottom:6px;">Rectified</figcaption> |
| 131 | +<img src="images/ep_rectif.jpg" alt="ep_rectif.jpg" width="50%"> |
| 132 | +</figure> |
| 133 | +</div> |
| 134 | + |
| 135 | +<div style="display:flex; flex-wrap:wrap; justify-content:center; text-align:center;"> |
| 136 | + |
| 137 | +<figure style="flex: 1 0 20%; margin:12px;"> |
| 138 | +<figcaption style="margin-bottom:6px;">Original</figcaption> |
| 139 | +<img src="images/cs170.png" alt="cs170.png" width="50%"> |
| 140 | +</figure> |
| 141 | + |
| 142 | +<figure style="flex: 1 0 20%; margin:12px;"> |
| 143 | +<figcaption style="margin-bottom:6px;">Rectified</figcaption> |
| 144 | +<img src="images/cs170_rectif.jpg" alt="cs170_rectif.jpg" width="50%"> |
| 145 | +</figure> |
| 146 | +</div> |
| 147 | + |
99 | 148 | </main> |
100 | 149 | </body> |
101 | 150 | </html> |
0 commit comments