Vote for centres at one radius
Every edge pixel votes for the two points one radius away along its gradient. A ball of that radius collects the votes at its centre. White circles are hand-labelled balls; the green ones are the peaks.
Try this
Slide the radius from the near balls (about 50 px) to the far ones (about 15 px), and watch which balls light up. Then make the accumulator cells coarser.
Where this lab comes from
The Hough Circle Transform: Finding Pool Balls with HoughCirclesThe Hough circle transform finds round things by letting every edge pixel vote for the centres a circle through it could have. On three photos of a pool table with 41 hand-labelled balls, OpenCV's HoughCircles finds 27 with one false alarm, and 17 of 26 on the two photos it was not tuned on. Built from scratch at one radius and checked against OpenCV on the biggest ball.
More in cameras and geometry
- Focus, aperture and depth of field — Move the subject and watch the focus plane and the blur follow.
- Four ways a fisheye maps angle to radius — Plot r(θ) for the classical designs against a fitted curve.
- The scene, and what the camera sees — Orbit a 3-D scene on the left; the pinhole view updates on the right.