Hough Line Detection

Description

This operator uses the Hough Transform to detect and extract lines from an input single-channel binary or edge image.

Overview

Detects and extracts lines from input single-channel binary or edge images using the Hough Transform algorithm.

Scenarios

Detecting straight edges of objects.

Inputs and Outputs

Inputs

Image: An 8-bit single-channel binary or edge image. Detection is more reliable when straight edges are clear.

Outputs

Detection Results: Outputs a list of detection instances.

Parameters

Detection Method

Description

Selects the Hough line detection algorithm. Standard Hough Transform detects infinite lines and uses minimum/maximum angles to limit the direction. Probabilistic Hough Transform detects line segments and uses minimum line length and maximum line gap. Both methods share the accumulator threshold, but their other parameters differ.

Tuning Instructions

For the standard method, use an angle range of [0,180]° with minimum angle no greater than maximum angle. For the probabilistic method, tune minimum line length and maximum line gap according to segment length and edge breaks.

Parameter Range

Values/Range:

  • Probabilistic Hough Transform

  • Standard Hough Transform

Default: Standard Hough Transform

Threshold

Description

The threshold of the accumulator count, which can be understood as "the minimum number of points required to form a line": only when the count where multiple points intersect at one location exceeds this threshold is a line considered to exist in the image space.

Tuning Instructions

  • Increase this value: Only very obvious long lines composed of a large number of pixels will be detected.

  • Decrease this value: Even short, discontinuous lines composed of a few points may be detected, but noise interference will increase.

Parameter Range

[1, 1000], Default value: 500

Parameter Range

Values/Range: [1, 1000]

Default: 500

Minimum Angle

Description

Sets the minimum detection angle for Standard Hough Transform.

Parameter Range

[0,180], default value: 0, unit: °. This value cannot exceed the maximum angle.

Parameter Range

Values/Range: [0.0, 180.0]

Default: 0

Unit: °

Maximum Angle

Description

Sets the maximum detection angle for Standard Hough Transform.

Parameter Range

[0,180], default value: 180, unit: °. This value cannot be less than the minimum angle.

Parameter Range

Values/Range: [0.0, 180.0]

Default: 180

Unit: °

Minimum Line Length

Description

Defines the minimum pixel length for a line segment to be identified (Probabilistic Hough Transform).

Tuning Instructions

Increasing this value can effectively filter out many short, irrelevant line segments caused by noise.

Parameter Range

[0, 1000], Default value: 180, Unit: Pixels

Parameter Range

Values/Range: [0.0, 1000.0]

Default: 180

Maximum Line Gap

Description

Defines the maximum allowed pixel gap between two points on the same line (Probabilistic Hough Transform).

Tuning Instructions

If the lines in the image are dashed or partially broken, increasing this value allows the algorithm to attempt to connect these broken segments into a complete line.

Parameter Range

[0, 1000], Default value: 180, Unit: Pixels

Parameter Range

Values/Range: [0.0, 1000.0]

Default: 180

Line Width

Description

Sets the width used to represent detected lines in the output result.

Tuning Instructions

This parameter does not affect the detection process; it is only used to control the line width setting for output results and visualization effects.

Parameter Range

[1, 200], Default value: 1

Parameter Range

Values/Range: [1, 200]

Default: 1