# Visual Perception: Camera Calibration

## Camera Calibration using DLT and Zhang’s Method from theoretical math explanation to MATLAB code application

We learned what Camera Calibration Matrix is in the previous post of this series. A general issue in Visual Perception is that usually, we need to calibrate our cameras before using them. That means, we need to **estimate Camera Calibration Matrix parameters** (intrinsic parameters) and **extrinsic **parameters (rotation and translation matrix of the camera)

To estimate these parameters, we will examine different methods but for each case, we will be using some **3D world points** and **their 2D projected image points**.

**DLT (Direct Linear Transform)**

DLT is a general way to create linear equations for a specific problem and put these linear equations in matrices in such a way we find the “unknowns” of the equation. For this purpose, we try to have an AX = 0 linear equation form where A includes the known data and X includes the unknown data. So the target is to find the X matrix.

Let’s start to apply DLT for our calibration problem then. We have a homogenous 3D world point, a P projection matrix, and a 2D homogenous image point:

So, we obtained a 2x12 matrix A, 12x1 matrix X using just **1** 3D world point with the 2D image point **match**. **Since we have 12 unknowns in the X matrix and 1 point gives us 2 equations, that means we need to have at least 6 points to solve this DLT equation! **Having at least 6 point matches, here are our final DLT formed matrixes:

!!! Note that we may say we have 11 unknowns (11 degrees of freedom DoF )since p34 is scale factor but for this task, it doesn't change our solution because even if we have 11 or 12 unknowns we need 6 points since 5 points are not enough even for 11 unknowns.

Now, how to solve a DLT equation?

The solution of a DLT equation comes from the eigenvector associated with the smallest eigenvalue of A’A where A’ is the transpose of A. If you want to learn more about the reason why we use the…