# Is it correct to use the pinhole camera model to get the mapping of a 3D line to a line in an image?

I've been working on a computer vision project in which I'm using the pinhole camera model to map one line of the world to one line in an image.

From previous research on the topic, I know that it is possible to map a point in the 3D world to a point in one image using the projection matrix obtained by calibrating the camera you're using to get the images of the 3D world. This mapping can be done as follows:

$\lambda \begin{bmatrix}u \\ v \\ 1\end{bmatrix} = P \begin{bmatrix}X \\ Y \\ Z \\ 1\end{bmatrix}$,

in which $(u,v,1)$ are the coordinates of the point in the image, $(X,Y,Z,1)$ are the coordinates of the same point in the world and $P$ is the projection matrix.

A line in the image can be defined as:

$\begin{bmatrix}A & B & C\end{bmatrix}\begin{bmatrix}u \\ v \\ 1\end{bmatrix}$,

in which $(A,B,C)$ are the parameters used to describe the line. My research also taught me that perspective projections preserve lines, i.e., a straight line in the world will map to a straight line in the image.

Using the description of a line and the method used to get the mapping of points, I got this model:

$\lambda \begin{bmatrix}A & B & C\end{bmatrix} \begin{bmatrix}u \\ v \\ 1\end{bmatrix} = \begin{bmatrix}A & B & C\end{bmatrix} P \begin{bmatrix}X \\ Y \\ Z \\ 1\end{bmatrix}$.

I've done some additional research, but so far I haven't found anything that can support this affirmation.

Is it correct to say that the mapping of a 3D line in the world to a line in an image of the world is done using the previous model?

Could anyone please point me in the right direction?

Thank you.

Essentially pinhole camera is perspective view behind the camera. Since we need to divide the $z$ coordinate at places, we have to use homogeneous coordinates. It is easy to prove that line in the 3D world maps to line in the pinhole image.
A line in 3D is $\lambda p_1 + (1-\lambda)p_2 = $$\begin{bmatrix} x \\ y \\ z \\ 1\end{bmatrix}, where -\infty < \lambda < \infty, p_1 and p_2 are points (4x1 vector in homogeneous coordinates) in 3D, and the line passes through these points. If P is perspective matrix transformation then we have the following: P(\lambda p_1 + (1-\lambda)p_2) =$$ P\begin{bmatrix} x \\ y \\ z \\ 1\end{bmatrix}$ in pinhole camera image
$\Rightarrow\lambda (Pp_1) + (1-\lambda)(Pp_2) = $$P\begin{bmatrix} x \\ y \\ z \\ 1\end{bmatrix} in pinhole camera image. This is equation of line. So yes if you have p_1 and p_2 points as parameters of line in 3D then Pp_1 and Pp_2 will be the parameters of line in pinhole camera image. You are confusing some things. First off, a line (or more precisely: the set of points (x,y) on a line) in 2D can be written as the set of points satisfying an equation of the form$$\begin{bmatrix}A&B&C\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix}= 0$$for some A,B,C. We could also write$$\begin{bmatrix}A&B\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}= -C.$$Note that we write the 2D point vector (x,y) extended by a 1 here, \begin{bmatrix}x\\y\\1\end{bmatrix}, has nothing to do with the "homogeneous 1" appended to the 2D point (u,v) in your (correct) equation for the perspective projection. Let me write that one out too: The 2D point (u,v) is the projection of the 3D point (X,Y,Z) under the projection matrix P \in \mathbb R^{3 \times 4} iff there is some \lambda \neq 0 such that \lambda \begin{bmatrix}u \\ v \\ 1\end{bmatrix} = P \begin{bmatrix}X \\ Y \\ Z \\ 1\end{bmatrix} Then you ask Is it correct to say that the mapping of a 3D line in the world to a line in an image of the world is done using the previous model? A mapping and a model are quite different things. IMO it is not very clear what you are asking for. Here is a few questions that you could ask given these considerations: • Given a line in 2D described via parameters (A,B,C) as above, what is the corresponding line in 3D? • Given a line in 3D, what is the line's (A,B,C) parametrization in 2D? Note that a line in 3D cannot be characterized by an equation of the form (say)$$\begin{bmatrix}U&V&W&T\end{bmatrix}\begin{bmatrix}x\\y\\z\\1\end{bmatrix}= 0$$(this characterizes a plane) But in every dimension a line can be defined by a point and a vector as the set of points of the curve$\phi(t) :=p + tv\$.