Laboratory of Computer and Information Science / Neural Networks Research Centre CIS Lab Helsinki University of Technology

T-61.5070 Computer Vision

Course assignment

The topic of this course assignment is blob analysis. The purpose is to find different kinds of blobs from the image based on their shape and internal structure. Blob analysis is a common method, for example in applications where we are interested in finding errors in an industrial manufacture line. E.g. a camera would be monitoring manufactured parts where high quality is required.

The assignment is done with Matlab and its Image Processing Toolbox. Use the command help images to get a list of all image processing commands. Some basic information on using Matlab for image processing can be found on the Digital Image Processing course website.

The blob image to be used is enamel.tif. It can be loaded into Matlab for example with the command:


Then proceed with the blob analysis by first (1) extracting segments and labeling them, (2) extracting features from the segments and finally (3) classifying the blobs.

NOTE: Below, references to the course book are given for both the old book (2nd edition) and the new one (3rd edition) separated by a /-sign, as 2nd/3rd.

1. Segmentation and Labeling

The interesting regions must be first found, i.e. segmented, from the image. For the given image the job is easy, since the blobs can be separated from the light background by simple gray-level thresholding. Use Algorithm 5.2/6.2: Iterative (optimal) threshold selection from the course book (pages 129-130/181) to find the threshold. Use the proposed initialization. Show the convergence of the algorithm with e.g. a diagram. Plot also the image histogram with proper scaling. Do you think that the obtained threshold is optimal? Where would you personally put the threshold?

Next, the found regions are labeled from the segmented binary image (use the value from your algorithm for thresholding). Use the Matlab function bwlabel. Remember to also fill the possible holes inside the regions so that the feature extraction may succeed. You don't need (and it's forbidden to use) the gray-level image in the following phases; only the segmentation images (non-filled and filled) are needed.

2. Feature Extraction

Remove those regions that intersect with the image edges or whose area is less than 100 pixels. For each remaining region, calculate at least the following features:

For the ratio of principal components some ready-made Matlab code can be found from the course assignment page of T-61.3020.

3. Classification

Solve the following problems (again, the gray-level image cannot be used):

  1. Find the blobs with several (more than one) light areas inside them.
  2. Find the donut-shaped blob that is located in the lower right corner. Use morphological filtering (dilation/erosion).
  3. Find nine blobs that are most circular with respect to their
    1. elongatedness and
    2. compactness.
    Pay attention to how you measure the closeness of a blob to a circle, i.e. what kind of values of elongatedness and compactness are closest to that of a circle?
    Furthermore, explain why the results of a and b might differ?


A written report must be made, containing your Matlab-code, all the resulting images, and a clear explanation of exactly what was done and what were the results. Remember to comment your code well! However, just returning commented Matlab-code is not acceptable as a report.

The course assignment is graded as passed or failed. For those who fail, a short description of what needs to be improved will be given and a corrected version should be returned in two weeks time.

Each student is expected to return his/her individual report, i.e. only one name per returned work! Cooperation on the level of ideas is fine, but code and text should definitely be done individually. The report must have a separate cover page which contains the name, student number and e-mail address.

The written report should be returned electronically as an e-mail attachment PDF file to the assistant (mats.sjoberg at The file should be named after your student number, e.g. 12345X.pdf. You should receive a confirmation from the assistant that your mail has arrived within two working-days. If you do not receive a reply please try again since some mails can get lost in the Junk mail-filtering!

The report can also be returned as a printed papercopy. The paper should then be put in the mailbox next to the notice board of the (old) Laboratory of Computer and Information Science (T-building, 3rd floor).

The course assignment must be finished and returned on Monday, May 26th at 4pm. The course is passed only after both the exam and the course assignment are done.

You are at: CIST-61.5070 → Course assignment

Page maintained by t615070 at, last updated Friday, 14-Mar-2008 10:36:04 EET