Project 1 |
|
This project was coded using MatLab, a powerful matrix based, mathematical programming language that allows for fairly flexible image manipulation. User InputFrom the Matlab interface, the user must input two things: sourcename (the name of the source file) and prefer(preference on aligning base, red, green, blue, or none). sourcename must be a valid image file name in the same directory as the project script. I was using .jpg and .tif files, some provided by Professor Efros, some acquired directly from the Library of Congress and some of my own creations. The prefer variable allows the user to force one of the component images to be the base image for comparison. This allows for a simple adjust if the image does not align properly. Program FlowUpon being initialized, the main project script loads the image, based on sourcename, in to a matrix, coverts the 8 bit data points (values ranging from 0-255) to doubles (values ranging from 0-1.0000), then passes the source image to the function stripwhitefnx. stripwhitefnxAs a pre-process function, here the original image is stripped of its white border. This may not seem like an important step, but it is essential to remove this border before being passed on to cutterfnx. cutterfnxcutterfnx performs the task of separating and trimming the three component images from the source image. Click above for more detail. imgalignThis is where the magic happens. imgalign is passed three source images, and with the help of alignhlpr, an aligned and trimmed color image is returned. Click above for more detail. whitebalBecause some of these images are over 100 years old, their color and brightness levels are not exactly optimal for human viewing. To make an effort in fixing this, the colorized image is handed over to whitebal. In this function both adjusts the brightness and the color levels to better reflect the true image. To figure out the white balance, the function looks for the point where the three channels have the highest value, hopefully this is the brightest point in the image, and better yet this should be the "whitest" point. Taking this in to consideration, the images are multiplied by a value that would make this one particular point equal to 1 in all three colors, or absolute white. Once the images are white balanced, each of the channels are passed through MatLab's imadjust function to adjust the individual colors. The output ends up being a decent representation of the world Prokudin-Gorskii saw. ResultsOver all this system worked out very well. There were a few images that the user needs to define what image to align on, but other than that, the output ends up being a good representation of Prokudin-Gorskii's images. The smaller, .jpg images take less than 5 seconds on my home machine (Dual Core 64 bit 3 GHz. with 4 GB of RAM) and the larger images take about 1:30 minutes. From testing on the CS departments cluster machines, the larger ones took about 30 seconds. Reflection Seeing as this was my voyage flight using Matlab, there are a few things that I would have done differently; however, I am overall pleased with how things turned out. In the core of imalign and cutterfnx there are some poorly planned algorithms that could be written better. They work, they are just sloppy Struggles Really the biggest issue was getting used to matlab, but that was expected. Other hard points were wrapping my head around the image pyramid, and the way I was searching the images. It took a bit of mental elbow grease to work that out, but it obviously worked. Other rough spots included trying to balance all of the threshold values that I embedded in the project. If one of them gets too far off, it throws off the entire program. That made debugging a hassle. I would not say that it was overly "easy;" however, it was fairly straightforward, and seeing as I had enough time, it was a good project.
Highlights This was one of the coolest code-based projects that I have worked on in a while. The mesh of code and photagraphy, made the results particularly satisfying. In most computer science courses you are manipulating data or abstract information and the output tends to be just as obscure. With this project you could easily see the output, and you could easily tell if you were doing it right. So cool!
|
|