From 0c8055a8f0600b9bb5686ac4914ac22d8d160049 Mon Sep 17 00:00:00 2001 From: eyedav <88885346+eyedav@users.noreply.github.com> Date: Wed, 15 Mar 2023 17:27:09 +0100 Subject: Keep the entire content of the Eyeware Beam SDK zip file --- eyeware-beam-sdk/API/cpp/include/eyeware/defines.h | 82 ++--- .../API/cpp/include/eyeware/geometry.h | 254 +++++++-------- .../API/cpp/include/eyeware/network_exception.h | 64 ++-- .../API/cpp/include/eyeware/tracker_client.h | 218 ++++++------- .../API/cpp/include/eyeware/tracker_listener.h | 66 ++-- .../API/cpp/include/eyeware/tracking_info.h | 342 ++++++++++----------- eyeware-beam-sdk/API/cpp/include/eyeware/types.h | 76 ++--- .../API/python/eyeware/client.cp36-win_amd64.pyd | Bin 0 -> 697856 bytes eyeware-beam-sdk/API/python/eyeware/libsodium.dll | Bin 0 -> 293376 bytes eyeware-beam-sdk/API/python/tracker_sample.py | 56 ++++ 10 files changed, 607 insertions(+), 551 deletions(-) create mode 100644 eyeware-beam-sdk/API/python/eyeware/client.cp36-win_amd64.pyd create mode 100644 eyeware-beam-sdk/API/python/eyeware/libsodium.dll create mode 100644 eyeware-beam-sdk/API/python/tracker_sample.py (limited to 'eyeware-beam-sdk/API') diff --git a/eyeware-beam-sdk/API/cpp/include/eyeware/defines.h b/eyeware-beam-sdk/API/cpp/include/eyeware/defines.h index 1c66b68..6307b72 100644 --- a/eyeware-beam-sdk/API/cpp/include/eyeware/defines.h +++ b/eyeware-beam-sdk/API/cpp/include/eyeware/defines.h @@ -1,41 +1,41 @@ -/** - * Copyright and confidentiality notice - * - * This file is part of GazeSense SDK, which is proprietary and confidential - * information of Eyeware Tech SA. - * - * Copyright (C) 2020 Eyeware Tech SA - * - * All rights reserved - */ - -#ifndef _EYEWARE_DEFINES_ -#define _EYEWARE_DEFINES_ - -#if !defined(EW_API_EXPORT) -#if defined(WIN32) || defined(_WIN32) -#define EW_API_EXPORT __declspec(dllexport) -#else -#define EW_API_EXPORT __attribute__((visibility("default"))) -#endif -#endif - -#if !defined(EW_API_IMPORT) -#if defined(EYEWARE_STATIC_LINK) || defined(EYEWARE_LINK_OBJ_LIB) -#define EW_API_IMPORT -#elif defined(WIN32) || defined(_WIN32) -#define EW_API_IMPORT __declspec(dllimport) -#else -#define EW_API_IMPORT -#endif -#endif - -#if !defined(EW_API) -#if defined(EYEWARE_SDK_BUILD) -#define EW_API EW_API_EXPORT -#else -#define EW_API EW_API_IMPORT -#endif -#endif - -#endif // _EYEWARE_DEFINES_ +/** + * Copyright and confidentiality notice + * + * This file is part of GazeSense SDK, which is proprietary and confidential + * information of Eyeware Tech SA. + * + * Copyright (C) 2020 Eyeware Tech SA + * + * All rights reserved + */ + +#ifndef _EYEWARE_DEFINES_ +#define _EYEWARE_DEFINES_ + +#if !defined(EW_API_EXPORT) +#if defined(WIN32) || defined(_WIN32) +#define EW_API_EXPORT __declspec(dllexport) +#else +#define EW_API_EXPORT __attribute__((visibility("default"))) +#endif +#endif + +#if !defined(EW_API_IMPORT) +#if defined(EYEWARE_STATIC_LINK) || defined(EYEWARE_LINK_OBJ_LIB) +#define EW_API_IMPORT +#elif defined(WIN32) || defined(_WIN32) +#define EW_API_IMPORT __declspec(dllimport) +#else +#define EW_API_IMPORT +#endif +#endif + +#if !defined(EW_API) +#if defined(EYEWARE_SDK_BUILD) +#define EW_API EW_API_EXPORT +#else +#define EW_API EW_API_IMPORT +#endif +#endif + +#endif // _EYEWARE_DEFINES_ diff --git a/eyeware-beam-sdk/API/cpp/include/eyeware/geometry.h b/eyeware-beam-sdk/API/cpp/include/eyeware/geometry.h index b78c4d1..0f5b107 100644 --- a/eyeware-beam-sdk/API/cpp/include/eyeware/geometry.h +++ b/eyeware-beam-sdk/API/cpp/include/eyeware/geometry.h @@ -1,127 +1,127 @@ -/** - * Copyright and confidentiality notice - * - * This file is part of GazeSense SDK, which is proprietary and confidential - * information of Eyeware Tech SA. - * - * Copyright (C) 2020 Eyeware Tech SA - * - * All rights reserved - */ - -#ifndef EYEWARE_SDK_GEOMETRY_H -#define EYEWARE_SDK_GEOMETRY_H - -#include -#include -#include - -#include "defines.h" - -namespace eyeware { - -/** - * Matrix of 3x3, implemented as an array of arrays (row-major). - * - * \code{.cpp} - * Matrix3x3 my_matrix; // Assume a Matrix3x3 instance is available - * int row = 1; - * int col = 2; - * float coefficient = my_matrix[row][col]; - * \endcode - * - */ -using Matrix3x3 = float[3][3]; - -/** - * Representation of a 2D vector or 2D point. - */ -struct Vector2D { - /** - * x coordinate - */ - float x = 0.0f; - /** - * y coordinate - */ - float y = 0.0f; -}; - -/** - * Representation of a 3D vector or 3D point. - */ -struct Vector3D { - /** - * x coordinate. - */ - float x = 0.0f; - /** - * y coordinate. - */ - float y = 0.0f; - /** - * z coordinate. - */ - float z = 0.0f; -}; - -/** - * Representation of a 3D affine transform, composed by a rotation matrix and a translation vector - * as A = [R | t], where - * - * R = [c_00, c_01, c_02 - * c_10, c_11, c_12 - * c_20, c_21, c_22], - * - * t = [c_03, - * c_13, - * c_23]. - * */ -struct AffineTransform3D { - /** - * Rotation matrix component. - */ - Matrix3x3 rotation; - /** - * Translation vector component. - */ - Vector3D translation; -}; - -struct Size2D { - float width; - float height; -}; - -struct Rectangle { - uint32_t top_left_x; - uint32_t top_left_y; - uint32_t width; - uint32_t height; -}; - -/** - * Defines a ray which is a subset of a line, given by the following equation: - * - * x = o + d(t), for t in [0, +oo[ and ||d|| = 1. - * - * Where o denotes the origin, d denotes the direction, t is any given - * constant between 0 and infinity that denotes the distance from the origin - * to a point x. - */ -struct Ray3D { - Vector3D origin; - Vector3D direction; -}; - -enum class Orientation { - UNKNOWN = 0, - CLOCKWISE_0 = 1, - CLOCKWISE_90 = 2, - CLOCKWISE_180 = 3, - CLOCKWISE_270 = 4 -}; - -} // namespace eyeware - -#endif // EYEWARE_SDK_GEOMETRY_H +/** + * Copyright and confidentiality notice + * + * This file is part of GazeSense SDK, which is proprietary and confidential + * information of Eyeware Tech SA. + * + * Copyright (C) 2020 Eyeware Tech SA + * + * All rights reserved + */ + +#ifndef EYEWARE_SDK_GEOMETRY_H +#define EYEWARE_SDK_GEOMETRY_H + +#include +#include +#include + +#include "defines.h" + +namespace eyeware { + +/** + * Matrix of 3x3, implemented as an array of arrays (row-major). + * + * \code{.cpp} + * Matrix3x3 my_matrix; // Assume a Matrix3x3 instance is available + * int row = 1; + * int col = 2; + * float coefficient = my_matrix[row][col]; + * \endcode + * + */ +using Matrix3x3 = float[3][3]; + +/** + * Representation of a 2D vector or 2D point. + */ +struct Vector2D { + /** + * x coordinate + */ + float x = 0.0f; + /** + * y coordinate + */ + float y = 0.0f; +}; + +/** + * Representation of a 3D vector or 3D point. + */ +struct Vector3D { + /** + * x coordinate. + */ + float x = 0.0f; + /** + * y coordinate. + */ + float y = 0.0f; + /** + * z coordinate. + */ + float z = 0.0f; +}; + +/** + * Representation of a 3D affine transform, composed by a rotation matrix and a translation vector + * as A = [R | t], where + * + * R = [c_00, c_01, c_02 + * c_10, c_11, c_12 + * c_20, c_21, c_22], + * + * t = [c_03, + * c_13, + * c_23]. + * */ +struct AffineTransform3D { + /** + * Rotation matrix component. + */ + Matrix3x3 rotation; + /** + * Translation vector component. + */ + Vector3D translation; +}; + +struct Size2D { + float width; + float height; +}; + +struct Rectangle { + uint32_t top_left_x; + uint32_t top_left_y; + uint32_t width; + uint32_t height; +}; + +/** + * Defines a ray which is a subset of a line, given by the following equation: + * + * x = o + d(t), for t in [0, +oo[ and ||d|| = 1. + * + * Where o denotes the origin, d denotes the direction, t is any given + * constant between 0 and infinity that denotes the distance from the origin + * to a point x. + */ +struct Ray3D { + Vector3D origin; + Vector3D direction; +}; + +enum class Orientation { + UNKNOWN = 0, + CLOCKWISE_0 = 1, + CLOCKWISE_90 = 2, + CLOCKWISE_180 = 3, + CLOCKWISE_270 = 4 +}; + +} // namespace eyeware + +#endif // EYEWARE_SDK_GEOMETRY_H diff --git a/eyeware-beam-sdk/API/cpp/include/eyeware/network_exception.h b/eyeware-beam-sdk/API/cpp/include/eyeware/network_exception.h index 37a33f3..5caaafb 100644 --- a/eyeware-beam-sdk/API/cpp/include/eyeware/network_exception.h +++ b/eyeware-beam-sdk/API/cpp/include/eyeware/network_exception.h @@ -1,33 +1,33 @@ -/** - * Copyright and confidentiality notice - * - * This file is part of GazeSense SDK, which is proprietary and confidential - * information of Eyeware Tech SA. - * - * Copyright (C) 2021 Eyeware Tech SA - * - * All rights reserved - */ - -#ifndef EYEWARE_NETWORK_EXCEPTION_H_ -#define EYEWARE_NETWORK_EXCEPTION_H_ - -#include -#include - -namespace eyeware { - -enum class NetworkError { TIMEOUT = 0, UNKNOWN_ERROR = 1 }; - -struct NetworkException : public std::exception { - public: - NetworkException(const std::string &error_msg) : m_error_msg{error_msg} {} - const char *what() const noexcept override { return m_error_msg.c_str(); } - - private: - std::string m_error_msg; -}; - -} // namespace eyeware - +/** + * Copyright and confidentiality notice + * + * This file is part of GazeSense SDK, which is proprietary and confidential + * information of Eyeware Tech SA. + * + * Copyright (C) 2021 Eyeware Tech SA + * + * All rights reserved + */ + +#ifndef EYEWARE_NETWORK_EXCEPTION_H_ +#define EYEWARE_NETWORK_EXCEPTION_H_ + +#include +#include + +namespace eyeware { + +enum class NetworkError { TIMEOUT = 0, UNKNOWN_ERROR = 1 }; + +struct NetworkException : public std::exception { + public: + NetworkException(const std::string &error_msg) : m_error_msg{error_msg} {} + const char *what() const noexcept override { return m_error_msg.c_str(); } + + private: + std::string m_error_msg; +}; + +} // namespace eyeware + #endif \ No newline at end of file diff --git a/eyeware-beam-sdk/API/cpp/include/eyeware/tracker_client.h b/eyeware-beam-sdk/API/cpp/include/eyeware/tracker_client.h index 82eadf3..f0f48b7 100644 --- a/eyeware-beam-sdk/API/cpp/include/eyeware/tracker_client.h +++ b/eyeware-beam-sdk/API/cpp/include/eyeware/tracker_client.h @@ -1,110 +1,110 @@ -/** - * Copyright and confidentiality notice - * - * This file is part of Eyeware SDK, which is proprietary and confidential information of - * Eyeware Tech SA. - * - * Copyright (C) 2021 Eyeware Tech SA - * - * All rights reserved - */ - -#ifndef EYEWARE_TRACKER_CLIENT_H_ -#define EYEWARE_TRACKER_CLIENT_H_ - -#include -#include - -#include "eyeware/defines.h" -#include "eyeware/network_exception.h" -#include "eyeware/tracking_info.h" - -namespace eyeware { - -/** - * The default base port used in the Eyeware Beam application to broadcast tracking data. - */ -constexpr int DEFAULT_BASE_COMMUNICATION_PORT = 12010; - -/** - * The default timeouts used to detect network errors. - */ -constexpr int DEFAULT_NETWORK_TIMEOUTS_IN_MS = 2000; - -/** - * Class for connecting to the tracker server and retrieving its resulting tracking data. - * - * It establishes communication to the tracker server (Eyeware Beam application) and - * provides synchronous access to the data. Those synchronous calls will return the last - * tracking data results received from the server. - * - * A `network_error_handler` callback can be provided. If `nullptr` is used (default), - * the network errors are ignored and the network connection is reestablished automatically - * when possible by the @ref TrackerClient class instance. If a network handler is given, - * it will be called in case of errors (e.g., timeout). In such case, the @ref TrackerClient - * instance becomes invalid and needs to be recreated to reestablish connection. - */ -class EW_API TrackerClient { - public: - /** - * @param network_error_handler An optional callback function for managing - * connection to the server errors. - * @param network_connection_timeout_ms The time period (in ms) for an attempt to - * connect to the server, after which the - * network connection is treated as broken. - * @param tracking_info_network_timeout_ms The time period (in ms) for an attempt to - * obtain tracking info from the server, after which - * the network connection is treated as broken. - * @param base_communication_port Base connection port to the server. The instance - * may use base_communication_port+1 as well. - * @param hostname The hostname of the server to obtain tracking - * results from. Typically the same PC, thus - * "127.0.0.1". - * - */ - TrackerClient(std::function network_error_handler = nullptr, - int network_connection_timeout_ms = DEFAULT_NETWORK_TIMEOUTS_IN_MS, - int tracking_info_network_timeout_ms = DEFAULT_NETWORK_TIMEOUTS_IN_MS, - int base_communication_port = DEFAULT_BASE_COMMUNICATION_PORT, - const char *hostname = "127.0.0.1"); - - ~TrackerClient(); - - /** - * Retrieves the most recent screen gaze tracking result. - */ - ScreenGazeInfo get_screen_gaze_info() const; - - /** - * Retrieves the most recent head pose tracking result. - */ - HeadPoseInfo get_head_pose_info() const; - - /** - * Whether this client is currently connected to the tracker server or not. - * - * \since 1.1.0 - */ - bool connected() const; - - private: - class Impl; - std::unique_ptr m_pimpl; -}; - -} // namespace eyeware - -#ifdef __cplusplus -extern "C" { -#endif -EW_API eyeware::TrackerClient *create_tracker_instance(const char *hostname, - int communication_port); -EW_API void release_tracker_instance(eyeware::TrackerClient *p_instance); -EW_API eyeware::ScreenGazeInfo get_screen_gaze_info(eyeware::TrackerClient *p_instance); -EW_API eyeware::HeadPoseInfo get_head_pose_info(eyeware::TrackerClient *p_instance); - -#include -EW_API bool connected(eyeware::TrackerClient *p_instance); -} - +/** + * Copyright and confidentiality notice + * + * This file is part of Eyeware SDK, which is proprietary and confidential information of + * Eyeware Tech SA. + * + * Copyright (C) 2021 Eyeware Tech SA + * + * All rights reserved + */ + +#ifndef EYEWARE_TRACKER_CLIENT_H_ +#define EYEWARE_TRACKER_CLIENT_H_ + +#include +#include + +#include "eyeware/defines.h" +#include "eyeware/network_exception.h" +#include "eyeware/tracking_info.h" + +namespace eyeware { + +/** + * The default base port used in the Eyeware Beam application to broadcast tracking data. + */ +constexpr int DEFAULT_BASE_COMMUNICATION_PORT = 12010; + +/** + * The default timeouts used to detect network errors. + */ +constexpr int DEFAULT_NETWORK_TIMEOUTS_IN_MS = 2000; + +/** + * Class for connecting to the tracker server and retrieving its resulting tracking data. + * + * It establishes communication to the tracker server (Eyeware Beam application) and + * provides synchronous access to the data. Those synchronous calls will return the last + * tracking data results received from the server. + * + * A `network_error_handler` callback can be provided. If `nullptr` is used (default), + * the network errors are ignored and the network connection is reestablished automatically + * when possible by the @ref TrackerClient class instance. If a network handler is given, + * it will be called in case of errors (e.g., timeout). In such case, the @ref TrackerClient + * instance becomes invalid and needs to be recreated to reestablish connection. + */ +class EW_API TrackerClient { + public: + /** + * @param network_error_handler An optional callback function for managing + * connection to the server errors. + * @param network_connection_timeout_ms The time period (in ms) for an attempt to + * connect to the server, after which the + * network connection is treated as broken. + * @param tracking_info_network_timeout_ms The time period (in ms) for an attempt to + * obtain tracking info from the server, after which + * the network connection is treated as broken. + * @param base_communication_port Base connection port to the server. The instance + * may use base_communication_port+1 as well. + * @param hostname The hostname of the server to obtain tracking + * results from. Typically the same PC, thus + * "127.0.0.1". + * + */ + TrackerClient(std::function network_error_handler = nullptr, + int network_connection_timeout_ms = DEFAULT_NETWORK_TIMEOUTS_IN_MS, + int tracking_info_network_timeout_ms = DEFAULT_NETWORK_TIMEOUTS_IN_MS, + int base_communication_port = DEFAULT_BASE_COMMUNICATION_PORT, + const char *hostname = "127.0.0.1"); + + ~TrackerClient(); + + /** + * Retrieves the most recent screen gaze tracking result. + */ + ScreenGazeInfo get_screen_gaze_info() const; + + /** + * Retrieves the most recent head pose tracking result. + */ + HeadPoseInfo get_head_pose_info() const; + + /** + * Whether this client is currently connected to the tracker server or not. + * + * \since 1.1.0 + */ + bool connected() const; + + private: + class Impl; + std::unique_ptr m_pimpl; +}; + +} // namespace eyeware + +#ifdef __cplusplus +extern "C" { +#endif +EW_API eyeware::TrackerClient *create_tracker_instance(const char *hostname, + int communication_port); +EW_API void release_tracker_instance(eyeware::TrackerClient *p_instance); +EW_API eyeware::ScreenGazeInfo get_screen_gaze_info(eyeware::TrackerClient *p_instance); +EW_API eyeware::HeadPoseInfo get_head_pose_info(eyeware::TrackerClient *p_instance); + +#include +EW_API bool connected(eyeware::TrackerClient *p_instance); +} + #endif // EYEWARE_TRACKER_CLIENT_H_ \ No newline at end of file diff --git a/eyeware-beam-sdk/API/cpp/include/eyeware/tracker_listener.h b/eyeware-beam-sdk/API/cpp/include/eyeware/tracker_listener.h index b8f94de..1deb7c6 100644 --- a/eyeware-beam-sdk/API/cpp/include/eyeware/tracker_listener.h +++ b/eyeware-beam-sdk/API/cpp/include/eyeware/tracker_listener.h @@ -1,33 +1,33 @@ -/** - * Copyright and confidentiality notice - * - * This file is part of GazeSense SDK, which is proprietary and confidential - * information of Eyeware Tech SA. - * - * Copyright (C) 2020 Eyeware Tech SA - * - * All rights reserved - */ - -#ifndef CPP_API_TRACKER_LISTENER_H -#define CPP_API_TRACKER_LISTENER_H - -#include "tracking_info.h" - -namespace eyeware { - -/** - * Class which the client needs to inherit in their own type to receive the real time tracking data - */ -class TrackerListener { - public: - /** - * Reimplement this function in a child class to receive TrackingEvents after registering it to - * a tracker - */ - virtual void on_track_ready(TrackingEvent event) = 0; -}; - -} // namespace eyeware - -#endif +/** + * Copyright and confidentiality notice + * + * This file is part of GazeSense SDK, which is proprietary and confidential + * information of Eyeware Tech SA. + * + * Copyright (C) 2020 Eyeware Tech SA + * + * All rights reserved + */ + +#ifndef CPP_API_TRACKER_LISTENER_H +#define CPP_API_TRACKER_LISTENER_H + +#include "tracking_info.h" + +namespace eyeware { + +/** + * Class which the client needs to inherit in their own type to receive the real time tracking data + */ +class TrackerListener { + public: + /** + * Reimplement this function in a child class to receive TrackingEvents after registering it to + * a tracker + */ + virtual void on_track_ready(TrackingEvent event) = 0; +}; + +} // namespace eyeware + +#endif diff --git a/eyeware-beam-sdk/API/cpp/include/eyeware/tracking_info.h b/eyeware-beam-sdk/API/cpp/include/eyeware/tracking_info.h index 6b74ea4..6b7a256 100644 --- a/eyeware-beam-sdk/API/cpp/include/eyeware/tracking_info.h +++ b/eyeware-beam-sdk/API/cpp/include/eyeware/tracking_info.h @@ -1,171 +1,171 @@ -/** - * Copyright and confidentiality notice - * - * This file is part of GazeSense SDK, which is proprietary and confidential - * information of Eyeware Tech SA. - * - * Copyright (C) 2020 Eyeware Tech SA - * - * All rights reserved - */ - -#ifndef CPP_API_TRACKING_INFO_H_ -#define CPP_API_TRACKING_INFO_H_ - -#include "defines.h" -#include "geometry.h" -#include "types.h" -#include - -namespace eyeware { - -/** - * Realibility measure for obtained tracking results. - */ -enum class TrackingConfidence { UNRELIABLE = 0, LOW = 1, MEDIUM = 2, HIGH = 3 }; - -/** - * Represents information of a person gaze intersection with a single screen, for a given time - * instant. Screen gaze coordinates are expressed in pixels with respect to the top-left corner of - * the screen. - * \cond - * For more information on the screen coordinate system, see @ref EwScreenConfig. - * \endcond - */ -struct ScreenGazeInfo { - /** - * ID of the screen, to differentiate in case of a multiscreen setup. - */ - uint32_t screen_id = 0; - - /** - * The horizontal screen coordinate for the gaze intersection. - */ - uint32_t x = 0; - - /** - * The vertical screen coordinate for the gaze intersection. - */ - uint32_t y = 0; - - /** - * The confidence of the tracking result. - */ - TrackingConfidence confidence = TrackingConfidence::UNRELIABLE; - - /** - * Tracking status that tells if the other values are dependable. - */ - bool is_lost = true; -}; - -/** - * Represents information about gaze tracking within single frame corresponding to a particular - * person. - * - * Note: left and right refer to the eyes from the point of view of the camera. This means that - * they are inverted compared to the anatomical left and right of the point of view of the - * person. - */ -struct GazeInfo { - /** - * Represents the left eye gaze ray, expressed in the World Coordinate System. - */ - Ray3D left_eye_ray; - - /** - * Represents the right eye gaze ray, expressed in the World Coordinate System. - */ - Ray3D right_eye_ray; - - /** - * Confidence of the left eye gaze ray prediction. - */ - TrackingConfidence confidence_left = TrackingConfidence::UNRELIABLE; - - /** - * Confidence of the right eye gaze ray prediction. - */ - TrackingConfidence confidence_right = TrackingConfidence::UNRELIABLE; - - /** - * Tracking status that tells if the other values are dependable - */ - bool is_lost = true; -}; - -/** - * Represents information about eyes blinks within a single frame corresponding to a particular - * person. - * - * Note: left and right refer to the eyes from the point of view of the camera. This means that - * they are inverted compared to the anatomical left and right of the point of view of the - * person. - */ -struct BlinkInfo { - /** - * Represents the left eye closure. - */ - bool left_eye_closed; - - /** - * Represents the right eye closure. - */ - bool right_eye_closed; - - /** - * Confidence of the left eye closure prediction. - */ - TrackingConfidence confidence_left = TrackingConfidence::UNRELIABLE; - - /** - * Confidence of the right eye closure prediction. - */ - TrackingConfidence confidence_right = TrackingConfidence::UNRELIABLE; - - /** - * Whether person's blinks were tracked, meaning the values in this data structure are valid. - */ - bool is_lost = true; -}; - -/** - * Represents information of the head pose, for a given time instant. - */ -struct HeadPoseInfo { - /** - * Head pose, defined at the nose tip, with respect to the World Coordinate System (WCS). - */ - AffineTransform3D transform; - /** - * Indicates if tracking of the head is lost, i.e., if false, the user is not being tracked. - */ - bool is_lost = true; - /** - * Indicates the ID of the session of uninterrupted consecutive tracking. - */ - uint64_t track_session_uid = 0; -}; - -struct TrackedPersonInfo { - HeadPoseInfo head_pose; - GazeInfo gaze; - ScreenGazeInfo screen_gaze; - BlinkInfo blink; -}; - -struct TrackedUser { - TrackedUser(uint32_t id) : id{id} {} - TrackedUser operator=(const TrackedUser &other) { return TrackedUser{other.id}; } - const uint32_t id = 0; - TrackedPersonInfo tracking_info; -}; - -struct TrackingEvent { - std::vector people; - Timestamp timestamp = 0.0; -}; - -} // namespace eyeware - -#endif +/** + * Copyright and confidentiality notice + * + * This file is part of GazeSense SDK, which is proprietary and confidential + * information of Eyeware Tech SA. + * + * Copyright (C) 2020 Eyeware Tech SA + * + * All rights reserved + */ + +#ifndef CPP_API_TRACKING_INFO_H_ +#define CPP_API_TRACKING_INFO_H_ + +#include "defines.h" +#include "geometry.h" +#include "types.h" +#include + +namespace eyeware { + +/** + * Realibility measure for obtained tracking results. + */ +enum class TrackingConfidence { UNRELIABLE = 0, LOW = 1, MEDIUM = 2, HIGH = 3 }; + +/** + * Represents information of a person gaze intersection with a single screen, for a given time + * instant. Screen gaze coordinates are expressed in pixels with respect to the top-left corner of + * the screen. + * \cond + * For more information on the screen coordinate system, see @ref EwScreenConfig. + * \endcond + */ +struct ScreenGazeInfo { + /** + * ID of the screen, to differentiate in case of a multiscreen setup. + */ + uint32_t screen_id = 0; + + /** + * The horizontal screen coordinate for the gaze intersection. + */ + uint32_t x = 0; + + /** + * The vertical screen coordinate for the gaze intersection. + */ + uint32_t y = 0; + + /** + * The confidence of the tracking result. + */ + TrackingConfidence confidence = TrackingConfidence::UNRELIABLE; + + /** + * Tracking status that tells if the other values are dependable. + */ + bool is_lost = true; +}; + +/** + * Represents information about gaze tracking within single frame corresponding to a particular + * person. + * + * Note: left and right refer to the eyes from the point of view of the camera. This means that + * they are inverted compared to the anatomical left and right of the point of view of the + * person. + */ +struct GazeInfo { + /** + * Represents the left eye gaze ray, expressed in the World Coordinate System. + */ + Ray3D left_eye_ray; + + /** + * Represents the right eye gaze ray, expressed in the World Coordinate System. + */ + Ray3D right_eye_ray; + + /** + * Confidence of the left eye gaze ray prediction. + */ + TrackingConfidence confidence_left = TrackingConfidence::UNRELIABLE; + + /** + * Confidence of the right eye gaze ray prediction. + */ + TrackingConfidence confidence_right = TrackingConfidence::UNRELIABLE; + + /** + * Tracking status that tells if the other values are dependable + */ + bool is_lost = true; +}; + +/** + * Represents information about eyes blinks within a single frame corresponding to a particular + * person. + * + * Note: left and right refer to the eyes from the point of view of the camera. This means that + * they are inverted compared to the anatomical left and right of the point of view of the + * person. + */ +struct BlinkInfo { + /** + * Represents the left eye closure. + */ + bool left_eye_closed; + + /** + * Represents the right eye closure. + */ + bool right_eye_closed; + + /** + * Confidence of the left eye closure prediction. + */ + TrackingConfidence confidence_left = TrackingConfidence::UNRELIABLE; + + /** + * Confidence of the right eye closure prediction. + */ + TrackingConfidence confidence_right = TrackingConfidence::UNRELIABLE; + + /** + * Whether person's blinks were tracked, meaning the values in this data structure are valid. + */ + bool is_lost = true; +}; + +/** + * Represents information of the head pose, for a given time instant. + */ +struct HeadPoseInfo { + /** + * Head pose, defined at the nose tip, with respect to the World Coordinate System (WCS). + */ + AffineTransform3D transform; + /** + * Indicates if tracking of the head is lost, i.e., if false, the user is not being tracked. + */ + bool is_lost = true; + /** + * Indicates the ID of the session of uninterrupted consecutive tracking. + */ + uint64_t track_session_uid = 0; +}; + +struct TrackedPersonInfo { + HeadPoseInfo head_pose; + GazeInfo gaze; + ScreenGazeInfo screen_gaze; + BlinkInfo blink; +}; + +struct TrackedUser { + TrackedUser(uint32_t id) : id{id} {} + TrackedUser operator=(const TrackedUser &other) { return TrackedUser{other.id}; } + const uint32_t id = 0; + TrackedPersonInfo tracking_info; +}; + +struct TrackingEvent { + std::vector people; + Timestamp timestamp = 0.0; +}; + +} // namespace eyeware + +#endif diff --git a/eyeware-beam-sdk/API/cpp/include/eyeware/types.h b/eyeware-beam-sdk/API/cpp/include/eyeware/types.h index 9b4812a..084b426 100644 --- a/eyeware-beam-sdk/API/cpp/include/eyeware/types.h +++ b/eyeware-beam-sdk/API/cpp/include/eyeware/types.h @@ -1,38 +1,38 @@ -/** - * Copyright and confidentiality notice - * - * This file is part of GazeSense SDK, which is proprietary and confidential - * information of Eyeware Tech SA. - * - * Copyright (C) 2020 Eyeware Tech SA - * - * All rights reserved - */ - -#ifndef EYEWARE_SDK_TYPES_H -#define EYEWARE_SDK_TYPES_H - -#include -#include - -#include "defines.h" - -namespace eyeware { - -using Timestamp = double; - -/*< Person ID numeric type */ -using person_profile_id_t = int64_t; - -/*< Object ID numeric type */ -using object_id_t = uint32_t; - -/*< Screen ID numeric type */ -using screen_id_t = uint32_t; - -/*< Sensor ID numeric type */ -using sensor_id_t = uint32_t; - -} // namespace eyeware - -#endif +/** + * Copyright and confidentiality notice + * + * This file is part of GazeSense SDK, which is proprietary and confidential + * information of Eyeware Tech SA. + * + * Copyright (C) 2020 Eyeware Tech SA + * + * All rights reserved + */ + +#ifndef EYEWARE_SDK_TYPES_H +#define EYEWARE_SDK_TYPES_H + +#include +#include + +#include "defines.h" + +namespace eyeware { + +using Timestamp = double; + +/*< Person ID numeric type */ +using person_profile_id_t = int64_t; + +/*< Object ID numeric type */ +using object_id_t = uint32_t; + +/*< Screen ID numeric type */ +using screen_id_t = uint32_t; + +/*< Sensor ID numeric type */ +using sensor_id_t = uint32_t; + +} // namespace eyeware + +#endif diff --git a/eyeware-beam-sdk/API/python/eyeware/client.cp36-win_amd64.pyd b/eyeware-beam-sdk/API/python/eyeware/client.cp36-win_amd64.pyd new file mode 100644 index 0000000..a1a2bb8 Binary files /dev/null and b/eyeware-beam-sdk/API/python/eyeware/client.cp36-win_amd64.pyd differ diff --git a/eyeware-beam-sdk/API/python/eyeware/libsodium.dll b/eyeware-beam-sdk/API/python/eyeware/libsodium.dll new file mode 100644 index 0000000..20dae06 Binary files /dev/null and b/eyeware-beam-sdk/API/python/eyeware/libsodium.dll differ diff --git a/eyeware-beam-sdk/API/python/tracker_sample.py b/eyeware-beam-sdk/API/python/tracker_sample.py new file mode 100644 index 0000000..4291b3b --- /dev/null +++ b/eyeware-beam-sdk/API/python/tracker_sample.py @@ -0,0 +1,56 @@ +""" + Copyright (c) 2021 Eyeware Tech SA http://www.eyeware.tech + + This file provides an example on how to receive head and eye tracking data + from Beam SDK. + + Dependencies: + - Python 3.6 + - NumPy +""" + +from eyeware.client import TrackerClient +import time +import numpy as np + +# Build tracker client, to establish a communication with the tracker server (an Eyeware application). +# +# Constructing the tracker client object without arguments sets a default server hostname and port which +# work fine in many configurations. +# However, it is possible to set a specific hostname and port, depending on your setup and network. +# See the TrackerClient API reference for further information. +tracker = TrackerClient() + +# Run forever, until we press ctrl+c +while True: + # Make sure that the connection with the tracker server (Eyeware application) is up and running. + if tracker.connected: + + print(" * Head Pose:") + head_pose = tracker.get_head_pose_info() + head_is_lost = head_pose.is_lost + print(" - Lost track: ", head_is_lost) + if not head_is_lost: + print(" - Session ID: ", head_pose.track_session_uid) + rot = head_pose.transform.rotation + print(" - Rotation: |%5.3f %5.3f %5.3f|" % (rot[0, 0], rot[0, 1], rot[0, 2])) + print(" |%5.3f %5.3f %5.3f|" % (rot[1, 0], rot[1, 1], rot[1, 2])) + print(" |%5.3f %5.3f %5.3f|" % (rot[2, 0], rot[2, 1], rot[2, 2])) + tr = head_pose.transform.translation + print(" - Translation: " % (tr[0], tr[1], tr[2])) + + print(" * Gaze on Screen:") + screen_gaze = tracker.get_screen_gaze_info() + screen_gaze_is_lost = screen_gaze.is_lost + print(" - Lost track: ", screen_gaze_is_lost) + if not screen_gaze_is_lost: + print(" - Screen ID: ", screen_gaze.screen_id) + print(" - Coordinates: " % (screen_gaze.x, screen_gaze.y)) + print(" - Confidence: ", screen_gaze.confidence) + + time.sleep(1 / 30) # We expect tracking data at 30 Hz + else: + # Print a message every MESSAGE_PERIOD_IN_SECONDS seconds + MESSAGE_PERIOD_IN_SECONDS = 2 + time.sleep(MESSAGE_PERIOD_IN_SECONDS - time.monotonic() % MESSAGE_PERIOD_IN_SECONDS) + print("No connection with tracker server") -- cgit v1.2.3