Hough Circle Detection

Description

This operator uses the Hough Transform algorithm to identify regions matching circular features by analyzing the edge information of the input grayscale image.

Overview

Detects regular circular targets based on the Hough Transform.

Scenarios

  • Part detection: Identifying circular holes, buttons, screw holes, etc., on products.

  • Defect detection: Finding circular pits, bubbles, or blemishes on product surfaces.

  • Object counting and localization: Counting and locating circular objects such as coins and pills.

Inputs and Outputs

Inputs

Input Image: The input single-channel grayscale image. For best results, circular edges in the image should be as clear as possible.

Outputs

Detection Results: Outputs a list of detection instances, each containing a polygon outlining the circular contour.

Center Point: A list containing the [x, y] coordinates of the center point of each detected circle.

Radius: A list containing the radius (in pixels) of each detected circle.

Parameters

Detection Method

Description

Selects the Hough circle detection algorithm. Standard Hough Gradient uses Canny edge detection and is suitable for general grayscale or edge images. High-accuracy Hough Gradient uses Scharr gradients and is suitable for original grayscale images with clear, continuous edges. The edge and candidate thresholds have different meanings for the two methods.

Tuning Instructions

Use the standard method when robustness and tolerance are important. Use the high-accuracy method when target circles have clear, regular edges and stricter circle-shape filtering is required.

Parameter Range

Values/Range:

  • Standard Hough Gradient

  • High Precision Hough Gradient

Default: Standard Hough Gradient

Minimum Center Distance

Description

Sets the minimum allowable distance between the centers of two detected circles, preventing multiple overlapping detections from being generated for the same circle.

Tuning Instructions

  • Value too small: may result in multiple adjacent "false" circles being detected near the same real circle.

  • Value too large: if multiple circles are located close together, some circles may be missed.

It is recommended to set this value slightly smaller than the actual center-to-center distance between the two closest circles expected to be detected.

Parameter Range

[0, 800], default value: 200

Parameter Range

Values/Range: [0.0, 800.0]

Default: 200

Edge Detection Threshold

Description

The upper threshold of the edge detector. Standard Hough Gradient uses Canny, while High-accuracy Hough Gradient uses Scharr; the high-accuracy method typically requires a higher threshold.

Tuning Instructions

Increasing this value suppresses weak edges and noise. Decreasing it allows weaker edges to be detected but may increase false detections.

Parameter Range

[0,1000], default value: 100

Parameter Range

Values/Range: [0.0, 1000.0]

Default: 100

Candidate Score Threshold (Standard)

Description

The circle-center accumulator threshold for Standard Hough Gradient.

Tuning Instructions

Higher values make detection stricter. Lower values may detect more circles but can increase false detections. Smaller target circles usually require a lower value.

Parameter Range

[0,1000], default value: 1

Parameter Range

Values/Range: [0.0, 1000.0]

Default: 1

Circle Perfectness (High Accuracy)

Description

The circle-perfectness score used by High-accuracy Hough Gradient. Its valid range is [0,1).

Tuning Instructions

Values closer to 1 require more complete and regular circles. Lower it for smaller circles or incomplete edges, but false detections may increase.

Parameter Range

[0,0.999], default value: 0.9

Parameter Range

Values/Range: [0.0, 0.999]

Default: 0.9

Minimum Radius

Description

Sets the minimum radius of the circles to be detected.

Tuning Instructions

Setting a reasonable radius range can greatly improve detection speed and accuracy, avoiding the algorithm wasting time on irrelevant sizes. Please estimate and set this value based on the actual pixel size of the target circles in the image.

Parameter Range

[1, 800], Default value: 100, Unit: Pixels

Parameter Range

Values/Range: [1, 800]

Default: 100

Maximum Radius

Description

Sets the maximum radius of the circles to be detected.

Tuning Instructions

Setting a reasonable radius range can greatly improve detection speed and accuracy, avoiding the algorithm wasting time on irrelevant sizes. Please estimate and set this value based on the actual pixel size of the target circles in the image.

Parameter Range

[1, 800], Default value: 200, Unit: Pixels

Parameter Range

Values/Range: [1, 800]

Default: 200