# CamCal 010 Essential Matrix Computation – an example

## CamCal 010 Essential Matrix Computation – an example

Highlights: In this post we will show some essential matrix computation for the example of parallel cameras. In addition, you will see why it can be useful for.

### Tutorial Overview:

This post covers the following topics:

## 1. Computation

In the last post we talked about essential matrix and what it does. Now we are going to show how it is computed.

So we have two parallel image planes, that means nothing is rotated. From that, we can conclude that the rotation matrix is just the identity matrix. And what is $$T$$ ? $$T$$ is the translation between the two camera centers. The camera center has just been translated and amount $$B$$ in the $$x$$ direction, or $$-B$$ in the other $$x$$ direction.

$$T= \left [ -B,0,0 \right ]^{T}$$

That means we can now compute our essential matrix because essential matrix defined before was this weird cross product:

$$E= \left [ T \right ] _{x} R$$

Because $$R$$ is the identity, we can just insert $$T$$ into the cross product formula and it looks like that:

$$E= \left [ T \right ] _{x} R= \begin{bmatrix}0 & 0 & 0 \\ 0 & 0 & B \\ 0 & -B & 0\end{bmatrix}$$

## 2. The use of the Essential Matrix

Let’s make use of that matrix.

Essential matrix constraints says, that $${p}’^{T}Ep= 0$$, where $${p}’$$and $$p$$ are the locations of the points, one in the prime frame and one in the regular frame. So, where are our points $$p$$? Well, it is in some location, $$X$$, $$Y$$, $$Z$$. Which is also, in the other frame, $$X’$$, $$Y’$$, $$Z$$. $$Z$$ is the same because our planes are parallel. So here are our points written:

$$p= \left [ X,Y,Z \right ]= \left [ \frac{Z_{x}}{f},\frac{Z_{y}}{f},Z \right ]$$

$${p}’= \left [ {X}’,{Y}’,{Z}’ \right ]= \left [ \frac{Z_{{x}’}}{f},\frac{Z_{{y}’}}{f},Z \right ]$$

This $$Z$$ is the same and we assume that under normal projection, $$x= \frac{fX}{Z}$$ and we are writing $$X= \frac{Zx}{f}$$.

Now let’s put those points in our, essential matrix equation.

$$\begin{bmatrix}{x}’ & {y}’ & f \end{bmatrix}\begin{bmatrix}0 & 0 & 0 \\ 0 & 0 & B \\ 0 & -B & 0 \end{bmatrix}\begin{bmatrix}x \\ y \\ f \end{bmatrix}= 0$$

So here we have $${p}’$$ $$E$$ and $$p$$, but you will notice we have now divided our points all the way through by the amount  $$\frac{Z}{f}$$. We don’t know what the value is, but it is some constant value. And we just divided all the points through by $$f$$. Now, we are allowed to do that because we can multiply anything we want by a constant and it stays equal to $$0$$.

So now we have:

$$\begin{bmatrix}{x}’ & {y}’ & f\end{bmatrix}\begin{bmatrix}0\\ Bf\\ -By\end{bmatrix}= 0$$

Multiply it once more and we get:

$$Bf{y}’= Bfy\Rightarrow {y}’= y$$

$$B$$ is a constant, $$f$$ is a constant of divide through, and it just says $${y}’= y$$ and that means if we have some point in the image location $$\left ( x,y \right )$$ in the regular frame, the $${y}’= y$$ is the line that this point has to be on. So what this epipolar constraint for parallel cameras says is that given a point in the image, the corresponding point has to be on the same horizontal line.

So that is called the essential matrix. And it is a map between calibrated systems. And what was really important about this whole operation is that we converted the geometric constraint into an algebraic constraint. However, suppose we have uncalibrated cameras. Geometrically, thinking about, if we had been given enough points it feels like we should be able to figure out how the epipolar lines are constrained. So what we need to do is to somehow figure out the algebraic relation between images, given those correspondences, and that algebraic relation will give us the relation between a point in one image and its epipolar line in the other image, if we have enough correspondences. That is what is called a fundamental matrix, and that is what we will do in the next post.

### Summary

All things considered, we have covered essential matrix computation and use cases. The last thing that remains to be covered is how to get the fundamental matrix, and we will cover that in the next post, as well as code.