-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.h
63 lines (61 loc) · 1.68 KB
/
player.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
#ifndef PLAYER_H
#define PLAYER_H
#include <QMutex>
#include <QThread>
#include <QImage>
#include <QWaitCondition>
#include <QFile>
#include <QDir>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/objdetect/objdetect.hpp>
using namespace cv;
class Player : public QThread
{ Q_OBJECT
private:
bool stoped;
QMutex mutex;
QWaitCondition condition;
Mat frame;
Mat captureFrame;
Mat detectionFrame;
int frameRate;
VideoCapture capture;
QImage captureImage;
QImage detectionImage;
CascadeClassifier faceCascade;
CascadeClassifier eyeCascade;
//las cargo como resource
char *faceCascadeXML = ":/cascades/cascades/haarcascade_frontalface_alt.xml";
char *eyeCascadeXML = ":/cascades/cascades/haarcascade_mcs_eyepair_big.xml";
signals:
//Signal to output the captured frame
void sigCaptureImage(const QImage &image);
//Signal to output the ROI
void sigDetectionImage(const QImage &image);
//Signal to output capture result
void sigDetectionResult(const char *message);
protected:
void run();
void msleep(int ms);
QImage mat2Qimage(Mat frame);
public:
//Constructor
Player(QObject *parent = 0);
//Destructor
~Player();
//Load a video from memory or open a cammera
bool loadVideo();
//Play the video
void play();
//Stop the video
void stop();
//Check if the player has been stopped
bool isStopped() const;
//Detect face in capture images
void detectFace(Mat frame);
//Detect eyes in capture images
void detectEyes(Mat frame);
};
#endif // VIDEOPLAYER_H