forked from tiendan/OpenGazer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PointTracker.h
executable file
·42 lines (33 loc) · 1.15 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
#pragma once
#include <boost/scoped_ptr.hpp>
#include "Point.h"
class TrackingException: public std::exception {};
class PointTracker {
public:
static const int eyePoint1 = 0;
static const int eyePoint2 = 1;
std::vector<uchar> status;
std::vector<cv::Point2f> origPoints, currentPoints, lastPoints;
PointTracker(const cv::Size &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 cv::Mat &frame, int pyramidDepth=1);
void retrack(const cv::Mat &frame, int pyramidDepth=1);
int countActivePoints();
bool areAllPointsActive();
int pointCount();
std::vector<Point> getPoints(const std::vector<cv::Point2f> PointTracker::*points, bool allPoints=true);
void draw(cv::Mat &canvas);
void normalizeOriginalGrey();
void save(std::string filename, std::string newname, const cv::Mat frame);
void load(std::string filename, std::string newname, const cv::Mat frame);
void saveImage();
private:
static const int _winSize = 11;
int _flags;
cv::Mat _grey, _origGrey, _lastGrey;
void synchronizePoints();
};