15-862

Dmitriy Solomonov

Project 1: Colorizing Photographs




The Prokudin-Gorskii photo collection makes it possible to see color images of early 20th century Russia, which at the time was quit revolutionary. The assignemt given was to write a program in Matlab that is capable of reading in the three color masks taken by Prokudin-Gorskii and converting them into a single color image.

For a sufficiently small image, it is enough to take the three layers and attempt to position them within a possible space of matching locality until the best possible image would be seen. Technically speaking, I would use the Blue layer as a base and move the Red and Green within a possibility range of 1/4 the size of the image. This was a little to moderate overkill of hte problem, but was enough to ensure that for the small image, I received the best
possible positioning of the photograph.


To judge which placement was better, I used a Sum-of-Square Differences  From a few experiments, I noticed that sdd did a better job on more images, so I calculated it for each position and chose the position with the lowest SDD. Also, when calculating these, I only payed attention to hte inner 80% of the image, since I knew that much of the borders were prone to problems.

For better accuracy I also did a multi-step approach with smaller size images. After position the Green layer, I would average the positioned green and blue layer, and use that as the light intensity comparison for the red. Some filtering was needed in creation of the new intensity layer. Subsequently, I woud recalculate the position of the Green based on the Red Blue previous calculation, and again recalculate the Red. This was very possible because it was only done for images smaller than 200 pixels.

When images were larger, I used an image pyramid to bring them down to the small size I needed and then work my way up. Once the initial placement was calculated, I only needed to check the surrounding 2 pixels to refine the chosen position and also adjust for any filtering error that may have been experienced along the way.

Once the final Position was calculated, trimmed off the non-intersecting parts of the image, and then attempted to cut away the bad borders or corners. To do this I calculated the worst square difference between the three masks for each pixel. Then for the group of center rows and center columns, I found which rows and columns had a substantialy large difference from the mean. Those first rows and columns were cut from the masks and the color images were formed.

I was unable to make every image as perfect as possible. A few have some errors here and there, but for the most part they are fairly solid images, and perhaps prokudin-Gorskii might not object too much to their end quality.

The images used and resulting effects can be found here.