2
$\begingroup$

I was going through the camera matrix explained in the wikipedia article and understand how the matrix K \begin{bmatrix}f_x&s&x_0\\0&f_y&y_0\\0&0&1\end{bmatrix} is built. The projection matrix is then essentially K * [R | T]

However, I am not able to understand what the perspective projection matrix is and how is it same to the intrinsic matrix K

$\endgroup$
4
  • $\begingroup$ "The **projection matrix is then essentially...". AFAICS That's not a projection matrix.. it's not really a "2D" rotation + translation matrix either. Are you familiar with homogeneous coordinates? You really need to understand those first. $\endgroup$
    – Simon F
    Commented Jan 14, 2020 at 8:40
  • 1
    $\begingroup$ @SimonF this matrix can be easily broken into 2D Scaling "+" 2D translation. Also, this is essentially the simple perspective projection matrix. (multiply by it and then homogenise the co-ordinates.) $\endgroup$
    – midi
    Commented Jan 14, 2020 at 17:28
  • 1
    $\begingroup$ @SimonF I now understand that the projection matrix (with the viewing frustum mapped to a cube) is used as it contains depth information which is lost in the simple perspective projection matrix I had written earlier. $\endgroup$
    – midi
    Commented Jan 14, 2020 at 17:30
  • $\begingroup$ Oh good. :-) FWIW my first comment was that you'd written [R|T] which seemed to me to imply Rotation +Scaling, but the matrix requires another term. $\endgroup$
    – Simon F
    Commented Jan 15, 2020 at 9:42

1 Answer 1

2
$\begingroup$

The projection matrix is then essentially K * [R | T]

Is incorrect, actually the K Matrix is similar to projection matrix and the R|T is called camera transform matrix or view transform matrix Or called extrinsic matrix. So focus on the projection stuff and forget about camera transform, what is the difference between K Matrix and Perspective Projection Matrix(call it P Matrix later)?

  • For K Matrix it transform 3D points to 2D pixels in image space.
  • For P Matrix it transform 3D points to NDC space.

Take a look at two matrices:

$$K = \begin{bmatrix}f_x& 0& c_x\\ 0& f_y& c_y\\ 0 & 0 & 1\\\end{bmatrix}$$

$$P = \begin{bmatrix} \frac{1}{t*a}& 0& 0& 0\\0& \frac{1}{t}& 0& 0\\ 0 & 0 & A& B&\\ 0 & 0 & -1& 0\\ \end{bmatrix}$$ $$t=tan(\frac{fovy}{2})$$ $$a=\frac{width}{height}$$

Let's add perspective divide and show the result of the above two matrices:

Intrinsic case: $$x_{2d} = \frac{x_0}{z_0 * \frac{1}{f_x}} + c_x$$

Perspective case: $$x_{2d} = \frac{x_0}{-z_0(t*a)}$$

Similar with some difference.

The image space: Origin from left-top corner so should add Cx Cy as the offset from center to left-top corner. And in NDC space we assume Z-axis direct out of screen so P(3,2) = -1.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.