Back to Aurora Vision Library website

You are here: Start » Function Reference » Computer Vision » Hough Transform » DetectLines


Header: AVL.h
Namespace: avl
Module: FoundationBasic

Finds lines in an image using Hough Transform.


void avl::DetectLines
	const avl::Image& inImage,
	atl::Optional<const avl::Region&> inRoi,
	float inAngleResolution,
	float inMinAngleDelta,
	float inMinDistance,
	float inMinScore,
	float inEdgeThreshold,
	atl::Array<avl::Line2D>& outLines,
	atl::Array<float>& outScores,
	avl::Image& diagGradientMagnitudeImage,
	avl::Image& diagScoreImage


Name Type Range Default Description
Input value
inImage const Image& Input image
Input value
inRoi Optional<const Region&> NIL Input region of interest
Input value
inAngleResolution float 0.1 - 180.0 1.0f Resolution of lines' orientation
Input value
inMinAngleDelta float 0.0 - 20.0f Minimum angle between two lines
Input value
inMinDistance float 0.0 - 20.0f Minimum distance between two lines
Input value
inMinScore float 0.0 - 20.0f Minimum matching score
Input value
inEdgeThreshold float 10.0f Minimum accepted edge magnitude
Output value
outLines Array<Line2D>& Output lines
Output value
outScores Array<float>& Output scores
Diagnostic input
diagGradientMagnitudeImage Image& Visualized gradients magnitude of an input image
Diagnostic input
diagScoreImage Image& Calculated score for each pixel of an input image


The operation detects straight edges in the inImage using the Hough Transform approach and treats them as infinite lines. The output array is ordered from best matching to worst matching results.

The parameter inAngleResolution specifies the precision of detected lines' orientations. Value of n means the filter will be able to reliably distinguish lines in n-degree increments.

Parameters inMinAngleDelta and inMinDistance are used for neighbouring results suppression. inMinAngleDelta specifies the minimum angle between two lines while inMinDistance specifies the minimum distance between two parallel lines.


DetectLines performed on the sample image with inMinScore = 0.3.


Low values of inAngleResolution (under 0.5) may cause high memory consumption and decrease in performance.

See Also

  • DetectPaths – Finds a specified shape in an image using Hough Transform.
  • DetectSegments – Finds segments in an image using Hough Transform.