Project 1: Images of the Russian Empire: Colorizing the Prokudin-Gorskii Photo Collection

Student Name: Kelvin Huang

Approach (Step by Step)

1. Image Loading and Preprocessing

The images from the Prokudin-Gorskii collection are read into the program using skimage.io.imread(). Since each image in the collection is a composite of three separate black-and-white images representing the blue, green, and red channels, the program first splits the image into three parts, each corresponding to one of the color channels.

The split is done by calculating the height of the image, dividing it into three equal sections, and assigning each section to the respective color channel (B, G, R).

2. Cropping the Edges

After splitting the image into channels, the edges of each channel are cropped to remove any misalignment or noise that may exist at the borders. This is done using the crop_image() function, which crops a specified percentage of the edges (10% in this case) from all sides of the image.

3. Image Alignment

The core of this project is the alignment of the color channels to create a properly registered color image. Misalignments between the three channels can occur due to the manual capture of the original photographs.

To align the images, a multi-resolution (pyramid) approach is used. The images are rescaled at different scales (12.5%, 25%, 50%, 100%) using skimage.transform.rescale(). At each scale, the best displacement between the green and red channels, and the green and blue channels, is found using the align_l2_norm() function. This function shifts the images over a range of displacements, computes the L2 norm between the shifted image and the reference image, and returns the displacement with the lowest error.

4. Applying the Best Displacement

After finding the optimal displacements for both the red-to-green and blue-to-green alignments, these displacements are applied using np.roll(), which shifts the red and blue channels accordingly.

5. Reconstruction and Saving

The aligned red, green, and blue channels are stacked together to form the final color image. The resulting image is converted to 8-bit format using (im * 255).astype(np.uint8) to ensure proper color representation, and then saved to disk as a JPEG file with the suffix _colored.

The displacements used for the alignment of each image are printed to the console for reference.

6. Batch Processing of Multiple Files

The program is designed to process multiple files in a batch. A list of image files is processed sequentially using the process_files() function, which performs all the steps mentioned above for each file in the list.

Image Results

Cathedral
Cathedral: Best displacement (R to G): (7, 1) Best displacement (B to G): (-5, -2)
Church
Church: Best displacement (R to G): (33, -8) Best displacement (B to G): (-25, -4)
Emir
Emir: Best displacement (R to G): (57, 17) Best displacement (B to G): (-49, -24)
Harvesters
Harvesters: Best displacement (R to G): (65, -3) Best displacement (B to G): (-59, -16)
Icon
Icon: Best displacement (R to G): (48, 5) Best displacement (B to G): (-41, -17)
Lady
Lady: Best displacement (R to G): (61, 3) Best displacement (B to G): (-51, -9)
Melons
Melons: Best displacement (R to G): (96, 3) Best displacement (B to G): (-81, -10)
Monastery
Monastery: Best displacement (R to G): (6, 1) Best displacement (B to G): (3, -2)
Onion Church
Onion Church: Best displacement (R to G): (57, 10) Best displacement (B to G): (-51, -26)
Sculpture
Sculpture: Best displacement (R to G): (107, -16) Best displacement (B to G): (-33, 11)
Self Portrait
Self Portrait: Best displacement (R to G): (98, 8) Best displacement (B to G): (-78, -29)
Three Generations
Three Generations: Best displacement (R to G): (58, -3) Best displacement (B to G): (-53, -14)
Tobolsk
Tobolsk: Best displacement (R to G): (4, 1) Best displacement (B to G): (-3, -3)
Train
Train: Best displacement (R to G): (43, 27) Best displacement (B to G): (-42, -5)

Own Choosing Example

Additional 1
Additional 1: Best displacement (R to G): (71, -8) Best displacement (B to G): (-55, -12)
Additional 2
Additional 2: Best displacement (R to G): (56, -15) Best displacement (B to G): (-45, 12)
Additional 3
Additional 3: Best displacement (R to G): (52, -13) Best displacement (B to G): (-41, 16)
Additional 4
Additional 4: Best displacement (R to G): (46, -8) Best displacement (B to G): (-32, 16)
Additional 5
Additional 5: Best displacement (R to G): (91, 33) Best displacement (B to G): (-207, 216)
Additional 6
Additional 6: Best displacement (R to G): (82, -2) Best displacement (B to G): (-34, -2)