|
Main /
Proj1Project1: Image ManipulationsDue Tuesday, October 10th 2006, 9:30am Updates:
On this page... (hide) 1. IntroductionThe purpose of this project is to have you implement some image manipulations. This will allow you to demonstrate that you understand image manipulation, and an opportunity to experience some of the pragmatic issues in doing image manipulation. This project consists of several independent pieces. You can think of it as four separate projects. You can write five separate programs. However, since the parts all have lots in common, you are probably better off thinking about them together so you can share code between them. You could write one program that has some interface for doing all of the options which is an extension to Main.Tutorial 6 .
2. For all Parts:Each of these operations should read in a Targa file and write back another Targa file. You may prompt the user (for example, using an FlTk file dialog box), or you may take the file names as command line arguments. Remember, that we define a Targa file to be the images that can read and written with the Libtarga library, so we recommend that you use that. We do not care what the user interface is for performing the operations. You might have several different command line programs, or 1 program with a GUI, or something in between. You must document your program/programs well enough that we can use it. You must be able to use your program. 2.1 Grading Difficulty OptionsFor several of the parts of this project, you will have options as to the "difficulty level" of what you try to do. For example there might be an "easy" option and a "difficult option." Each option will be assigned a letter grade that is the highest grade you can get for taking this option. For example, if you take the "B" option on some part and do it really well, you'll get a B for that part. If you take the "A" option and your program doesn't get a correct answer, you might get a "C". You must tell us which option you chose to do before we do the grading (you must specify it in your README file). The grading standards are designed such that if you have a correct solution to a lower difficulty option and hand it in as a partial solution to a higher option, you will get a lower grade. You may choose a different option for each of the parts of the assignment. For some of the parts of this project, there are "Bonus" or "Extra Credit" options. Remember, that it is course policy that you cannot use extra credit to raise your grade. If you choose to do extra credit, you must also do the normal graded part. 2.2 GradingEach part the assignment will be graded. Your total grade will be the average of them. The "weights" for different parts are as follows. One third of the project grade (1/3) goes for resizing part. One third (1/3) goes for impressionist painting. The final third (1/3) is for warping and black and white conversion (2/9 for warping and 1/9 for black and white conversion). You will be evaluated on:
Note: we will not evaluate the efficiency of your program (within reasonable time). Concentrate on writing programs that get correct answers and are clean and readable code. If your program takes more than 10-20 seconds to process a 600x400 image, then maybe there's something wrong - but don't worry about trying to get into a race with Photoshop. More specific information on grading will be added later. 2.3 Demonstrations:The main testing of your program will happen at a scheduled demonstration in B240. You will compile and run your program for us - we'll bring the test data. 3. The Four Image Processing Operations:3.1 ResizeYou program must be able to change the size of an image by resampling it. It may be easier to solve the problem by considering enlarging and reducing the image seperately, as their basic challenges are different. However, to get an A for this part, you must have a single interface where the user enters a scale factor (for example as a percentage) or a new size in pixels for the resulting image. To get an A your program must also allow for anisotropic scaling. That's a fancy way to say that you can have a different scale factor in each dimension. ReduceOur program must take a TGA image and produce a smaller version of it. The hints might help you!
If you did proper sampling (B1 or A) -
If you did a variable reconstruction filter (B2 or A) -
EnlargeThis is similar to reduce, except that you should make the image bigger.
If you did "B" or "A":
3.2 Convert to Black and WhiteYour program must be able to convert a color image to a black and white one. That is, the result of this command must be an image where each pixel is either black or white (0,0,0 or 255,255,255). In making the conversion, your program should account for the perceptual sensitivities of the human eye. (e.g. we are more sensitive to green than to red, and more sensitive to red than to blue). Because our eyes are more sensitive to green, an equally bright green, blue, and red will not appear equally bright. This means that if you are converting between color and grayscale, the color red (255,0,0) should not turn into the same brightness as the color green (0,255,0). The exact ratios vary. One simple one is to say that green is twice as sensitive as red is twice as sensitive as blue, which gives the rations for R,G,B as 2/7, 4/7, 1/7, or .28, .57, .14. I have also seen systems that use r = 0.212671, g = 0.715160, b = 0.072169. The closest thing to an "official" standard is what is used in NTSC (the North American video standard) to compute brightness from colors. That's: Y = 0.30R + 0.59G + 0.11B. There are many possible quantization algorithms. Several were discussed in class, or in the readings. You should pick the best one that you can implement. However, it is better to have a correctly working simple threshold than an incorrectly working error diffusion method. The basic "signs of life" required for this part is that your program successfully creates a valid black and white image, and that the image resembles the input. Your program's ability to capture gradations in tone will get you a better grade.
If you did the "B" option:
If you did the "AB" "A" or "Bonus" option:
3.3 Impressionist PaintingYour program must take a color image and produce a new color image that is a "painted" version of the original. The basic idea is that you sample the original image and for each sample you place a "brush stroke" in the destination image. You need to randomize the order of the strokes a little. This is a case where undersampling/aliasing actually creates some nice effects Here's an example (click on an image to get the bigger versions):
One possibility is to have the user specify where the brush strokes go (have them click on the image and brush strokes appear there). The original version of painting did it this way. You can see a Java implementation of it here. Paul Haeberli, the inventor of the technique, is a UW alumn! Implementing the interactive version is fun. However, you must also have a "batch mode" version that processes a whole picture without any user intervention. We've seen some pretty creative solutions to this assignment in past years.
Making good paintings from images is a hard problem. There is actually a lot of research out there. Haeberli's original paper is easy (and fun) to read. Here is another old (but good) source of lots of ideas. The version of this project that was assigned at U. Texas has even more ideas. (note: the Texas project has students use the OpenGL graphics library to render the brush strokes. You must render the brush strokes yourself (actually writing the pixels into the image). Graphics classes at other universities give variants of the impressionist painting as an assignment. Often, they ask students to use a graphics library (OpenGL) to draw the brush strokes. We don't recommend you do this: you should draw the brush strokes by actually setting the pixels in the image.
A note on expectations: We don't expect you to do cutting edge research - its a part of a class project for an undergrad graphics class. Many of the techniques that adapt the strokes to the image require a tiny bit of computer vision know-how. (OK - easy version - a high-pass filter can tell you when there's detail in an image, and that you should use more small strokes). What's cool about impressionist painting, however, is how cool you can make it look just doing the basic stuff. Most people find doing it really fun.
Describe the algorithm that you implemented. One specific detail that we will want to know: how do you choose where to sample/place brush strokes. If you do anything fancy, be sure to describe it. Also, how did you create the brush shapes?
Hand in Note: please turn in 1-3 small images produced with your painting algorithm that shows off how well it works.
3.4 Non-linear warpingWarps are simply mappings from a source image to a destination images. This mapping takes the form (x',y') = f(x,y)
Where (x',y') describe the position in the destination image. (x,y) is the position in the original image. A non-linear warp means that the function is not linear. There are lots of ideas for non-linear warping. This includes Swirling, Creating waves, Turning an image into a diamond or fisheye warping. Another interesting idea is that you can impose a grid on the source image. The user is allowed to move the points on the grid around, and the image is warped accordingly. This specific warp is interesting because it is the basis on which some morphing systems work (thought not exactly that way). You can find an illustration of this method here (http://freespace.virgin.net/hugo.elias/graphics/x_warp.htm) Implementing non-linear warping requires performing image resampling. The positions of the samples are determined by the warping function. Warping can be done using either one of two methods, the forward method, and the reverse method (or backwards method). For the forward method, we scan the source image pixel by pixel, moving this pixel to its target in the destination image. In the reverse method, we scan the destination image pixel by pixel figuring out where each pixel came from in the source image. Forward warps are hard to implement because we need to find a logical way to fill in the gaps. Therefore, for this project we recommend that you implement reverse warping. Notice that when doing an reverse warping, you need to be able to computer the inverse of the function f. In reverse warping, for each pixel of the target image you sample the source image. The position of this sample is given by the inverse of the warp function. Note that there are two issues that make this sampling difficult:
These issues are similar to resampling for resizing. One way to think of how non-linear warping is harder is that for every pixel, the amount of resizing is different. And those nice, round (or elliptical) gaussian kernels can get warped into wierd shapes. There are many choices in how you implement the resampling. The easiest method would be to point sample and use nearest neighbor interpolation. Better solutions would use interpolation and variable size sampling filters (where the filter kernel changes size depending on the warp). Implementing a variable shape filter kernel is harder.
Note: if you implement a harder version, you should also implement the easier version so that you can show the difference. Here are some examples for nonlinear warps. Starting from this input picture ![]() Here are examples of warps done using point sampling ![]() ![]() Notice the jagged edges in the pictures. This is not always desirable. Using bilinear interpolation instead produces smoother results ![]() ![]() However, notice that the blurriness in the center of the fisheye warp is incorrect. This area should be sharper. We get similar effects using gaussian kernel with fixed radius. ![]() ![]() Finally, here are two examples done using a variable gaussian filter. These were produced using simple isotropic filtering ![]() ![]()
4. Handing in your assignmentYour assignment will be handed in by placing files into your handin directory (P:/course/cs559-gleicher/handin/LOGIN/p1). The "effective date" of your handin will the be timestamp of the last file put into this directory. Your handin must include:
You should not include any of the intermediate files or an executable. Note: when we test your program, we will copy your handin directory to the local disk of a STORM machine, load the solution file into Visual Studio, and hit compile. You should check to make sure this will work. 5. Some Implementation HintsSome hints to make your life easier:
6. Projects Given by this Course in the PastBack in 2001, we gave a project that required students to create a much more complete imaging system with a lot more features. Here are some of the pictures that they made with their projects. 7. Material for Help Session |