Introduction
The purpose of this project was to create an algorithm that from the Gorskii photo collection negatives (an example of such a negative) will create color pictures with the best possible alignment of the channels. As some of the negatives had relatively high resolution (~60MB .tiff files) we also had to use Gaussian pyramids so that the algorithm will be able to scale easily.Approach
Given the picture, by splitting it into three equal parts we get the three channels R, G, B. We try to match R and B and G and B separately and then we combine the results. The matching is done by moving the other channel within a specified window of translations while keeping B fixed. But applying this directly didn't work with only this picture because the channels have border effects. The simple solution that worked very well was to just remove 10% of each side of the picture. Then, using some heuristics we trim the borders of the picture where we have some strange colors as a result of the format of the original plate. Finally, some contrast adjustments are made to make the picture look more realistic.Distance Measure
I have tried both the Eucledian metric and the Normalized CrossCorrelation (NCC), but applying them directly on the images did not produce satisfying results because the channels themselves have different intensities. To overcome this problem, I have instead tried to minimize the difference of the numerical gradients (as computed by MATLAB's gradient). Or more precisely, if A and B are the gradients of the pictures I tried to minimize n(AB) where n is the sum of all the entries in the argument matrix and X represents the matrix obtained by taking absolute values of the entries of X (i.e. X[i,j] = norm(X[i,j])).Gaussian Pyramids
To be able to handle large resolutions when two channels X and Y were aligned, first their Gaussian pyramids were created in an incremental way until we get a level of sufficient size (around 300400 pixels). Then the matching was performed in an incremental way from the coarsest level to finer levels, improving our estimate on the way and of course reducing the size of the window of translations.Removing Border Effects
As already mentioned, because of the nature of the negative plates the results from the previous phase had some strange colors. These borders contained black and white regions and also some very intense random colors. The algorithm that was employed used two heuristics when removing these borders, namely Lines that were completely black or white (within a small specified error interval) were discarded.
 For every line, the average of the absolute values of the normalized correlations between the three channels was computed. If this value was under a specified constant, then the line was discarded.
Setting the parameter too high produced almostperfect results for some pictures, but some were cropped too much. On the other hand, setting it too low worked for some pictures but some still had think boundary. To show the variaton on the algorithm on the pictures, all the pictures below have been processed using the same finetuned constants unless otherwise stated in the box below the picture.
Picture Enhancement
I have tried several enhancement techniques, including the popular white balancing (using the Gray World enhancement) and histogram equalization. But, these did not give naturally looking results. I used a different technique, namely the gray levels were remapped to use the whole interval using MATLAB's imadjust. Some results of this procedure are shown below.Results
The results below were obtained by running the algorithm on the provided samples and as well on other pictures from the Gorskii photo collection. The constants that were used were as follows The error interval for black/white lines was set to 0.05
 The lower bound on the correlation was set to 0.315
Low Resolution Pictures
These were generated using the match_img function directly with a window of size 15x15.For the first picture (00125v.jpg) the threshold on correlation was lowered to 0.19, as the cropping algorithm took too much of the border.
Provided Pictures










Pictures of my Choice






