ISTA 352 - Images: Past, Present, and Future - Fall 2012

Assignment Five

Note change back to original format---we are back to one big assignment, but it is designed as relatively short one at that.

Due: Late (*) Monday, December 03.

(*) "Late" means that the instructor might start grading by 8AM Wednesday. Once the instructor starts grading, no more assignments will be accepted.

10 points

This assignment should be done individually

 


 

You can do the programming parts of this assignment in any language you like, although if your results are anomalous, and the grader does not speak the language you use, they may be less able to quickly figure out what the problem is and give you reasonable part marks.

 

Regardless of what language you use, please follow the instructions linked here  carefully.

 


Deliverables

Deliverables within questions are flagged with ($).

 

This assignment has 2 regular questions worth 6, and 4 points respectively, and an extra question for 2 bonus marks. ,

 

 


Before you start reading and get confused by the details of the application, you may want to consider how you will do two basic building blocks: 1) drawing circles on an image; 2) drawing a circular disc (i.e., providing a filled in circle). Looking these up on the web, or finding a Matlab tricks do to them is OK (for the second, you could have a look at the function “fspecial”.

  1. A program to count money (six points). The image linked here has several coins in it. This question explores the possibility of using filtering methods to locate the coins, thereby enable counting them. To begin, convert the input image to black and white (using color to an advantage will be considered for bonus points). Now create a filter with a circular pattern with values -1 within a disc, and zeros outside (the Matlab routine fspecial might be helpful here). The disc size should be the coin size. Intuitively, this filter should respond differently to a coin compared to the background via “template matching”. (For later parts, make the size of the circle a parameter that is easy to change). Provide an appropriately offset and scaled visualization of your filter as an image ($).

Now use convolution or filtering (e.g., Matlab imfilter) to run the filter over the image, and provide an image of the result. Likely you will need to scale the image to visualize the filtered result ($). Now create an algorithm that goes from the filtered result to a count of the coins. You could set a threshold, and investigate “connected components” in Matlab. Provide some details and/or visualizations of your program, as well as the final answer (how many coins?) and a visualization the final result. For this, draw circles over the image where your program thinks the coins are ($).

Run your program on these additional images

            coins-2.jpg      coins-3.jpg      coins-4.jpg      coins-5.jpg      coins-6.jpg

with appropriate presentation of the results ($). You likely will need to either change the circle size, or step through circle sizes and figure out a way to declare so that you can output coins at different sizes. This is tricky to do well, and doing more than simply manually setting the parameter could lead to bonus points if you explain what you did and present results in a reasonable way. Alternatively, you could scale the image sizes so that the coins in all of them are about the same size. I expect that your program will not handle these images equally well, and you should identify and comment on failed results ($).  If you are pressed for time, you might consider skipping this part for now, and carrying on with parts 2 and 3

 

  1. Trying out more filters (four points).  Consider a similar filter to the disk above, but now put a second ring of 1’s around the disk of -1’s so that the sum of all values in the filter is approximately zero. You can use a value close to one instead to get it exactly zero if you like. Create a scaled visualization of your filter as an image and put it into your writeup ($). Create two more filters based on the two you have (one from problem one, one just constructed) by convolving the filter itself with a Gaussian mask.  If you are using Matlab, an easy way to get a Guassian is with the function “fspecial”. This will create a blurry version of the two filters. You have the sigma parameter to play with, which may come in handy soon. For now, show visualizations for values of sigma where the blurring is obvious ($). Finally, create a filter that is a simply a cut-out of a coin from one of the images, and provide an image of that filter.

You now have four new filters,  two of them which have a sigma parameter that you can play with. Apply these filters to the images from the preceding questions and report some results and visualizations of the results ($). Are you able to count coins better? Note that when you make changes to one part of an algorithm (here the filters), you need to consider whether other parts (e.g., thresholds) need to be changed as well.

 

Extra problem

 

  1. Normalized cross correlation (two points extra credit). As discussed in class, the kind of template matching in the previous two problems is sensitive to the brightness of the image. In normalized cross correlation we divide the response to the filter at each point by the vector magnitude (vector norm) of the part of the signal (image) under the filter. For a given filter size, you can prepare an array of these values that you can use to normalize filter responses. Study whether this helps your program with counting coins, and provide some results with comments ($). Again, note that when you make changes to one part of an algorithm (here the filters), you need to consider whether other parts (e.g., thresholds) need to be changed as well. (A possible result of using normalized cross correlation is that the same threshold can apply to broader range of images).

 

 

What to Hand In

Consult the instructions linked here for conventions for preparing and handing in assignments. In 2012, hand in assignments via email to Kyle Simek (ksimek@email.arizona.edu).