gaze
0.1.0
Perform gaze tracking with common webcams.
|
Helper classes within the gaze library. More...
Classes | |
struct | Data |
Wraps the data acquired per frame into a single instance. More... | |
Functions | |
dlib::rectangle | get_eye_region (int eye, dlib::full_object_detection object_detection) |
double | parse_aspect_ratio (std::string aspect_ratio_string) |
double | clamp (double value, double min, double max) |
void | fill_displacement_tables (dlib::matrix< double > &table_x, dlib::matrix< double > &table_y, int size) |
YAML::Node | get_config () |
YAML::Node | get_config (int pipeline_step_number) |
dlib::point | cv_to_dlib (const cv::Point &to_convert) |
dlib::rectangle | cv_to_dlib (const cv::Rect &to_convert) |
cv::Rect | dlib_to_cv (const dlib::rectangle &to_convert) |
std::vector< dlib::chip_details > | get_eyes_chip_details (const dlib::full_object_detection object_detection) |
template<typename T > | |
void | normalize_and_threshold_gradients (dlib::matrix< T > &horizontal, dlib::matrix< T > &vertical, double relative_threshold=-1) |
std::ostream & | operator<< (std::ostream &ostr, const Data &data) |
dlib::point | cv_to_dlib (const cv::Vec3d &to_convert) |
template<typename T , int N> | |
dlib::vector< T, N > | cv_to_dlib (const cv::Vec< T, N > &to_convert) |
template<typename T , int N> | |
cv::Vec< T, N > | dlib_to_cv (const dlib::vector< T, N > &to_convert) |
Helper classes within the gaze library.
This namespace contains a data access class (util::Data).
double gaze::util::clamp | ( | double | value, |
double | min, | ||
double | max | ||
) |
If value is smaller than min, min is returned. If value is bigger than max, max is returned. Else, the value is returned.
value | The value to clamp. |
min | The minimum allowed value. |
max | The maximum allowed value. |
Definition at line 36 of file gaze_point_calculation.cpp.
Referenced by gaze::pipeline::GazePointCalculation::process().
dlib::point gaze::util::cv_to_dlib | ( | const cv::Point & | to_convert | ) |
Converts a cv::Point to a dlib::point.
to_convert | The point to convert. |
Definition at line 8 of file dlibcv.cpp.
References Point_< int >::x, and Point_< int >::y.
dlib::rectangle gaze::util::cv_to_dlib | ( | const cv::Rect & | to_convert | ) |
Converts a cv::Rect to a dlib::rectangle.
to_convert | The rectangle to convert. |
Definition at line 12 of file dlibcv.cpp.
References cv::Rect_< _Tp >::height, cv::Rect_< _Tp >::width, cv::Rect_< _Tp >::x, and cv::Rect_< _Tp >::y.
dlib::point gaze::util::cv_to_dlib | ( | const cv::Vec3d & | to_convert | ) |
Converts a cv::Point to a dlib::point.
to_convert | The point to convert. |
cv::Rect gaze::util::dlib_to_cv | ( | const dlib::rectangle & | to_convert | ) |
Converts a dlib::rectangle to a cv::Rect.
to_convert | The rectangle to convert. |
Definition at line 17 of file dlibcv.cpp.
void gaze::util::fill_displacement_tables | ( | dlib::matrix< double > & | table_x, |
dlib::matrix< double > & | table_y, | ||
int | size | ||
) |
Filles the displacement table to precalculate values for vector Timm2011.
The function returns without modifying table_x or table_y if size is smaller than the current table size.
The size will always be set to size or size + 1, whichever is odd. This ensures that the center value is 0 as a reference point.
After a call to this function with a sufficiently big size argument, table_x and table_y contain values such that reading from both tables at the same indices yields the respective components for a unit vector geometrically pointing from the center of the matrix to the read position.
A table_x would thus look like this:
And the corresponding table_y would be table_x's transposed version:
Accessing table_x and table_y at (0, 0) yields which is a unit length vector pointing from the center (1, 1) to (0, 0).
table_x | The x components of . |
table_y | The y components of . |
size | The size to grow this table to. |
Definition at line 23 of file pupil_localization.cpp.
References std::numeric_limits< class >::min(), and std::sqrt().
Referenced by gaze::pipeline::PupilLocalization::process().
YAML::Node gaze::util::get_config | ( | ) |
Tries to read "gaze_pipeline.yaml" or on failure "gaze_pipeline.default.yaml" and returns the resulting YAML::Node.
Definition at line 12 of file config.in.cpp.
Referenced by gaze::pipeline::FallbackStep::FallbackStep(), gaze::pipeline::HeadPoseEstimation::get_and_maybe_read_distortions(), get_config(), gaze::pipeline::HeadPoseEstimation::read_or_set_camera_matrix(), and gaze::pipeline::SourceCapture::SourceCapture().
YAML::Node gaze::util::get_config | ( | int | pipeline_step_number | ) |
Calls get_config() and gets the data from
Where pipeline_step_number is the bullet to read.
pipeline_step_number | the pipeline step to read |
Definition at line 22 of file config.in.cpp.
References get_config().
dlib::rectangle gaze::util::get_eye_region | ( | int | eye, |
dlib::full_object_detection | object_detection | ||
) |
Returns the bounding box around an eye region. Works for both, the 5 and the 68 landmarks model.
eye | 0 for left eye, 1 for right eye. |
object_detection | The detected face landmarks. |
Definition at line 239 of file eye_like.cpp.
References get_eye_region(), one(), and rectangle().
Referenced by get_eye_region().
std::vector< dlib::chip_details > gaze::util::get_eyes_chip_details | ( | const dlib::full_object_detection | object_detection | ) |
Determines a bounding box around the eyes from a given object detection. This function is designed to work with 5 feature landmarks.
object_detection | A full object detecetion as acquired from a dlib::shape_predictor. |
Definition at line 12 of file pipeline_utils.cpp.
References one(), std::vector< _Tp, _Alloc >::push_back(), and rectangle().
Referenced by gaze::pipeline::GazeCapture::process(), gaze::pipeline::PupilLocalization::process(), gaze::pipeline::GazePointCalculation::process(), and gaze::pipeline::PupilLocalization::visualize().
void gaze::util::normalize_and_threshold_gradients | ( | dlib::matrix< T > & | horizontal, |
dlib::matrix< T > & | vertical, | ||
double | relative_threshold = -1 |
||
) |
Normalizes a horizontal and a vertical gradient matrix to unit length vectors.
If a relative threshold is provided, all values where the gradient magnitude is lower than are set to 0.
horizontal | A gradient, e.g. from dlib::sobel_edge_detector |
vertical | A gradient, e.g. from dlib::sobel_edge_detector |
relative_threshold | optional threshold to set small values to 0. |
Definition at line 79 of file pupil_localization.h.
References magnitude(), mean(), sqrt(), and threshold().
Referenced by gaze::pipeline::PupilLocalization::process().
|
inline |
Prints a human readable short information about the data object to the stream.
ostr | the stream. |
data | the data object. |
Definition at line 130 of file data.h.
References std::endl(), gaze::util::Data::eyes, gaze::util::Data::image, gaze::util::Data::landmarks, cv::Mat::size, and gaze::util::Data::source_image.
double gaze::util::parse_aspect_ratio | ( | std::string | aspect_ratio_string | ) |
Parses a string representing an aspect ratio. If the string contains : or /, it is split there and the aspect ratio is the quotient between the values left and right: a:b
is equal to a/b
. If non of the tokens is present, the string is parsed as a double.
aspect_ratio_string | The string to parse. |
Definition at line 20 of file gaze_point_calculation.cpp.
References basic_string< char >::find(), and basic_string< char >::substr().