www.pudn.com > colortracker.rar > MPColorTracker.h
/*
* MPColorTracker.h
*
*
* Created by Josh Susskind 2003.
* Copyright (c) 2003 Machine Perception Laboratory
* University of California San Diego.
* Please read the disclaimer and notes about redistribution
* at the end of this file.
*
* Authors: Josh Susskind, Bret Fortenberry
*/
#ifdef WIN32
#pragma warning(disable:4786)
#endif
#ifndef __MPCOLORTRACKER_H__
#define __MPCOLORTRACKER_H__
/* ================================================================ */
#include "preprocessor.h"
#ifdef WIN32
#include "Images/imageio.h"
#endif
#include "Images/color.h"
#include "mpisearchthread.h"
//#include "commthread.h"
//#include "MPImageWrapper.h"
#include "MPColorResults.h"
#include "MPKeyFrame.h"
#include "MPHistogramHue.h"
#include "MPHistogram.h"
#include "colorsearchparams.h"
#ifdef PREDICTIVE
#include "colorfeatsearch.h"
#else
#include "probColorSearch.h"
#endif
/* ================================================================ */
class MPColorTracker
{
public:
MPColorTracker();
~MPColorTracker(); /* Destructor */
private:
RImage m_colorImage;
#ifdef PREDICTIVE
MPColorFeatSearch m_colorFeatSearch;
#else
ProbColorSearch m_colorSearch; /* for exhaustive color search */
#endif
int m_searchHeight;
int m_searchWidth;
////#ifdef PREDICTIVE
////TIntegral m_likRatImageInt;
// double m_hr, m_scaledev;
////#else
RImage m_likRatImage;
// TSquare m_vBox;
////#endif
TSquare m_mBox;
double m_llikeMPI;
double m_activation;
LONGLONG m_NumFrames;
MPISearchThread *m_MPI;
//CommThread *m_CommThread;
MPColorTools m_ColorTools;
MPColorResults m_results;
ColorSearchParams m_csearchparams;
//int m_DownSample;
int m_resetTracker;
/* for prior */
// MPISearchProbSearch::PriorType m_prior_type;
// double m_size_scale, m_x_scale, m_y_scale;
/* for exponential smoothing of face box */
// double m_smooth_param;
/* for searching hypotheses */
// int m_minScaleUp;
// int m_minStride;
// double m_minSizePct;
// double m_stridePct;
// double m_scaleUpPct;
int (*m_samples)[2];
int m_successTrackerSize;
int m_successTrackerIndex;
double (*m_successTracker);
double m_successMeasure;
int m_successCount;
int m_success;
long m_curFrame;
#ifdef USEHUE
MPHistogramHue m_LogProbColorGivenFace;
MPHistogramHue m_LogProbColorGivenBack;
#else
MPHistogram m_LogProbColorGivenFace;
MPHistogram m_LogProbColorGivenBack;
#endif
MPKeyFrameCollection *m_Collection;
public:
int DoSearch();
int InitStreaming();
int EndStreaming();
void ShowProbs();
void ShowProbs(const bool &type);
void WriteBitmap(char *directory);
void MPIUpdate();
void PutImage(void *img, int &w, int &h, long & frameCount);
void SetKeyFrameCollection(MPKeyFrameCollection *collection);
inline int GetLastFaces( FaceBoxList &faces) { return m_MPI->GetMPIFaceBoxes(faces); }
inline void GetColorBox( TSquare &box ) { box.x = m_results.x1; box.y = m_results.y1; box.size = m_results.getWidth(); }
inline int GetLastNumFrontalFaces() const {return m_MPI->GetNumFaces(); };
inline TIMETYPE GetTimeStamp() const {return m_MPI->getTimeStamp();}
inline double GetElapsedTime() const {return m_MPI->getElapsedTime();}
inline void getActivation( double &activation ) { activation = m_activation; }
inline int GetMissedFrames() { return static_cast(m_curFrame - m_MPI->getLastFrame()); }
};
/* ================================================================ */
#endif //__MPCOLORTRACKER_H__
/*
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* 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.
* 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
*
* 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.
*
*/