-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathFaceDetector.h
66 lines (61 loc) · 1.4 KB
/
FaceDetector.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
///*
// * File: EyesDetector.h
// * Author: andrey
// *
// * Created on April 17, 2015, 2:41 PM
// */
//#include "ImageSample.h"
//#include <fstream>
//#include <sstream>
//
//#ifndef EYESDETECTOR_H
//#define EYESDETECTOR_H
//
//class faceDetector
//{
//public:
// cv::CascadeClassifier cascade;
// std::vector<cv::Rect> rects;
// faceDetector();
// ~faceDetector();
// void getFace(cv::Mat& img, cv::RotatedRect& faceRect);
//private:
//};
//
//#endif /* EYESDETECTOR_H */
//
#define USE_DLIB_FD
#include "ImageSample.h"
#include <fstream>
#include <sstream>
#include <chrono>
#include <algorithm>
#include <random>
#ifdef USE_DLIB_FD
#include <dlib/opencv.h>
#include <dlib/image_processing/frontal_face_detector.h>
#include <dlib/image_processing/render_face_detections.h>
#include <dlib/image_processing.h>
#endif
#ifndef EYESDETECTOR_H
#define EYESDETECTOR_H
class faceDetector
{
public:
#ifndef USE_DLIB_FD
cv::CascadeClassifier cascade;
#else
dlib::frontal_face_detector detector;
#endif
std::vector<cv::Rect> rects;
faceDetector();
~faceDetector();
void getFace(cv::Mat& img, cv::RotatedRect& faceRect);
private:
std::default_random_engine generator;
std::uniform_int_distribution<int> distribution;
#ifdef USE_DLIB_FD
cv::Rect getRect(dlib::rectangle dlibrect);
#endif
};
#endif /* EYESDETECTOR_H */