gml_Tracker.h

00001 // gml_Tracker.h
00002 //
00003 //   Define of the gml_TTracker class.
00004 //
00005 //  Copyright (c) 2004 CLIPS-IMAG
00006 //
00007 //  See the file "gml_LicenseTerms.txt" for information on usage and redistribution
00008 //  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00009 //
00010 //  Created in March 2004 (JL).
00011 
00012 #ifndef __GML_TRACKER__
00013 #define __GML_TRACKER__
00014 
00015 // project includes
00016 #include "gml/base/gml_Errors.h"
00017 #include "gml/base/gml_Types.h"
00018 #include "gml/image/gml_Geometry.h"
00019 #include "gml/vision/gml_TrackedObject.h"
00020 #include "gml/base/gml_Timer.h"
00021 
00022 ////////////////////////////////////////////////////////////////////////////////
00023 //                                                                            //
00024 //                     gml_TTracker class declaration                         //
00025 //                                                                            //
00026 ////////////////////////////////////////////////////////////////////////////////
00027 
00028 /// gml_TTracker --
00029 ///
00030 ///   Track a set of points evolving in a 2D space over time.
00031 ///   Tracking is very basic here: no prediction, no filtering. It's well suited
00032 ///   for high frequency or slow movement applications.
00033 
00034 class gml_TTracker
00035 {
00036 public:
00037   ///
00038   /// Init --
00039   ///   Setup data structure for tracking
00040   ///
00041   gml_TError Init (
00042       UInt32 maxTrackedPoints,      ///< maximum number of simultaneously tracked objects
00043       Float32 maxSpeed              ///< maximum speed of tracked objects, in pixels/second
00044     );
00045     
00046   void Dispose ();
00047   
00048   ///
00049   /// Step --
00050   ///   Feed newly detected coordinates to the tracker, and generate events.
00051   ///
00052   gml_TError Step (
00053       gml_TPointFloat * points,     ///< array of newly detected coordinates
00054       UInt32 npoints                ///< length of the <points> array
00055     );
00056     
00057   ///
00058   /// Queue --
00059   ///   Return the queue of events to be processed
00060   ///
00061   gml_TError Queue (gml_TTrackingEventQueue * &queue);
00062 
00063   ///
00064   /// Reset --
00065   ///   Forget about all known tracked objects.
00066   ///   The queue of events is updated accordingly with Disappear events.
00067   ///
00068   void Reset ();
00069 
00070 
00071 protected:
00072   gml_TTimer * fTimer;              ///< gives high-resolution absolute system time
00073   
00074   gml_TTrackingEventQueue * fQueue; ///< queue used to store the events
00075 
00076   UInt32 fMaxTrackedPoints;         ///< maximum number of tracked objects
00077   Float32 fMaxSpeed;                ///< maximum speed of tracked objects, in pixels/second
00078 
00079   gml_TTrackedObject *mTracked;     ///< array of currently tracked objects
00080   UInt32 fTrackedCount;             ///< number of objects currently tracked
00081 
00082   bool *mTrackedFlags;              ///< array of flags indicating if each
00083                                     ///< of the corresponding elements in
00084                                     ///< <mTracked> os in use
00085 
00086   // temporary storage for the Step() method
00087 
00088 private:
00089   SInt32 *mTrackedIndex;          ///< index of the gml_TPointFloat in <points> that
00090                                   ///< corresponds to each gml_TTrackedObject in <mTracked>
00091   bool *mFMatchFlags;             ///< indicates wether each point in <points> was
00092                                   ///< matched with a tracked object
00093   bool *mTFMatchFlags;            ///< indicates wether each tracked object in <mTracked>
00094                                   ///< was matched to a point in <points>
00095 };
00096 
00097 #endif /* __FingerTracker__ */
00098 
Generated on Tue Jun 12 14:03:28 2007 for gml by Doxygen 1.5.2.