Odometry

scalacv.Odometry
See theOdometry companion object
final class Odometry extends AutoCloseable

A running visual-odometry pipeline: feed frames in order, get the camera's motion each step.

This is the front-end loop of visual SLAM, composing the per-frame primitives: it keeps the previous frame and its tracked points, follows them into each new frame with OpticalFlow, and estimates the step's motion with VisualOdometry. Chaining the steps is dead-reckoning — it drifts, and correcting that drift (loop closure, global optimisation) is the SLAM back end, beyond OpenCV.

Monocular, so each step's translation is a unit direction (scale is unobservable from one camera). The pipeline retains a frame's worth of native memory between calls, so it is AutoCloseableclose it.

val odometry = Odometry.monocular(Intrinsics(fx = 500, fy = 500, cx = 320, cy = 240))
try camera.foreach(frame => odometry.update(frame).foreach(step => track(step)))
finally odometry.close()

Not thread-safe: feed one frame at a time.

Attributes

Companion
object
Source
Odometry.scala
Graph
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def close(): Unit

Releases the retained frame. Idempotent.

Releases the retained frame. Idempotent.

Attributes

Source
Odometry.scala
def framesProcessed: Int

How many frames have been fed so far.

How many frames have been fed so far.

Attributes

Source
Odometry.scala
def update(frame: Image): Option[CameraMotion]

Feeds the next frame and returns the camera's motion since the previous one. None on the very first frame (it becomes the reference) and whenever too few points survive to estimate a motion.

Feeds the next frame and returns the camera's motion since the previous one. None on the very first frame (it becomes the reference) and whenever too few points survive to estimate a motion.

Attributes

Source
Odometry.scala