Loadable Function: [H, R] = hough_line(I, angles)

Calculate the straight line Hough transform of a binary image I.

The angles are given in radians and default to -pi/2:pi/2.

H is the resulting Hough transform, and R is the radial distances.

The algorithm is described in Digital Image Processing by Gonzales & Woods (2nd ed., p. 587)

For a Matlab compatible Hough transform see hough.m

Demonstration 1

The following code

 I = zeros(100, 150);
 I(30,:) = 1; I(:, 65) = 1; I(35:45, 35:50) = 1;
 for i = 1:90, I(i,i) = 1;endfor
 I = imnoise(I, 'salt & pepper');
 imshow(I);
 J = houghtf(I); J = J / max(J(:));
 imshow(J);

Produces the following figure

Figure 1

Package: image