visageSDK
TrackerGazeCalibrator.h
1 //
3 // (c) Visage Technologies AB 2002 - 2023 All rights reserved.
4 //
5 // This file is part of visage|SDK(tm).
6 // Unauthorized copying of this file, via any medium is strictly prohibited.
7 //
8 // No warranty, explicit or implicit, provided.
9 //
10 // This is proprietary software. No part of this software may be used or
11 // reproduced in any form or by any means otherwise than in accordance with
12 // any written license granted by Visage Technologies AB.
13 //
15 
16 #ifndef SCREENSPACEGAZE_H
17 #define SCREENSPACEGAZE_H
18 #include <vector>
19 #include "vs_main.h"
20 
21 #ifdef EMSCRIPTEN
22 #include <unistd.h>
23 #include <stdio.h>
24 #endif
25 #ifdef VISAGE_STATIC
26  #define VISAGE_DECLSPEC
27 #else
28 
29  #ifdef VISAGE_EXPORTS
30  #define VISAGE_DECLSPEC __declspec(dllexport)
31  #else
32  #define VISAGE_DECLSPEC __declspec(dllimport)
33  #endif
34 
35 #endif
36 
37 namespace VisageSDK
38 {
39 
42 struct VISAGE_DECLSPEC QualityParams
43 {
45  //* This value is set after successful calibration.
46  //**/
47  //float fitQuality;
48 
50  //* This value is set after successfully calibration and is updated for each new estimation frame.
51  //* In offline mode this value is calculated after processing is finished. In online mode this value is currently not set.
52  //**/
53  //float varEstimRotation;
54  //
56  //* This value is updated for each new frame.
57  //* In offline mode This value is calculated after processing is finished if running in offline mode. In online mode this value is currently not set.
58  //**/
59  //float varTrackQuality;
60 
62  //* In offline mode this value is calculated after processing is finished. In online mode this value is updated for each new calibration frame.
63  //**/
64  //float varCalibTrackQuality;
65 
67  //* In offline mode this value is calculated after processing is finished. In online mode this value is updated for each new calibration frame.
68  //**/
69  //float varCalibRotation;
70  //
71  //
73  //* In offline mode this value is calculated after processing is finished. In online mode this value is updated for each new calibration frame.
74  //**/
75  //float varCalibTranslation;
76  //
78  //* In offline mode this value is calculated after processing is finished. In online mode this value is updated for each new calibration frame.
79  //**/
80  //float avgCalibTrackQuality;
81  //
83  //* In offline mode this value is calculated after processing is finished. In online mode this value is updated for each new calibration frame.
84  //**/
85  //float avgCalibDetectQuality;
86 
88  //* In offline mode this value is calculated after processing is finished. In online mode this value is updated for each new calibration frame.
89  //**/
90  //float calib_perc;
91 
93  //* In offline mode this value is calculated after processing is finished. In online mode this value is updated for each new estimation frame.
94  //**/
95  //float estim_perc;
96 
98  {
99  CalibTrackQuality = 0;
100  EstimTrackQuality = 0;
101  EstimCumulativeRotation = 0;
102  CalibCumulativeRotation = 0;
103  CalibCumulativeTranslation = 0;
104  CalibFramesStatus = 0;
105  EstimFramesStatus = 0;
106  CalibDetectQuality = 0;
107  CalibFramesCount = 0;
108  CalibOutliersCount = 0;
109  CalibDefinedCount = 0;
110  EstimFramesCount = 0;
111 
112  }
113 
118 
123 
129 
134 
139 
144 
149 
154 
159 
164 
169 
174 
175 };
176 
180 struct VISAGE_DECLSPEC ScreenSpaceGazeData
181 {
187  int index;
188 
192  float x;
193 
197  float y;
198 
211  int inState;
212 
217  float quality;
218 
219  bool isFix;
220 
221  VsImage* lEyeImage;
222  VsImage* rEyeImage;
223  int usedEye;
224 
225  int calibrationGroup;
226  double regularizationWeight;
227 
229  virtual ~ScreenSpaceGazeData();
230 };
231 
239 class VISAGE_DECLSPEC ScreenSpaceGazeRepository
240 {
241 
242 public:
245 
249  ScreenSpaceGazeData* Get(int index);
250 
254  int GetCount();
255 
259  int GetFirst();
260 
264  int GetLast();
265 
270  void Add(ScreenSpaceGazeData* data);
271 
279  void Add(int index, float x, float y);
280 
281  void Clear();
282 
283 
284 private:
285 
286  std::vector<ScreenSpaceGazeData*>* repository;
287 
288 };
289 
290 
291 //class ScreenSpaceGazeCalibrator : public ScreenSpaceGazeRepository
292 //{
293 //public:
294 //
295 // ScreenSpaceGazeCalibrator(void);
296 //
297 // void Add(ScreenSpaceGazeData* data);
298 // void Add(int index, float x, float y, int inState);
299 //
300 // ScreenSpaceGazeData* Get(int index);
301 //
302 // int GetCount();
303 //
304 // int GetFirst();
305 //
306 // int GetLast();
307 //
308 // void Clear();
309 //
310 //
311 //private:
312 //
313 // std::vector<ScreenSpaceGazeData*> repository;
314 //
315 //};
316 }
317 #endif
VisageSDK::ScreenSpaceGazeData::inState
int inState
Flag indicating the state of the gaze estimator for the current frame.
Definition: TrackerGazeCalibrator.h:211
VisageSDK::ScreenSpaceGazeData::y
float y
Y coordinate of screen space gaze normalized to screen height.
Definition: TrackerGazeCalibrator.h:197
VisageSDK
Definition: linux_header.h:1
VisageSDK::QualityParams::EstimTrackQuality
float * EstimTrackQuality
Array holding tracking quality for each estimation frame.
Definition: TrackerGazeCalibrator.h:122
VisageSDK::QualityParams
QualityParams is container structure used to hold a number of parameters related to estimating screen...
Definition: TrackerGazeCalibrator.h:42
VisageSDK::QualityParams::EstimCumulativeRotation
float * EstimCumulativeRotation
Array holding cumulative head rotation for each estimation frame.
Definition: TrackerGazeCalibrator.h:128
VisageSDK::QualityParams::CalibFramesCount
int CalibFramesCount
Total number of defined or undefined calibration frames.
Definition: TrackerGazeCalibrator.h:143
VisageSDK::ScreenSpaceGazeRepository
Data repository holding ScreenSpaceGazeData objects in offline screen space gaze tracking mode.
Definition: TrackerGazeCalibrator.h:239
VisageSDK::QualityParams::EstimFramesCount
int EstimFramesCount
Number of estimation frames.
Definition: TrackerGazeCalibrator.h:158
VisageSDK::QualityParams::QualityParams
QualityParams()
‍** Estimated quality of calibration. Higher values indicate lower number of outliers and better fitt...
Definition: TrackerGazeCalibrator.h:97
VisageSDK::QualityParams::CalibOutliersCount
int CalibOutliersCount
Number of defined calibration frames discarded from calibration.
Definition: TrackerGazeCalibrator.h:148
VisageSDK::ScreenSpaceGazeData::index
int index
Index of the video frame.
Definition: TrackerGazeCalibrator.h:187
VisageSDK::QualityParams::CalibTrackQuality
float * CalibTrackQuality
Array holding tracking quality for each calibration frame.
Definition: TrackerGazeCalibrator.h:117
VisageSDK::QualityParams::CalibCumulativeTranslation
float * CalibCumulativeTranslation
Array holding cumulative head translation for each calibration frame.
Definition: TrackerGazeCalibrator.h:138
VisageSDK::QualityParams::CalibDefinedCount
int CalibDefinedCount
Number of defined calibration frames,.
Definition: TrackerGazeCalibrator.h:153
VisageSDK::QualityParams::EstimFramesStatus
int * EstimFramesStatus
Array holding tracking status for each estimation frame.
Definition: TrackerGazeCalibrator.h:168
VisageSDK::ScreenSpaceGazeData
ScreenSpaceGazeData is a container structure used to hold the gaze point location,...
Definition: TrackerGazeCalibrator.h:180
VisageSDK::ScreenSpaceGazeData::quality
float quality
The frame level gaze tracking quality.
Definition: TrackerGazeCalibrator.h:217
VisageSDK::ScreenSpaceGazeData::x
float x
X coordinate of screen space gaze normalized to screen width.
Definition: TrackerGazeCalibrator.h:192
VisageSDK::QualityParams::CalibCumulativeRotation
float * CalibCumulativeRotation
Array holding cumulative head rotation for each calibration frame.
Definition: TrackerGazeCalibrator.h:133
VisageSDK::QualityParams::CalibFramesStatus
int * CalibFramesStatus
Array holding tracking status for each calibration frame.
Definition: TrackerGazeCalibrator.h:163
VisageSDK::QualityParams::CalibDetectQuality
float * CalibDetectQuality
Array holding detection quality for each calibration frame.
Definition: TrackerGazeCalibrator.h:173