My algorithm uses a Sobel edge filter to isolate the edges of shapes within the 3 pictures before attempting to combine them. The offset which provides the smallest difference between the two edge detected images that are being compared is chosen as the correct offset. It works in most of the images I tried.

I did a lot of fooling around with various parts of the algorithm without improving the results on the whole. The only small tweak which had a large effect was raising the edge detected images element wise to a power of 0.2, which improved the results dramatically by further accentuating the edges. 0.2 seemed to be the magic number, providing better results than 0.15 and 0.25

I also cropped the top and bottom by the larger vertical shift and the sides by 1/20th the width of the picture in order to cut out the ugly sides. It streched the images a little, which doesn't make sense to me since I thought crop just made the image smaller, but I still think it looks better. Here they are:

This one is off a bit

This one didn't work but it looks cool: