Project 1

Colorizing the Gorskii collection

In this project, I attempted to colourize the digitized Gorskii collection. The collection contains many images, each made up frome a set of 3 greyscale images. These greyscale images represent the images captured by Gorskii, where each greyscale image is a negative of blue, green, red components of the entire coloured image. In this project, I attempt to do 3 things, crop out the edges of the scanned collection, allign each colour to create a final coloured image, and finally, enhance the image as much as possible.

Original Cathedral Image

Original Monastery Image

Original Tobolsk Image


The Core Process

The first step in the process was to crop the edges. I first seperated the images into thirds, then cropped 5% of the image off each edge. This resulted in an image without the black and white borders.

Left to Right: Blue, Green, Red Positives of the Cathedral Image

The second step was to allign these images together. This was the hardest part as I needed to find an effecient way to align large images without using a overly computationaly intensive algorithm. The original method was to use the sum of the normalized cross correlation of two pictures (a higher score is better) to calculate how closely the two images aligned. This method worked for smaller jpg images, however, for larger tif images, a better method was needed. For example, checking a range of only 10 pixle horizontal and vertical shifts would create 100 calculations, with some image sizes being up to about 4000x4000 pixles in dimension. Therefor, an image pyramid was used, to scale down the resolution of the images and calculate the alignment, then having a reasonable guess on the horizontal and verticle shifts, the image would then be scaled up, and the guess would be refined. This method called an "image pyramid" dramatically reduced the time it took to align the images.

Finally, having calculated the shifts needed to align the images, the negatives were turned into positives, and stacked to form a 3-channel RGB representation of the coloured image.

Representing of shifts calculated to align the images. This is the last layer of the image pyramid and only shifts that increase the NCC score are shown.

Issues, Bells, and Whistles

When NCC Doesn't Work

There are some issues with the algorithm described. For one, if the intensities of the filters a very different, then this method fails to allign the image. You can see this with the image "Emir", where his dress is solid blue. This makes the blue filter very intense in that region, while the other filters are nearly zero. This means the NCC score will be low, depite being in the right region. Using the NCC score method yields the folliwng allignment.

"Emir" aligned using NCC

As such, a change was needed. The solution I decided upon was to identify the edges of the image, since the cloak and it pattern made very distinguished lines. Then using the image of just the lines, use those to calculate the shifts needed with the NCC method. The result looked like this:

Uncanny Edge Detection Of Emir Filters

Finally, the shifts were calculated and the final shifts were applied to the colour filters.

"Emir" aligned using NCC via Edge Detection

Normalization

Another issue I found was that image normalization helped with the alignment of images. I suspect this is because if the image was very bright to begin with, the difference between NCC scores would be small wherever you shifted the image. Normalization helps with this because it scales the darkest value and brightest values, to the min and max of the intensity range. Therefore, the normalization stretches out the NCC differences, allowing there to be a greater difference between the NCC score of good alignment and the NCC score of of bad alignment.

"Church" Aligned Without Normalization.
"Church" Aligned With Normalization.

Black Point adjustment and Contrast Adjustment

Lastly, all the images shown have had an automatic blackpoint adjustment and a manual contrast adjustment. The blackpoint adjustment find the 2nd percentile pixle value of each filter, and zeros them out. This allows the light exposed old filter, to have more distinct blacks.

"Melons" No Adjustment.
"Church" Adjusted.