-
Notifications
You must be signed in to change notification settings - Fork 24
/
FaceDetectionShield.h
120 lines (93 loc) · 1.86 KB
/
FaceDetectionShield.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
Project: 1Sheeld Library
File: FaceDetectionShield.h
Version: 1.11.0
Compiler: Arduino avr-gcc 4.3.2
Author: Integreight
Date: 2016.11
*/
#ifndef FaceDetectionShield_h
#define FaceDetectionShield_h
#include "ShieldParent.h"
//Output Function ID
//Input Function ID
#define FACE_GET 0x01
#define FACE_OUT_OF_BOUNDS 0x02
//Literals
#define MAX_FACES 20
struct Face{
int leftEyeOpened;
int rightEyeOpened;
int smiling;
int xCoordinate;
int yCoordinate;
int faceID;
unsigned int faceWidth;
unsigned int faceHeight;
Face()
{
faceID = -1;
leftEyeOpened = -1;
rightEyeOpened = -1;
smiling = -1;
xCoordinate = 0;
yCoordinate = 0;
faceWidth = 0;
faceHeight = 0;
}
int getSmileProbability()
{
return smiling;
}
int getLeftEyeOpenProbability()
{
return leftEyeOpened;
}
int getRightEyeOpenProbability()
{
return rightEyeOpened;
}
int getXCoordinates()
{
return xCoordinate;
}
int getYCoordinates()
{
return yCoordinate;
}
int getID()
{
return faceID;
}
unsigned int getWidth()
{
return faceWidth;
}
unsigned int getHeight()
{
return faceHeight;
}
};
class FaceDetectionShield : public ShieldParent
{
public:
FaceDetectionShield();
Face getVisibleFace(byte);
Face getFace(int);
byte getVisibleFacesCount();
bool isFaceVisible(int);
void setOnNewFace(void (*)(Face));
void setOnNotVisible(void (*)(int ));
private:
bool isCallBackAssigned;
bool isdeletedAssigned;
byte counter;
void eraseFaceData(byte);
void processData();
Face facesArray[MAX_FACES];
void (*onNewFaceCallback)(Face);
void (*onDeletedFaceCallback)(int);
void rearrangeFaces();
};
extern FaceDetectionShield FaceDetector;
#endif