Revision 6e5349f5802bc8b600508331e7f36162f97cf09b (click the page title to view the current version)

Relative Pose

Changes from 6e5349f5802bc8b600508331e7f36162f97cf09b to current

---
title: Relative Pose
categories: session
---

**Reading** Ma 2004 Chapter 5

# The Epipolar Constraint
**Briefing** [Relative Pose Lecture]()

![Epipolar constraint due to Hamidur Rahman](Images/epipolar.jpg)
# Exercises

+ Two cameras, two co-ordinate frames
+ Relative Pose: transformation $(R,T)$ from Camera Frame 1 to Camera Frame 2.
+ Consider a point $p$ in 3D, it has
    + co-ordinates $\mathbf{X}_i$ in Camera Frame $i$
+ The projection of $\mathbf{X}_i$ in homogeneous co-ordinates is
  called $\mathbf{x}_i$
    + $\mathbf{X}_i = \lambda_i\matbf{x}_i$
+ Combining this with the relation $\mathbf{X}_2=R\mathbf{X}_1+T$, we get
  $$\lambda_2\mathbf{x}_2} = R\lambda_1\mathbf{x}_1 + T$$
+ To simplify, we multiply by $\hat T$ to get
  $$\lambda_2\hat T\mathbf{x}_2} = \hat TR\lambda_1\mathbf{x}_1 + \hat TT$$
+ The last term is zero because $T\times T=0$
  $$\lambda_2\hat T\mathbf{x}_2} = \hat TR\lambda_1\mathbf{x}_1$$
+ Now $\mathbf{x}_2$ is perpendicular on $T\times\mathbf{X}_2$ so
  $$0=\mathbf{x}_2^T\lambda_2\hat T\mathbf{x}_2} = \mathbf{x}_2^T\hat TR\lambda_1\mathbf{x}_1$$
+ Since $\lambda_1$ is a scalar, we can simplify
  $$0= \mathbf{x}_2^T\hat TR\mathbf{x}_1$$
  This is the **epipolar constraint**
+ $E=\hat TR$ is called the **essential matrix**
## Exercise 5.5

## Some Jargon
> Explain under what conditions the family of epipolar lines in at least
  one of the image planes will be parallel to each other.
  Where is the corresponding epipole 
  (in terms of is homogeneous co-ordinates)?

+ For each point $p$, we have
    + a *epipolar plane* $\langle o_1,o_2,p\rangle$
    + *epipolar line* $\ell_i$ as the intersection of the epipolar plane
      and the image plane
+ The *epipoles* $\mathbf{e}_i$ is the projection of origo onto
  the image plane of the other camera.
+ Note that the epipoles are on the line $\langle o_1,o_2\rangle$, and
  hence in the epipolar plane
To make sense of the question, you have two draw the situation.

## Some properties
1.  Draw the two origins and the two image planes.
    Where are the epipoles?
2.  Draw two or three separate object points (3D) and the corresponding
    epipolar planes.  (Avoid object points in the same epipolar plane.)
    Where are the corresponding epipolar lines?
3.  If you have now identified different epipolar planes within one
    fixed camera configuration, you will have a *family of epipolar lines*
    in each image plane.
    Where do these lines intersect?
4.  Try to rotate one of the cameras.
    - Can you rotate it so that the epipolar lines become parallel?
    - How does this come about?
    - Where is the epipole when this happens?
5.  Review the original exercise text.  Does it make sense in terms
    of the thought experiment that you have just conducted?

**Proposition 5.3(1)**
## Exercise 5.8

$$\mathbf{e}_2^TE = E\mathbf{e}_1=0$$
> Given two images $x_1$, $x_2$ of a point $p$ together with the
  relative camera motion $(R,T)$, $\mathbf{X}_2=R\mathbf{X}_1+T$:

+ This is because
    1. $\mathbf{e}_2\sim T$ and $\mathbf{e}_1\sim R^TT$
    2. $E=\hat TR$
    3. $T\hat T = T\times T=0$
> 1. express the depth of $p$ with respect to the first image,
     i.e. $\lambda_1$ in terms of $x_1$, $x_2$, and $(R,T)$.
> 1. express the depth of $p$ with respect to the second image,
     i.e. $\lambda_2$ in terms of $x_1$, $x_2$, and $(R,T)$.

**Proposition 5.3(2)**

**Proposition 5.3(3)**
1.  Again, you need to draw the situation.

+ Both the image point and the epipole lie on the epipolar line
    - Draw the two image planes and origins, as well as $p$.
    - Identify the points $x_1$ and $x_2$.
    - Mark the lengths $\lambda_1$ and $\lambda_2$
      (i.e. the depths or $z$-co-ordinates of $p$)
      in the figure.  (We do not calculate them yet.)
    - Identify the epipoles and epipolar lines as usual.
2.  Imagine that you move $p$ closer to camera 1, but keeping
    it on the same line so that the image point $x_1$ remains fixed.

    - what happens to $\lambda_1$?
    - what happens to $x_2$?

3.  Imagine $\lambda_1\to0$.  

    - Where does $p$ end up?
    - Where does $x_2$ end up?

The task (part 1 in the exercise) is to find a formula or method to
determine $\lambda_1$, given $x_1$, $x_2$, and $(R,T)$.
We can assume that the cameras are normalised so that the image
plane has equation $z=1$ with respect to its own basis.
There are two approaches to completing the exercises.  The geometric
one will probably give the most insight.

### Algebraic Solution

The relationship between $x_1$, $x_2$, $(R,T)$, $\lambda_1$, and
$\lambda_2$ is given on page 111.

$$\lambda_2x_2 = R\lambda_1x_1+T$$

+ Does this make sense in your figure?
+ What are the unknowns?
+ Do you have enough constraints to find a unique solution?
+ Rewrite the equation as a set of scalar equations.
  Can you solve for $\lambda_1$ and $\lambda_2$?

### Geometric Solution

All the objects that we consider are situated in the same epipolar plane.
Redraw the origins, epipoles, image points, and depths $\lambda_1,\lambda_2$
in this plane.

+ What is the co-ordinates of the epipoles of camera 2?
+ Consider the triangle with corners in the origin, epipole,
   and image point for camera 2.

  - Which sides (lengths) are known?
  - Can you determine the angle at the origin? 

+ Consider the larger triangle with corners in the two origins and $p$.

  - Which sides and angles are known?
  - The unknown $\lambda_1$ is one of these sides.
    Can you calculate this with the help of triangulation?

### Part 2

We have only considered $\lambda_1$ above.
The calculation of $\lambda_2$ is symmetric, though you may have
to invert the transformation $(R,T)$.


## Optional exercises

+ [Pre- and Co-image]()
+ Exercise 5.3
+ Exercise 5.4
+ Exercise 5.2 (1)

# Debrief