Project 1 Approach

For single resolution images, I bruteforce search for the correct offset within a 128x128 box. In an early approach, the similarity score is determined by the dot product between two normalized images, but it failed to align emir. So I handwrote a sobel filter using scipy.signal.convolve since high level functions are prohibited.

For high-resolution images, I scale the image down to about 1/8 and apply the same search algorithm within the 128x128 box. After that, the algorithm progresses up each step by a factor of 2, aligning the 1/4, 1/2, and 1/1 images successively. Note that you only have to search within a 2x2 box after the first alignment, which is a dramatic speedup.

Cropping

I attempted to use sobel filter and a loop to count the number of disrupting changes in rows and columns. I took the dot product between each row and its reverse, a low number signifies low self-similarity. It eventually didn't work out so I resorted to a fixed percentage.

Color Remapping

Instead of doing np.dstack, you can multiply each color channel by a vector of 3 color weights. You do that for all three channels and then add the results together.

Some images are omitted due to 25MB limit.

Plain output

Card image cap
Offset:2,5 3,12 cathedral.jpg
Card image cap
Offset:24,49 41,107 emir.jpg
Card image cap
Offset:18,60 14,123 harvesters.jpg
Card image cap
Offset:18,41 23,90 icon.jpg
Card image cap
Offset:8,53 14,114 lady.jpg
Card image cap
Offset:2,-3 2,3 monastery.jpg
Card image cap
Offset:1,3 0,8 nativity.jpg
Card image cap
Offset:9,35 20,123 pows.jpg
Card image cap
Offset:29,78 37,175 self_portrait.jpg
Card image cap
Offset:0,7 -1,15 settlers.jpg
Card image cap
Offset:13,52 10,110 three_generations.jpg
Card image cap
Offset:7,43 33,86 train.jpg
Card image cap
Offset:22,56 29,117 turkmen.jpg
Card image cap
Offset:12,64 22,137 village.jpg

Cropped

Card image cap
cathedral.jpg
Card image cap
emir.jpg
Card image cap
harvesters.jpg
Card image cap
icon.jpg
Card image cap
lady.jpg
Card image cap
monastery.jpg
Card image cap
nativity.jpg
Card image cap
nativity.jpg
Card image cap
self_portrait.jpg
Card image cap
settlers.jpg
Card image cap
three_generations.jpg
Card image cap
train.jpg
Card image cap
turkmen.jpg
Card image cap
village.jpg

Color Remapped

Card image cap
cathedral.jpg
Card image cap
emir.jpg
Card image cap
harvesters.jpg
Card image cap
icon.jpg
Card image cap
lady.jpg
Card image cap
monastery.jpg
Card image cap
nativity.jpg
Card image cap
nativity.jpg
Card image cap
self_portrait.jpg
Card image cap
settlers.jpg
Card image cap
three_generations.jpg
Card image cap
train.jpg
Card image cap
turkmen.jpg
Card image cap
village.jpg