🟧 Hough Line Detection

Function Description

This operator uses the Hough transform algorithm to detect and extract line segments in the input grayscale image.

Usage Scenarios

Detect straight edges of objects.

Input Output

Input

Image: Input single-channel grayscale image. The clearer the straight edges in the image, the better the detection effect.

Output

Detection Results: Output a list of detection instances.

Parameter Description

Threshold

Parameter Description

Threshold for accumulator count values, which can be understood as the "minimum number of points needed to form a straight line". Only when the count value of multiple points intersecting at one point exceeds this threshold is a straight line considered to exist in image space.

Parameter Adjustment

  • Increasing this value: Only very obvious long straight lines formed by a large number of pixel points will be detected.

  • Decreasing this value: Even short, discontinuous lines formed by a few points may be detected, but will increase noise interference.

Parameter Range

[1, 1000], Default value: 500

Line Width

Parameter Description

Set the width of lines representing detected straight lines in output results.

Parameter Adjustment

This parameter does not affect the detection process, only used to control line width settings in output results and visualization effects.

Parameter Range

[1, 200], Default value: 1

Detection Method

Parameter Description

Select the specific algorithm for Hough line detection:

  • Standard Hough Transform: Finds all straight lines of infinite length that meet conditions in the image, rather than finite line segments. Suitable for scenarios that need to analyze line direction rather than length.

  • Probabilistic Hough Transform: An optimized algorithm that can directly return start and end points of detected line segments, runs faster and is more intuitive.

Parameter Adjustment

Standard Hough Transform

  • Min/Max Angle: Set the angle range of straight lines to be detected. If the goal is to detect straight lines in specific directions (e.g., only horizontal or vertical lines), you can narrow the search space by setting this range to improve efficiency and accuracy.

Probabilistic Hough Transform

  • Minimum Line Length: Define the minimum pixel length for a line segment to be recognized. Increasing this value can effectively filter out many short, irrelevant line segments caused by noise.

  • Maximum Line Gap: Define the maximum pixel gap allowed between two points on the same straight line. If straight lines in the image are dashed or have partial breaks, you can appropriately increase this value, and the algorithm will try to connect these broken line segments into a complete straight line.

Parameter Range

Min/Max Angle: [0,360], Default value: 0/180, Unit: °

Minimum Line Length: [0,1000], Default value: 180, Unit: pixels

Maximum Line Gap: [0,1000], Default value: 180, Unit: pixels