Lab 9: Recursion
CS 142: The Mathematics of Computer Graphics,Spring 2007
Due Date: Thursday, April 12
Goals
- Use convolution to modify images.
- Use recursion in Povray to generate interesting structures.
Programs
In this lab, you will use of several "homemade" Java programs. These will be available on the
\home\classes drive in the folder \gorr\cs142\JarFiles. Copy this entire folder over your H drive.
To run a program, you must double click on the files with extension ".jar". If the program does not
run, please ask the instructor for help.
Image Manipulation
Convolution:
- Review the class and web notes on convolution.
- Run the Convolver.jar program. When it starts up, it will immediately request that you choose
a jpg image. You may use one that is already in the JarFiles folder or you may use one of your own. However,
it is best to use and image that is not very large (e.g. 400 pixels wide or less).
- Try entering different convolution filters:
- Blurring. What happens when you repeat this multiple times?
- Edge detection: horizontal only, vertical only, or all
- Experiment with others.
- Save an image that you have created. Write done the filter or the sequence of filters you used. For each filter
you should have 9 numbers. Make sure you keep track of the precise order of the filters.
- Place the image on your webstie along with a description of the filter(s) you used.
-
Other
- Run the Illustrator.jar program. Go to the menu File:Open and choose a jpg image to open.
- Look at the choices of filters under the "Image" menu. You should understand what each filter is
doing (these will be discussed in class). Try applying a sequence of filters to an image. Is it
what you would expect?
- Save several of the resulting images, keeping track of the sequence of filters that were applied.
- Place at least 2 of your images on your webstie along with a description of the filter(s) you used.
Cellular Automaton
Recursion
In class, we discussed how to make the Koch curve:
(povray code)
Download this povray code and run it. Read though the code to understand what it does.
Draw a line shape that begins at some point A and ends some point B to the right. For example:
Write down the sequence of "turtle moves" that would be needed to achieve this shape. Make sure that
the turtle begins and ends pointed to the right (myAngle=0).
-
Based in this, modify the koch code to follow your shape. Run your program, trying different levels
of recursion (depth).
Summary of what to turn in
No later than class time on Thursday, April 12, please do the following:
- Place your convolution picture on your webpage along with the descripion of the filters.
- Place at least two "Illustrator" pictures on your webpage along with the descripion of the filters used.
- Place your turtle pictures (generated in povray) on your website. Include several different levels of recursion, including the
one that shows the original shape.
- Email to gorr:
- your povray file for your turtle graphics.
- one png image generated from this povray file.
Please remember to place
"CS-142 Lab 9" in the subject line.
We will look at your images during class on April 12.
[top] [Schedule]
[Home]