-
Notifications
You must be signed in to change notification settings - Fork 0
/
iEyePosMonitor.h
108 lines (86 loc) · 2.29 KB
/
iEyePosMonitor.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
#ifndef IEYEPOSMONITOR_H_
#define IEYEPOSMONITOR_H_
#include <QObject>
#include <QScopedPointer>
#include <QTimer>
#include <QRect>
#include <QVector>
#include <QPoint>
#include "iEyeTypes.h"
namespace iEye
{
class iEyeProcessor;
/*!
* Class designed to monitor the position of eye.
*/
class iEyePosMonitor : public QObject
{
Q_OBJECT
public:
/*!
* \brief Constructor for the iEyePosMonitor
* \param hQL horizontal quantization levels.
* \param vQL vertical quantization levels.
*/
iEyePosMonitor(iEyeProcessor* p, QObject* parent = 0);
virtual ~iEyePosMonitor();
public :
//! Keyboard event enable flag
static bool kb_en;
static void ieye_keybd_event(Qt::Key k);
void setOnDuty(bool onDuty)
{
m_onDuty = onDuty;
}
bool isOnDuty()
{
return m_onDuty;
}
/*!
* \brief posSampler return the QScopedpointer reference to the timer used to sample the position of the eye
*/
QScopedPointer<QTimer>& posSampler()
{
return m_timer;
}
//! Starts sampling the position of the eye every at frequency of 1/mseconds
void startSampling();
void stopSampling();
/*!
* \return the center of the eye given by calibration result.
*/
const QPoint& center() const
{
return m_eyeCenter;
}
/*!
* \brief region obtained after calibration in the 160x120 domain
* \return const reference to the rectangular area
*/
const QRect& region()
{
return m_eyeRegion;
}
public slots:
/*!
* \brief function that sets the new region for eye's movement.
* \param newRegion the new rectangle specifying the eye region of movement
*/
void setNewRegion(const QRect& newRegion);
void setNewRegion(const QRect& newRegion, const QPoint &newCenter);
protected:
iEyeProcessor* proc() const
{
return m_proc;
}
private:
virtual void onNewRegionAvailable() = 0;
private:
iEyeProcessor* m_proc;
bool m_onDuty; // The duty flag.
QPoint m_eyeCenter; // Center of the eye
QRect m_eyeRegion; // The eye's region of movement.
QScopedPointer<QTimer> m_timer;
};
}
#endif