summaryrefslogtreecommitdiffhomepage
path: root/eyeware-beam-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'eyeware-beam-sdk')
-rw-r--r--eyeware-beam-sdk/API/cpp/include/eyeware/defines.h41
-rw-r--r--eyeware-beam-sdk/API/cpp/include/eyeware/geometry.h127
-rw-r--r--eyeware-beam-sdk/API/cpp/include/eyeware/network_exception.h33
-rw-r--r--eyeware-beam-sdk/API/cpp/include/eyeware/tracker_client.h110
-rw-r--r--eyeware-beam-sdk/API/cpp/include/eyeware/tracker_listener.h33
-rw-r--r--eyeware-beam-sdk/API/cpp/include/eyeware/tracking_info.h171
-rw-r--r--eyeware-beam-sdk/API/cpp/include/eyeware/types.h38
-rw-r--r--eyeware-beam-sdk/API/cpp/lib/libsodium.dllbin0 -> 293376 bytes
-rw-r--r--eyeware-beam-sdk/API/cpp/lib/tracker_client.dllbin0 -> 572416 bytes
-rw-r--r--eyeware-beam-sdk/API/cpp/lib/tracker_client.libbin0 -> 18152 bytes
-rw-r--r--eyeware-beam-sdk/CHANGELOG.md14
-rw-r--r--eyeware-beam-sdk/CREDITS.pdfbin0 -> 18472 bytes
-rw-r--r--eyeware-beam-sdk/LICENSE.pdfbin0 -> 152973 bytes
13 files changed, 567 insertions, 0 deletions
diff --git a/eyeware-beam-sdk/API/cpp/include/eyeware/defines.h b/eyeware-beam-sdk/API/cpp/include/eyeware/defines.h
new file mode 100644
index 0000000..1c66b68
--- /dev/null
+++ b/eyeware-beam-sdk/API/cpp/include/eyeware/defines.h
@@ -0,0 +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_
diff --git a/eyeware-beam-sdk/API/cpp/include/eyeware/geometry.h b/eyeware-beam-sdk/API/cpp/include/eyeware/geometry.h
new file mode 100644
index 0000000..b78c4d1
--- /dev/null
+++ b/eyeware-beam-sdk/API/cpp/include/eyeware/geometry.h
@@ -0,0 +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 <cstdint>
+#include <limits>
+#include <memory>
+
+#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
new file mode 100644
index 0000000..37a33f3
--- /dev/null
+++ b/eyeware-beam-sdk/API/cpp/include/eyeware/network_exception.h
@@ -0,0 +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 <exception>
+#include <string>
+
+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
new file mode 100644
index 0000000..82eadf3
--- /dev/null
+++ b/eyeware-beam-sdk/API/cpp/include/eyeware/tracker_client.h
@@ -0,0 +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 <functional>
+#include <memory>
+
+#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<void(const NetworkError &)> 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<Impl> 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 <stdbool.h>
+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
new file mode 100644
index 0000000..b8f94de
--- /dev/null
+++ b/eyeware-beam-sdk/API/cpp/include/eyeware/tracker_listener.h
@@ -0,0 +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
diff --git a/eyeware-beam-sdk/API/cpp/include/eyeware/tracking_info.h b/eyeware-beam-sdk/API/cpp/include/eyeware/tracking_info.h
new file mode 100644
index 0000000..6b74ea4
--- /dev/null
+++ b/eyeware-beam-sdk/API/cpp/include/eyeware/tracking_info.h
@@ -0,0 +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 <vector>
+
+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<TrackedUser> 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
new file mode 100644
index 0000000..9b4812a
--- /dev/null
+++ b/eyeware-beam-sdk/API/cpp/include/eyeware/types.h
@@ -0,0 +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 <cstdint>
+#include <limits>
+
+#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/cpp/lib/libsodium.dll b/eyeware-beam-sdk/API/cpp/lib/libsodium.dll
new file mode 100644
index 0000000..20dae06
--- /dev/null
+++ b/eyeware-beam-sdk/API/cpp/lib/libsodium.dll
Binary files differ
diff --git a/eyeware-beam-sdk/API/cpp/lib/tracker_client.dll b/eyeware-beam-sdk/API/cpp/lib/tracker_client.dll
new file mode 100644
index 0000000..68641ec
--- /dev/null
+++ b/eyeware-beam-sdk/API/cpp/lib/tracker_client.dll
Binary files differ
diff --git a/eyeware-beam-sdk/API/cpp/lib/tracker_client.lib b/eyeware-beam-sdk/API/cpp/lib/tracker_client.lib
new file mode 100644
index 0000000..bae87e6
--- /dev/null
+++ b/eyeware-beam-sdk/API/cpp/lib/tracker_client.lib
Binary files differ
diff --git a/eyeware-beam-sdk/CHANGELOG.md b/eyeware-beam-sdk/CHANGELOG.md
new file mode 100644
index 0000000..32d8b5e
--- /dev/null
+++ b/eyeware-beam-sdk/CHANGELOG.md
@@ -0,0 +1,14 @@
+# Beam SDK Changelog
+
+## 1.1.0
+2021-08-11
+
+### New Features
+* The API can now distinguish between no connection and tracking being lost
+
+
+## 1.0
+2021-07-30
+
+### New Features
+* Initial release
diff --git a/eyeware-beam-sdk/CREDITS.pdf b/eyeware-beam-sdk/CREDITS.pdf
new file mode 100644
index 0000000..17ef5a4
--- /dev/null
+++ b/eyeware-beam-sdk/CREDITS.pdf
Binary files differ
diff --git a/eyeware-beam-sdk/LICENSE.pdf b/eyeware-beam-sdk/LICENSE.pdf
new file mode 100644
index 0000000..35e4612
--- /dev/null
+++ b/eyeware-beam-sdk/LICENSE.pdf
Binary files differ