By Andrew Loeza
This project wanted us to take images that have been separated into 3 color channels and combine them into a properly aligned colored image. This was to be done with both low resolution .jpg images and higher resolution .tiff images. Moreover, for the .tiff images, we were required to implement an image pyramid for the alignment so that it would finish in a reasonable amount of time. While for the .jpg images, exhaustive search for the alignment could be used.
Lower resolution images (.jpg):
For the lower resolution images, the image was first loaded and separated into 3 equal height color channels, corresponding to blue, green, and red, in that order. Then, the borders of the images were temporarily cropped so that they wouldn't interfere with the alignment process. Finally, an x-displacement and a y-displacement were found by exhaustively shifting either the red or green layers over a chosen displacement range and selecting the one that ranked best by applying the SSD metric to the shifted layer and the blue layer.
Higher resolution images (.tiff):
For the higher resolution images, the method is essentially the same as for the lower resolution. The main caveat being that an image pyramid was implemented into the align function so that the displacement values could be found much quicker. Furthermore, in order to increase the performance even more, at each level of the image pyramid, only a subsection of the image is displaced and used in the SSD metric. As a result of both of these, the alignment process typically only takes around 13 seconds per image.
All of the images aligned correctly with the sole exception of the emir.tiff file, which due to differing brightness values in each layer, wasn't aligned properly by using the raw pixel values in the SSD metric. For the other images, simply cropping the border of each layer and running the image pyramid alignment algorithm produced very good results.
Cathedral
Green Layer Displacment: (2, 5)
Red Layer Displacement: (3, 12)Monastery
Green Layer Displacment: (2, -3)
Red Layer Displacement: (2, 3)Tobolsk
Green Layer Displacment: (3, 3)
Red Layer Displacement: (3, 7)Castle
Green Layer Displacment: (2, 33)
Red Layer Displacement: (5, 98)Train
Green Layer Displacment: (6, 42)
Red Layer Displacement: (32, 85)Harvesters
Green Layer Displacment: (17, 59)
Red Layer Displacement: (15, 124)Lady
Green Layer Displacment: (8, 51)
Red Layer Displacement: (11, 113)Icon
Green Layer Displacment: (18, 41)
Red Layer Displacement: (23, 90)Melons
Green Layer Displacment: (9, 82)
Red Layer Displacement: (12, 181)Three Generations
Green Layer Displacment: (14, 50)
Red Layer Displacement: (12, 110)Self Portrait
Green Layer Displacment: (29, 78)
Red Layer Displacement: (37, 175)Onion Church
Green Layer Displacment: (27, 50)
Red Layer Displacement: (37, 108)Workshop
Green Layer Displacment: (-1, 53)
Red Layer Displacement: (-12, 105)Emir
Green Layer Displacment: (24, 48)
Red Layer Displacement: (-74, -232)Extra Images:
Kartina
Green Layer Displacment: (13, 48)
Red Layer Displacement: (19, 113)Vases
Green Layer Displacment: (4, 25)
Red Layer Displacement: (6, 111)Korpus
Green Layer Displacment: (15, 17)
Red Layer Displacement: (24, 59)Chertovo
Green Layer Displacment: (-11, -27)
Red Layer Displacement: (-23, -14)Skala
Green Layer Displacment: (19, 2)
Red Layer Displacement: (20, -12)
In order to get a better result on the emir.tiff image, I decided to use skimage's canny edge detector to generate a less noisy version of each colored layer. Then, I used these new layers like masks on the original layers, in order to remove the pixels that were causing the misalignment to take place. The result of this is a much better aligned emir.tiff.
Green Layer Displacement: (23, 49)
Red Layer Displacement: (41, 106)