Thursday, December 3, 2009

Activity 2: Hough Transform

Introduction
Hough transform is one of the many computational methods that can isolate features of images such as shapes and edges. In this activity, I will use hough transform to the image shown below.
Using Hough transfrom in Scilab, the rectangular image's edges were detected by finding the infinite lines in which the image's edges lie. These lines are then plotted and overlayed with the raw image.

The Hough Transform Method
The coordinates of any edge i of our image are known (xi, yi) through image processing. These coordinates are used as constants to find the parametric notation of lines in hough transform space that will pass through the coordinates of i. The notation is given as follows.

where r is the length perpendicular to the line coming from the origin, and theta is the angle between the horizontal to r as shown below.



These parameters alone (r, theta) can thus define a possible infinite line that passes through the edge of the image. Scanning through all possible (r,theta) combinations for each point i (xi,yi) and plotting these (r,theta) in polar Hough transform space, we get the Hough transform of the image that are sinusoidal. The points of maximum intensity defines the intersection of the curves, which represent the points that are collinear in cartesian coordinates.


Applying the method to my raw image, I got the Hough transform as follows:


For the above plot, I used "jetcolormap" of scilab to color the plot. The intersections indicate the points that are collinear in cartesian coordinates. These lines detected by the Hough transform are when overlayed with the original rectangle is shown below.

The application of hough transform to detect lines in a raw image and to properly superimpose these detected lines with the raw image is successfully implemented. In this activity, I give myself a total points of 10.


Main references (for the method section):
1. http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm
2. Physics 305 handouts