Assignment 1: Image Processing
Due: 9/30/2001 at 11:59PM.
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. The
operations that you implement will be mostly filters which take an input
image, process the image, and produce an output image.
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 .
-
main.[cpp/h]: Manages the user interface. Also provides utilities for
reading and writing image files in ppm (ascii) format.
-
Image.[cpp/h]: Image class.
Class for managing images with functions for getting and setting indivual
pixels.
-
ip.[cpp/h]: Processing routines.
Bare bones structure for the image processing routines.
-
Makefile: A Makefile suitable for the graphics machines.
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 Load
and Save functions are implemented. Load an image file in ppm format.
(You can convert many image formats
to ppm using the program xv.)
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 how many points the feature is worth.
The features in bold face are required. The other ones are optional.
Refer to this web page for more details on
the implementation of each filter and example output images.
-
(1/2) Brighten: Individually scale the RGB channels of an
image.
-
(1/2) Contrast: Change the contrast of an image. See Graphica
Obscura.
-
(1/2) Saturation : Change the saturation of an image. See Graphica
Obscura.
-
(1/2) Negate: Create the negative of an image by subtracting the image from the all white image.
-
(1/2) Grey: Convert a color image to its grey scale version.
-
(1/2) Crop: Extract a subimage specified by two corners.
-
(1) Embed: Embed one image in another.
-
(1/2) Extract Channel: Leave specified channel intact and set all others
to zero.
-
(1/2)Quantize by rouunding: Change the number of bits per channel of an
image, using simple rounding.
-
(2) Quantized with Ordered dither: Convert an image to a given number of bits per channel,
using a 4x4 ordered dithering matrix.
-
(2) Quantize with Floyd-Steinberg dither: Convert an image to a given number of
bits per channel, using dithering with error diffusion.
-
(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) Edge detect: Detect edges in an image by convolving it with an edge
detection kernel.
-
(2) Scale: Scale an image up or down by a real valued factor.
-
(1) Rotate: Rotate an image by a given angle.
-
(2) Fun: Warp an image using a non-linear mapping of your choice
(examples are fisheye, sine, bulge, swirl).
-
(1) Composite: Composite one image with a second image, using a
third image as a matte.
-
(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, 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: Morph two images using the method in Beier & Neeley's ``Feature-based metamorphisis. ''
For any feature that involves resampling (i.e., scale, rotate, "fun," and
morph), you have to provide three sampling methods: point sampling, bilinear
sampling, and Gaussian sampling.
By implementing all the required features, you get 12 points. There
are many ways to get more points:
-
(as listed above) implementing optional features ,
-
(1) submitting one or more images for the art contest,
-
(1) submitting a .mpeg movie animating the results of one or more filters
with continuously varying parameters,
-
(2) winning the art contest.
For images or movies that you submit, you also have to submit the sequence
of commands used to created them, otherwise they will not be considered
valid.
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.cpp and ip.h,
-
a makefile
-
the .ppm 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.
The writeup should be a HTML document called assignment1.html
which may include other documents or pictures. It should be brief, describing
what you have implemented, what works and what doesn't, how you created
the composite image, how you created the art contest images, and instructions
on how to run the fun filters you have implemented.
Make sure the source code compiles in the graphics
machines. If it doesn't, you will have to attend to a grading session
with a TA, and your grade will suffer.
Policies
-
You have 5 late days for use during the semester. You may use some or all
of them for this assignment.
-
You can acquire an additional late day by submitting this assignment at
least 24 hours early.
-
Aside from the code provided, you must design and write all code that you
submit.
-
You may discuss problems and ideas with your classmates but you may not,
under any circumstances, share code.
Hints
-
Do the simpler filters first!
-
Look at the examples pages.
-
Post questions to the course mailing list.
-
Stay tuned for more hints.
Announcements
-
Stay tuned for more announcements.
Last Update: 9/17/01