Overview

Given three black-and-white images representing the red, green, and blue color channels, how can we align/combine them to produce a high quality color image?

My Approach

My solution aligns the red and blue channels to the green channel. As preprocessing, it crops out the outer 1/6 of the image, as we mainly care about the center of the image and the nasty borders on the sides can really screw things up. To align two channels, it tries to find a displacement that maximizes some image similarity metric. I used normalized cross-correlation (NCC), which is essentially a dot product between the two normalized images.

To find a good displacement, I used an image pyramid, a recursive solution. I halve the resolution and find a good displacement for these smaller images. The equivalent displacement is used as a starting point for the larger images, and then I try all displacements in [-2, 2]. (Ideally, [-1, 1] is enough to cover all possible displacements, but a slightly larger range allows the algorithm to correct itself a bit.) I stop recursing when the width or height of the image is at most 30 pixels, in which I just assume the best displacement is no displacement. The image pyramid is much faster than exhaustive search. Since it builds off of low-res/blurred images, the image pyramid works with larger features within the image, and so I imagine it would be less affected by noise compared to exhaustive search.

My Colorized Images

cathedral.jpg


blue: (-5, -2)
red: (7, 1)


emir.tif


blue: (-49, -24)
red: (57, 17)


harvesters.tif


blue: (-59, -17)
red: (65, -3)


icon.tif


blue: (-41, -17)
red: (48, 5)


lady.tif


blue: (-55, -9)
red: (62, 4)


monastery.jpg


blue: (3, -2)
red: (6, 1)


nativity.jpg


blue: (-3, -1)
red: (4, -1)


self_portrait.tif


blue: (-78, -29)
red: (98, 8)


settlers.jpg


blue: (-7, 0)
red: (8, -1)


three_generations.tif


blue: (-52, -14)
red: (59, -3)


train.tif


blue: (-43, -6)
red: (43, 27)


turkmen.tif


blue: (-56, -21)
red: (60, 7)


village.tif


blue: (-65, -12)
red: (73, 10)


More Colorized Images

coins.tif


blue: (-55, 0)
red: (49, 5)


girls.tif


blue: (16, -10)
red: (26, 8)


painting.tif


blue: (-79, -20)
red: (74, 5)


police.tif


blue: (4, 23)
red: (46, -18)


street_vendors.tif


blue: (-49, -18)
red: (55, 1)