[Math] projection matrix for 2D to 1D perspective projection

projective-geometry

I was wondering, if there is a projection matrix for a perspective projection of a 2D point to a line.

E.g. a random point being projected to the line at $x=1$, parallel to the y axis in the direction of the origin $(0,0)$.

I know that the easiest way to compute this would be to solve the linear equation at $x=1$ (or the intersection of the lines), but isn't there be a matrix based solution too?

To be concrete: I'm looking for a matrix $A$, that solves the equation $x \rightarrow Ax$ with $A\in \mathbb{R}^{3\times3} $

x=1 as example


To conclude Emilios answer below, the matrix I was looking for can be written as
$$x\rightarrow Ax,\text{with }A=
\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
\frac{1}{\text{intercept}_x} & \frac{1}{\text{intercept}_y} & 0
\end{bmatrix}
$$

Best Answer

If I well understand your question, the answer can be done using homogeneous coordinates.

Given a point $P=(a,b)$, his homogeneous coordinates are $P=[a,b,1]^T\equiv [ca,cb,c]^T$ ( see here for a definition).

using this the projection from the origin on the line $x=1$ can be represented by the matrix: $$A= \begin{bmatrix} 1&0&0\\ 0&1&0\\ 1&0&0 \end{bmatrix} $$ that gives: $$ \begin{bmatrix} 1&0&0\\ 0&1&0\\ 1&0&0 \end{bmatrix} \begin{bmatrix} a\\ b\\ 1 \end{bmatrix}= \begin{bmatrix} a\\ b\\ a \end{bmatrix}\equiv \begin{bmatrix} 1\\ b/a\\ 1 \end{bmatrix} $$


For any $P=(a,b)$, the straight line from $O$ to $P$ has equation $y=\frac{b}{a}x$, so the point $P'$ of this line with $x=1$ has coordinates $P'=(1,\frac{b}{a})$

So, in homogeneous coordinates, the two points are represented as: $$ P=\begin{bmatrix} a\\ b\\ 1 \end{bmatrix} \qquad P'=\begin{bmatrix} 1\\ b/a\\ 1 \end{bmatrix}=\begin{bmatrix} a\\ b\\ a \end{bmatrix} $$ and a simple inspection show that the matrix that transforms $P \to P'$ is the matrix $A$

Related Question