9

Could someone direct me to a tutorial or guide me how to track motion of an object moving with 6 DOF. I am planing to use a video stream of a moving toy car. I want to calculate displacement and rotation angle of the toy car. I came across some research papers but couldn't find any libraries to the job.

Is there a way to do this using OpenCV or Matlab or some other freely available software?

Thank you

5
  • Perhaps a neural network (I'm not sure at all)...
    – BlackBear
    Jan 15, 2011 at 20:38
  • I was hoping for a bit simpler way (:D) may be using edges, corners and surface features
    – Niroshan
    Jan 15, 2011 at 20:50
  • Then pattern matching looks the only choice I guess.. Good luck in that case ;)
    – BlackBear
    Jan 15, 2011 at 20:59
  • It's a tough problem you're trying to solve. Jan 24, 2011 at 13:48
  • @Utkrash It's part of my final year research. My project is related to free viewpoint videos. And the project is very much depended on this. I have to get this done. I am planning on studying methods proposed here. That's why I have not accepted any yet. I sure will post my solution if I succeeded
    – Niroshan
    Jan 24, 2011 at 14:23

6 Answers 6

21

Tracking is a classical computer vision problem to which research is still devoted in computer science; you can quickly get a sense of the state-of-the-art in this field by checking the list of accepted papers in CVPR 2010 (which is an annual top computer vision conference) and you'll see that there is still active work being published on the topic (search for the word "tracking" within the list).

The standard processing pipeline of a solution for a tracking problem works as follows: The image is first parsed to extract meaningful descriptors that capture relevant corners and other salient features of the image. These descriptors are later fed to an on-line classifier that is trained to detect likely instances of your particular object of interest in each frame. The descriptor of your object may be known a priori, (i.e. computed off-line) from previous examples of what the object looks like, but it is usually updated in every frame by what the the system sees over time, to make the detection adaptive to the dynamic object appearance. Finally, in order to choose from a pool of possible candidates in each frame (from those that were detected), parameters such as the position and velocity of your objects are estimated with respect to previous frames using a sequential statistical model.

There is a vast computer vision literature on good image descriptors, but some of the most popular ones are SIFT, SURF, or HOG. For classification, two of the most successful methods are support vector machines or classification ensembles (e.g. boosting or random forests), and for the estimation part, most people still use Kalman filters (which is a type of sequential Markov model), particle filters or more generally density estimation models.

The specific case you described is a bit easier than the more general and difficult object-tracking problem with arbitrary camera and object motion in natural outdoor scenes, so you might be able to find some code online that could work right away in your setting, but I doubt it. As others pointed out, (and to the best of my knowledge), there is no off-the-shelf library that works right away for all sorts of objects, backgrounds and motion spaces. That said, you can probably find code for the individual components of the standard general pipeline I described above (classifiers, banks of filters/features, Markov estimation models) online.

My suggestion is, if you are interested in building a good system (i.e. one that actually works), then look at the websites of the authors of most recent papers in top annual computer vision conferences, such as CVPR, ICCV, ECCV and SIGGRAPH. They tend to have code online for their most recent work with some video examples, and this might help you get a sense of how their methods work in a real setting.

3

I doubt there is a program ready to use for that... at least you will have to get a couple of methods or libraries and use no so easy maths to do that. People do their thesis about that!

This is a paper I read recently:

http://cobweb.ecn.purdue.edu/RVL/Research/ModelBasedTracking/index.html

If you think is not what you are looking for then go the references only to get more ideas ;)

3

Maybe the KLT Tracker (Kanade Lucas Tomasi) can help you. It tells you where detected points moved between the images. The OpenCV library contains a version of the KLT Tracker but without affine conistency check (as the KLT homepage states).

3

If you want to try some ready-made code, there is a sample file that comes with OpenCV. In OpenCV 2.1 it's in samples/c/blobtrack.cpp and in OpenCV 2.2 it's in samples/c/blobtrack_sample.cpp. Both come with .exe files, so you can try the samples right away in case you happen to use Windows. There is an oldish site, The OpenCV Video Surveillance / Blob Tracker Facility, documenting how the code works.

The tracker in blobtrack.cpp is divided in three stages (copied from the previous link):

  1. A foreground/background discriminator which labels each pixel as either foreground or background.
  2. A blob detector which groups adjacent "foreground" pixels into blobs, flood-fill style.
  3. A blob tracker which assigns ID numbers to blobs and tracks their motion frame-to-frame.

blobtrack.cpp actually implements several methods for each stage, so you can try different combinations to see which one works best.

That last stage means that you can actually track multiple objects simultaneously. I've tested it on videos of vehicles moving on highways taken with a static camera and it works pretty well, if a bit slow with the best methods.

Also, you can go a long way using a simple technique called background subtraction if the background of your video is static, that is, if the only thing that changes from frame to frame is the toy car itself. But I think that will only help you as far as locating the object, not estimating its pose.

Note: I couldn't get the sample that comes with OpenCV 2.2 to work. The one that comes with OpenCV 2.1 worked fine for me.

2

Have a look at TLD (apparantly Matlab):

TLD is an award-winning, real-time algorithm for tracking of unknown objects in video streams. The object of interest is defined by a bounding box in a single frame. TLD simultaneously Tracks the object, Learns its appearance and Detects it whenever it appears in the video. The result is a real-time tracking that typically improves over time.

Haven't used it personally, but the demo videos are awesome.

1

This is the software you are looking for http://www.cabrillo.edu/~dbrown/tracker/

This articles may help inspiring you http://www.wired.com/wiredscience/2010/10/physics-of-angry-birds/

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