Hough Transformation Equation

I was wondering why the Hough Transform uses rho=xcos(theta) + ysin(theta) to represent a straight line (y=mx+b) . I tried to do it (and told about it

+6
source share
3 answers

Conclusion:

The equation x/a + y/b = 1 :

  • defines a string
  • has x-intercept = a
  • has y-intercept = b

From trigonometry, remember how rays rotated by the angle t will be projected on the x and y axis in accordance with (angle=t, radius=1) -> (x=cos(t), y=sin(t)) *

http://en.wikipedia.org/wiki/File:Unit_circle.svg

Draw a tangent line at the marked point. Trigonometry (or even geometry with similar triangles) tells us that the tangent line intersects at x=1/cos(t) , y=1/sin(t) . Thus, a line at a distance of 1 will have a=1/cos(t) and b=1/sin(t) and thus x/(1/cos(t)) + y/(1/sin(t)) = 1 ...

... which is just cos(t) x + sin(t) y = rho , where rho=1

You can see that rho corresponds to how far the line is from the origin (either playing with the equation, or noting that here the multiplication scales all the values ​​by the same amount, effectively scaling the grid).


* see http://en.wikipedia.org/wiki/File:Unit_circle.svg for a loan

+12
source

It is just a conversion from a linear coordinate system to a rotational one. The reason for this is indicated in the Wikipedia article:

In the Hough transform, the main idea is to consider the characteristics of the line not as image points (x1, y1), (x2, y2), etc., but instead in terms of its parameters, the slope parameter m and the capture parameter b. Based on this fact, the line y = mx + b can be represented as a point (b, m) in the parameter space. However, it is worthwhile to encounter the problem that vertical lines lead to unlimited values ​​of the parameters m and b . Therefore, for computational reasons, it is better to use another pair of parameters, designated as r and ΞΈ (theta), for lines in the Hough transform.

And to convert between them, use the equation y = -(cos(theta)/sin(theta))x + r/sin(theta) . Thus, m = -(cos(theta)/sin(theta)) and b = r/sin(theta) . They obviously collapse at sin(theta)=0 or theta=0 , therefore, a rotational coordinate system is preferable (there are no problems with lines with infinite slopes).

+6
source

Each rho, theta pair refers to an x,y pair for a given line in which the distance rho from the origin at the theta angle puts you at the x,y coordinate on the line.

Instead of y=mx+b , the rho, theta equation is used, so that a sequence of rho, theta values ​​can be introduced into the equation without the computational problems that arise with the y=mx+b method, where the slope is undefined (that is, the line is vertical).

0
source

Source: https://habr.com/ru/post/898395/


All Articles