0
$\begingroup$

I'm reading an article related to road lane detection. Here it is

On page 3, there is the formula

$$y-y_{vp}=\frac h d(x-x_{vp})\tag{1}$$ It is the equation for line $S'$.

I cannot understand how the slope was calculated.

Can you, please, give me a hint? Thank you in advance.

1 Answers 1

0

Short answer: The key facts are that points with $z=0$ in the camera coordinate system get mapped to points at infinity in the image, and that a line’s point at infinity and its direction vector are identical in homogeneous coordinates. By construction, the line $S$ passes through the point $(d,h,0,1)$, which gets mapped to the point at infinity $(d,h,0)$ in the image. Every line that passes through this point has a direction vector of $(d,h,0)$, i.e., has slope $h/d$ in the image.

Longer answer: the matrix that projects from camera coordinates to image coordinates is of the form $$M=\pmatrix{1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&\frac1f&0},$$ where $z=f$ is the image plane. By construction, the line $S$ passes through the point $(d,h,0,1)$, which is mapped to $(d,h,0,0)$ by $M$. The line $S'$ also passes through the vanishing point $(x_{vp},y_{vp})$ in the image plane. Three points in $\mathbb P^2$ are colinear if their homogeneous coordinates are linearly dependent, so we have as an equation for $S'$: $$\begin{vmatrix}x&y&1 \\ d&h&0 \\ x_{vp}&y_{vp}& 1\end{vmatrix}=hx-dy-hx_{vp}+dy_{vp}=0$$ which can be rearranged into equation (1).

Alternatively, we can parameterize $S$ as $(d,h,0,1)+t(a,b,c,0)$ for $c\ne0$ and transform that: $$(d+at,h+bt,ct,1)\mapsto(d+at,h+bt,ct,ct/f)$$ which corresponds to the parameterization $x=(d+at)/ct$, $y=(h+bt)/ct$ for $S'$. Reparameterizing with $t'=1/ct$ gives us $x=dt'+a/c$, $y=ht'+b/c$, from which it’s obvious that the slope of $S'$ is $h/d$. In addition, this parameterization gives a formula for the vaninshing point $(x_{vp},y_{vp})$: if $(a,b,c)$ is a direction vector for $S$ in the camera coordinate system, then the vanishing point in the image is $(a/c,b/c)$. Of course, we could’ve also discovered this by applying $M$ directly to this direction vector.