1 #ifndef INCLUDE_GAZE_PIPELINE_STEPS_PUPIL_LOCALIZATION_H_
2 #define INCLUDE_GAZE_PIPELINE_STEPS_PUPIL_LOCALIZATION_H_
6 #include "dlib/matrix.h"
8 #include "gaze/gui/visualizeable.h"
9 #include "gaze/pipeline_step.h"
10 #include "gaze/util/data.h"
65 dlib::matrix<double>& table_y,
80 dlib::matrix<T>& horizontal,
81 dlib::matrix<T>& vertical,
82 double relative_threshold = -1) {
84 magnitude =
dlib::sqrt(dlib::squared(horizontal) +
85 dlib::squared(vertical));
88 if (relative_threshold >= 0) {
90 + dlib::stddev(magnitude) * relative_threshold;
91 for (
int row = 0; row < horizontal.nr(); ++row) {
92 for (
int col = 0; col < horizontal.nc(); ++col) {
94 horizontal(row, col) = 0;
95 vertical(row, col) = 0;
102 horizontal = dlib::pointwise_multiply(
103 horizontal, dlib::reciprocal(magnitude));
104 vertical = dlib::pointwise_multiply(
105 vertical, dlib::reciprocal(magnitude));
128 dlib::matrix<double> displacement_table_x;
129 dlib::matrix<double> displacement_table_y;
130 double relative_threshold_factor;
154 #endif // INCLUDE_GAZE_PIPELINE_STEPS_PUPIL_LOCALIZATION_H_
Scalar mean(InputArray src, InputArray mask=noArray())
Abstract base class for PipelineSteps. Must be inherited from.
Implements Timm and Barth (2011) to detect eye centers.
void magnitude(InputArray x, InputArray y, OutputArray magnitude)
void visualize(util::Data &data) override
void fill_displacement_tables(dlib::matrix< double > &table_x, dlib::matrix< double > &table_y, int size)
Implements VisualizeableBase for several widget types.
void process(util::Data &data) override
double threshold(InputArray src, OutputArray dst, double thresh, double maxval, int type)
Wraps the data acquired per frame into a single instance.
complex< _Tp > sqrt(const complex< _Tp > &)
void normalize_and_threshold_gradients(dlib::matrix< T > &horizontal, dlib::matrix< T > &vertical, double relative_threshold=-1)