A program was written in Matlab to construct a line in a 100 by 100 pixel input image which did not contain noise. This line had a gradient m=0.75 and a y-intercept value of b=20.0. The program was then extended to implement the Hough algorithm on feature points only. Feature points were defined as points with a grey level of 200 or more. It was specified in the program that points on the line were to have a grey level of 255.
For each value of
that this point could take, the corresponding r values were calculated. If a r value was found to be less than zero, then this r value was set to one. For each
calculated, the corresponding positions in the accumulator array were incremented by a value of one.
After each feature point was examined, the maximum value in the accumulator array was located. The position
in the array where this maximum occurred was noted. A line could then be reconstructed in a new image with the equation,
The input image, accumulator array and the reconstructed line can be viewed in the figure below. The Matlab code can be viewed in Appendix B.