Some time ago I saw a demo of a small 'toy tank' with a single camera mounted on it. This tank was able to drive around the floor and detect objects and then move/steer to avoid them. The interesting part was that it used a single camera vision system and as far as I remember was taking advantage of the floor being flat. and then using the rate a feature was moving in the scene relative to the motors and directions of travel to evaluate and hence map the scene.

Can anyone send me pointers what to search for to get some more information on this, or some pointers to codebases that can do this.

The reason I ask is that this was a single camera system from a number of years ago (5+) and therefore (from what I remember) was a relatively low compute load. I was intending to try this out on a Raspberry PI to build a car/tank that maps a room or set of rooms.


It's hard to say exactly what they were doing, but the terms you may want here are "optical flow" and "egomotion". Sounds like there may have been some feature detection and matching (something like SURF or SIFT) or foreground/background segmentation thrown in as well.

OpenCV is probably the most widely used codebase for computer vision, they have a lot of functionality for motion analysis. OpenCV should run on the Raspberry Pi, although your algorithms may be limited by computing power.


Building on WildCrustcean's response another possiblity would be stereo vision. While we often think of stereo vision as using two cameras the techniques really only need images displaced in space and a model of the displacement. In other words I can take an image, move, then take another image. So long as I know the transformation between these two images I can then use stereo vision techniques to calculate the distance to a point in the image.

  • 2
    $\begingroup$ I think the technique you are talking about is called "Structure from motion". $\endgroup$ – Kozuch Apr 9 '16 at 14:30

It could have been using Parellel Tracking and Mapping PTAM. PTAM is an implementation of the Simultaneous Localization and Mapping (SLAM) problem that uses a single camera to build a 3D map of the world and localize by tracking visual features.

My team once experimented with using the PTAM package in ROS.

We were running Ubuntu on an Intel Atom, and as I recall it didn't grain too much of the processor. We didn't end up using though, mainly because we couldn't get it to find enough features in the environment where our robot would be running.


In the general you can't extract metric distance measurements from a single image, unless you have extra information about the world. For example, if you know the world is planar (or you can detect the floor, which is a planar region), then you can estimate a homography.

A homography is a projective transformation between planes (3x3 matrix). Given the camera intrinsic calibration, you can decompose this plane-induced homography into a rotation and translation. The translation is up to scale. You can resolve this scale ambiguity by knowing the distance from the camera to the floor (plane).

Once you have the homography, you can detect objects that are not on the plane. The homography allows you warp the first image onto the second. Objects on the plane will align and will have a small error. Objects not on the plane will not align. This is called parallax.

One way to implement this could be

  1. Extract features from both images.
  2. Match the features, or track them.
  3. Estimate the homography using RANSAC.
  4. Decompose the homography into a rotation and translation using the calibration.
  5. Warp the first image onto the
    second. Pixels with large errors are not on the floor and could be

Most of the building blocks are implemented in opencv (see http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html).

Good luck.

P.S. the homography decomposition will also give you the normal of the plane. But, since you are assuming this is the ground plane, we have the normal pointing in the up direction. A more precise solution can be accomplished in your calibration procedure. You can use a checkerboard target and estimate its pose. The pose will have a plane normal and distance to the camera.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.