Click or drag to resize
Accord.NET (logo)

HoughLineTransformation Class

Hough line transformation.
Inheritance Hierarchy

Namespace:  Accord.Imaging
Assembly:  Accord.Imaging (in Accord.Imaging.dll) Version: 3.7.0
public class HoughLineTransformation
Request Example View Source

The HoughLineTransformation type exposes the following members.

Public methodHoughLineTransformation
Initializes a new instance of the HoughLineTransformation class.
Public propertyLinesCount
Found lines count.
Public propertyLocalPeakRadius
Radius for searching local peak value.
Public propertyMaxIntensity
Maximum found intensity in Hough map.
Public propertyMinLineIntensity
Minimum line's intensity in Hough map to recognize a line.
Public propertyStepsPerDegree
Steps per degree.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLinesByRelativeIntensity
Get lines with relative intensity higher then specified value.
Public methodGetMostIntensiveLines
Get specified amount of lines with highest intensity.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodProcessImage(Bitmap)
Process an image building Hough map.
Public methodProcessImage(BitmapData)
Process an image building Hough map.
Public methodProcessImage(UnmanagedImage)
Process an image building Hough map.
Public methodProcessImage(Bitmap, Rectangle)
Process an image building Hough map.
Public methodProcessImage(BitmapData, Rectangle)
Process an image building Hough map.
Public methodProcessImage(UnmanagedImage, Rectangle)
Process an image building Hough map.
Public methodToBitmap
Convert Hough map to bitmap.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Extension Methods
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodToT
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)

The class implements Hough line transformation, which allows to detect straight lines in an image. Lines, which are found by the class, are provided in polar coordinates system - lines' distances from image's center and lines' slopes are provided. The pole of polar coordinates system is put into processing image's center and the polar axis is directed to the right from the pole. Lines' slope is measured in degrees and is actually represented by angle between polar axis and line's radius (normal going from pole to the line), which is measured in counter-clockwise direction.

Note Note
Found lines may have negative radius. This means, that the line resides in lower part of the polar coordinates system and its Theta value should be increased by 180 degrees and radius should be made positive.

The class accepts binary images for processing, which are represented by 8 bpp grayscale images. All black pixels (0 pixel's value) are treated as background, but pixels with different value are treated as lines' pixels.

See also documentation to HoughLine class for additional information about Hough Lines.

Sample usage:

HoughLineTransformation lineTransform = new HoughLineTransformation( );
// apply Hough line transofrm
lineTransform.ProcessImage( sourceImage );
Bitmap houghLineImage = lineTransform.ToBitmap( );
// get lines using relative intensity
HoughLine[] lines = lineTransform.GetLinesByRelativeIntensity( 0.5 );

foreach ( HoughLine line in lines )
    // ...

Initial image:

Hough line transformation image:

See Also