Structure from motion

The structure from motion primitives used by Kontiki are perhaps a bit different from what you are used to. Instead of modelling landmarks as e.g. a 3D-point in world coordinates, we instead use a combination of a reference observation and an inverse depth.

This formulation is nice because it is simple to represent landmarks at infinity, and also only require us to optimize a single scalar (the inverse depth) instead of a full 3D-point. For a more detailed description see e.g. [Lovegrove2013].

Usage

To setup a structure from motion problem we create View and Landmark objects, and then add Observation objects by calling View.create_observation(). Note that it is impossible to create Observation objects any other way.

Assume that we have a list of tracks that each contain a list of tuples (n, x), where n is a frame number, and y is an image point. Then creating the structure from motion objects looks like this:

landmarks = []
views = {}  # frame number -> View

for track_data in tracks:
    lm = Landmark()
    for n, y in track_data:
        view = views.get(n, View(n / frame_rate))
        view.create_observation(lm, y)

To be usable, we also need to set the reference observation for each landmark. Easiest is to use the first one:

for lm in landmarks:
    lm.reference = lm.observations[0]

Classes

class kontiki.sfm.View
create_observation(self: kontiki.sfm.View, arg0: kontiki.sfm.Landmark, arg1: numpy.ndarray[float64[2, 1]]) → kontiki.sfm.Observation

Create a new observation

frame_nr

Frame number

observations

List of observations

remove_observation(self: kontiki.sfm.View, arg0: kontiki.sfm.Observation) → None

Remove an observation

t0

Start of frame time

class kontiki.sfm.Landmark

A 3D landmark

Landmarks are represented by a reference observation, and an inverse depth.

id

Landmark ID

Warning

The landmark ID is only unique within a session. You can not trust an ID to be the same e.g. if loading the same problem from disk twice.

inverse_depth

The inverse depth, relative to the reference observation

locked

Lock landmark to not allow it to change during optimization. Defaults to False.

observations

List of all landmark observations

reference

Reference observation

class kontiki.sfm.Observation

An observation of a landmark in a view

is_reference

True if this is the landmark reference observation

landmark

The Landmark this observation belongs to

uv

The image measurement.

view

The View this observation belongs to

References

[Lovegrove2013]Lovegrove, S.; Patron-Perez, A.; and Sibley, G. Spline Fusion: A continuous-time representation for visual-inertial fusion with application to rolling shutter cameras In Procedings of the British Machine Vision Conference 2013