1 | //----------------------------------------------
|
---|
2 | // Heriot-Watt University |
---|
3 | // MACS
|
---|
4 | // www.lirec.eu
|
---|
5 | // author: Amol Deshmukh |
---|
6 | // Date: 17/03/2009
|
---|
7 | //----------------------------------------------- |
---|
8 | |
---|
9 | #ifndef FACEDETECT_INCLUDEDEF_H
|
---|
10 | #define FACEDETECT_INCLUDEDEF_H |
---|
11 | |
---|
12 | |
---|
13 | #include <cv.h> |
---|
14 | #include <cvaux.h> |
---|
15 | #include <highgui.h> |
---|
16 | |
---|
17 | #include <stdlib.h> |
---|
18 | #include <string.h> |
---|
19 | #include <assert.h> |
---|
20 | #include <math.h> |
---|
21 | #include <float.h> |
---|
22 | #include <limits.h> |
---|
23 | #include <time.h> |
---|
24 | #include <ctype.h> |
---|
25 | #include <iostream> |
---|
26 | //-----------------------------------------------
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * This class provides face detection capabilties
|
---|
30 | */
|
---|
31 | class FaceDetect
|
---|
32 | {
|
---|
33 | public:
|
---|
34 |
|
---|
35 | FaceDetect();
|
---|
36 |
|
---|
37 | ~FaceDetect();
|
---|
38 | |
---|
39 | //Set scale for the image
|
---|
40 | void SetScale( double dScale){m_dScale = dScale; };
|
---|
41 |
|
---|
42 | double GetScale(){ return m_dScale ;};
|
---|
43 | |
---|
44 | // show output on screen
|
---|
45 | void ShowResult( bool bflag){m_bflagShowResult = bflag; };
|
---|
46 | |
---|
47 | // output screen flag
|
---|
48 | bool GetShowResultFlag(){return m_bflagShowResult;}; |
---|
49 | |
---|
50 | void StartFaceDetection(void);
|
---|
51 |
|
---|
52 | double GetFaceMidPointX(){ return m_dMidX;};
|
---|
53 |
|
---|
54 | double GetFaceMidPointY(){ return m_dMidY;};
|
---|
55 |
|
---|
56 | double GetFaceAngleX(){ return m_dAngleX;}; |
---|
57 | |
---|
58 | double GetFaceAngleY(){ return m_dAngleY;}; |
---|
59 |
|
---|
60 | // number of faces detected
|
---|
61 | int m_iNumFaces;
|
---|
62 | |
---|
63 | // boolean value if face is detected
|
---|
64 | bool m_bFaceDetected; |
---|
65 | |
---|
66 | // flag to detect face at threshold distance (camera and resolution dependent) |
---|
67 | // resolution required 640 * 480 (can be modified acc to requirement) |
---|
68 | bool m_bUserProximicFlag; |
---|
69 | |
---|
70 |
|
---|
71 |
|
---|
72 | private:
|
---|
73 | // scale factor for image
|
---|
74 | double m_dScale;
|
---|
75 |
|
---|
76 |
|
---|
77 | //face midpoint(+ve:Face is left side, -ve:right side of camera)
|
---|
78 | double m_dMidX;
|
---|
79 | double m_dMidY;
|
---|
80 |
|
---|
81 | //angle from face midpoint
|
---|
82 | //(if value is +ve:Face is at left side, -ve:right side of camera)
|
---|
83 | double m_dAngleX; |
---|
84 | double m_dAngleY;
|
---|
85 | |
---|
86 | //show result in a window
|
---|
87 | bool m_bflagShowResult;
|
---|
88 |
|
---|
89 | //detects a face and draws rectangle around the face
|
---|
90 | void DetectAndDraw( IplImage* cvImg, double dScale );
|
---|
91 |
|
---|
92 | //detect face in a region of an image
|
---|
93 | int DetectSubFace(IplImage* cvTempimage);
|
---|
94 |
|
---|
95 |
|
---|
96 | };
|
---|
97 | #endif |
---|