Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Motion tracking using Emgu CV (or OpenCV)

How can I do motion tracking using Emgu CV or OpenCV? What are different ways of doing it?

I want to track objects against a fixed background.

Best Regards

like image 303
Kaveh Shahbazian Avatar asked Jun 13 '11 07:06

Kaveh Shahbazian


1 Answers

Since I don't know Emgu CV, I would recommend OpenCV. I'd suggest you use the Lucas Kanade tracking (optical flow). You track objects by doing the following:

  1. Read an image from source (webcam/video file etc.)
  2. Preprocess it (optional, but can be proven useful)
  3. Extract from a region (e.g. from the head of a person) points to track. You can do this automatically using the cvGoodFeaturesToTrack method.
  4. Then you can track these points with cvCalcOpticalFlowPyrLK, which will give you the new positions of your tracked points.

See a better tutorial here.

If you want to understand the concepts behind these functions I would highly recommend reading Learning OpenCV - unfortunately the linked book is only a preview, with missing pages.

Anyway I am sure you can think of a place where you can get this book ;).

like image 179
Matyas Avatar answered Nov 17 '22 14:11

Matyas