C# Class Accord.Vision.Tracking.Camshift

Continuously Adaptive Mean Shift (Camshift) Object Tracker

Camshift stands for "Continuously Adaptive Mean Shift". It combines the basic Mean Shift algorithm with an adaptive region-sizing step. The kernel is a step function applied to a probability map. The probability of each image pixel is based on color using a method called histogram backprojection.

The implementation of this code has used Gary Bradski's original publication, the OpenCV Library and the FaceIt implementation as references. The OpenCV library is distributed under a BSD license. FaceIt is distributed under a MIT license. The original licensing terms for FaceIt are described in the source code and in the Copyright.txt file accompanying the framework.

References: G.R. Bradski, Computer video face tracking for use in a perceptual user interface, Intel Technology Journal, Q2 1998. Available on: ftp://download.intel.com/technology/itj/q21998/pdf/camshift.pdf R. Hewitt, Face tracking project description: Camshift Algorithm. Available on: http://www.robinhewitt.com/research/track/camshift.html OpenCV Computer Vision Library. Available on: http://sourceforge.net/projects/opencvlibrary/ FaceIt object tracking in Flash AS3. Available on: http://www.libspark.org/browser/as3/FaceIt

Inheritance: IObjectTracker
Exibir arquivo Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
Camshift ( ) : System

Constructs a new Camshift tracking algorithm.

Camshift ( Rectangle objectArea ) : System

Constructs a new Camshift tracking algorithm.

Camshift ( Rectangle objectArea, CamshiftMode colorMode ) : System

Constructs a new Camshift tracking algorithm.

Camshift ( UnmanagedImage frame, Rectangle objectArea ) : System

Constructs a new Camshift tracking algorithm.

Camshift ( UnmanagedImage frame, Rectangle objectArea, CamshiftMode colorMode ) : System

Constructs a new Camshift tracking algorithm.

GetBackprojection ( ) : Bitmap

Generates a image of the histogram back projection

GetBackprojection ( PixelFormat format ) : Bitmap

Generates a image of the histogram backprojection

GetBackprojection ( PixelFormat format, Rectangle rectangle ) : Bitmap

Generates a image of the histogram backprojection

GetBackprojection ( UnmanagedImage image, Rectangle rectangle ) : void

Generates a image of the histogram backprojection

ProcessFrame ( UnmanagedImage frame ) : void

Processes a new video frame.

Reset ( ) : void

Resets the object tracking algorithm.

Private Methods

Method Description
camshift ( UnmanagedImage frame ) : void

Camshift algorithm

checkSteadiness ( ) : bool

Checks for aberrant fluctuations in the tracking object.

computeHistogramRatio ( float histogramM, float histogramI, float ratio ) : float

Computes the ratio histogram between to histograms.

http://www.robinhewitt.com/research/track/backproject.html

createHistogram ( UnmanagedImage frame, Rectangle area ) : float[]

Creates a color histogram discarding low intensity colors

generateBackprojectionMap ( UnmanagedImage frame, float ratioHistogram ) : void

Image histogram back-projection.

initialize ( UnmanagedImage frame, Rectangle objectArea, CamshiftMode colorMode ) : void
meanShift ( UnmanagedImage frame ) : CentralMoments

Mean shift algorithm

Method Details

Camshift() public method

Constructs a new Camshift tracking algorithm.
public Camshift ( ) : System
return System

Camshift() public method

Constructs a new Camshift tracking algorithm.
public Camshift ( Rectangle objectArea ) : System
objectArea System.Drawing.Rectangle
return System

Camshift() public method

Constructs a new Camshift tracking algorithm.
public Camshift ( Rectangle objectArea, CamshiftMode colorMode ) : System
objectArea System.Drawing.Rectangle
colorMode CamshiftMode
return System

Camshift() public method

Constructs a new Camshift tracking algorithm.
public Camshift ( UnmanagedImage frame, Rectangle objectArea ) : System
frame Accord.Imaging.UnmanagedImage
objectArea System.Drawing.Rectangle
return System

Camshift() public method

Constructs a new Camshift tracking algorithm.
public Camshift ( UnmanagedImage frame, Rectangle objectArea, CamshiftMode colorMode ) : System
frame Accord.Imaging.UnmanagedImage
objectArea System.Drawing.Rectangle
colorMode CamshiftMode
return System

GetBackprojection() public method

Generates a image of the histogram back projection
public GetBackprojection ( ) : Bitmap
return System.Drawing.Bitmap

GetBackprojection() public method

Generates a image of the histogram backprojection
public GetBackprojection ( PixelFormat format ) : Bitmap
format PixelFormat
return System.Drawing.Bitmap

GetBackprojection() public method

Generates a image of the histogram backprojection
public GetBackprojection ( PixelFormat format, Rectangle rectangle ) : Bitmap
format PixelFormat
rectangle System.Drawing.Rectangle
return System.Drawing.Bitmap

GetBackprojection() public method

Generates a image of the histogram backprojection
public GetBackprojection ( UnmanagedImage image, Rectangle rectangle ) : void
image Accord.Imaging.UnmanagedImage
rectangle System.Drawing.Rectangle
return void

ProcessFrame() public method

Processes a new video frame.
public ProcessFrame ( UnmanagedImage frame ) : void
frame Accord.Imaging.UnmanagedImage
return void

Reset() public method

Resets the object tracking algorithm.
public Reset ( ) : void
return void