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

eyefinder.h

Go to the documentation of this file.
00001 /*
00002  *  eyefinder.h
00003  *
00004  *  Author:Ian Fasel
00005  *  Fixes:
00006  *
00007  *  Copyright (c) 2003 Machine Perception Laboratory
00008  *  University of California San Diego.
00009  *
00010  * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00011  *
00012  *    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00013  *    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.
00014  *    3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
00015  *
00016  * 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.
00017  *
00018  */
00019 
00020 #ifndef __EYEFINDER_H__
00021 #define __EYEFINDER_H__
00022 
00023 #include "mpisearchFaceDetector.h"
00024 //#include "mpisearchBinary.h"
00025 #include "faceobject.h"
00026 #include <vector>
00027 
00028 #define checkAll 1
00029 #define MPISEARCH_OBJECT_TYPE float
00030 
00031 enum patch_rez{eye_dist=0, eye_only=1, half_dist, smallest, largest, largest_2}; // resolution of patch
00032 #define DEFAULT_PATCH_REZ eye_dist
00033 
00034 enum centering_condition{eye_centered=0,face_centered};
00035 #define DEFAULT_CENTERING eye_centered
00036 
00037 struct EYESHIFTARRAY{
00038         int x;
00039         int y;
00040 };
00041 
00042 // sufficient statistics for Gaussian prior
00043 // note: 
00044 struct GPrior{
00045   vector< float > mean;
00046   vector< vector< float > > cov;
00047   vector< vector< float > > invCov;
00048   GPrior();
00049   void Release();
00050   GPrior(const vector< float > &mean_, const vector< vector< float > > &cov_, const vector< vector< float > > &invCov_);
00051   void SetPrior(const vector< float > &mean_, const vector< vector< float > > &cov_, const vector< vector< float > > &invCov_);
00052 }; 
00053 
00054 struct ROIdata{
00055   int numscales;
00056   vector< float > mean;
00057   vector< vector< float > > cov;
00058   vector< vector< float > > invCov;
00059   vector< float > scales;
00060   vector< vector< float > > bounds;
00061   void Release();
00062 
00063 };
00064 
00065 //class MPEyeFinder : public MPISearchBinary {
00066 class MPEyeFinder : public MPISearchFaceDetector {
00067  public:
00068 
00069   MPEyeFinder ( );
00070   ~MPEyeFinder( );
00071 
00072   int findEyes(const RImage<MPISEARCH_OBJECT_TYPE> &pixels, VisualObject &faces,
00073                float WINSHIFT=1.25, combine_mode mode=none);
00074   void initStream(const int width, const int height, double WINSHIFT=1.25);
00075   void resetStream(const int width, const int height, double WINSHIFT=1.25);
00076   void releaseStream();
00077   void SetCentering(const centering_condition &c);
00078   void SetRez(const patch_rez &r);
00079  protected:
00080   void getPatchWidth(patch_rez p, float &patchWidthPct);
00081   GPrior MPEyeFinder::setROI(FaceObject* &face, feature_type eye_type);
00082   int eyeSearch(MPISearchStream<MPISEARCH_OBJECT_TYPE> &thestream, FeatureData &thedata, vector< EyeObject > &eyelist, 
00083                 FaceObject *current_face, GPrior &gp, feature_type eyetype, combine_mode mode=DEFAULT_COMBINE_MODE);
00084   void getEyeOffsets(patch_rez p, centering_condition centering, float &xoff, float &yoff);
00085   void initROIdata();
00086   int matrixMult(int row1,int col1, float *matrix1, int row2, int col2, float *matrix2, float *rtn_matrix);
00087   int matrixMult(int row1,int col1, float *matrix1, int row2, int col2, vector< vector< float > > matrix2, float *rtn_matrix);
00088   // patch specific things
00089   patch_rez m_rez;
00090   centering_condition m_centering;
00091   float mean_dist;
00092 
00093   FeatureData left_eye_data;
00094   MPISearchStream<MPISEARCH_OBJECT_TYPE> left_eye_stream;
00095   ROIdata leftROIdata;
00096 
00097   FeatureData right_eye_data;
00098   MPISearchStream<MPISEARCH_OBJECT_TYPE> right_eye_stream;
00099   ROIdata rightROIdata;
00100 };
00101 
00102 #endif
00103 
00104 /*
00105  * 
00106  * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00107  * 
00108  *    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00109  *    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.
00110  *    3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
00111  * 
00112  * 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.
00113  * 
00114  */
00115 

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