forked from stefan-k/eyetracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheyetracker.cpp
More file actions
63 lines (56 loc) · 1.37 KB
/
eyetracker.cpp
File metadata and controls
63 lines (56 loc) · 1.37 KB
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
/**
* @file eyetracker.cpp
* @brief EyeTracker
*
* Image Processing and Pattern Recognition
* (Bildverarbeitung und Mustererkennung)
* Project
*/
#include "eyetracker.h"
#include "eyecapture.cpp"
#include "tracking/trackingEyeHough.cpp"
/**
* @brief The main entry point
*/
int main(int /*argc*/, char ** /*argv*/)
{
TrackingEyeHough eye;
TrackedPupil pupil;
cv::Mat frame;
cv::VideoWriter writer;
int video_output = 0;
if(video_output)
{
writer.open("output.avi", CV_FOURCC('X','V','I','D'), 10, cv::Size(640, 480));
if (!writer.isOpened())
{
std::cout << "[Error] Cannot encode video with fallback codec!" << std::endl;
return -1;
}
}
for(;;)
{
pupil = eye.getPupil();
frame = pupil.frame.clone();
if (frame.empty())
{
std::cout << "[Warning] Skipping empty frame." << std::endl;
continue;
}
//for(int i = 0; i < pupil.position.size(); i++)
for(int i = 0; i < 1; i++)
{
cv::circle(frame, cv::Point(pupil.position[i].x, pupil.position[i].y), pupil.radius[i], cv::Scalar(255), 2);
}
cv::imshow("edges", frame);
if(cv::waitKey(10) >= 0) break;
if(video_output)
{
cv::Mat color;
cv::cvtColor(frame.clone(), color, CV_GRAY2BGR);
writer << color;
}
}
// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
}