-
Notifications
You must be signed in to change notification settings - Fork 0
/
facerecognizer.h
58 lines (43 loc) · 1.26 KB
/
facerecognizer.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
/*
* File: FaceRecognizer.h
* Author: viniciusas
*
* Created on 30 de Novembro de 2016, 13:28
*/
#ifndef FACERECOGNIZER_H
#define FACERECOGNIZER_H
#include <vector>
#include <map>
using namespace std;
#include <opencv2/core.hpp>
#include <opencv2/face.hpp>
using namespace cv;
#include "queueface.h"
#include "recognizedfaceslist.h"
class FaceRecognizer {
public:
enum InitType { LOAD, TRAIN };
FaceRecognizer();
FaceRecognizer(RecognizedFacesList *recognizedList);
bool init(FaceRecognizer::InitType initType);
void recognize(QueueFace &face);
private:
const int num_components = 80;
const double threshold = DBL_MAX;
Ptr<face::FaceRecognizer> recognizer;
RecognizedFacesList *recognizedList;
int im_width = 300; //0;
int im_height = 300; //0
const std::string imagesize_train_file = "./train/imagesize-train.yml";
const std::string train_file = "./train/train.yml";
const std::string labels_file = "./labels.csv";
const std::string faces_file = "./faces.csv";
void loadNamesFile();
void loadFacesDatabaseFile();
void normalizeImages();
bool cropFace(Mat &image);
vector<cv::Mat> images;
vector<int> labels;
map<int,std::string> names;
};
#endif /* FACERECOGNIZER_H */