# Revision history [back]

### Rho and Theta resolution in Hough Transform

Hello,

One of the parameters in Hough Transform is the distance (rho) resolution. In OpenCV documentation (https://github.com/card-io/card.io-dmz/blob/master/cv/hough.cpp#L99) it is defined as

numrho = cvRound(((width + height) * 2 + 1) / rho)


But I don't really understand two things:

1) Why is there width + height instead of sqrt(width^2+height^2)

and, more importantly:

2) Why does the amount of detected lines grow along with increasing the rho resolution? For me it is completly illogical - higher resolution should result in lowering this amount, as there are less possible values for rho to be obtained. Could you please explain me where did I go wrong?

### Rho and Theta resolution in Hough Transform

Hello,

One of the parameters in Hough Transform is the distance (rho) resolution. In OpenCV documentation (https://github.com/card-io/card.io-dmz/blob/master/cv/hough.cpp#L99) it is defined as

numrho = cvRound(((width + height) * 2 + 1) / rho)


But I don't really understand two things:

1) Why is there width + height instead of sqrt(width^2+height^2)

and, more importantly:

2) Why does the amount of detected lines grow along with increasing the rho resolution? For me it is completly illogical - higher resolution should result in lowering this amount, as there are less possible values for rho to be obtained. Could you please explain me where did I go wrong?

EDIT: ad. 2): does it work in this way, that the max distance is always equal to a diagonal of an image, hence doubling a rho resolution results in "inspissating" this distance to be still equal to a diagonal, so in fact there 2x more possible values that can be taken for rho (resolution)?

### Rho and Theta resolution in Hough Transform

Hello,

One of the parameters in Hough Transform is the distance (rho) resolution. In OpenCV documentation (https://github.com/card-io/card.io-dmz/blob/master/cv/hough.cpp#L99) it is defined as

numrho = cvRound(((width + height) * 2 + 1) / rho)


But I don't really understand two things:

1) Why is there width + height instead of sqrt(width^2+height^2)

and, more importantly:

2) Why does the amount of detected lines grow along with increasing the rho resolution? For me it is completly illogical - higher resolution should result in lowering this amount, as there are less possible values for rho to be obtained. Could you please explain me where did I go wrong?

EDIT: ad. 2): does it work in this way, that the max distance is always equal to a diagonal of an image, hence doubling a rho resolution results in "inspissating" this distance to be still equal to a diagonal, so in fact there 2x more possible values that rho (resolution) can be taken for rho (resolution)?take?