forked from opengazer/OpenGazer
-
Notifications
You must be signed in to change notification settings - Fork 3
/
PointTracker.h
48 lines (38 loc) · 1.25 KB
/
PointTracker.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
#pragma once
#include <opencv/cv.h>
#include <vector>
#include <vgl/vgl_homg_point_2d.h>
#include "utils.h"
using namespace std;
typedef vgl_vector_2d<double> HomPoint;
class TrackingException: public std::exception {};
class PointTracker {
public:
static const int eyepoint1 = 0;
static const int eyepoint2 = 1;
vector<char> status;
vector<CvPoint2D32f> origpoints, currentpoints, lastpoints;
private:
static const int win_size = 11;
int flags;
scoped_ptr<IplImage> grey, orig_grey, pyramid, orig_pyramid,
last_grey, last_pyramid;
void synchronizepoints();
public:
PointTracker(const CvSize &size);
void cleartrackers();
void addtracker(const Point &point);
void updatetracker(int id, const Point &point);
void removetracker(int id);
int getClosestTracker(const Point &point);
void track(const IplImage *frame, int pyramiddepth=1);
int countactivepoints(void);
bool areallpointsactive(void);
int pointcount();
void draw(IplImage *canvas);
vector<HomPoint>
getpoints(const vector<CvPoint2D32f> PointTracker::*points,
bool allpoints=true);
void save(string filename, string newname, const IplImage *frame);
void load(string filename, string newname, const IplImage *frame);
};