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.

Try it: vote for centres at one radius

Where this lab comes from

The Hough Circle Transform: Finding Pool Balls with HoughCircles

The 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