Homework 4
16-311 Introduction to Robotics
Prof. Howie Choset
Due on 3:30 PM, Wednesday, February 4th
- (70%) Group: Braitenburg Vehicles
- (30%) Individual: Convolution.
Individual Work (but learning from each other is encouraged)
-
Write a C program conv.c to perform convolution.
Your program should
input two pgm file names from the keyboard: one for the image and one for
the mask.
Write a function that convolves the mask with the image.
The
size of the input and output images should be the same. To make things
easier, you will not have to worry about padding the edges of the input
image, as discussed in class. Instead, we will just accept that the
right-most and bottom-most pixels in the output image will be "wrong."
In other words, if the input image has r rows and
c columns and the mask has m rows and n columns, the output image
will have r rows and c columns but the first r-m+1 rows and c-n+1 columns
will have the output. Simply put zeros in the remaining rows and columns.
- Use your program to perform convolution on these two images with
each of the three masks provided for a total of six output images. Make a web page which shows these six images.
Be sure to do a contrast operation after the convolution, so that the values range from 0-255!
- Also answer the following questions.
- (a) What do these masks do to the input image?
- (b) What are the advantages of using a small mask? Why would you want to
use a large mask?
- (c) Suppose you wanted to identify the horizon in images at sea. What
mask might you use to do this?
- Some sample code based on last week's code is here.
A note:
There may be some confusion about the FlipMask routine in the code
provided for homework 4. Basically, this routine takes the input mask and
rotates it about the origin by 180 degrees. Why? Well, as you might
remember from class, convolution technically requires the mask to be
flipped. If you don't flip the mask, the operation is called correlation.
Many members of the vision community use the two interchangeably, which is
why we told you not to worry about flipping the mask. In the starter code
provided, we flipped the mask. You can opt to simply comment this out or
you can use the convensional/signal processing version of convolution and
flip the mask -- it is your choice. However, for the masks and images
provided, it really doesn't make much difference--do you know why? Please
be careful; it is easy to get confused, but resolving this confusion will
have a nice payoff!
Turn in:
Email Somchaya Liemhetcharat with:
- A link to your web page (which has your images and a POINTER to your source code)
- Answers to the above questions (not printed, just on the webpage OR as .doc, .pdf). Please have a pointer to the doc or pdf file from your webpage.
Last updated 2/4/09 by Somchaya Liemhetcharat