-
Notifications
You must be signed in to change notification settings - Fork 71
/
GazeTracker.h
64 lines (49 loc) · 1.61 KB
/
GazeTracker.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
#pragma once
#include "utils.h"
#include "GaussianProcess.cpp"
typedef MeanAdjustedGaussianProcess<SharedImage> ImProcess;
struct Targets {
vector<Point> targets;
Targets(void) {};
Targets(vector<Point> const& targets): targets(targets) {}
int getCurrentTarget(Point point);
};
struct CalTarget {
Point point;
SharedImage image, origimage;
CalTarget();
CalTarget(Point point, const IplImage* image, const IplImage* origimage);
void save(CvFileStorage* out, const char* name=NULL);
void load(CvFileStorage* in, CvFileNode *node);
};
struct TrackerOutput {
Point gazepoint;
Point target;
int targetid;
TrackerOutput(Point gazepoint, Point target, int targetid);
};
class GazeTracker {
scoped_ptr<ImProcess> gpx, gpy;
vector<CalTarget> caltargets;
scoped_ptr<Targets> targets;
static double imagedistance(const IplImage *im1, const IplImage *im2);
static double covariancefunction(const SharedImage& im1,
const SharedImage& im2);
void updateGPs(void);
public:
TrackerOutput output;
GazeTracker(): targets(new Targets),
output(Point(0,0), Point(0,0), -1) {}
bool isActive() { return gpx.get() && gpy.get(); }
void clear();
void addExemplar(Point point,
const IplImage *eyefloat, const IplImage *eyegrey);
void draw(IplImage *canvas, int eyedx, int eyedy);
void save(void);
void save(CvFileStorage *out, const char *name);
void load(void);
void load(CvFileStorage *in, CvFileNode *node);
void update(const IplImage *image);
int getTargetId(Point point);
Point getTarget(int id);
};