forked from tiendan/OpenGazer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calibrator.h
executable file
·83 lines (65 loc) · 2.34 KB
/
Calibrator.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
#pragma once
#include <glibmm.h>
#include <gdkmm.h>
#include "utils.h"
#include "TrackingSystem.h"
#include "Containers.h"
#include "GraphicalPointer.h"
#include "FeatureDetector.h"
#include "mir.h"
class FrameProcessing;
class FrameFunction:
public Containee<FrameProcessing, FrameFunction>
{
const int &frameno;
int startframe;
protected:
int getFrame() { return frameno - startframe; }
public:
FrameFunction(const int &frameno): frameno(frameno), startframe(frameno) {}
virtual void process()=0;
virtual ~FrameFunction();
};
class FrameProcessing:
public ProcessContainer<FrameProcessing,FrameFunction> {};
class MovingTarget: public FrameFunction {
boost::shared_ptr<WindowPointer> pointer;
public:
MovingTarget(const int &frameno,
const vector<Point>& points,
const boost::shared_ptr<WindowPointer> &pointer,
int dwelltime=20);
virtual ~MovingTarget();
virtual void process();
Point getActivePoint();
int getDwellTime();
int getPointFrame();
bool active();
bool isLast();
protected:
vector<Point> points;
const int dwelltime;
int getPointNo();
};
class Calibrator: public MovingTarget {
static const Point defaultpointarr[];
boost::shared_ptr<TrackingSystem> trackingsystem;
scoped_ptr<FeatureDetector> averageeye;
scoped_ptr<FeatureDetector> averageeye_left;
scoped_ptr<std::vector<std::vector<int> > > vectorOfVectors_horizontal, vectorOfVectors_vertical,
vectorOfVectors_horizontal_left, vectorOfVectors_vertical_left;
scoped_ptr<std::vector<std::vector<std::vector<int> > > > histPositionSegmentedPixels, histPositionSegmentedPixels_left;
public:
static vector<Point> defaultpoints;
static vector<Point> loadpoints(istream& in);
Calibrator(const int &frameno,
const boost::shared_ptr<TrackingSystem> &trackingsystem,
const vector<Point>& points,
const boost::shared_ptr<WindowPointer> &pointer,
int dwelltime=20);
virtual ~Calibrator();
virtual void process();
static vector<Point> scaled(const vector<Point>& points, double x, double y);
static vector<Point> scaled(const vector<Point>& points, int x, int y, double width, double height);
//virtual std::vector<int> magic_function(std::vector<int> res, std::vector<int> vectorX);
};