CS 426 Assignment 2

An Image Enhancer

Due 11:59 PM, Friday, October 18, 1996



Some results of the 1995 Graphics Class.


Introduction

This assignment will allow you to explore a variety of image enhancement, image processing and ``artistic'' ideas. The program will allow you to select a transformation type and then let you explore transformations along the selected axis. There will be two types of transforms, continuous (e.g., gamma), and enumerated (e.g., dithering types). You will have to fill in some code to define each of these filters.

For example, gamma will give you nine selections of various gamma settings to choose from. The original image will be shown at the top of the screen. When you select an image, it will move to the center and nine new choices will be presented. The choices to the left and right of the current choice will be only slightly different from the current one with the top and bottom rows moving more quickly away from the original one. Thus repeated choices should allow you to fully explore the space of possible transforms. This can continue until a new transformation type is selected.


Setting up

Create a directory to hold this assignment's files. Then copy all files from /u/cs426/Examples/TkEnhance to that directory.

You can already see a fully working version of the program by running
tkenhance rex.ppm from your directory.

When you start programming, change the first line of the tkenhance script to make it point to your "imgwish".


How it works

Each filter is implemented as a separate Unix program. Most of the .c files contain empty filter routines which you will fill in, except imgNoise.c, which contains a complete working filter, as an example.

Your job will be to fill in the various image processing functions, throughout the .c files. Whenever you see the string WORK HERE, you will have some work to do.

When you type make, you'll be building a program called imgwish, which contains all the usual Tcl/Tk stuff plus extensions for your image filters. tkenhance is a wish script for imgwish.

Each time a new transformation type is selected an entry will be made in a list of transformations. An image script of the chosen transforms and parameters can be written, which can actually be used later to apply your group of filters to a number of images from the command line.

You should try to make the code as efficient as you can. Think about operations that are used repeatedly, etc. For example, consider bitwise operations for the quantization, etc.

You will also have to submit 5 image scripts (.imgsh). These will be used to see how your filters can work together to produce your final artwork.


What to implement

The transformations must include the following list plus at least two creative ones of your own making. Note that the noise function is already done for you as an example. The remaining filters are based on the web page Image Processing By Interpolation and Extrapolation. There's some code for this in imgNoise.c which you may want to borrow for the these filters.


File formats

Tkenhance can only read the ppm format. You can convert an rgb image to ppm like so:
toppm me.rgb me.ppm

You can convert a ppm to a gif file like so:
ppmquant 256 me.ppm | ppmtogif -interlace > me.gif

You can convert a ppm to a jpeg image like so:
cjpeg me.ppm > me.jpg
If your system doesn't have cjpeg, you can also view your picture with xv and save as a jpeg.


What to submit

Initially, you should probably use your 160x120 images, so the image processing algorithms go faster. When you find a filter combination that you really like, you should generate an image script for the filter and run that image script on your larger image.

When you're all done, you should have five image scripts and some number of favourite warped, distorted, and disfigured images. Choose two (or more) you like best, put them on a web page, and mention the URL for them in a README file which you submit with your assignment. We'll put our favourites on the class Web page.

Please submit:

Please don't submit binaries, images, or core files.



More documentation on TkEnhance.


CS 426 (Computer Graphics), CS Department, Princeton University
Last modified: Mon Oct 7 15:48:53 1996