gaze  0.1.0
Perform gaze tracking with common webcams.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
data.cpp
1 #include "gaze/util/data.h"
2 
3 #include <utility>
4 
5 
6 namespace gaze {
7 
8 namespace util {
9 
10 Data::Data()
11  : eyes(2),
12  centers(2),
13  pupils(2),
14  gaze_points(2),
15  execution_times() {
16 }
17 
18 Data::Data(const Data& data)
19  : source_image(data.source_image),
20  landmarks(data.landmarks),
21  eyes(2),
22  centers(2),
23  head_rotation(data.head_rotation),
24  head_translation(data.head_translation),
25  pupils(2),
26  gaze_points(2),
27  estimated_gaze_point(data.estimated_gaze_point),
28  execution_times(data.execution_times) {
29  dlib::assign_image(this->image, data.image);
30 
31  for (auto i = decltype(data.eyes.size()){0};
32  i < data.eyes.size(); ++i) {
33  dlib::assign_image(this->eyes[i], data.eyes[i]);
34  }
35 
36  for (auto i = decltype(data.centers.size()){0};
37  i < data.centers.size(); ++i) {
38  this->centers[i] = data.centers[i];
39  }
40 
41  for (auto i = decltype(data.pupils.size()){0};
42  i < data.pupils.size(); ++i) {
43  this->pupils[i] = data.pupils[i];
44  }
45 
46  for (auto i = decltype(data.gaze_points.size()){0};
47  i < data.gaze_points.size(); ++i) {
48  this->gaze_points[i] = data.gaze_points[i];
49  }
50 }
51 
53  this->swap(data);
54  return *this;
55 }
56 
57 void Data::swap(Data& data) {
58  std::swap(this->source_image, data.source_image);
59  std::swap(this->image, data.image);
60  std::swap(this->landmarks, data.landmarks);
61  std::swap(this->eyes, data.eyes);
62  std::swap(this->centers, data.centers);
65  std::swap(this->pupils, data.pupils);
66  std::swap(this->gaze_points, data.gaze_points);
69 }
70 
71 } // namespace util
72 
73 } // namespace gaze
dlib::array< dlib::array2d< double > > eyes
Definition: data.h:69
dlib::array< dlib::point > centers
Definition: data.h:75
dlib::array2d< dlib::bgr_pixel > image
Definition: data.h:52
enable_if< __and_< __not_< __is_tuple_like< _Tp > >, is_move_constructible< _Tp >, is_move_assignable< _Tp > >::value >::type swap(_Tp &__a, _Tp &__b) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
std::vector< cv::Vec3d > gaze_points
Definition: data.h:100
cv::Vec2d estimated_gaze_point
Definition: data.h:105
cv::Mat head_rotation
Definition: data.h:82
dlib::full_object_detection landmarks
Definition: data.h:64
std::map< std::string, double > execution_times
Definition: data.h:111
cv::Mat head_translation
Definition: data.h:87
Data & operator=(Data data)
Definition: data.cpp:52
Wraps the data acquired per frame into a single instance.
Definition: data.h:27
std::vector< cv::Vec3d > pupils
Definition: data.h:95
cv::Mat source_image
Definition: data.h:47