template class sophus::InverseDepthPoint3

Overview

Inverse depth point representation. More…

#include <inverse_depth.h>

template <class TT>
class InverseDepthPoint3 {
public:
    // construction

    InverseDepthPoint3();

    InverseDepthPoint3(
        Eigen::Matrix<TT, 2, 1> const& proj_in_z1_plane,
        TT const& one_by_z
        );

    InverseDepthPoint3(
        TT const& x_by_z,
        TT const& y_by_z,
        TT const& one_by_z
        );

    // methods

    Eigen::Matrix<TT, 2, 1> projInZ1Plane() const;
    TT const& psi() const;
    TT& psi();
    TT const* data() const;
    TT* data();
    Eigen::Matrix<TT, 3, 1> const& params() const;
    Eigen::Matrix<TT, 3, 1> toEuclideanPoint3() const;
    static InverseDepthPoint3 fromEuclideanPoint3(Eigen::Matrix<TT, 3, 1> const& p);
    static InverseDepthPoint3 fromAbAndPsi(Eigen::Matrix<TT, 3, 1> const& ab_and_psi);
};

Detailed Documentation

Inverse depth point representation.

(a, b) := (x/z, y/z) and psi := 1/z

following https://ethaneade.com/thesis_revised.pdf, pp. 79

Let us assume we have Euclidean 3d point (x,y,z) in a local reference frame (e.g. camera origin). One can construct an inverse depth point (in the same local reference frame) as follows:

First we project the point (x,y,z) through the origin (0,0,0) onto the z=1 plane. We call the projection (a, b) := (x/z, y/z).

In other words, (a, b) is the intersection of the line through (0, 0, 0) to (x, y, z) and the 2d Euclidean plane z=1.

Now, we can describe almost any 3d point in our local reference frame as a point (a’,b’) in the Euclidean plane z=1 and the inverse depth psi := 1/z.

For example, the Euclidean point (2, 0, 8) is represented as (a, b) = (2/8, 0/8) = (1/4, 0) and inverse depth psi = 1/8.

The only Euclidean 3d point we cannot describe is the origin (0,0,0) (since there are infinitely many lines through the origin which intersect with the plane z=1).

The advantage of using an inverse depth representation over Euclidean representation is that we can also represent points at infinity. Let (a,b) a 2d Euclidean point on our reference plane z=1; nothing stops us from choosing a psi=0, which corresponds to a “z = 1/0 = infinity”.

In summary, using this representation, we can represent

  • points at infinity: psi == 1/z == 0

  • points close to +infinity: psi == 1/z == +e

  • points close to -infinity: psi == 1/z == -e

  • points one unit in front: psi == 1/z == +1

  • points one unit behind: psi == 1/z == -1

  • points close to zero, in front: psi == 1/z == +999999

  • points close to zero, behind: psi == 1/z == -999999

Methods

TT const& psi() const

Returns inverse depth psi, hence “1 / z”.

Eigen::Matrix<TT, 3, 1> toEuclideanPoint3() const

Precondition: psi must not be close to 0, hence z must not be near infinity.