Image Processing Toolbox User's Guide Previous page   Next Page

Hough transform



[H, theta, rho] = hough(BW) computes the Standard Hough Transform (SHT) of the binary image BW. You can use the hough function to detect lines in an image. The function returns H, the Hough transform matrix. theta (in degrees) and rho are the arrays of rho and theta values over which the Hough transform matrix was generated.

[H, theta, rho] = hough(BW,param1,val1,param2,val2) specifies parameter/value pairs, listed in the following table. Parameter names can be abbreviated, and case does not matter.


Real scalar value between 0 and 90, exclusive, that specifies the spacing (in degrees) of the Hough transform bins along the theta axis. Default: 1.


Real scalar value between 0 and norm(size(BW)), exclusive, that specifies the spacing of the Hough transform bins along the rho axis. Default: 1


The hough function implements the Standard Hough Transform (SHT). The SHT uses the parametric representation of a line:

The variable rho is the distance from the origin to the line along a vector perpendicular to the line. theta is the angle between the x-axis and this vector. The hough function generates a parameter space matrix whose rows and columns correspond to rho and theta values respectively. Peak values in this space represent potential lines in the input image.

The Hough transform matrix, H, is NRHO-by-NTHETA where NRHO = 2*ceil(norm(size(BW))/RhoResolution)-1, and NTHETA = 2*ceil(90/ThetaResolution). Theta angle values are in the range [-90, 90) degrees and rho values range from -DIAGONAL to DIAGONAL where DIAGONAL = RhoResolution*ceil(norm(size(BW))/RhoResolution). Note that if 90/DTHETA is not an integer, the actual angle spacing will be 90/ceil(90/DTHETA).

Class Support

BW can be logical or numeric and it must be real, 2-D, and nonsparse.


Compute and display the Hough transform of an image

See also

houghpeaks, houghlines

Previous page  histeq houghlines Next page

© 1994-2005 The MathWorks, Inc.