$r = y\cos(\theta) - x\sin(\theta) $ derivation for Hough Transform

524 Views Asked by At

I am trying to see how $y = x\tan(θ) + \dfrac{r}{\cos(θ)}$ is made from the graph.

Also how does the derivation work if $(x, y)$ is in the different quadrant? i.e. the $θ$ location stays the same.

enter image description here

Many thanks in advance

1

There are 1 best solutions below

0
On BEST ANSWER

Starting with $y=mx+c$, m is the slope of the line =$tan(\theta)$

We also have, with $r\ge0$: $y=r\cos(\theta)$ and $x=-r\sin(\theta)$ So that $$ r\cos(\theta)= tan(\theta)(-r\sin(\theta))+c$$ $$ c=r(\cos(\theta)+\sin^2(\theta)/\cos(\theta))$$ $$ c=r/\cos(\theta))$$

Replacing $m$ and $c$ in $y=mx+c$, you get $$y=x\tan(\theta)+r/\cos(\theta)$$

The parameter $\theta$ in the range $(0,\pi)$, measured from the plus side of the $x$ axis. In this derivation, $r$ will be positive (when located on the minus side of the $x$ axis) or negative (when located on the plus side of the $x$ axis).