For my image pyramid, I halved the size of the images until one of their dimensions was too small (I found that under 10 pixels was a good stopping point), and then aligned the images from there. Each level of the pyramid used the best guess of the level below it (doubled to account for the doubling of the image size) as a starting point, and then searched in a 49 pixel grid centered at that location for the best alignment.
For my alignment algorithm, I used the sum of squared differences as my distance metric. Although I tried normalized cross correlation and basic edge alignment, I found that SSD produced the best alignments.
I found that cropping the images prior to trying to align them vastly improved the results. I tried various values, and found that removing 10% from each edge before aligning the pictures produced the best results.
Below are the results of running my algorithm on the supplied images, as well as on nine other images I found online. The algorithm produces reasonable alignments for all images except for the third (a man sitting in a chair). I was able to get this image to align correctly by changing the amount of the image that was cropped, but this caused other images to be misaligned, so I reverted to my previous value.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |