Project 1: Image Processing
Due: 9/23/02 at 11:59 PM
Overview
This assignment is adopted, with some minor modifications, from COS426
at Princeton as taught by Tom Funkhouser. In this assignment you will
create a simple image processing program. Most of the operations you will
implement are filters that take an input image and process it to
produce an output image. To allow you to focus on image
processing, you are provided with an OpenGL framework and an image class.
This code is available in /cs/cs155/proj1/src/ on the graphics
machines.
A full implementation of this image processor is available for your
use here. Information about this
program can be found in its manual.
A gallery of images created by previous semesters of this class is
maintained here for motivation.
Getting Started
You should use the code available at /cs/cs155/proj1/src on the
graphics machines as a starting point for your assignment. We provide you
with several files, but you should only change ip.cpp and
ip.h. Following is a description of the various files we provide.
-
main.[cpp/h]: sets up the OpenGL context and handles displaying and
resizing the image window.
-
common.h: useful definitions and a few common includes.
-
control.[cpp/h]: handles OpenGL menus and user i/o.
-
image.[cpp/h]: class for managing images with functions for getting and
setting individual pixels, as well as reading and writing BMP and PPM
files.
-
ip.[cpp/h]: bare bones structure for the image processing routines.
-
ip.[dsp/dsw]: Visual C++ 6.0 project and workspace files, if you'd rather
do the project on a windows box. Remember though that your final code
will be graded on the graphics machines.
-
win32.[cpp/h]: necessary code to keep the project running smoothly on
windows machines.
-
Makefile: a Makefile suitable for the graphics machines, including
makedepend support.
After you copy the provided files to your directory, the first thing to
do is compile the program. An executable called ip will be
created. Run the executable. Right click in the display window to view
menu options. At this point only the options under the File submenu are
implemented. Load an image file in ppm or bmp format. (You can convert
many image formats to ppm or bmp using the programs xv, gimp, or
convert)
The Makefile supports a few operations...make will build
all necessary objects and the executable. make clean will
remove the executable and all object files. make depend will
create header dependency information. make fresh is the same
as make clean ; make depend ; make.
What You Have to Do
The assignment is worth 20 points. The following is a list of features that
you may implement. The number in front of the feature corresponds to its point
value.
The features in bold face are required. The other
ones are optional. Examples of most filters are provided
here. Information on filter design
can be found in the lecture notes and implementation details can be
found
in the
ip
manual.
-
(1/2) Blur by Box filter: Blur an image by convolving it with an nxn box
filter.
-
(1/2) Blur by Triangle filter: Blur an image by convolving it with an nxn
triangle filter.
-
(2) Blur by Gaussian filter: Blur an image by convolving it with
an nxn Gaussian filter.
-
(1/2) Brighten: Individually scale the RGB channels of an
image.
-
(1) Composite: Composite one image with a second image, using a
third image as a matte.
-
(1/2) Contrast: Change the contrast of an image.
-
(1/2) Crop: Extract a subimage specified by two corners.
-
(1) Edge detect: Detect edges in an image by convolving it with an edge
detection kernel.
-
(1/2) Extract Channel: Extract a single channel from an image.
-
(1/2) Grey: Convert a color image to its grey scale version.
-
(1/2) Invert: Create the negative of an image by subtracting the image
from the all white image.
-
(1) Median: Replace each pixel with the median of the surrounding pixel
values.
-
(1/2) Noisify: Add random noise to the image.
-
(1/2) Quantize by rounding: Change the number of bits per channel of an
image using simple rounding.
-
(2) Quantize with Ordered dither: Change the number of
bits per channel of an image using a 4x4 ordered dithering matrix.
-
(2) Quantize with Floyd-Steinberg dither: Change the
number of bits per channel using dithering with error diffusion.
-
(1) Rotate: Rotate an image by a given angle about a given point.
-
(1/2) Saturation: Change the saturation of an image.
-
(2) Scale: Scale an image in x and y.
-
(1/2) Threshold: Create a new one bit per channel, one channel image, where
each pixel is white if the original pixel's intensity exceeds the
threshold and black otherwise.
-
(2) Warp: Warp an image using a non-linear mapping of your choice
(examples are fisheye, sine, bulge, swirl).
-
(1) Create a composite image of yourself and a famous person.
-
(up to 3) Nonphotorealism: Implement any non-trivial painterly filter.
For inspiration, take a look at the effects available in programs like
xv, convert, PhotoShop, and Image Composer (e.g., impressionist, charcoal,
stained glass, etc.). The points awarded for this feature will depend on
the creativity and difficulty of the filter. At most one such filter
will receive points.
-
(3) Morph: Implement the morphing algorithms found in Beier & Neeley's ``Feature-based metamorphosis.''
For any feature that involves resampling (i.e., scale, rotate, warp,
and morph), you have to provide three sampling methods: nearest point
sampling, bilinear sampling, and Gaussian sampling.
Filters should operate on 1-channel and 3-channel images. (In cases
where this doesn't make sense, e.g. extract on a 1-channel image, use
your own judgement as to how to handle.)
By implementing all the required features, you get 12.5 points. There
are many ways to get more points:
-
(?) Implement optional features (pre-approval is recommended).
-
(1) Submit a non-trivial processed image for the art contest.
-
(2) Win the art contest.
-
(1) Submit an MPEG movie made by varying the paramaters to one or more
filters (see the Movie FAQ for
more information).
-
(1) Demonstrate on 9/17/02 that you have correctly implemented at least
10 points worth of features for this assignment.
The code provided reads the input paramters for most of the filters but does no error checking. That is your responsibility. In addition, you must request and read parameters for any filters you design.
(Do this in ip.cpp!)
It is possible to get more than 20 points. However, after 20 points,
each point is divided by two, and after 22 points, each point is divided
by four.
What to Submit
You should submit:
-
the complete source code for your version of ip,
-
a makefile,
-
the .ppm or .bmp images (sources, masks, and final) for the composite
feature,
-
the .mpeg movie for the movie feature (optional),
-
the images for the art contest (optional), and
-
a writeup.
Some Rules
Read the following carefully.
-
Your submissions is not considered complete until a writeup is submitted.
Your writeup should be an HTML document called assignment1.html.
It should be brief,
describing what you have implemented, what works and what doesn't,
and
instructions on how to run the fun filters you have implemented.
It should include any images/movies you want to submit.
-
For images or movies that you submit, you need to provide all sources
images and also describe the
sequence of commands used to created them. (Note: To receive credit
we must be able to reproduce the image/movie!)
- Make sure the source code compiles in the graphics machines. If it
doesn't, you will be in a world of hurt.
- You must write, from scratch, all code you submit beyond that which
we provide.
-
You may use one late day without incurring a penalty for this assignment.
If you do not
use the late day it will be banked for subsequent assignments.
After one day you will be charged 2 points per day penalty until the
program is submitted. In order to pass the class, you must submit
a program with each required feature correctly implemented no later
than two weeks after the assignment is due. Make sure you understand
this paragraph.
-
You can earn one late day (to be used for future assignments) by
submitting your solution at least 24 hour early.
-
Additional points may be earned by suggesting creative ways to get students to start these projects early and finish them on time!
Notes
-
Do the simpler filters first!
-
Look at the examples page.
-
See the
ip manual.
-
Read the lecture notes.
-
Look at the faq for questions.
-
See Graphica Obscura.
-
Post questions to the course mailing list.
-
It may make things easier to make separate interpolate and convolve
functions that take an Image* and return a new Image*, and then use those
functions to implement the various filters.
-
Stay tuned for more notes.
Links
Last Update: 9/8/02