Project 1: Images of the Russian Empire

In this project, I implemented a straightforward image pyramid aligning two images, finding alignments by manually searching across a (-15,15) area, taking the maximum NCC value. The image pyramid adjusts by accumulating the shifts from subsequent levels. The biggest issue I faced was a bug in how the image adjustments accumulated; I only found out when I realized that all final adjustments to full-size images were still bounded by the (-15,15) box. The moral, I suppose, is to always double check your recursion logic.

cathedral.jpg
Red shift: ( 8 , 3 ) Green shift: ( 3 , 1 )
icon.tif
Red shift: ( 177 , 45 ) Green shift: ( 81 , 33 )
emir.tif
Red shift: ( 67 , -782 ) Green shift: ( 49 , 24 )

This was the only image in the sample set that failed to align. It's fairly easy to see why, just by taking a look at the images: the blue channel and the red channel, over the entire expanse of the emir's robe, are basically inverts of one another, since the "real" color is a saturated blue. As such, the NCC for the correct alignment will be quite low, and the highest NCC value will have the least amount of overlap in that area.

emir.tif (using Sobel horizontal edge kernel as feature)
Red shift: ( 105 , 41 ) Green shift: ( 49 , 24 )

After experimenting with a few different convolutional matrices, I found that using Sobel edges as features instead of the original image data resulted in a correct alignment for the image of the Emir. Interestingly, generic edge detection with a ((-1,-1,-1),(-1,8,-1),(-1,-1,-1)) matrix failed to produce usable results for this image, and using vertical Sobel edges seemed to align the image offset in the X direction properly, but the images remained misaligned vertically.

lady.tif
Red shift: ( 119 , 12 ) Green shift: ( 56 , 8 )
melons.tif
Red shift: ( 178 , 13 ) Green shift: ( 82 , 10 )
monastery.jpg
Red shift: ( 3 , 2 ) Green shift: ( -3 , 2 )
nativity.jpg
Red shift: ( 8 , 0 ) Green shift: ( 3 , 1 )
old_cross.tif
Red shift: ( 47 , 2 ) Green shift: ( 20 , 7 )
three_generations.tif
Red shift: ( 112 , 11 ) Green shift: ( 53 , 14 )
tobolsk.jpg
Red shift: ( 6 , 3 ) Green shift: ( 3 , 3 )
train.tif
Red shift: ( 87 , 32 ) Green shift: ( 42 , 6 )
village.tif
Red shift: ( 138 , 22 ) Green shift: ( 64 , 12 )
workshop.tif
Red shift: ( 105 , -12 ) Green shift: ( 53 , 0 )
monument.tif
Red shift: ( 60 , 29 ) Green shift: ( 24 , 21 )
standard.tif
Red shift: ( 120 , -50 ) Green shift: ( 50 , -25 )