Ting Ting Wu
15-463 Lab 1


result of the big tif image

-->

-->

My function is called colorize and it takes in the path of the input file, and the path of the file you want to write the end image to.


Comparisons

I used the Sum of Squared Differences method to measure how well the 3 channels matched up. I held the Blue channel in place and shifted the Red and Green channels to do this.



Image Pyramid

For each image I create an image pyramid that goes to an image size no smaller than 32 in width. I did this by taking the log2(width) and then subtracted 5 from that. Because at each level it tests moving the image 30 pixels left/right and 30 pixels up/down. So that's just under 32 pixels size.
So it start by resizing all three channels to that minimum size, which means this width is 1/2^k of the original width. We shift the smaller red and smaller green channels around until they match up with the smaller blue pretty well, and then we shift the original 3 channels by 2^k * whatever amount we shifted previously.
After doing that for the coarsest level, we resize the newly shifted 3 original channels again but this time it's twice the size as before and has twice as much detail. We do the same thing as we did for the previous resolution. And we repeat this process until we finally do that for the finest level where we are working with the channels at their actual size.
After the alignment is done, we can concat the 3 channels together into an image. And voila!


Miscellany

I debated about the range to use when shifting the channels to match up. At first, I used -10 to 10 pixels up/down and left/right as a range. Then I used from -height/64 to height/64 vertically and -width/64 to width/64 horizontally at each resolution. That way it varies the range it looks depending on how big the image is.


Good Cases/Bad Cases

-->

When I first started working on the program, I continually tested on one image (woman sitting at table) and was quite pleased with the results. But when I started testing on other images I was surprised that the lining up was not always as accurate.

-->(without neglecting border)-->(neglecting 1/12 of image width around sides)

-->--> For example, the vase picture came out not very well aligned at first, but when I looked at it I noticed the dark borders had matched up. The borders dominated the SSD calculations. So I tried having it ignore a border around the image when doing the SSD calculations (1/12th of height and width on each side). And that gave me a much better image. It also gave me a better image for the building. However, that change also meant messing up the alignment of other pictures, so I changed it back.
The pictures that seem to match up well are those that have good contrast. So there is a dark object and a light background, and the borders are not too thick.