segmentImageTrack.H

Go to the documentation of this file.
00001 /*!@file VFAT/segmentImageTrack.H .H Basic image segmenter blob finder using color */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the //
00005 // University of Southern California (USC) and the iLab at USC.         //
00006 // See http://iLab.usc.edu for information about this project.          //
00007 // //////////////////////////////////////////////////////////////////// //
00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00010 // in Visual Environments, and Applications'' by Christof Koch and      //
00011 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00012 // pending; application number 09/912,225 filed July 23, 2001; see      //
00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00014 // //////////////////////////////////////////////////////////////////// //
00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00016 //                                                                      //
00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00018 // redistribute it and/or modify it under the terms of the GNU General  //
00019 // Public License as published by the Free Software Foundation; either  //
00020 // version 2 of the License, or (at your option) any later version.     //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00025 // PURPOSE.  See the GNU General Public License for more details.       //
00026 //                                                                      //
00027 // You should have received a copy of the GNU General Public License    //
00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00030 // Boston, MA 02111-1307 USA.                                           //
00031 // //////////////////////////////////////////////////////////////////// //
00032 //
00033 // Primary maintainer for this file: T. Nathan Mundhenk <mundhenk@usc.edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/VFAT/segmentImageTrack.H $
00035 // $Id: segmentImageTrack.H 4663 2005-06-23 17:47:28Z rjpeters $
00036 //
00037 
00038 #include "Image/Image.H"
00039 #include "Util/log.H"
00040 #include "VFAT/segmentImage.H"
00041 #include <cstdio>
00042 #include <cstdlib>
00043 
00044 class segmentImageTrack
00045 {
00046 private:
00047   int minX,maxX,minY,maxY,centerX,centerY,mass;
00048   int minMass, maxMass;
00049   int xBound, yBound;
00050   int trajCounterM,trajCounterS,trajCounterR,trajCounterMS;
00051   bool iter,LOT,doTraj,trajStart;
00052   float levity;
00053   float meanTsize;
00054   float meanTmass;
00055   float meanTratio;
00056   float meanTMS;
00057   float meanTsizeStd;
00058   float meanTmassStd;
00059   float meanTratioStd;
00060   float meanTMSStd;
00061   segmentImage *image;
00062   //! stores blobs that are candidates after filtering
00063   std::vector<bool> candidateBlob;
00064   std::vector<bool> softCandidateBlob;
00065   //! this tells if candidicy was removed be me and not someone else
00066   std::vector<bool> killedByTrack;
00067   //! holds size info
00068   std::vector<float> Tsize;
00069   std::vector<float> TsizeStd;
00070   //! holds mass info
00071   std::vector<float> Tmass;
00072   std::vector<float> TmassStd;
00073   //! holds Ratio info
00074   std::vector<float> Tratio;
00075   std::vector<float> TratioStd;
00076   //! holds size verses mass info
00077   std::vector<float> TMS;
00078   std::vector<float> TMSStd;
00079   //! holds votes
00080   std::vector<int> Twinner;
00081   std::vector<float> TwinnerScore;
00082 
00083   //! apply hard Constraints to blobs
00084   void applyHardConst();
00085   //! apply fluid Mass constraints
00086   void fluidTrackCalc(float *thisMean, float *thisStd,
00087                       float *thisCounter,
00088                       std::vector<float> &thisList);
00089   //! marry winning blobs
00090   void mergeBlobs();
00091 public:
00092   //! P that a blob will bring this instance into vergance
00093   std::vector<float> pVergance;
00094   //! set up tracker one time, input max blobs and a linked image segmenter
00095   segmentImageTrack();
00096   segmentImageTrack(int initSize);
00097   segmentImageTrack(int initSize,segmentImage *seg);
00098   ~segmentImageTrack();
00099   //! insert image into object
00100   void setImage(segmentImage *seg);
00101   //! set up variables
00102   void setUpVars(int initSize);
00103   //! track this object
00104   /*! Call this method to apply single camera tracking constraints.
00105     @param _levity This is how much levity to allow in tracking constraints \
00106     0 = none while 1 equals total levity and almost disables this feature
00107   */
00108   void track(float _levity = 0);
00109   //! get centroid of object in X
00110   int getObjectX();
00111   //! get centroid of object in Y
00112   int getObjectY();
00113   //! get boundry of object minimum X
00114   int getXmin();
00115   //! get boundry of object maximum X
00116   int getXmax();
00117   //! get boundry of object minimum Y
00118   int getYmin();
00119   //! get boundry of object maximum Y
00120   int getYmax();
00121   //! get mass of object
00122   int getMass();
00123   //! tell if this blob is still a candidate
00124   bool isCandidate(int blob);
00125   //! tell if this blob is a soft candidate
00126   bool isSoftCandidate(int blob);
00127   //! tells if candidicy was removed by this class and not externally
00128   bool wasKilledByTrack(int blob);
00129   //! let an external class set this blobs candidicy
00130   void setCandidate(int blob, bool setThis);
00131   //! Returns if it has a loss of track
00132   bool returnLOT();
00133   //! resets some parameters if needed
00134   void reset();
00135 };
00136 
00137 
Generated on Sun May 8 08:42:35 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3