Skip to content

Hough circle detection

Use edge and gradient evidence to find circular structures.

Try it on your image ↓

VISUAL WALKTHROUGHGeometry
REFERENCE INPUTEdge observations

A supported shape is mixed with a few unrelated edge samples.

RESULTRecover centre and radius

The recovered geometry follows the consistent observations; isolated samples do not define the final shape.

STEP 03 / 03

Estimate radii and retain sufficiently supported circles.

Illustrative example. The stages explain the method; they are not a live OpenCV execution.

Try it on an image

YOUR IMAGE · REAL OPENCV

Experiment at pixel level

Open full lab ↗

Blur grayscale first, then detect circles using the Hough gradient method.

The engine loads on your first run. Your images stay in this browser.

Input448 × 320
OutputWaiting for a result

Scroll over either image to zoom at the pointer. Use the scrollbars to pan both views over the same relative area. Zoom is relative to the input; pixel coordinates belong to each image. Warps can change scene correspondence.

Pixel inspector RGBA · native values · matched scale · 9 × 9 output pixels
Hover to inspect. Click to pin a pixel.
Input
Select a pixel

Output
Select a pixel

Sample models and licenses

When to use it

Locate approximately circular markers, cells or manufactured parts.

How it works

  1. 01Measure edges and their gradient directions.
  2. 02Accumulate candidate centre evidence.
  3. 03Estimate radii and retain sufficiently supported circles.

(x−cx)² + (y−cy)² = r²

What to tune

minDist separates centres; minRadius/maxRadius narrow the search; tune the thresholds for the selected method.

Where it breaks down

The supported methods use different scoring rules. Reflections, overlapping circles and perspective ellipses can confuse circular detection.

TypeScript API

Open an entry for its exact overloads, parameter descriptions, result ownership and pinned upstream source.

All of these calls execute on the CPU. Native objects need explicit disposal. See matrices and ownership and build compatibility.