Hough circle detection
Use edge and gradient evidence to find circular structures.
A supported shape is mixed with a few unrelated edge samples.
Each observation votes for compatible shapes. Agreement accumulates even when the visible boundary has gaps.
A strong accumulator peak identifies a plausible centre or line parameter pair. This view illustrates the voting mechanism.
The recovered geometry follows the consistent observations; isolated samples do not define the final shape.
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
Experiment at pixel level
Blur grayscale first, then detect circles using the Hough gradient method.
The engine loads on your first run. Your images stay in this browser.
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
Select a pixel
Select a pixel
When to use it
Locate approximately circular markers, cells or manufactured parts.
How it works
- 01Measure edges and their gradient directions.
- 02Accumulate candidate centre evidence.
- 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.
Related methods
Image resizing
Sample the source on a new pixel grid at a different resolution.
Arbitrary remapping
Provide a source coordinate for every destination pixel.
Affine transformations
Map points with a linear transform plus translation, preserving straight lines and parallelism.
Homography and RANSAC
Estimate a projective mapping between two views of a plane, rejecting inconsistent point matches.