Fall 2018
CS194-26: Image Manipulation and Computational Photography

Jack Wang
SID: 26862566
cs194-26-agk

Project 1: Colorizing the Prokudin-Gorskii Photo Collection


Overview

In this project we take the Prokudin-Gorskii glass plate negatives and combine them to form colour images.

Part1: Naive Alignment using Normalized Cross Correlation

First, the smaller jpg images were naively aligned using NCC as described in lecture. For each red and green section, I loop over a displacement of [-15, 15] using np.roll to create the displacements. Each displacement is compared using NCC and the best one is returned and simply aligned. This worked fairly well with the smaller images. The borders were naively cropped based on a pixel estimate so that the algorithm worked better. The results can be seen below.

Part2: Image Pyramid

For the large tif images, the naive solution would require a far too big displacement. An image pyramid was created. This was simply done by appending successively half size images using skimage.transform.rescale in a python list until it was about 300 x 300. Then the displacement is found at the smallest image, then it would iterate to the next image. The displacement window started at [-15, 15] and halved each time as the adjustments would be finer and calculating NCC at each level becomes more expensive. Halving the displacement window allowed it to run much faster (less than a minute vs many minutes). Like before the borders had to be naively cropped. Most pictures were pretty well aligned but I did run into problems with the Emir. This is likely due to the fact that most of him is blue and the NCC would be confused by aligning a mostly blue subject.

Part3: Using Edge Detection to Align (bells and whistles)

Due to the slight problems with the emir I was motivated to try to align them using edge detection. This process simply involved running the displaced image and the reference image through a sobel filter (skimage.filters) before comparing them with NCC. If you look below this process made the emir look at alot better as the edges are being aligned rather than the blueness which confused the original NCC colour metric. However, some of the smaller jpg images were worse with the edge detection alignment. My hypothesis is the poor quality made for poor edge detection (needs more jpeg) and thus made the two filtered edge images for the ncc very chaotic and thus was actually worse. This hypothesis is further bolstered when I tried other images in the collection. If I used the small jpeg images, the edge alignment would be worse than the naive NCC but for large images they'd always be a bit better.

Part4: Automatic Contrasting (bells and whistles)

I used the percentile stretch method to automatically contrast the images. After the images were aligned, I would stretch each of their colour distribution to the 2nd and 98th percentiles. This made some images look a lot more natural but I think some of them looked a little aritifical. This is largely subjective but I think it made them look a lot better.

Results

Figure 1: Naive cathedral

Figure 2: Bells and whistles cathedral

Figure 4: Naive church

Figure 5: Bells and whistles church

Figure 6: Naive emir (blueness makes naive alignment bad)

Figure 7: Bells and whistles emir

Figure 8: Naive factory

Figure 9: Bells and whistles factory

Figure 10: Naive harvesters

Figure 11: Bells and whistles harvesters

Figure 12: Naive icon

Figure 13: Bells and whistles icon

Figure 14: Naive kids

Figure 15: Bells and whistles kids

Figure 16: Naive lady

Figure 17: Bells and whistles lady

Figure 18: Naive monastery

Figure 19: Bells and whistles monastery (bad image quality makes edge detection bad)

Figure 20: Naive nativity

Figure 21: Bells and whistles nativity (bad image quality makes edge detection bad)

Figure 22: Naive self_portrait

Figure 23: Bells and whistles self_portrait

Figure 24: Naive settlers

Figure 25: Bells and whistles settlers

Figure 26: Naive three_generations

Figure 27: Bells and whistles three_generations

Figure 28: Naive train

Figure 29: Bells and whistles train

Figure 30: Naive turkmen

Figure 31: Bells and whistles turkmen

Figure 32: Naive village

Figure 33: Bells and whistles village



Displacements


emir: disp r x, y -104 55 disp g x, y -57 24
harvesters: disp r x, y -88 13 disp g x, y -46 16
icon: disp r x, y -123 23 disp g x, y -66 17
lady: disp r x, y -106 10 disp g x, y -53 8 disp r x, y -95 13 disp g x, y -51 9
self_portrait: disp r x, y -40 35 disp g x, y -30 27
three generations: disp r x, y -101 9 disp g x, y -51 12
train: disp r x, y -122 32 disp g x, y -64 5
turkmen: disp r x, y -100 25 disp g x, y -51 18
village: disp r x, y -75 22 disp g x, y -40 12
cathedral: disp r x, y -14 3 disp g x, y -8 2
monastery: disp r x, y -20 2 disp g x, y -16 2
nativity: disp r x, y -18 0 disp g x, y -10 1
settlers: disp r x, y -12 -1 disp g x, y -6 0