The goal of this project is to extract 3 color channel images, place them on top of each other, and align them to form a single RGB color image. This will be done on the digitized Prokudin-Gorskii glass plate images.
The first step was to separate the input images into 3 RGB color channels. The goal is to minimize the differences between the color channels when aligning them. To calculate this difference, I used the L2 norm, also known as the Sum of Squared Differences distance metric. Minimizing these differences allows for better alignment when stacking the color channels and consequently, a less blurry and more clear image.
For smaller images, I used an exhaustive search to find how much each image should be displaced to minimize our image matching metric. I keep the blue color channel the same and align the green and red color channels to this one. To accomplish this, I search over a window of possible displacements of [-15, 15] pixels for both the x and y axes, scoring each one using the L2 norm metric. The displacements that achieve the lowest image matching metric are used to align the 3 color channels.
For larger images, exhaustive search is no longer feasible so I use an image pyramid because it is a faster search procedure. I used 4 levels on the pyramid, dividing the height and width dimensions of the images by the following values: 16, 8, 4, 2. I process sequentially starting from the smallest image and update the estimate of best displacement after each level.
A problem that occurred was that some images that I ran my alignment algorithm on still came out blurry and/or misaligned. To solve this, I cropped each side of the color channels by 12.5% before inputting them into my algorithm. This helped because the center of the image is more likely to be similar across the 3 color channels.
cathedral.jpg Offset (x, y) Red channel: (3, 12) Green channel: (2, 5)
monastery.jpg Offset (x, y) Red channel: (2, 3) Green channel: (2, -3)
tobolsk.jpg Offset (x, y) Red channel: (3, 6) Green channel: (3, 3)
church.tif Offset (x, y) Red channel: (-2, 29) Green channel: (2, 12)
emir.tif Offset (x, y) Red channel: (-50, 40) Green channel: (12, 24)
harvesters.tif Offset (x, y) Red channel: (7, 62) Green channel: (8, 29)
icon.tif Offset (x, y) Red channel: (11, 45) Green channel: (8, 20)
lady.tif Offset (x, y) Red channel: (6, 56) Green channel: (4, 26)
melons.tif Offset (x, y) Red channel: (6, 89) Green channel: (5, 41)
onion_church.tif Offset (x, y) Red channel: (18, 54) Green channel: (13, 26)
self_portrait.tif Offset (x, y) Red channel: (18, 88) Green channel: (14, 39)
three_generations.tif Offset (x, y) Red channel: (6, 56) Green channel: (7, 26)
train.tif Offset (x, y) Red channel: (16, 44) Green channel: (3, 21)
workshop.tif Offset (x, y) Red channel: (-6, 52) Green channel: (0, 26)