As stated in the assignment, first of all we detected the
edges by using Prewitt filtering with a 3-by-3 mask, which is shown in
the Appendix part. To take the transform we needed to binarize the image
with a threshold of 100. To the image obtained from the preprocessing procedure
stated above, we applied the Hough transform of straight-line equation
with the representation of
In the implementation of Hough Transform, first of all we created a
matrix for parameter plane having (2* (max. r value)+1) rows for r values
and 46 columns for theta values. Maximum value of r is calculated as
.
This matrix stores the accumulation numbers of
pairs.
For every point of the binary image having intensity value 1, we calculated
the r values for all 46 theta-values in the range of
using the equation above. We incremented the accumulation number corresponding
to that r and
pair. Then we selected the points with maximum accumulation numbers. For
each selected point, we found the corresponding line in the x-y plane using
the equation:
or
and connected components on that line by iterating y or x respectively.
If the length of connected components is larger than a specified value
(20 in our implementation) we sketch the line component on the output image.