CS 4495/7495: Computer Vision

Problem Set 2: Filtering and Pyramids

Due: September 18, 2001


http://www.cc.gatech.edu/classes/AY2002/cs4495_fall/ps/ps2.html

Part I:  Plain old filtering

For this part, implement a convolution in Matlab that will allow you to take an image and a kernel (a square one) and generate the new image that results from convolving  the image with the kernel.  For all the steps below, apply your code to two images.  One is the Lena image (512x512), which is a straight TIFF image of the black and white classic image processing image (e.g. in the Burt and Adelson paper).  The other is any image of your choosing.  (Here is a 128x128 Lena image to try slow code on - use if your convolution code is really slow....)
  1. Using a 7x7 boxcar (plain rectangle), filter the image.  Be careful how you treat the edges. If your original image is NxN and you want an NxN image out, the edges require some thinking.  If you're stuck on this, do help conv2 in Matlab and read about the edges.
  2. Subtract the filtered image from the original, and look at the remainder.   How would you describe it?  (Remember, these images can go negative- use imagesc or roll your own method for displaying real-valued images.
  3. Now, create a 7x7 kernel that is more like a Gaussian blob.  (Don't forget to normalize your filter so it sums to one).  Filter the images using that kernel.
  4. Subtract the Gaussian blur form the original.  How does that compare to the image in step 2?  What about as you vary the width of sigma in the Gaussian filter?
Now that you've written your own code, you can appreciate the Matlab routines.
  1.    Repeat the above steps using the Matlab routines conv2 or filter2 Which you use depends upon how you like to do things.  Do you get the exact same results?  Close?  Where's the difference?

Part II: Pyramids

Implement the primary functions of the Burt & Adelson pyramid: reduce and expand. You want to code up few helper functions too.  You can use conv2 or filter2 if you want...
  1. Create a Gaussian pyramid of both of your images.   Choose a value for a (the parameter in the paper) that works well.
  2. Expand up all your pyramid levels so that they are the size of the original images.  That is, end up with Gaussian pyramid but all images are the same size.
  3. Clearly each level of the Gaussian pyramid represents convolution with a bigger and bigger Gaussian.  What is a simple way to empirically determine the effective size of the Gaussian at each level?  (Remember: the kernel is also called the impulse response.  What is an "impulse image"?)
  4. Subtract each subsequent level from the one below it (ie subtract neighboring levels) using these same size Gaussians.  What do those "band-pass" images look like?
  5. Graduate students:  In these band pass images, note that some areas you have an image whose value is near zero but whose intensity slope is reasonably steep.  Threshold these subtracted images so that pixels that are near zero but have reasonable slope are set 1, everything else is set to zero.  (These are zero crossings and are related to edge detection.)

What to hand in:

You will submit your work electronically (no paper). Instead, you will submit an HTML file. We have provided an HTML template that you can use. Feel free to modify the page and add additional figures and explanations to better demonstrate your work. However, the page should contain at least the following:

  1. your name on top of the page,
  2. links to ALL of your matlab code,
  3. your answers to the questions (replace the text "YOUR ANSWER GOES HERE" in the HTML template with your actual answer, leave the color of the text blue for better visibility),
  4. links to your result images converted to JPG format.

Your matlab code should be reasonably commented if you want us to understand it and give you credit/comments. Also include two test scripts: test_filters.m and test_pyramids.m. These files should demonstrate your work for part I an II of this problem set, respectively. The scripts should:

  1. load your test images,
  2. call your other matlab functions that do the required image processing,
  3. show all results on the screen using multiple figures, and
  4. save all result images in JPG format with appropriate names
  5. that can be loaded from the web page.

To submit your work do the following:

  1. On a UNIX platform create a directory named after your CoC login_name
  2. Put ALL your matlab files, the two test scripts, the two original images, and all result images in that directory.
  3. Also put a README file that explains any special needs of your code, and lists any KNOWN BUGS/FEATURES.
    For example if your code is running very slow try to explain why and mention that you used only 128x128 images.
  4. Download and modify the HTML template according to the instructions given above. Save it as index.html in the same directory.
  5. CD to the parent directory.
  6. Create a tar archive using:
  7. Gzip the tar file using:
  8. E-mail the login_name.tar.gz file to cs7495@cc.gatech.edu