The program used in the previous section to find a straight line in an image was extended to find a line in a noisy image. The noisy image was constructed with two lines, one of gradient m=2.0 and y-intercept b=10.0, and the other line of gradient m=-0.7 and y-intercept b=85.0. Rather than finding feature points, the program implemented the Hough transform on all points in the image. For each
coordinate calculated, the accumulator array was incremented by the grey level value at the corresponding (x,y) pixel in the input image.
It should be noted that the Hough transform will only find the longest line in the image. To detect the second line in the image, the program would have to locate the second local maxima in the accumulator array. The input image, accumulator array, and reconstructed line can be viewed below. The Matlab code can be viewed in Appendic C.
![]() |