12 cv::Mat Blank(
int height,
int width) {
16 cv::Mat Spiral(
int height,
int width) {
21 double theta_step = 0.05;
22 const int num_points = 500;
24 auto x = [a, b](
double theta) ->
double {
27 auto y = [a, b](
double theta) ->
double {
33 double half_width = width / 2.0;
34 double half_height = height / 2.0;
35 for (
int i = 0; i < num_points; ++i) {
36 points[i] =
cv::Point(half_width + x(theta), half_height + y(theta));
40 const int num_points_ptr[1] = {num_points};
47 int to_width,
int to_height,
48 int from_width,
int from_height) {
49 auto map = [](
int value,
int from,
int to) ->
int {
50 return value * to / from;
53 map(point.
second, from_height, to_height));
56 void main_loop(
const std::function<
cv::Mat(
int,
int)> drawing,
59 int target_width = 1920,
60 int target_height = 1080) {
66 cv::Mat image = drawing(height, width);
69 tracker->start_trial(
"simple tracker");
74 cv::Point gaze_point = map_and_convert(gaze_pair,
75 width, height, target_width, target_height);
84 tracker->stop_trial();
89 int main(
const int,
const char**
const) {
92 int target_width = 72;
93 int target_height = 45;
94 main_loop(&::Blank, width, height, target_width, target_height);
void copyTo(OutputArray m) const
void destroyWindow(const String &winname)
static MatExpr zeros(int rows, int cols, int type)
void imshow(const String &winname, InputArray mat)
complex< _Tp > sin(const complex< _Tp > &)
void polylines(Mat &img, const Point *const *pts, const int *npts, int ncontours, bool isClosed, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
void namedWindow(const String &winname, int flags=WINDOW_AUTOSIZE)
void drawMarker(Mat &img, Point position, const Scalar &color, int markerType=MARKER_CROSS, int markerSize=20, int thickness=1, int line_type=8)
This class wraps the gaze tracking process.
complex< _Tp > cos(const complex< _Tp > &)
static Scalar_< double > all(double v0)
complex< _Tp > exp(const complex< _Tp > &)