segmentImageTrack2.H

Go to the documentation of this file.
00001 /*!@file VFAT/segmentImageTrack2.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/segmentImageTrack2.H $
00035 // $Id: segmentImageTrack2.H 4663 2005-06-23 17:47:28Z rjpeters $
00036 //
00037 
00038 #include "Image/Image.H"
00039 #include "Util/log.H"
00040 #include "VFAT/blobProp.H"
00041 #include "VFAT/segmentImage2.H"
00042 #include <cstdio>
00043 #include <cstdlib>
00044 
00045 class segmentImageTrack2
00046 {
00047 private:
00048   int SIT_minX,SIT_maxX,SIT_minY,SIT_maxY,SIT_centerX,SIT_centerY,SIT_mass;
00049   //int SIT_minMass, SIT_maxMass;
00050   int SIT_xBound, SIT_yBound;
00051   int SIT_trajCounterM,SIT_trajCounterS,SIT_trajCounterR,SIT_trajCounterMS;
00052   bool SIT_iter,SIT_LOT,SIT_doTraj,SIT_trajStart;
00053   bool SIT_blobSet;
00054   float SIT_levity;
00055   float SIT_meanTsize;
00056   float SIT_meanTmass;
00057   float SIT_meanTratio;
00058   float SIT_meanTMS;
00059   float SIT_meanTsizeStd;
00060   float SIT_meanTmassStd;
00061   float SIT_meanTratioStd;
00062   float SIT_meanTMSStd;
00063   segmentImage2 *SIT_image;
00064   blobProp *SIT_blobProp;
00065   //! stores blobs that are candidates after filtering
00066   std::vector<bool> SIT_candidateBlob;
00067   std::vector<bool> SIT_softCandidateBlob;
00068   //! this tells if candidicy was removed be me and not someone else
00069   std::vector<bool> SIT_killedByTrack;
00070   //! holds size info
00071   std::vector<float> SIT_Tsize;
00072   std::vector<float> SIT_TsizeStd;
00073   //! holds mass info
00074   std::vector<float> SIT_Tmass;
00075   std::vector<float> SIT_TmassStd;
00076   //! holds Ratio info
00077   std::vector<float> SIT_Tratio;
00078   std::vector<float> SIT_TratioStd;
00079   //! holds size verses mass info
00080   std::vector<float> SIT_TMS;
00081   std::vector<float> SIT_TMSStd;
00082   //! holds votes
00083   std::vector<int> SIT_Twinner;
00084   std::vector<float> SIT_TwinnerScore;
00085 
00086   //! apply hard Constraints to blobs
00087   void SITapplyHardConst();
00088   //! apply fluid Mass constraints
00089   void SITfluidTrackCalc(float *thisMean, float *thisStd,
00090                       float *thisCounter,
00091                       std::vector<float> &thisList);
00092   //! marry winning blobs
00093   void SITmergeBlobs();
00094 public:
00095   //! P that a blob will bring this instance into vergance
00096   std::vector<float> SIT_pVergance;
00097   //! set up tracker one time, input max blobs and a linked image segmenter
00098   segmentImageTrack2();
00099   segmentImageTrack2(int initSize);
00100   segmentImageTrack2(int initSize,segmentImage2 *seg);
00101   ~segmentImageTrack2();
00102   //! insert image into object
00103   void SITsetImage(segmentImage2 *seg);
00104   //! insert blobProp pointer
00105   void SITsetBlobProp(blobProp *bp);
00106   //! set up variables
00107   void SITsetUpVars(int initSize);
00108   //! track this object
00109   /*! Call this method to apply single camera tracking constraints.
00110     @param _levity This is how much levity to allow in tracking constraints \
00111     0 = none while 1 equals total levity and almost disables this feature
00112   */
00113   void SITtrack(float _levity = 0);
00114   //! get centroid of object in X
00115   int SITgetObjectX();
00116   //! get centroid of object in Y
00117   int SITgetObjectY();
00118   //! get boundry of object minimum X
00119   int SITgetXmin();
00120   //! get boundry of object maximum X
00121   int SITgetXmax();
00122   //! get boundry of object minimum Y
00123   int SITgetYmin();
00124   //! get boundry of object maximum Y
00125   int SITgetYmax();
00126   //! get mass of object
00127   int SITgetMass();
00128   //! tell if this blob is still a candidate
00129   bool SITisCandidate(int blob);
00130   //! tell if this blob is a soft candidate
00131   bool SITisSoftCandidate(int blob);
00132   //! tells if candidicy was removed by this class and not externally
00133   bool SITwasKilledByTrack(int blob);
00134   //! let an external class set this blobs candidicy
00135   void SITsetCandidate(int blob, bool setThis);
00136   //! Returns if it has a loss of track
00137   bool SITreturnLOT();
00138   //! allows you to manually set the LOT bool
00139   void SITsetLOT(bool LOT);
00140   //! resets some parameters if needed
00141   void SITreset();
00142 };
00143 
00144 
Generated on Sun May 8 08:07:04 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3