You are on page 1of 3

EC1743 Computer Vision

Problem Set 2 Filtering & Hough


Due Friday, April 29, 2016
This problem set is your first vision project where you compute an answer that is some
structural or semantic description as to what is in an image. And youll learn that some methods work
well for carefully controlled situations and hardly at all when you relax those constraints.
As a reminder as to what you hand in: A Zip file that has

A PDF file that shows all the results you got for the problem set. This will include the code,
images, and the small number of written responses necessary to answer some of the questions.

In addition to the PDF you also need to provide Images and Code separately .
There should be a separate folder for each main part with names like PS2-1, the folder will
contains images and code (.m files) for that part. Regarding the code you used for each
question, it should be clear how to run your code to generate the results.
Note:

In this assignment, you will need to convolve filter masks with an image many times (in
part 1, 2, and 3), so you should write a function which convolves a filter mask with an
image. The input parameters to the function should be image and filter mask and it
should return the output image.
Do not use Matlab built-in functions to solve the problems unless specified
otherwise.
To convert color images provided to gray scale use rgb2gray function.

1. Remove noise from the image ps2-input1.png using averaging (box) filter and Gaussian filter.
Write your own function for convolving the filter mask with the whole image. Take care of the
filter output on the image boundaries (you may use padarray function here). Output the two
smoothed images, and comment on the difference of the two outputs.
2. Find the edges in the image ps2-input2.png using Sobel and Laplacian filters using your own
functions. In case of Laplacian output should be scaled, so that there are no negative values. In
case of Sobel, note that output image is the resultant magnitude of Sobel output in x and y
direction.
Compare the Sobel and Laplacian output, and comment on the difference. In addition,
comment on the difference of scaled and un-scaled version of Laplacian.
3. Apply the Sobel edge detection that you developed in part-2 on ps2-input3.png and ps2-input3-

noisy.png. What is the problem with the output of the second image, and how can you solve
this. The final outputs should be thresholded binary edge images. How can you solve this
problem using the canny edge detector? You can use canny edge detector option in Matlab
edge function.
4. Matlab Hough for lines.
a. This question use the image ps2-input3.png which looks like this:

This is a test image for which the answer should be clear, where the object boundaries
are only lines. You can use canny edge detector option in Matlab edge function to find
edges. Use Matlab Hough function for finding lines. Apply it to the edge image. Draw the
lines in color on the monochrome intensity (not edge) image. The lines can extend to
the edge of the images (aka infinite lines). You should see an image that looks like the
image given below.
In addition, find the lines in ps2-input4.png.

Output: the edge image


Output: Hough accumulator array image with peaks circled or somehow
labeled.
Output: intensity image with lines drawn on them
b. Find lines in ps2-input3-noisy.png and ps2-input4-noisy.png. These images are the same
as before but with noise. Your goal is to adjust the filtering, the edge finding, and the
Hough algorithms to find the lines as best you can in these test cases.
Output: Hough accumulator array image with peaks circled or somehow labeled.

Output: intensity image (original one with the noise) with lines drawn on them
Output: describe what you had to do to get the best result you could
5. THIS PART IS (SOMETIMES) HARDER THAN IT LOOKS LEAVE EXTRA TIME FOR THIS! TO
TEST THIS YOU MIGHT MAKE YOUR OWN TEST IMAGE. THIS PART HAS DOUBLE MARKS.
Write your own circle finding version of the Hough transform for a fixed radius. You can
detect different sized circle by changing the value of the radius in your algorithm.
Use the images ps2-input5.png and ps2-input6.png. You can smooth the image and find
edges using built-in canny edge detection, and then apply your circle finding algorithm on
it.
Output: edge image and images with the circles drawn in color
Output: describe what you had to do to find the circles.
You can compare your algorithm result with built-in Matlab algorithms of Hough circle
finding imfindcircles.
Extra Credit Question: Write circle finding version of the Hough transform for an unfixed
radius. If you find your arrays getting too big, (hint) you might try make the range of radii
very small to start with and see if you can find one size circle. Then maybe try the
different sizes. Use the images same images as in part 5.
Output: edge image and images with the circles drawn in color
Output: describe what you had to do to find the circles.

You might also like