In this project, I took individual rgb glass plane images taken by Prokudin-Gorskii and converted them into one colorized image. This process is not as simple as stacking the red, green, and blue filtered images on top of each other. Because Prokudin-Gorskii had to take each red, green, and blue image separately, the images do not align naturally.
I began this project by taking a glass plane image and converting it into its three separate color channel images. I noticed that many images have a border around them, which interferes with alignment, so I cropped 1/10 of the border off each side of every image.
Next, I went to align the green filtered image with the blue filtered image. I did the same alignment with the red image and blue image. This alignment consisted of finding a displacement vector which I could use to move the green and red images to match up with the blue image. I used SSD (Sum of Squared Differences) to compare pixel values between the different color images and find the alignment that gave the lowest SSD value. I searched through a window of 15 * 15 pixels and found the proper displacement vectors to align the green and red images with the blue image. I then used np.roll() to shift the images as specified by the displacement vector and stacked the red green and blue images on top of each other to get a colorized image.
For higher resolution images, I ran into the problem that my search window was not large enough to get the proper alignment and the alignment was taking a very long time to compute. To fix this problem, I implemented an image pyramid. I began by rescaling the green and blue images to a much smaller size. Then I found the displacement vector for the rescaled images. Then I was able to rescale the images and displacement vector up to a larger and larger size iteratively. I used the displacement vector to narrow my search margin, meaning I only had to look at a search window of 2 * 2 pixels around the displacement vector. I followed the same process with the red and blue images, and I was able to properly align almost all (see "Bells and Whistles" section) the high resolution images efficiently with this method.
Unfortunately, the method described in the Overview section did not work on one image: "Emir.tif". This is likely because the lighting changed in between taking the individual color images. In order to solve this I used skimage's edge detector function to align the red, green, and blue images by their edges rather than RGB values. This worked well and I was able to output a nicely aligned image of Emir.