# Hough Transform, Computer Vision

There is some thing i dont understand about Hough Transform in polar coordinates.

From wikipedia article:

"The simplest case of Hough transform is detecting straight lines. In general, the straight line y = mx + b can be represented as a point (b, m) in the parameter space. However, vertical lines pose a problem. They would give rise to unbounded values of the slope parameter m. Thus, for computational reasons, Duda and Hart proposed the use of the Hesse normal form $R = X*Cos(\theta) + Y*Sin(\theta)$ , where $R$ is the distance from the origin to the closest point on the straight line, and $\theta$ is the angle between the x axis and the line connecting the origin with that closest point."

now the issue im having with this is:
The Distance from the origin to the closest point on the straight line would be $\sqrt{x^2 + y^2}$ by the euclidean metric
and not $R = X*Cos(\theta) + Y*Sin(\theta)$

• Wikipedia is not a primary source. In cases like this, you should consult an original source. In this case, Wikipedia gives you a direct citation to an original reference. So, have you read Duda and Hart? That might be an imperfect summary of what was actually written in that paper.
– D.W.
Aug 3 '18 at 22:36

Consider a vector $\mathbf v$ of any dimension. The hyperplanes orthogonal to that vector are given by the equation $r = \mathbf u\cdot \mathbf v$ for various $r$s. That is, the collection of vectors $\mathbf u$ satisfying $r=\mathbf u\cdot\mathbf v$ describe a hyperplane orthogonal to $\mathbf v$. If $\varphi$ is the (acute) angle between $\mathbf u$ and $\mathbf v$ (in the plane that they span, not to be confused with the hyperplane the earlier equation describes), this can be written as $r=|\mathbf u||\mathbf v|\cos\varphi$. From this we can see that $|\mathbf u|$ is minimum when $\varphi = 0$ so that $\cos\varphi=1$, the maximum value of $\cos$. If we choose $\mathbf v$ to be a unit vector, i.e. $|\mathbf v|=1$, then the point on the hyperplane closest to the origin is $\mathbf u=r\mathbf v$ and has distance $r$, i.e. $|\mathbf u|=r$.
In the 2D case, the "hyperplane" is actually a line. A unit vector in the plane has the form $\mathbf v = (\cos\theta,\sin\theta)$ for some $\theta$. The dot product equation describing the line is then $r=\mathbf u\cdot\mathbf v = u_x\cos\theta + u_y\sin\theta$ where $\mathbf u = (u_x,u_y)$. The point on the line closest to the origin is then $r\mathbf v = (r\cos\theta,r\sin\theta)$ which is a vector of length $r$ just as stated in the article. As mentioned in the previous paragraph, if $\mathbf v$ is chosen as a unit vector (and it always can be), then this is true in general: $r$ is the distance of the closest point to the origin of the described hyperplane, and that closest point is $r\mathbf v$.