The OpenCV documentation states:

dp: Inverse ratio of the accumulator resolution to the image resolution. For example, if dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has half as big width and height.

But it gives no indication how the size of this value affects circle detection. I thought the accumulator was just a collection of maxima, how does it have a resolution?

During hough transformation you transform your input image into so called hough space. It is 3-dimensional while trying to find circles (the three dimensions are the coordinates of the circle center and the radius). During the transformation each edge pixel in your input image votes for all possible circles on which the pixel could lie.

You can think of the voting as increasing multiple values within a 3-dimensional matrix (hough space). After voting you search for the highest value within this matrix and read of the circle center and its radius.

The bigger the matrix (compared to your input image) (the smaller your `dp`

), the higher the resolution of your voting. The higher the resolution, the more accurate the circle detection.

However, the more accurate the detection, the more likely it is to e.g. miss slightly degenerated circles or detect multiple circles instead of one with a big edge.

Tags: javajava