Project 1: Image Manipulation and Computational Photography

Pranav Chopada, CS 294-26

Project Objective

The objective of the assignment is to convert the digitized Prokudin-Gorskii glass plate images to produce a color image using image processing techniques. This is achieved by stacking the red, green, and blue plates on top of each other to create a color photo. The techniques used are SSD, Image Pyramid implementation and Edge Detection Implementation.

Single Scale Implementation

The three images were separated and had to be aligned on top of each other for best results. Out of the three image plates, blue was selected as the benchmark as it produced the best results. Sum of Squared Differences (SSD) technique was used to calculate the offset of red and green plates against the blue benchmark. To align the image, SSD for all possible offsets were calculated and the minimum SSD offset was used to transform the red and green plate to match the blue benchmark. This approach is time consuming and is not the optimal way to solve the problem.

Results


img

Red Offset: (-1,7)
Green Offset: (-1,1)

img

Red Offset: (1,9)
Green Offset: (0,-6)

img

Red Offset: (3,6)
Green Offset: (2,3)


Image Pyramid Implementation

A better approach at aligning images is by rescaling the image matrix down by 2 until it cannot be reduced further. For every rescaled matrix, the offset is calculated and proportionally added to the overall offset. The SSD alignment code is reused and larger images can be processsed faster. This increases the accuracy of offset detection as the image dimensions go up. However, this does not work well with Emir photo where the brightness levels are different for each of the three: red, green, and blue plates. Edge detection is used to solve that specific problem.

Results


Church
img

Red Offset: (-4,58)
Green Offset: (4,25)

Three Generations
img

Red Offset: (12,112)
Green Offset: (15,54)

Melons
img

Red Offset: (14,179)
Green Offset: (12,82)


Onion Church
img

Red Offset: (36,108)
Green Offset: (26,52)

Train
img

Red Offset: (32,88)
Green Offset: (6,44)

Icon
img

Red Offset: (23,90)
Green Offset: (17,42)


Self Portrait
img

Red Offset: (-3773,176)
Green Offset: (-3780,80)

Harvesters
img

Red Offset: (14,124)
Green Offset: (17,60)

Sculpture
img

Red Offset: (-27,-3117)
Green Offset: (-11,33)


Lady
img

Red Offset: (12, 120)
Green Offset: (9,52)

Workshop
img

Red Offset: (-12,106)
Green Offset: (0,53)

Emir
img

Red Offset: (-1028,33)
Green Offset: (24,49)


Edge Detection Algorithm (Bells and Whistles)

Edge Detection algorithm is implemented using a gaussian blur on the entire input image and by applying the sobel filter on the gaussian blur. Further, the image is cropped to avoid the multiple coloration near the border of the image. The improvement using the edge detection algorithm can be clearly seen in the example below:

Results


img

Using SSD Pyramid Implementation

img

Edge Image of Emir

img

Using Edge Detection Algorithm


Cropping Photos

Photo can be cropped after alignment by 10 percent on each side to remove the coloring problem on the borders. An example of conversion is shown below:

img
img