Harvey Mudd College
Computer Science 153
Problem Set 4
Due Friday, November 11, 11:59pm

Back to Problem Set 4 top-level page

Section 1: The Hough Transform for Lines

In this section you will implement the Hough transform for lines and use it to identify the lines in the sketches that you drew in class. These sketches can be found in: /cs/cs153/ImagesF05/PS4/Ink/ They are simply grayscale images. In this next section we will work with the same images represented as stroke data, but for now there's no new image representation. I recommend starting with the simple shapes and then moving on to the complete trees as the trees may take a long time to run.

Part 1: Implementing the Hough Transform

Your only task in this section of the assignment is to implement the Hough transform for lines as we descibed it in class using the line representation x*cos(theta) + y*sin(theta) + d = 0. Implementing this algorithm will involve addressing the following issues:

Note that I do not see any clear way to use matrix manipulation to analyze all the points in parallel, so this implementation will involve some loops (which is partly why it will be so slow).

If you find you are unhappy with your fit, here are some more things to consider (as suggested by Z. Dodds):

To display your results, overlay the lines found by your Hough transform on top of the original image. You can plot a line by first generating a number of x and y values that fall on your line and then plotting those values using the "plot" command. For example, to plot the line x*cos(20) + y*sin(20) + 2 = 0 on x ranging from 0 to 5:

x = [0 5];
y = (cosd(20).*x + 2) / sind(20);
plot(x,y); 

When you are satisfied with your Hough transform, run it on several of the simple shape images, and a few of the family trees (these could take a LONG time). Show the resulting accumulator array (visualize it as a 2D image by treating bin values as image intensities (you may have to scale them)) and the lines found overlaid on the original image. Also include a brief (2-3 paragraph) writeup about your experience with the hough transform. What worked and what didn't and what did you finally settle on?


Results:


Possible Extensions

Remember that you need to pursue only one extension in one part of the assignment, and it can be anything you'd like to investigate. These are only suggestions.