Assignment 3: Filter design

Due date: May 30 (23:55)

In this lab you are supposed to compare different image filters and understand their impacts. The lab is inspired by two very nice papers, that you should check out:

While you have read the first paper, the second is (mostly) for pleasure.

  1. (40 points)

You will need to write a Matlab function that translates an image (periodically) by an offset in x and y. We assume that the offset is given in pixel units. I.e. an offset of (1, 1) simply shifts the image by one pixel to the right and one up. An offset of ( − 1, −1) simply shifts the image by one pixel to the left and one down. Of course, your routine should be working perfectly for any real number given as a shift value. Periodically shifting simply means that you connect the left end of the image with the right and the top with the bottom end of the image. The inputs of the Matlab routine are an image (of arbitrary length and width), an arbitrary offset, as well as the interpolation pre-filter to be used and should return the shifted image.

In order to prepare your report for this task, you will need to write an image-diff routine that computes the difference of the original image and the image you get by translating K times by a distance of 1/K followed by on offset of −1.

You need to prepare a graph with two error measures, one on each of the x and y axis resp. The first error metric (on x) should be the standard root-mean-squared error (RMSE). The units should be between 0 and 255 (assuming an 8bit image). The second error measure is average relative error per pixel (i.e. the average over all pixels of final/original). Repeat this graph for K = 2, 3, 4, 5, 10, 100.

You should then interpret these graphs and discuss their implications.

Here is how the points split up:

  1. (40 points)

For this question you will need to write a Matlab routine to rotate an image around its center point by a certain angle. The routine should take as input an image (or arbitrary length and width), an angle (in degrees), as well as the interpolation pre-filter to be used and spit out the rotated image.

Since we are rotating around the center of the image, some clarification of what we mean by center: Assume an image of dimensions N × M, and it's pixels are indexed from 0…N − 1 in x and 0…M − 1 in y. Further, we assume that each pixel has dimensions 1 × 1 and is centered at integer points. I.e. the first pixel is centered at (0, 0) and the last pixel at (N − 1, M − 1). Using this setup, the image will be rotated around the point ((N − 1)/2, (M − 1)/2)

In order to prepare your report for this task, you will need to write an image-diff routine that computes the difference of the original image and the image you get by rotating K times by an angle of 360/K degrees.

You need to prepare a graph with two error measures, one on each of the x and y axis resp. The first error metric (on x) should be the standard root-mean-squared error (RMSE). The units should be between 0 and 255 (assuming an 8bit image). The second error measure is average relative error per pixel (i.e. the average over all pixels of final/original). Repeat this graph for K = 2, 3, 4, 12, 36, 360.

You should then interpret these graphs and discuss their implications.

Here is how the points split up:

  1. (20 points)

Produce two separate cli's, one for the translation experiment and one for the rotation experiment. Within the commandline you should be able to specify the following:

When the user presses enter, s/he will be able to see the translation / rotation of all different images using all different (implemented) pre-filter kernels:

In addition to the rotated images, the user will also see

The CSV file written by your program should include a row per implemented filter with columns being:

Please note that for any of the tasks above, you should only deal with gray-scale images with a dynamic range of 0…255.

You should test your results on different types of images. For a nice repository, please see the collection by Gonzales and Woods. At the very least you should do your experiments for the mandril and the peppers images.

Hints

Submission instructions

You can use Matlab or Octave and you are allowed to use all built-in functions. The use of any additional toolboxes or packages, especially the Image Processing Toolbox (Matlab) or the Image Package (Octave) is prohibited.

If you are using Octave: Your code will be tested in Matlab, therefore it should be consistent with the Matlab syntax. Octave also supports C-Style programming, which is not acceptable for this course. If your code doesn't work in Matlab, it needs to run on the lab machines! PLEAE NOTE: if your code doesn't run, no points will be awarded!

Please write A LOT OF COMMENTS IN YOUR CODE, so we can follow what you are doing! If we don't understand your code, we might call you in and you will have to explain the code to us.

If there is anything unusual about your submission, please provide a readme.txt file with your submission.

For each task explain how you solved the problem and why you are doing it this way.

That being said, what you need to hand in is a zipped folder (called YourLastName_YourStudentID_SIP18s.zip with:

Late submission

Late submissions are possible, yet they will be penalized. Don't get behind in the lab assignments - always start early! In this course you will have a total of 4 (four) grace days. A grace day allows you to submit an assignment up to 24h late without any penalty. Every further 24h you submit late consumes another grace day.

You can distribute grace days however you like (e.g. one for each assignment or all 4 for one). Once you used all your grace days you have to submit before the deadline, as further late submissions will not be accepted, i.e. NO points will be awarded. Grace days you don't use are lost (i.e. no bonus points).

Academic Honesty