The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

MPColorTracker.h

Go to the documentation of this file.
00001 /*
00002  *  MPColorTracker.h
00003  *  
00004  *
00005  *  Created by Josh Susskind 2003.
00006  *  Copyright (c) 2003 Machine Perception Laboratory
00007  *  University of California San Diego.
00008  *  Please read the disclaimer and notes about redistribution
00009  *  at the end of this file.
00010  *
00011  *  Authors: Josh Susskind, Bret Fortenberry
00012  */
00013 #ifdef WIN32
00014 #pragma warning(disable:4786)
00015 #endif
00016 
00017 #ifndef __MPCOLORTRACKER_H__
00018 #define __MPCOLORTRACKER_H__
00019 
00020 /* ================================================================ */
00021 
00022 #include "preprocessor.h"
00023 
00024 #ifdef WIN32
00025 #include "Images/imageio.h"
00026 #endif
00027 #include "Images/color.h"
00028 #include "mpisearchthread.h"
00029 //#include "commthread.h"
00030 //#include "MPImageWrapper.h"
00031 #include "MPColorResults.h"
00032 #include "MPKeyFrame.h"
00033 #include "MPHistogramHue.h"
00034 #include "MPHistogram.h"
00035 #include "colorsearchparams.h"
00036 
00037 #ifdef PREDICTIVE
00038 #include "colorfeatsearch.h"
00039 #else
00040 #include "probColorSearch.h"
00041 #endif
00042 
00043 
00044 
00045 /* ================================================================ */
00046 
00047 class MPColorTracker 
00048 {
00049 public:
00050   MPColorTracker();
00051   ~MPColorTracker();    /* Destructor */
00052 private:
00053         RImage<RGBTRIPLE> m_colorImage;
00054 #ifdef PREDICTIVE
00055         MPColorFeatSearch m_colorFeatSearch;
00056 #else
00057         ProbColorSearch<double> m_colorSearch; /* for exhaustive color search */
00058 #endif
00059   int m_searchHeight;
00060   int m_searchWidth;
00061 
00064 //      double m_hr, m_scaledev;
00066         RImage<double> m_likRatImage;
00067 //      TSquare<double> m_vBox;
00069         TSquare<double> m_mBox;
00070         double m_llikeMPI;
00071         double m_activation;
00072         LONGLONG m_NumFrames;
00073         MPISearchThread *m_MPI;
00074         //CommThread *m_CommThread;
00075         MPColorTools m_ColorTools;
00076 
00077         MPColorResults m_results;
00078 
00079         ColorSearchParams m_csearchparams;
00080         //int m_DownSample;
00081         int m_resetTracker;
00082 
00083         /* for prior */
00084 //      MPISearchProbSearch::PriorType m_prior_type;
00085 //      double m_size_scale, m_x_scale, m_y_scale;
00086 
00087         /* for exponential smoothing of face box */
00088 //      double m_smooth_param;
00089 
00090         /* for searching hypotheses */
00091 //      int m_minScaleUp;
00092 //      int m_minStride;
00093 //      double m_minSizePct;
00094 //      double m_stridePct;
00095 //      double m_scaleUpPct;
00096         
00097   int (*m_samples)[2];
00098         
00099         int m_successTrackerSize;
00100   int m_successTrackerIndex;
00101   double (*m_successTracker);
00102   double m_successMeasure;
00103         int m_successCount; 
00104         int m_success;
00105         long m_curFrame;
00106 
00107 #ifdef USEHUE
00108   MPHistogramHue<float, NUMBINS> m_LogProbColorGivenFace;
00109   MPHistogramHue<float, NUMBINS> m_LogProbColorGivenBack;
00110 #else
00111   MPHistogram<float, NUMBINS> m_LogProbColorGivenFace;
00112   MPHistogram<float, NUMBINS> m_LogProbColorGivenBack;
00113 #endif
00114 
00115         MPKeyFrameCollection *m_Collection;
00116 
00117 public:
00118         int DoSearch();
00119   int InitStreaming();
00120   int EndStreaming();
00121         void ShowProbs();       
00122         void ShowProbs(const bool &type);
00123         void WriteBitmap(char *directory);
00124         void MPIUpdate();
00125         void PutImage(void *img, int &w, int &h, long & frameCount);    
00126         void SetKeyFrameCollection(MPKeyFrameCollection *collection);
00127         
00128         inline int GetLastFaces( FaceBoxList &faces) { return m_MPI->GetMPIFaceBoxes(faces); }
00129         inline void GetColorBox( TSquare<double> &box ) { box.x = m_results.x1; box.y = m_results.y1; box.size = m_results.getWidth(); }
00130   inline int GetLastNumFrontalFaces() const {return m_MPI->GetNumFaces(); };
00131   inline TIMETYPE GetTimeStamp() const {return m_MPI->getTimeStamp();}
00132         inline double GetElapsedTime() const {return m_MPI->getElapsedTime();}
00133         inline void getActivation( double &activation ) { activation = m_activation; }
00134         inline int GetMissedFrames() { return static_cast<int>(m_curFrame - m_MPI->getLastFrame()); }
00135          
00136 };
00137 
00138 /* ================================================================ */
00139 
00140 #endif //__MPCOLORTRACKER_H__
00141 
00142 
00143 /*
00144  * 
00145  * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00146  * 
00147  *    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00148  *    2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
00149  *    3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
00150  * 
00151  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00152  * 
00153  */

Generated on Mon Nov 8 17:07:42 2004 for MPT by  doxygen 1.3.9.1