← Back to Computer Vision Projects

Colorizing the Prokudin-Gorskii Photo Collection

I am given a collection of 3 black-and-white images, corresponding with pixel-values of RGB of a complete image. In this project, I align the 3 images with one another to produce a colored image. Blurriness in the images indicates poor alignment.

Tobolsk separated

Example of given, RGB-separated image. Top is b, middle is g, bottom is r.

Methods to Combine the Images

The images were separated into their RGB components in place. Image alignment was done brute force, then with a coarse-to-fine pyramid speedup.

Brute Force Approach

I experimented with Cross Correlation and Euclidean Distance to score image alignments. Normalized Cross Correlation (NCC) produced the most consistent results for me. I measured image alignments in a [-15, 15] window. To create sensible alignments, I cropped a border of 15 pixels width around the image channels before calculating NCC score. The alignment with the highest score was used. I used np.roll to realign two channels to match the third channel (generally, g and r were realigned to match b).

Tobolsk unaligned
Image overlay with no alignment.
Tobolsk aligned
Post alignment: Displacement of green channel: (2, 3), red channel: (3, 6)

Coarse-to-Fine Pyramid Speedup

For larger images, I used the same function to find proper alignment as I did in the brute force approach. This time, I applied the alignment in multiple functions. I downsized the images using cv2's resize function. The factor of this resize (downsize) was the first 2^n to bring the image to have vertical dimension below 600. I made a single alignment of the smallest image of my pyramid in the range [-20, 20]. Then, I repeatedly aligned subsequent pyramid images (larger by factors of 2 up to the original image) up to 2 (pseudo-)pixels in the horizontal and vertical directions.

Large image example
Post alignment: Displacement of green channel: (-22, 48), red channel: (-30, 94)

Further Images

Small (jpg)

Displacement of green channel: (2, 5), red channel: (3, 12)
Displacement of green channel: (2, -3), red channel: (2, 3)

Large (tif)

Some of the images shown used alignment on the green channel instead of alignment on the blue channel.

Displacement of green channel: (-22, 48), red channel: (-30, 94)
Displacement of blue channel: (-38, -62), red channel: (30, 70)
Displacement of green channel: (6, 70), red channel: (4, 132)
Displacement of blue channel: (-26, -54), red channel: (16, 62)
Displacement of blue channel: (2, -94), red channel: (-10, 110)
Displacement of green channel: (24, 46), red channel: (39, 118)
Displacement of green channel: (-22, 46), red channel: (-32, 150)
Displacement of blue channel: (-24, -94), red channel: (0, 110)
Displacement of green channel: (17, 70), red channel: (16, 126)
Displacement of green channel: (-10, 154), red channel: (28, 102)