CS194-26 Project 1
Weichao Chen
Image Alignment
Despite having the same size, simply overlaying # the three color channels result in misalignment because of difference in bezel.
Naive Method
The naive implementation of image alignment is to fix one color channel, overlay another # on top of it along the z-axis, and iteratively try displacement along the x-axis and y-axis within a predefined set of range and record the best displacement vector. Two color channels are consider well aligned when the image similarity score is high. Multiple similarity function can be tried including SSD (Sum Square Difference)
Image Pyramid
Now the naive way of exhausitively searching for alignment is computational heavy for larger images. For a high resolution image, not only does it have a large total # number of pixels, it will also have a correspondingly larger bezel that require a larger # search range. As a result, an image pyramid approach, which is to start with a coarse, small size image, find alignment and the gradually increase the image size.
Bells & Whitsles
Cropping
A variety of border artifacts exist in images after the three color channel alignment. To remove such border artifacts, we perform the following steps.
- Perform RGB to HSV transformation and extract the Saturation layer.
- As boundary of the image typically has a higher than average saturation value, we can then perform thresholding to binarize the image, such that boundary area contain all 1s and the rest of the image all 0s.
- Sum across the all rows and columns
- To find the image boundary, start at 1/10 into the image and march toward the boundary, if the sum of that particular row/col is more than threshold * mean, set it as the boundary.
Gallery
workshop(G:[-52.0,12.0],B:[-104.0,12.0])
lady(G:[-60.0,0.0],B:[-112.0,-8.0])
melons(G:[-96.0,-4.0],B:[-180.0,-12.0])
self_portrait(G:[-98.0,-8.0],B:[-176.0,-36.0])
emir(G:[-58.0,-18.0],B:[82.0,-17.0])
train(G:[-43.0,-26.0],B:[-86.0,-32.0])
harvesters(G:[-64.0,2.0],B:[-124.0,-16.0])
onion_church(G:[-58.0,-10.0],B:[-108.0,-37.0])
village(G:[-72.0,-10.0],B:[-137.0,-23.0])
icon(G:[-48.0,-6.0],B:[-90.0,-24.0])
three_generations(G:[-58.0,4.0],B:[-108.0,-12.0])
cathedral(G:[-7,0],B:[-7,1])
tobolsk(G:[-4,-1],B:[-6,-3])
monastery(G:[-6,-1],B:[-9,-1])