The goal of this project is to take Prokudin-Gorskii's digitized glass plate images and reconstruct full-color images using image processing techniques. The primary challenge is to align the three color channel images (red, green, blue) extracted from a single plate, ensuring that the final composite image has minimal visual artifacts.
I choose to align the green and blue channels with the red channel using translation-based image alignment. A simple exhaustive search over small pixel displacements is employed to find the best alignment, using the sum of squared differences as the matching metric (the lower the better). To improve the efficiency , the pyramid search method is applied. This method involves scaling down the images and aligning them at coarser levels before refining the alignment at higher resolutions. Each level will pass on the alignment information to the next level and the search range will be halfed to lower the computational costs as the resolution is getting higher (the initial search range is set to [-20, 20] and the minimal serach range is [-2, 2]). Also the channels will be cropped slightly by 10% before begining the alignment process to ensure the algorithm is matching the actual contents instead of the borders of the images.
Below are some of the images that I have colorized using the above approach.
Instead of aligning the entire channels, I used cv2.Canny to detect edges and align those edges. This works very well on images with lots of edges like emir.tif.
An auto cropping algorithm is used to crop the unwanted visual effects of the postprocessed images. It will compare the intensities of the pixels between the three channels and actively detect white or black borders. The reserved region will be the rectangle bounding the largest connecting region.
The algorithm will mostly be able to remove white and black orders and remove some colored borders. It is not perfect on every image
* Shifts are with respect to the red channel [b_shift, g_shift]