<p>"A not so simple approach". I may have messed a little bit too much with grouping the terms, do forgive my elementary math skills, it's a side effect of using tools like wolfram and mathematica too much.</p>

<p>Without loss of generality we can assume that the near plane is given as <span class="math-container">$z=1$</span> (that is having normal <span class="math-container">$(0,0,1)$</span> and a point on it <span class="math-container">$(0,0,1)$</span>) and the camera center (the reflected pinhole camera aperture point) is at <span class="math-container">$(0,0,0)$</span>. Let <span class="math-container">$p,q \in \mathbb{R}^3$</span> be two points on a line (non-degenerate, meaning <span class="math-container">$p\ne q$</span>, otherwise it's just a point and the projection is also a point - unless it's at <span class="math-container">$(0,0,0)$</span> then it's undefined). If the line defined by <span class="math-container">$p,q$</span> passes through <span class="math-container">$(0,0,0)$</span> the projection is a point and the requirement is trivially satisfied.
Now let this not be the case. A perspective projection onto the plane through <span class="math-container">$(0,0,0)$</span> is given by <span class="math-container">$p' = \frac{p}{p_z}$</span>, and <span class="math-container">$q' = \frac{q}{q_z}$</span>. The line defined by <span class="math-container">$p,q$</span> is given as <span class="math-container">$r(\lambda) = p + \lambda(q-p), \lambda \in  \mathbb{R}$</span>. Its projection is given by <span class="math-container">$r'(\lambda) = \frac{r(\lambda)}{r_z(\lambda)}$</span>. Since <span class="math-container">$z=1$</span> for all projected points, then we need only study the <span class="math-container">$x,y$</span> coordinates. We want to show that any projected point <span class="math-container">$r'(\lambda)$</span> can be written as an affine combination of <span class="math-container">$p',q'$</span> (this defines a line). Taking that into account:
<span class="math-container">$$p'+\mu(q'-p') = \frac{r(\lambda)}{r_z(\lambda)}$$</span>
<span class="math-container">$$(1-\mu)\frac{p}{p_z} + \mu\frac{q}{q_z} = \frac{p + \lambda(q-p)}{p_z + \lambda(q_z-p_z)}$$</span>
<span class="math-container">$$(1-\mu)q_z(p_z+\lambda(q_z-p_z))p + \mu p_z(p_z+\lambda(q_z-p_z))q = q_zp_z(p + \lambda(q-p))$$</span>
<span class="math-container">$$q_zp_z(p - \lambda p) + q^2_z\lambda p - \mu q_z(p_z+\lambda(q_z-p_z))p + \mu p_z(p_z+\lambda(q_z-p_z))q - q_zp_z(p - \lambda p) - q_zp_z\lambda q = 0$$</span>
<span class="math-container">$$(1-\mu)\lambda q^2_z p -\mu(1-\lambda)q_zp_z p + \mu(1-\lambda)p^2_zq - (1-\mu)\lambda p_zq_z q = 0$$</span>
<span class="math-container">$$(1-\mu)\lambda q_z(q_zp - p_zq) - \mu(1-\lambda)p_z(q_zp-p_zq) = 0$$</span>
<span class="math-container">$$((1-\mu)\lambda q_z - \mu(1-\lambda)p_z)(q_zp - p_zq) = 0$$</span></p>

<p>For this to be satisfied one of the terms must be <span class="math-container">$0$</span>. The first case concerns the second term: <span class="math-container">$p' = q'$</span>, which we already considered as the trivial case. Then we must show that we can always pick a <span class="math-container">$\mu$</span> such that <span class="math-container">$(1-\mu)\lambda q_z - \mu(1-\lambda)p_z = 0$</span>. Solve for <span class="math-container">$\mu$</span> and you get: <span class="math-container">$\mu = \frac{\lambda q_z}{(1-\lambda)p_z + \lambda q_z}$</span>. Thus I have not only found that it is a straight line, but also the relationship between the parameterizations.</p>

<p>In general a projection onto a different 2-manifold (not a plane) will not result in the lines remaining straight (think of a sphere or a cylinder).</p>

CC BY-SA 4.0
2019-04-08T19:20:37.263Z
2019-04-09T16:23:05.473Z
2019-04-09T16:23:05.473Z
lightxbulb
<p>If I have a straight line in 3D space and I use a camera matrix to do a perspective projection into a 2D plane/screen will the resulting line always be straight too? If I project the start point and end point and join the dots is that equivalent to having projected the line?</p>

<p>I suspect this is true, but have no basis for this assumption. </p>

<p>Is this still true for off-centre perspective projection or a cylindrical projection? I assume this isn't true for real cameras as they have all kinds of non-ideal optical effects right?</p>

<geometry><projections><perspective><camera-matrix>
Do straight lines always remain straight when projected with a perspective camera?
Owen
# Do straight lines always remain straight when projected with a perspective camera?

(Asked by: username_0 on 2019-04-06)

If I have a straight line in 3D space and I use a camera matrix to do a perspective projection into a 2D plane/screen will the resulting line always be straight too? If I project the start point and end point and join the dots is that equivalent to having projected the line?

I suspect this is true, but have no basis for this assumption.

Is this still true for off-centre perspective projection or a cylindrical projection? I assume this isn't true for real cameras as they have all kinds of non-ideal optical effects right?

**Tags:** geometry, projections, perspective, camera-matrix


---

## 1 answers

### Answer by username_1 on 2019-04-08. Score: 3 | Accepted answer

"A not so simple approach". I may have messed a little bit too much with grouping the terms, do forgive my elementary math skills, it's a side effect of using tools like wolfram and mathematica too much.

Without loss of generality we can assume that the near plane is given as $z=1$ (that is having normal $(0,0,1)$ and a point on it $(0,0,1)$) and the camera center (the reflected pinhole camera aperture point) is at $(0,0,0)$. Let $p,q \in \mathbb{R}^3$ be two points on a line (non-degenerate, meaning $p\ne q$, otherwise it's just a point and the projection is also a point - unless it's at $(0,0,0)$ then it's undefined). If the line defined by $p,q$ passes through $(0,0,0)$ the projection is a point and the requirement is trivially satisfied.
Now let this not be the case. A perspective projection onto the plane through $(0,0,0)$ is given by $p' = \frac{p}{p\_z}$, and $q' = \frac{q}{q\_z}$. The line defined by $p,q$ is given as $r(\lambda) = p + \lambda(q-p), \lambda \in \mathbb{R}$. Its projection is given by $r'(\lambda) = \frac{r(\lambda)}{r\_z(\lambda)}$. Since $z=1$ for all projected points, then we need only study the $x,y$ coordinates. We want to show that any projected point $r'(\lambda)$ can be written as an affine combination of $p',q'$ (this defines a line). Taking that into account:
$$p'+\mu(q'-p') = \frac{r(\lambda)}{r\_z(\lambda)}$$
$$(1-\mu)\frac{p}{p\_z} + \mu\frac{q}{q\_z} = \frac{p + \lambda(q-p)}{p\_z + \lambda(q\_z-p\_z)}$$
$$(1-\mu)q\_z(p\_z+\lambda(q\_z-p\_z))p + \mu p\_z(p\_z+\lambda(q\_z-p\_z))q = q\_zp\_z(p + \lambda(q-p))$$
$$q\_zp\_z(p - \lambda p) + q^2\_z\lambda p - \mu q\_z(p\_z+\lambda(q\_z-p\_z))p + \mu p\_z(p\_z+\lambda(q\_z-p\_z))q - q\_zp\_z(p - \lambda p) - q\_zp\_z\lambda q = 0$$
$$(1-\mu)\lambda q^2\_z p -\mu(1-\lambda)q\_zp\_z p + \mu(1-\lambda)p^2\_zq - (1-\mu)\lambda p\_zq\_z q = 0$$
$$(1-\mu)\lambda q\_z(q\_zp - p\_zq) - \mu(1-\lambda)p\_z(q\_zp-p\_zq) = 0$$
$$((1-\mu)\lambda q\_z - \mu(1-\lambda)p\_z)(q\_zp - p\_zq) = 0$$

For this to be satisfied one of the terms must be $0$. The first case concerns the second term: $p' = q'$, which we already considered as the trivial case. Then we must show that we can always pick a $\mu$ such that $(1-\mu)\lambda q\_z - \mu(1-\lambda)p\_z = 0$. Solve for $\mu$ and you get: $\mu = \frac{\lambda q\_z}{(1-\lambda)p\_z + \lambda q\_z}$. Thus I have not only found that it is a straight line, but also the relationship between the parameterizations.

In general a projection onto a different 2-manifold (not a plane) will not result in the lines remaining straight (think of a sphere or a cylinder).


---

