Due: 10/03/99 at 11:59PM.
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, somehow process the image, and produce an output image.
You should use the code available at /u/cs426/1/, on the MECA machines, as a starting point for your assignment. We provide you with several files, but only one, image.c, needs to be changed.
Also, you can find test images at /u/cs426/1/images.
After you copy the provided files to your directory, the first thing to do is compile the program. If you are developing on a Windows NT machine, running Microsoft Visual C++, from the MS-DOS prompt, type:
% copy Makefile.nt Makefile % "c:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32" % nmake
If you are developing on a UNIX machine, type:
% copy Makefile.unix Makefile % make
In either case an executable called image will be created.
The user interface for this assignment was kept to the simplest possible, so you can concentrate on the image processing issues. The program runs on the command line. It reads an image from the standard input, processes the image using the filters specified by the command line arguments, and writes the resulting image to the standard output. For example, to increase the brightness of the image in.bmp by 10%, and save the result in the image out.bmp, you would type:
% image -brightness 1.1 < in.bmp > out.bmp
For each available image filter there is a corresponding optional argument. To see the complete list of options, type:
% image -help
If you specify more than one option, the options are processed in the order that they are found. For example,
% image -contrast 0.8 -scale 0.5 0.5 < in.bmp > out.bmp
would first decrease the contrast of the input image by 20%, and then scale down the result by 50% in both x and y directions. Another way of doing the same thing would be
% image -contrast 0.8 | image -scale 0.5 0.5 < in.bmp > out.bmp
which uses pipes instead of multiple options per command line. The ability to use pipes can be used to avoid creating temporary files. For example,
% image -contrast 0.8 | image -scale 0.5 0.5 < in.bmp | xv -
does the same thing as the previous command, but it redirects the final output to be
the input of xv
, which simply shows you the result on the screen, without
creating any temporary files in your directory.
Another advantage of this kind of interface is that you can combine different filters in shell scripts, and automate image processing steps, which can save you time.
The assignment is worth 15 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.
For any feature that involves resampling, like scale and rotate, you have to provide three sampling methods: point sampling, bilinear sampling, and Gaussian sampling.
By implementing all the required features, you get 13 points. There are many ways to get more points:
For any image that you submit, you also have to submit the sequence of commands used to created the image, otherwise the image will not be considered valid.
It is possible to get more than 15 points. However, after 15 points, each point is divided by 2, and after 17 points, each point is divided by 4.
You should submit:
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 compile in the MECA workstations. If it doesn't, you will have to attend to a grading session with a TA, and your grade will suffer.
Always remember the late policy and the collaboration policy.
image.[ch
].
You may find them helpful while writing your filters.Makefile.nt
.xv
: right-click to open the xv
controls window, then click on the 24/8 Bit menu-button, then select the 24-bit
mode option. Alt-8 toggles between 8-bit and 24-bit modestdin
and stdout
are opened as text files, not
as binary files. A new version of main.c
that fixes this has been released.Makefile.nt
with bug fixes was released.main.c
with bug fixes was released.main.c
and a new Makefile
with bug fixes were released.