Homework 4
16-311 Introduction to Robotics
Fall-05. Prof. Howie Choset
Due in class Tue, Sep. 20st
Please answer the following questions. Hand in a hard copy in class. No webpage necessary,
and no need to email Robert anything (my inbox is full enough as it is).
(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.
Update:
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!
The masks (as .pgm files)
Mask #1
Mask #2
Mask #3
The images to convolve:
zebra.pgm
horse.pgm
Use your program to perform convolution on the two images provided with
each of the three masks provided for a total of six images. Please hand in a hard copy of
all the pictures. You do not have to display them on your webpage unless you want to. Please link your code to your andrew webspace and write the address on the hardcopy you turn in. Do not turn in a printout of the code.
Also answer the following questions.
-
(a) What do the masks provided 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.