INFOIBV
Image Processing

Assignment 2: Morphological filters

Use the provided framework and add the following functionality:
  1. Erosion/dilation: implement two functions that take a grayscale image, a structuring element and a grayscale control image as input and output the geodesic eroded/dilated image with the mask as control image, respectively. You functions should also work for binary images. In this case, use only the values 0 and 1 in both image and control image. Check whether image and control image have the same size.(15 points)
  2. Opening/closing: implement two functions that take a grayscale image, a structuring element and a grayscale control image as input and output the image after geodesic morphological opening and closing, respectively. You functions should also work for binary images. In this case, use only the values 0 and 1 in both image and control image. Check whether image and control image have the same size. For geodesic opening, first perform a "normal" erosion (no control image), followed by a geodesic dilation. (15 points)
  3. Complement: implement a function that takes a (binary) grayscale image as input and outputs the complement of the image. (10 points)
  4. AND/OR: implement two functions that take two (binary) grayscale images as input and output the AND and the OR of both images. Check the input arguments but only perform the AND/OR when the sizes of both images are the same. (10 points)
  5. Value counting: implement a function that takes a grayscale image as input and outputs the number of distinct values. (10 points)
Choose what happens with boundary pixels. Make sure your code works with structuring elements of arbitrary size. Demonstrate your implementation by loading image B or C from assignment 1. Make sure it is a binary single channel image. We call this image W. Then:
  1. dilate image W with a 3x3 square kernel. This is image X.
  2. erode image W with a 3x3 square kernel. This is image Y.
  3. take the AND of image X and the complement of Y. This is image Z.
  4. use image A from assignment 1, convert it to grayscale and perform a series of dilations with increasing structuring element size. Choose the shape of the element (e.g. plus, square), but keep it fixed. The resulting images are E1...En.
  5. for each image E1...En, count the number of distinct values F1..Fn.
Write a brief (2-page) report with:
  1. the images X, Y and Z. Explain what result Z is. (10 points)
  2. a graph with on the x-axis the size of the structuring element and on the y-axis the values F1...Fn. Explain what you see. How can this be explained? (10 points)

Submission
Submit (through http://www.cs.uu.nl/docs/submit, and select Image Processing Assignment 2):

  1. your code (NO binaries/libs)
  2. your 2-page report
Mark all deliverables clearly with your names and student numbers. The root of the archive should be a folder formated as follows: StudentNumber#1 - StudentNumber#2. To execute the program, make sure your code runs out-of-the-box. Handing in code with a batch or command file that starts a compilation is completely at your own risk. Make sure your file size is smaller than 30MB. After a successful submission you should receive a confirmation email in your student email account. If not, contact Ronald Poppe (before the deadline) by sending a link to a download. DO NOT submit your assignment by email.

Bonus points
You can earn bonus points by:

  1. implementing a function that performs geodesic reconstruction by erosion. Make sure your algorithm stops when the stable result is obtained. (10 points)
  2. demonstrate your reconstruction function using an example. So take an image, take a control image and show in your report the stable results of the reconstruction. (10 points)

Deadline
Deadline is Wednesday October 18, 23:00. One full point will be deducted for submissions within one day of the deadline (you will have to email Ronald Poppe). No further extensions to the deadline will be given. There is NO re-take for the assignments.

Questions/Contact:
The assistants for this course are available to answer your questions and to provide guidance about your project. Contact them through the INFOIBV2017 Slack team. There are walk-in sessions where the student assistants can help you.