Cognotics Home  
Search Cognotics:
Home > OpenCV Resources > Software Downloads > Simple Camshift Wrapper
 
A Simple Camshift Wrapper

Camshift is OpenCV's face tracking algorithm. There's currently no simple C-language example in the OpenCV samples directory for implementing Camshift. The implementation in the camshiftdemo program is intertwined with user-interace code that makes is fairly difficult to adapt to other purposes unless one is already very familiar with Camshift.

There's a C++ wrapper class in cvaux.hpp but, this also is somewhat complex, with many interfaces. And of course, it's only available through C++.

This Simple Camshift Wrapper is provided here to make Camshift more accessible to the casual, or beginning, user. It provides a minimal C-language interface with four main methods:

  • createTracker(): pre-allocates internal data structures
  • releaseTracker(): releases Camshift resources
  • startTracking(): initiates tracking from an image plus a rectangular region
  • track(): tracks the object in this region from frame to frame using Camshift

There are also two methods for setting the parameters smin and vmin:

  • setVmin()
  • setSmin()

The example program, Track Faces, uses the Simple Camshift Wrapper in a program that detects a face in live video and automatically begins tracking it.

 

Download Camshift Wrapper

Optional Patches. These were kindly contributed by Stefanie Tellex. (See the readme for a description.)

 

How Camshift Works

 
Seeing With OpenCV:

Part 1: Introduction to OpenCV

Part 2: Finding Faces in Images

Part 3: Follow that Face!

Part 4: Face Recognition With Eigenface

Part 5: Implementing Eigenface
 
O'Reilly book from
the creators of OpenCV

Home | Vision | OpenCV Resources