forked from stefan-k/eyetracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheyecapture.cpp
More file actions
39 lines (30 loc) · 923 Bytes
/
eyecapture.cpp
File metadata and controls
39 lines (30 loc) · 923 Bytes
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
#include "eyecapture.h"
#include <iostream>
// opencv
#include "highgui.h"
//------------------------------------------------------------------------------
EyeCapture::EyeCapture(const unsigned cameraID, const bool convert_to_gray)
: m_convert_to_gray(convert_to_gray)
{
m_eye = new cv::VideoCapture(cameraID);
if (!(m_eye->isOpened()))
{
std::cout << "[Error] cannot open video file";
}
// Get video information
m_eye_width = (int)m_eye->get(CV_CAP_PROP_FRAME_WIDTH);
m_eye_height = (int)m_eye->get(CV_CAP_PROP_FRAME_HEIGHT);
}
//------------------------------------------------------------------------------
EyeCapture::~EyeCapture()
{
delete m_eye;
}
//------------------------------------------------------------------------------
cv::Mat EyeCapture::getFrame()
{
*(m_eye) >> m_frame;
if(m_convert_to_gray)
cv::cvtColor(m_frame.clone(), m_frame, CV_BGR2GRAY);
return m_frame;
}