1 /*M///////////////////////////////////////////////////////////////////////////////////////
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
10 // Intel License Agreement
11 // For Open Source Computer Vision Library
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
14 // Third party copyrights are property of their respective owners.
16 // Redistribution and use in source and binary forms, with or without modification,
17 // are permitted provided that the following conditions are met:
19 // * Redistribution's of source code must retain the above copyright notice,
20 // this list of conditions and the following disclaimer.
22 // * Redistribution's in binary form must reproduce the above copyright notice,
23 // this list of conditions and the following disclaimer in the documentation
24 // and/or other materials provided with the distribution.
26 // * The name of Intel Corporation may not be used to endorse or promote products
27 // derived from this software without specific prior written permission.
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the Intel Corporation or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
41 ///////////////////////////////////////////////
42 //// Created by Khudyakov V.A. bober@gorodok.net
43 //////////////////////////////////////////////
45 #ifndef __CVFACETEMPLATE_H__
46 #define __CVFACETEMPLATE_H__
51 FaceFeature(double dWeight,void * lpContour,bool bIsFeature);
53 virtual ~FaceFeature();
54 inline bool isFaceFeature();
55 inline void * GetContour();
56 inline double GetWeight();
57 inline void SetContour(void * lpContour);
58 inline void SetWeight(double dWeight);
59 inline void SetFeature(bool bIsFeature);
63 bool m_bIsFaceFeature;
66 inline void FaceFeature::SetFeature(bool bIsFeature)
68 m_bIsFaceFeature = bIsFeature;
71 inline bool FaceFeature::isFaceFeature()
73 return m_bIsFaceFeature;
74 }//inline bool FaceFeature::isFaceFeature()
76 inline void * FaceFeature::GetContour()
79 }//inline void * FaceFeature::GetContour()
81 inline double FaceFeature::GetWeight()
84 }//inline long FaceFeature::GetWeight()
86 inline void FaceFeature::SetContour(void * lpContour)
88 m_lpContour = lpContour;
89 }//inline void FaceFeature::SetContour(void * lpContour)
91 inline void FaceFeature::SetWeight(double dWeight)
94 }//inline void FaceFeature::SetWeight(double * dWeight)
101 FaceTemplate(long lFeatureCount) {m_lFeturesCount = lFeatureCount; m_lpFeaturesList = new FaceFeature[lFeatureCount];};
102 virtual ~FaceTemplate();
104 inline long GetCount();
105 inline FaceFeature * GetFeatures();
108 FaceFeature * m_lpFeaturesList;
110 long m_lFeturesCount;
111 };//class FaceTemplate
114 inline long FaceTemplate::GetCount()
116 return m_lFeturesCount;
117 }//inline long FaceTemplate::GetCount()
120 inline FaceFeature * FaceTemplate::GetFeatures()
122 return m_lpFeaturesList;
123 }//inline FaceFeature * FaceTemplate::GetFeatures()
126 //class RFaceTemplate
129 class MouthFaceTemplate:public FaceTemplate
132 inline MouthFaceTemplate(long lNumber,CvRect rect,double dEyeWidth,double dEyeHeight,double dDistanceBetweenEye,double dDistanceEyeAboveMouth);
133 ~MouthFaceTemplate();
134 };//class MouthFaceTemplate:public FaceTemplate
137 inline MouthFaceTemplate::MouthFaceTemplate(long lNumber,CvRect rect,double dEyeWidth,double dEyeHeight,
138 double dDistanceBetweenEye,double dDistanceEyeAboveMouth):FaceTemplate(lNumber)
141 CvRect MouthRect = rect;
144 CvRect LeftEyeRect = cvRect(cvRound(rect.x - (dEyeWidth + dDistanceBetweenEye/(double)2 - (double)rect.width/(double)2)),
145 cvRound(rect.y - dDistanceEyeAboveMouth - dEyeHeight),
147 cvRound(dEyeHeight) );
149 CvRect RightEyeRect = cvRect(cvRound(rect.x + (double)rect.width/(double)2 + dDistanceBetweenEye/(double)2),
150 cvRound(rect.y - dDistanceEyeAboveMouth - dEyeHeight),
152 cvRound(dEyeHeight) );
154 // CvRect NoseRect = cvRect(cvRound(rect.x + (double)rect.width/(double)4),
155 // cvRound(rect.y - (double)rect.width/(double)2 - (double)rect.height/(double)4),
156 // cvRound((double)rect.width/(double)2),
157 // cvRound((double)rect.width/(double)2) );
159 CvRect CheenRect = cvRect(rect.x,rect.y + 3*rect.height/2,rect.width,rect.height);
163 CvRect * lpMouthRect = new CvRect();
164 *lpMouthRect = MouthRect;
165 m_lpFeaturesList[0].SetContour(lpMouthRect);
166 m_lpFeaturesList[0].SetWeight(1);
167 m_lpFeaturesList[0].SetFeature(false);
170 CvRect * lpLeftEyeRect = new CvRect();
171 *lpLeftEyeRect = LeftEyeRect;
172 m_lpFeaturesList[1].SetContour(lpLeftEyeRect);
173 m_lpFeaturesList[1].SetWeight(1);
174 m_lpFeaturesList[1].SetFeature(true);
176 CvRect * lpRightEyeRect = new CvRect();
177 *lpRightEyeRect = RightEyeRect;
178 m_lpFeaturesList[2].SetContour(lpRightEyeRect);
179 m_lpFeaturesList[2].SetWeight(1);
180 m_lpFeaturesList[2].SetFeature(true);
183 // CvRect * lpNoseRect = new CvRect();
184 // *lpNoseRect = NoseRect;
185 // m_lpFeaturesList[3].SetContour(lpNoseRect);
186 // m_lpFeaturesList[3].SetWeight(0);
187 // m_lpFeaturesList[3].SetFeature(true);
189 /* CvRect * lpCheenRect = new CvRect();
190 *lpCheenRect = CheenRect;
191 m_lpFeaturesList[4].SetContour(lpCheenRect);
192 m_lpFeaturesList[4].SetWeight(1);
193 m_lpFeaturesList[4].SetFeature(false);
197 };//constructor MouthFaceTemplate(long lNumFeatures,CvRect rect,double dEyeWidth,double dEyeHeight,double dDistanceBetweenEye,double dDistanceEyeAboveMouth);
201 #endif//__FACETEMPLATE_H__