Main Page | Namespace List | Class List | File List | Class Members

CAMShiftTracker Class Reference

CAMShiftTracker is a class encapsulating the CAMShift functionality of OpenCV. More...

#include <CAMShiftTracker.h>

List of all members.

Public Member Functions

void setVmin (int vmin=10)
 Sets the minimum V value (in the HSV color space) of a pixel for it to be processed by CAMShift.
void setVmax (int vmax=256)
 Sets the maximum V value (in the HSV color space) of a pixel for it to be processed by CAMShift.
void setSmin (int smin=30)
 Sets the minimum S value (in the HSV color space) of a pixel for it to be processed by CAMShift.
int getVmin () const
 Gets the minimum V value (in the HSV color space) of a pixel for it to be processed by CAMShift.
int getVmax () const
 Gets the maximum V value (in the HSV color space) of a pixel for it to be processed by CAMShift.
int getSmin () const
 Gets the minimum S value (in the HSV color space) of a pixel for it to be processed by CAMShift.
SimpleManeuveringFiltergetPositionFilter ()
 Gets the SimpleManeuveringFilter object used to filter the x,y position.
SimpleManeuveringFiltergetSizeFilter ()
 Gets the SimpleManeuveringFilter object used to filter the size (width, height).
SimpleManeuveringFiltergetAngleFilter ()
 Gets the SimpleManeuveringFilter object used to filter the angle.
void resetFilters ()
 Resets all three SimpleManeuveringFilter objects to their default parameters.
void setMinArea (int a=300)
 Sets the minimum area required for tracking.
int getMinArea ()
 Gets the currently set minimum area required for tracking.
void run (IplImage *frame)
 Runs the tracker and processes the image (frame).
IplImage * getImage () const
 Returns the last image received through the run() function.
IplImage * getBackProject () const
 Returns an image of the "BackProject".
IplImage * getHistogramImage () const
 Returns an image of the color histogram, representing the model.
CvHistogram * getHistogram () const
 Returns the actual histogram, representing the model.
void drawEllipse (IplImage *image) const
 Draws on the image an ellipse representing the currently tracked object.
CvBox2D getTrackBox () const
 Returns the actual tracking information of the currently tracked object.
CvScalar getTrackColor () const
 Returns the color representing the whole histogram.
void learn (CvRect selection)
 Trains the tracker by building a color histogram from the given selection in the image.
void forget ()
 Makes the tracker ignore its histogram and return to an untrained state.
void enableTracking (CvRect selection)
 Enables tracking as if the object is in selection, but does not train from selection.


Detailed Description

CAMShiftTracker is a class encapsulating the CAMShift functionality of OpenCV.

It provides a set of easy to use functions for parameter setup, and runs the CAMShift tracker algorithm in an appropriate manner for most applications. It also uses a SimpleManeuveringFilter to smooth out noise from its measured values.

To use this object, set the filters if desired, then call run() for every image you have. Then when you get to an image displaying a colored object you want to track, call learn() with a rectangle corresponding to the position and size of this object. The tracker will start tracking that color, and you can call getTrackBox() after every run() to find out where the object is now.

Author:
Samuel Audet
Version:
1.0, 2006-01-21
Since:
1.0


Member Function Documentation

void CAMShiftTracker::drawEllipse IplImage *  image  )  const
 

Draws on the image an ellipse representing the currently tracked object.

Parameters:
image the image to draw an ellipse on

void CAMShiftTracker::enableTracking CvRect  selection  ) 
 

Enables tracking as if the object is in selection, but does not train from selection.

This is useful if we load the histogram from somewhere else.

Parameters:
selection a rectangle indicating where the object is now

void CAMShiftTracker::forget  )  [inline]
 

Makes the tracker ignore its histogram and return to an untrained state.

Takes effect at the next run() call.

SimpleManeuveringFilter& CAMShiftTracker::getAngleFilter  )  [inline]
 

Gets the SimpleManeuveringFilter object used to filter the angle.

Returns:
SimpleManeuveringFilter of the angle

IplImage* CAMShiftTracker::getBackProject  )  const [inline]
 

Returns an image of the "BackProject".

This grayscale image indicates the probability that a pixel is of the color stored in the histogram, 0 = 0.0 and 255 = 1.0. See the documentation of OpenCV for more details.

Returns:
the "BackProject" image

CvHistogram* CAMShiftTracker::getHistogram  )  const [inline]
 

Returns the actual histogram, representing the model.

The tracker will attempt to track the color represented by this histogram. See the documentation of OpenCV for more details.

Returns:
the actual histogram object

IplImage* CAMShiftTracker::getHistogramImage  )  const [inline]
 

Returns an image of the color histogram, representing the model.

The tracker will attempt to track the color represented by this histogram. See the documentation of OpenCV for more details.

Returns:
the color histogram image

IplImage* CAMShiftTracker::getImage  )  const [inline]
 

Returns the last image received through the run() function.

Returns:
last image received, usually from camera

int CAMShiftTracker::getMinArea  )  [inline]
 

Gets the currently set minimum area required for tracking.

Returns:
current minimum area required for tracking

SimpleManeuveringFilter& CAMShiftTracker::getPositionFilter  )  [inline]
 

Gets the SimpleManeuveringFilter object used to filter the x,y position.

Returns:
SimpleManeuveringFilter of the x,y position

SimpleManeuveringFilter& CAMShiftTracker::getSizeFilter  )  [inline]
 

Gets the SimpleManeuveringFilter object used to filter the size (width, height).

Returns:
SimpleManeuveringFilter of the size (width, height)

int CAMShiftTracker::getSmin  )  const [inline]
 

Gets the minimum S value (in the HSV color space) of a pixel for it to be processed by CAMShift.

Returns:
the minimum S value

CvBox2D CAMShiftTracker::getTrackBox  )  const [inline]
 

Returns the actual tracking information of the currently tracked object.

That is, the position, the size, and the angle.

Returns:
the tracking information

CvScalar CAMShiftTracker::getTrackColor  )  const [inline]
 

Returns the color representing the whole histogram.

This can be used to color representative objects in a GUI.

Returns:
representative tracking color val[0] = Red, val[1] = Green, val[2] = Blue

int CAMShiftTracker::getVmax  )  const [inline]
 

Gets the maximum V value (in the HSV color space) of a pixel for it to be processed by CAMShift.

Returns:
the maximum V value

int CAMShiftTracker::getVmin  )  const [inline]
 

Gets the minimum V value (in the HSV color space) of a pixel for it to be processed by CAMShift.

Returns:
the minimum V value

void CAMShiftTracker::learn CvRect  selection  )  [inline]
 

Trains the tracker by building a color histogram from the given selection in the image.

The selection rectangle refers to the image as returned by getImage(). The color histogram will be updated after a call to this function and the run() function.

Parameters:
selection a rectangle indicating where in the image is the color we want to train on

void CAMShiftTracker::run IplImage *  frame  ) 
 

Runs the tracker and processes the image (frame).

Parameters:
frame image to process

void CAMShiftTracker::setMinArea int  a = 300  )  [inline]
 

Sets the minimum area required for tracking.

The area is compared to what CAMShift returns in comp->rect divided by 255 (see OpenCV documention). So, the minimum area is basically a value indicated the minimum area in pixel^2 if the "probability" in the "backproject" of all pixels in that area were of 255. If this minimum is not reached, the tracker will try to latch on to something (else) in the image.

Parameters:
a the minimum area required for tracking

void CAMShiftTracker::setSmin int  smin = 30  )  [inline]
 

Sets the minimum S value (in the HSV color space) of a pixel for it to be processed by CAMShift.

Parameters:
smin the minimum S value

void CAMShiftTracker::setVmax int  vmax = 256  )  [inline]
 

Sets the maximum V value (in the HSV color space) of a pixel for it to be processed by CAMShift.

Parameters:
vmax the maximum V value

void CAMShiftTracker::setVmin int  vmin = 10  )  [inline]
 

Sets the minimum V value (in the HSV color space) of a pixel for it to be processed by CAMShift.

Parameters:
vmin the minimum V value


The documentation for this class was generated from the following files:
Generated on Sun Feb 19 21:44:51 2006 for CV4HCI by  doxygen 1.4.4