Project 1: ImpressionistAssigned: Tuesday, September 2, 2010
Due: Tuesday, September 21, 2010 (before 11:59pm)
Artifact Due: Monday, September 27, 2010 (before 11:59pm)
Project DescriptionImpressionist is an interactive program that creates pictures that look like impressionistic paintings. It is based on a paper and a program by Paul Haeberli.
To create an impressionistic picture, the user loads an existing image and paints a seqence of "brush strokes" onto a blank pixel canvas. These brush strokes pick up color from the original image, giving the look of a painting. To see some samples that were generated with the results of this project, click here.
Project ObjectiveYou will add the functionality to a skeleton version of the Impressionist program, which we will provide. The purpose of this project is to give you experience working with image manipulation, OpenGL primitives, user-interface design, and image processing.
You'll definitely want to take a look at the FLTK documentation and the OpenGL Red Book. Keep in mind that you are not allowed to use any additional software libraries or toolkits besides FLTK, although the use of any module within FLTK is fair game.
- For lab Linux machines: Download impressionist.tgz. This archive contains the starting source code and a makefile. Extract the archive to create an "impressionist" directory with the source files. You'll need to copy Makefile.campus to Makefile before you build. Once that's done, just type "make" in the directory you extracted and it should build an executable called "impressionist".
- For home Linux/Mac: Download and install fltk-1.1.10 from the fltk website. The same impressionist download file as for campus should work, but this time copy Makefile.mac to Makefile before typing "make". You may have a problem if you don't have libpng installed when you do this. If so, download the libpng tarball, unpack it with "tar zxvf filename" where "filename" is the name of the file you created from the download, then cd to the libpng-1.2.31 directory and type "sudo make install". Then retry the impressionist build. If you have a similar problem on a home linux machine, after unpacking this file do "./configure; make check; make install" from within the libpng-1.2.31 directory.
- For Windows: If you have Visual Studio 2005, you can download the include files and prebuilt libraries and unzip them into the C:\ directory. If you are using any other development environment, you will need to download and install fltk-1.1.10 from the fltk website. Now download impressionist.zip. This zip file contains the starting source code and a Visual Studio 2005 solution file ("impressionist.sln"). You should be able to build the starting binary from this solution file.
Other useful resources:
- Sample images: Linux version and Windows version
- Sample solutions: Linux version and Windows version
Explanation of the Skeleton ProgramThe skeleton program we provide does very little. It allows you to load the original image (which must be a 24-bit uncompressed BMP file), and save the painted version. Brush selection is done via a modeless dialog ("File/Brushes..."). There is one brush implemented (points) and a slider for controlling the brush size.
Required ExtensionsYou must add the following features to the Impressionist program:
A sample solution is posted on the main projects page. Your implementations of brush strokes, brush direction controls, etc. do not have to behave exactly the same as the sample solution, but they should demonstrate the same functionality.
- Implement 5 different brush types: a single line, a brush consisting of multiple scattered lines (think scratches), a brush consisting of multiple scattered points (think spraycan), (filled) circles, and scattered (filled) circles (think polkadots).
- Add sliders to control various brush attributes. You need to include sliders for the line thickness, brush angle, and alpha (opacity), in addition to the existing brush size slider. Feel free to add any other sliders that you feel might be helpful to the project.
- Add the ability to control the brush direction (angle). The stroke direction should be controlled three different ways: using a slider value, using the right mouse button to drag out a direction line, and using the direction of the cursor movement. You can use a radio box to allow the user to select which method to use.
- Add the ability to apply a convolution kernel (filter) to either the original image or the painted image. Store the result of the convolution in the painted image. See this discussion of image processing to understand what you need to be able to do. You should also build an appropriate UI for the kernel interface. You should be able to change the kernel size in both x and y separately. You should support at least a 3x3 kernel. Some code for this is already present in the skeleton, but the UI element is not.
Project ArtifactWhen you are done with this project, you will create a project "artifact" to show off the features of your program. For the Impressionist artifact, you will create an impressionistic painting from an image of your choice. We will then create a gallery of all the paintings on the course web page. Please note that you are not allowed to use other people's programs or sample solutions for your artifacts.
Bells and WhistlesHere is a list of suggestions for extending the program. For the purposes of grading, a bell is worth two whistles. Items marked with the bell/whistle icon may be worth anywhere from a bell to a whistle, depending on the quality of the implementation. You are also encouraged to come up with your own extensions, which will be assigned bonus values during grading. We're always interested in seeing new, unanticipated ways to use this program!
To give your paintings more variety, add some additional brush types to the program. These brush strokes should be substantially different from those you are required to implement. You will get one whistle for each new brush.
When using your program, you currently can't see what part of the original image you're painting. Extend the program so that when you're making a brush stroke, a marker appears on the original image showing where you're painting.
A different solution to the problem of not being able to see where you're painting is to show a dimmed version of the painting on the canvas. Add a slider that allows the user to fade in or fade out the original image beneath the user's brush strokes on the canvas. (Beware, this bell and whistle is more difficult than it looks).
To make your painting more interesting, add "alpha-mapped" brush strokes. In other words, allow the user to load a bitmap representing a brush stroke. This bitmap would contain an alpha value at each position. Then when this brush is used to draw, a single color would be selected from the image, all pixels in the brush bitmap would be set to this RGB color (without changing the alpha value), and this partially transparent bitmap would be painted on the canvas. A new color would be used each time the brush is drawn.
It can be time-consuming to paint an image manually. Add a feature so that a whole painting can be created automatically. The user should only have to specify a brush type, size, and angle to use. Then the program should automatically paint brush strokes over the entire image, using a randomized brush order and varying the brush attributes slightly as it goes (to increase realism).
Add the ability to automatically set the brush direction (angle) based on the perpendicular direction to the gradient of the image. In other words, when a pixel is painted over in this mode, the angle of the brush is determined by first looking up the gradient of the original image (at that pixel), and then finding the vector perpendicular to the gradient. You may find that you get better results if you first blur the image, such as with a broad Sobel filter, and then use the gradient of the blurred image. For information about calculating the gradient, look here.
At times, you may want the brush strokes to follow the gradient of a different image than the base image. Add a button(s) that will cause the direction of brush strokes to be automatically determined from a user specified image.
The "accuracy" of the painting can be also be improved by clipping long brush strokes to edges in the image. Allow the user to load a black-and-white image that represents the edges in the picture. Then add a checkbox so that the user can turn on edge-clipping, which will automatically clip brush strokes at edges in the image.
Use the image processing techniques described in class to automatically find the edges in the base image. Once you have found the edges, add a button to the user interface that will allow the user to select whether or not the brush strokes should be clipped to the edges in the picture.
Implement a multiresolution automatic painting technique. See Painterly Styles for Expressive Rendering.
Implement a curved brush that follows the image gradient. See Painterly Styles for Expressive Rendering.
Design a brush that can be used to stretch and pull the image as if it were rubber.
Extend the Impressionist program to work with video. The user should be able to load a series of images from a video and set up some initial parameters, and the program should automatically generate an impressionistic version of the video. The video should exhibit temporal coherency.
Project Turn-inYou will need to use the "turnin" program on the departmental Unix machines to submit an electronic version for each part of the project before its respective deadline. If you are not in the CS department, please apply for a UTCS account well before the deadline (https://udb.cs.utexas.edu/amut/acut/). If you developed your program on Windows, you will need to transfer your files to your account on the departmental Unix machines in order to use the "turnin" program. The SCP or SFTP variants of Putty can be used to do this if you don't already have a client.
All submissions should include a file named README.txt that describes any special notes for compiling and using your program.
1) To turn in the main project, first clean your development area so that all intermediate files and binary executables are removed. Then, go to the parent directory and use the following command to submit your entire project tree:turnin --submit ckm project1 impressionist2) To turn in your artifact, you will need to submit two images: a) the artifact produced by impressionist and b) the original image. In the interest of conserving image gallery bandwidth, please submit jpgs of all your images. The Unix command "convert [image].bmp [image].jpg" may be useful - it is located in /lusr/ImageMagick/bin/ on the lab machines. Use the following convention when naming the images:turnin --submit ckm project1-artifact artifact.jpg orig.jpgIf you wish to share additional information about the artifact (e.g the steps you used to create the image, artistic notes, etc.), you are welcome to include a README.txt in your artifact submission.
- Stylized Depiction in Computer Graphics
- Paint By Numbers: Abstract Image Representations, Paul Haeberli, Siggraph 1990. [Course reader pp. 83-90]
- Processing Images and Video for An Impressionist Effect, Peter Litwinowicz, Siggraph 1997.
- Painterly Rendering with Curved Brush Strokes of Multiple Sizes, Aaron Hertzmann, Siggraph 1998.