This project was an attempt to create color images from the slides in the Prokudin-Gorskii collection I did this by taking the original slides which were taken under blue, green and red filters, and automatically aligning the layers. My process is described below.
I used a relatively simple algorithm to colorize my images. I created several pyramid layers for each color of each image, creating more layers for larger images (halving width and height each time). My algorithm attempted to align the red and blue images with the green one. I found that using the green as the base produced the best results. The program still prints the shifts from blue, since that is consistent with the instructions. Because of the way the images are shifted, it seems that the green tends to be in the middle of the red and blue most of the time, which is probably what made this method more reliable.
For each blue or red pyramid layer, I moved the layer +/-1 pixel and calculated the sum of squared differences (SSD) for -1, 0, and 1 shifts from the green layer in both dimensions. I took double the offset with the least SSD as a base offset for the next layer and repeated the process until I reached the full image.
Since I chose to use a fixed small window for each layer, I needed to make sure that the first layer was small enough to deal with the offset. I did this by estimating the maximum reasonable offset (usually around 10% of the width/height of the image) and calculating the pyramid to a depth which allowed me to match that offset with shifting the layer by 1 in either direction. I didn't test to see whether this was significantly more accurate or faster than using a larger window for the first layer(s), but this produced reasonably fast and accurate results so I chose not to mess with it.
For the large images it usually ran in under a minute on my laptop, which was fast enough for what I needed. The alignment of the images seemed quite good, particularly in the larger images.
My algorithm seems to work pretty well in general, but there are a few problems with the resulting images which could be fixed with further processing. It might be possible to repair some of the discoloration on the edges without having to crop the images by using techniques to automatically adjust the color levels. I think a similar technique could be used to remove the splotches of color in certain areas. I also think that some adjustments could be done to keep the colors from looking washed out in some of the images, but I didn't attempt to do that.
I made an attempt to crop the image by using edge detection and finding the edges near the corners. This was somewhat successful when tuned correctly. To do this, I looked for borders in the red, green and blue images as well as in a grayscale version of the original image. Then I scanned through the rows and columns near the edge and areas which were particularly "edgy" to remove. I added a parameter to tune the sensitivity of the cropper as well.
The filter tried to use a fairly conservative default sensitivity, so it should try to preserve information if it can. It is possible to remove some of the splotches and halo-like effects around the edges by increasing the sensitivity value, but this sometimes can cut off information we might want to keep in the images.
I've summarized my results in the tables below.
The smaller images didn't seem to achieve as great results as the larger ones. The images are a bit more blurry and discolored, but I think this might have been a result of the originally low quality of my images more than it was my alignment algorithm.
Original Images | Colorized Image |
---|---|
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
I got some pretty good results with these larger images, except for some discoloration on the edges of some of the images, like the image of the woman. If I increase my edge threshold in my algorithm it will generally remove these areas, but I left them on here to avoid cutting off useful pieces of the actual image.
Original Images | Colorized Image |
---|---|
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |