Project 1: Image Processing
Due: Thursday, January 28
CSC385 - Computer Graphics
Goal: In this assignment you will
create a simple image processing program. Your program will provide a variety of filters
including ones that threshold, brighten, blur, edge detect, dither, and warp.
This assignment will be graded on a 100 point scale.
Action
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 others
are optional. Each filter should operate on both one and three channel images
unless otherwise specified.
-
Simple pixel transformations:
-
(5) Extract Channel:
Extract a single channel, R, G or B, from a three channel image by setting the other channels to 0. (Output is a three channel image.)
-
(5) Gray: Convert a three channel image to its one channel gray scale version.
-
(5) Threshold: Create a new one bit per channel image
where the color value of a pixel/channel is 1 if the corresponding value in
the input
image exceeds the threshold. Otherwise the color value
is 0.
-
Interpolation/Extrapolation: Write a general purpose
interpolation/extrapolation routine that takes two images,
I_1 and I_2, and an α value. The routine returns the
image α * I_1 + (1-α) * I_2 . Use this routine to filter an
input image as described below.
-
(5) Brighten: Brighten or darken an image.
-
(5) Contrast: Change the contrast of an image.
-
(5) Saturation: Change the saturation of a three channel image.
-
(5) Invert: Create the negative of an image.
-
(5) Noisify: Add random noise to the image.
-
Convolution: Write a general purpose convolution routine that takes an image,
a convolution kernel, and the size of the kernel. The routine returns the convolved image. Use it
to filter an input image as described below.
-
(5) Edge detect: Detect edges in an image by convolving it with an edge
detection kernel.
-
(5) Blur by Box filter: Blur an image by convolving it with an nxn box
filter (n must be odd).
-
(5) Blur by Gaussian filter: Blur an image by convolving it with an nxn
Gaussian filter (n must be odd).
- Quantize: Requantize an image using the techniques described below. Note that quantization by rounding is worth 0 points but is required!
-
(0) Quantize by rounding: Change the number of bits per channel of an
image using simple rounding.
-
(10) Quantize with Ordered dither: Change the number of
bits per channel of an image using a 4x4 ordered dithering matrix.
-
(10) Quantize with Floyd-Steinberg dither: Change the
number of bits per channel using dithering with error diffusion.
-
Warp: Warp an image allowing the user a choice of resampling methods. Write general purpose resampling methods based on nearest sample, bilinear, and guassian methods.
-
(10) Rotate: Rotate an image by a given angle about a given point.
-
(5) Scale: Scale an image in x and y.
-
(0-10) Fun Warp: Warp an image using a non-linear mapping of your choice.
Some examples are fisheye, sine, bulge, swirl. (The point value depends on the quality of the effect, average scores are 5 pts.)
- Misc. effects
-
(5) Composite: Composite one image with a second image, using a
third image as a matte.
-
(5) Crop: Extract a subimage specified by two corners.
-
(?) 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.
- Create an image
-
(0-10) Create a composite image of yourself and a famous person.
- (5) Create an interesting image using your image processor and submit it to the art contest
By implementing all the required features, you get 70 points.
You can acquire additional points by implementing optional features,
winning the art contest (10 points), winning the composite image contest (10 points), thinking up something new and different
(prior approval is recommended), or reporting a bug (see below).
It is possible to get more than 100 points. However, after 100 points,
each point is divided by two, and after 110 points, each point is divided
by four, etc.
What You Are Provided
To allow you to focus on the
image processing algorithms, we provide skeleton code that includes
a user interface and an image class.
The interface 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. (Note: these requests should be
made from ip.cpp, which is described in the next section.)
There is also a full implementation of the image processor,
available on blackboard, that you may find useful to debug and test your own code.
Information about this implementation can be found in its manual (also on blackboard).
If you find a bug in the code, notes, or documentation for this project,
please notify me immediately. Please be sure to
provide enough information so that I can recreate the problem. You will
acquire (up to) 5 bonus points if you are the first to report the problem.
Getting Started
We provide you
with several files to get you started. The ONLY ones you should edit are ip.cpp and ip.h.
-
main.cpp, main.h: sets up the OpenGL context and handles
window display.
-
common.h: useful definitions and a few common includes.
-
control.cpp, control.h: handles OpenGL menus and user i/o.
-
image.cpp, image.h: class for managing images with functions for getting and
setting individual pixels, as well as reading and writing BMP
files (only one channel 8 bit and 3 channel 24 bit files that are uncompressed).
-
ip.cpp, ip.h: bare bones structure for the image processing routines.
-
win32.cpp, win32.h: defnitions for windows applications.
You may download a zipped version of these files on blackboard.
After you copy these files to your directory, you should
compile the program by using Visual Studio.
Run the executable. Right click in the display window to view
the menu options. At this point only the options under the File submenu are
implemented. Load an image file in bmp format. Be sure it is an 8 bit grayscale image or a 24 bit color image. Gimp is a useful tool for converting file formats.
The first filter you should implement is quantize by rounding. You'll note that this
feature is required but worth 0 points!
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 you want to submit.
-
For images 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
I must be able to reproduce the image!)
- Make sure the source code compiles and runs on the Olin 102 machines.
If not I won't be able to grade it!
- You must write, from scratch, all code you submit beyond that which
is provided.
-
In accordance with the late policy, you will lose 10 points per day for assignments submitted after 1:55 on the due date.
- In order to pass the class, you must submit (by our final slot)
a program that:
- Receives at least 50 points total.
- Receives at least 50% of the possible points on the required
features.
Make sure you understand
this statement.
Notes
-
Check your solutions against those generated by the sample code.
(NOTE: For ordered dither, the example solution does 2x2, so your solution won't match.)
-
Post questions to the course mailing list or wave.
Deliverables
You should the following on blackboard:
- a zipped version of the complete visual project studio folder including all source files
- the images (sources, masks, and final) for the composite feature
- the images for the art contest (optional)
- an html writeup.
You should not submit anything else.