API Docs (Unity Mobile)
Overview
Name | type | Description |
---|---|---|
GazeTracker | class | GazeTracker is the class that generates gaze tracking data from the video from the device's front camera. |
InitializationDelegate | class | This class contains a callback function that is called when the GazeTracker.initGazeTracker function is called. |
StatusDelegate | class | A class contains a callback function for whether gazetracker has been started or stopped. |
GazeDelegate | class | Including a callback function passing gazeInfo. class. |
FaceDelegate | class | Including a callback function passing faceInfo. class. |
CalibrationDelegate | class | This class includes callback functions related to calibration. |
UserStatusDelegate | class | This class contains callback functions related to UserStatus. |
GazeInfo | class | This is a class that contains gaze information. |
FaceInfo | class | This is a class that contains face information. |
UserStatusOption | class | The class in which the userStatusOption is defined. |
CameraPosition | class | This class has information about the actual camera position of the Android device. |
InitializationErrorType | enum | An enum that explains why the initialization failed. |
StatusErrorType | enum | An enum explaining why the GazeTracker stopped. |
TrckingState | enum | The enum that contains state types using at GazeInfo . |
EyeMovementState | enum | The Enum that contains eye movement state types using at GazeInfo |
ScreenState | enum | The Enum that contains screen state types using at GazeInfo |
CalibrationModeType | enum | The enum that contains mode of GazeTracker.startCalibartion . |
AccuracyCriteria | enum | An enum describing options for calibration accuracy. |
UIInterfaceOrientation | enum | Constants that specify the orientation of the app's user interface. |
GazeTracker
public class GazeTracker
GazeTracker
is the class that generates gaze tracking data from the video from the device's front camera.
Summary
Constructor and Destructor |
---|
initGazeTracker |
initGazeTracker (with User Status Options) |
deinitGazeTracker |
initGazeTracker
public static void initGazeTracker(string license, InitializationDelegate.onInitialized onInitialized)
GazeTracker
constructing process includes authentication.
The process is asynchronous.
Parameters | Type | Description |
---|---|---|
license | String | Key generated from SeeSo Console. |
onInitialized | InitializationDelegate.onInitialized | The implementation of InitializationDelegate onInitialized delegate. This contains GazeTracker construction result. |
Example
void onInitialized(InitializationErrorType error)
{
Debug.Log("onInitialized result : " + error);
if(error == InitializationErrorType.ERROR_NONE)
{
isInitialized = true;
}
else
{
isInitialized = false;
}
}
GazeTracker.initGazeTracker("key", onInitialized);
initGazeTracker with User Status Options
public static void initGazeTracker(string license, InitializationDelegate.onInitialized onInitialized, UserStatusOption option)
GazeTracker
constructing process includes authentication.
The process is asynchronous.
The created GazeTracker instance is delivered through InitializationDelegate.
To use this initGazeTracker
and User Status
in your production environment, please contact to the SeeSo team.
Parameters | Type | Description |
---|---|---|
license | String | Key generated from SeeSo Console |
onInitialized | InitializationDelegate.onInitialized | The implementation of InitializationDelegate onInitialized delegate. This contains GazeTracker construction result. |
option | UserStatusOption | A class containing User status option information |
Example
void onInitialized(InitializationErrorType error)
{
Debug.Log("onInitialized result : " + error);
if(error == InitializationErrorType.ERROR_NONE)
{
isInitialized = true;
}
else
{
isInitialized = false;
}
}
UserStatusOption option = new UserStatusOption();
option.useAll();
GazeTracker.initGazeTracker("key", onInitialized, option);
deinitGazeTracker
public static void deinitGazeTracker()
After this is called, do not call gazeTracker
's methods.
For memory optimization, assigning null
to the destructed object is recommended.
Example
GazeTracker.deinitGazeTracker();
getVersionName
public static string getVersionName()
Returns SeeSo SDK version.
Return Type | Description |
---|---|
string | version name |
Example
string version = GazeTracker.getVersionName();
Debug.Log("SeeSo version: " + version);
startTracking
public static void startTracking()
This is the function that should be called before starting gaze tracking.
It calls the onStarted()
function when gaze tracking initialization succeeded and setstatusCallback
has been attached to GazeTracker
.
Example
void onStarted()
{
Debug.Log("onStarted");
isTracking = true;
}
void onStopped(StatusErrorType error)
{
Debug.Log("onStopped with error : " + error);
isTracking = false;
}
GazeTracker.setStatusCallback(onStarted, onStopped);
// after initGazeTracker Success, Call startTracking
GazeTracker.startTracking();
stopTracking
public static void stopTracking()
This function is called to stop gaze tracking.
It calls the onStop()
function when setStatusCallback(onStarted, onStopped)
has been attached to GazeTracker
.
Example
void onStarted()
{
Debug.Log("onStarted");
isTracking = true;
}
void onStopped(StatusErrorType error)
{
Debug.Log("onStopped with error : " + error);
isTracking = false;
}
GazeTracker.stopTracking();
isTracking
public static bool isTracking()
This function represents the status of gaze tracking.
Return Type | Description |
---|---|
bool | It returns true when gaze tracking is working, false when gaze tracking is stopped. |
Example
bool isTracking = GazeTracker.isTracking();
setTrackingFPS
public static bool setTrackingFPS(int fps)
The parameter that sets the FPS of the gaze tracking source.
Its value should bigger than 0
and no more than 30
.
FPS can be dropped due to device spec. The default value is 30
.
Parameters | Type | Description |
---|---|---|
fps | int | Custom FPS(Frame Per Second) for gaze tracking |
Return Type | Description |
---|---|
bool | success |
Example
GazeTracker.setTrackingFPS(20);
setAttentionInterval
public static void setAttentionInterval(int interval)
Set time interval for the UserStatus Attention
callback.
The UserStatus Attention
score will be calculated for the given time interval
.
The beginning and ending timestamps are passed through the onAttention
callback as timestampBegin
and timestampEnd
.
The interval
range is 10 to 60 (seconds), and the default value is 30
seconds.
Parameters | Type | Description |
---|---|---|
interval | int | Time interval for the UserStatus Attention score. |
Example
GazeTracker.setAttentionInterval(30);
getAttentionScore
public static float getAttentionScore()
Get current Attention
score from the GazeTracker
.
This API does not provide timestamp
of the Attention
score data.
Use onAttention
callback, unless the Attention
score is required at a specific time/location.
Return Type | Description |
---|---|
float | Attention score. |
Example
float score = GazeTracker.getAttentionScore();
setAttentionRegion
public static void setAttentionRegion(float left, float top, float right, float bottom)
Set Attention ROI
Parameters | Type | Description |
---|---|---|
left | float | Left boundary of attention region. |
top | float | Top boundary of attention region. |
right | float | Right boundary of attention region. |
bottom | float | Bottom boundary of attention region. |
Device screen region is set as default.
Example
// Set attention region that (x,y) = (100,100), (width, height) = 100,100
GazaTracker.setAttentionRegion(100,100,200,200)
getAttentionRegion
public static float[] getAttentionRegion()
Return Type | Description |
---|---|
float[] | If the region is not set, returns an empty array. Otherwise, returns left , top , right , bottom passed from setAttentionRegion |
removeAttentionRegion
public static void removeAttentionRegion()
Remove Attention ROI
setForcedOrientation
public static void setForcedOrientation(UIInterfaceOrientation orientation)
Set the forced device orientation for the GazeTracker. This function sets the orientation of the device forcibly for certain situations. Specifically, when the device is in portrait lock mode and the developer wants to rotate it to landscape mode, the gaze coordinates also need to be rotated. However, the function only works when not in the calibration process, meaning that the device's orientation cannot be forcibly changed during calibration.
Parameters | Type | Description |
---|---|---|
orientation | UIInterfaceOrientation | The forced device orientation. |
Example
GazeTracker.setForcedOrientation(UIInterfaceOrientation.LANDSCAPE_LEFT);
resetForcedOrientation
public static void resetForcedOrientation()
Reset the forced device orientation for the GazeTracker.
This function resets the orientation of the device that was forcibly set by the setForcedOrientation
function.
After this function is called, the device orientation will no longer be forcibly controlled, and the gaze coordinates will be determined based on the actual device orientation.
However, this function only works when not in the calibration process, meaning that the device's orientation cannot be forcibly changed during calibration.
Example
GazeTracker.resetForcedOrientation();
startCalibration
public static bool startCalibration(CalibrationModeType calibrationModeType, float left, float top, float right, float bottom)
public static bool startCalibration(CalibrationModeType mode, AccuracyCriteria criteria)
public static bool startCalibration(float left, float top, float right, float bottom)
public static bool startCalibration()
Parameters | Type | Description |
---|---|---|
calibrationModeType | CalibrationModeType | Can select the calibration option. DEFAULT(=FIVE_POINT), ONE_POINT, FIVE_POINT, SIX_POINT. |
left | float | Region that needs calibration. The unit is px . |
top | float | Region that needs calibration. The unit is px . |
right | float | Region that needs calibration. The unit is px . |
bottom | float | Region that needs calibration. The unit is px . |
criteria | AccuracyCriteria | Option that manage calibration process and accuracy. Three options - DEFAULT, LOW, HIGH - are available. Default is DEFAULT . |
Return Type | Description |
---|---|
bool | It returns true when parameters are valid. The false return will block the calibration process. |
Example
void onCalibrationNextPoint(float x, float y)
{
Debug.Log("onCalibrationNextPoint" + x + "," + y);
calibrationX = _convertCoordinateX(x);
calibrationY = _convertCoordinateY(y);
isNextStepReady = true;
}
void onCalibrationProgress(float progress)
{
Debug.Log("onCalibrationProgress" + progress);
calibrationProgress = progress;
}
void onCalibrationFinished(double[] calibrationData)
{
Debug.Log("OnCalibrationFinished" + calibrationData.Length);
isCalibrationFinished = true;
}
GazeTracker.setCalibrationCallback(onCalibrationNextPoint, onCalibrationProgress, onCalibrationFinished);
bool success = GazeTracker.startCalibration();
stopCalibration
public static void stopCalibration()
Example
GazeTracker.stopCalibration();
startCollectSamples
public static bool startCollectSamples()
This relies on the coordinates of the target point which should be displayed when calibration is in progress at the function: CalibrationDelegate.onCalibrationNextPoint
.
You should display the coordinates on the screen and call startCollectSamples
for calibration.
Return Type | Description |
---|---|
boolean | It returns true when parameters are valid |
Example
if (isNextStepReady)
{
isNextStepReady = false;
GazeTracker.startCollectSamples();
}
setCalibrationData
public static bool setCalibrationData(double[] calibrationData)
Set existing calibration data to gazeTracker.
Parameters | Type | Description |
---|---|---|
calibrationData | double[] | Calibration Data |
Return Type | Description |
---|---|
boolean | It returns true when parameters are valid |
Example
void onCalibrationFinished (double[] calibrationData)
{
Debug.Log("calibration is done");
appStorageCalibrationData = calibrationData;
}
// when you restart app etc...
// you can set existing calibration data without new calibration
GazeTracker.setCalibrationData(appStorageCalibrationData);
setCameraPreview
public static void setCameraPreview(float left, float top, float right, float bottom)
Set camera preview to appear in the specified location
For Android, previews used by GazeTracker must be hardware acceleration enabled
Parameters | Type | Description |
---|---|---|
left | float | Region that needs camera preview. The unit is px . |
top | float | Region that needs camera preview. The unit is px . |
right | float | Region that needs camera preview. The unit is px . |
bottom | float | Region that needs camera preview. The unit is px . |
Example
GazeTracker.setCameraPreview(previewLeft, previewTop, previewRight, previewBottom);
removeCameraPreview
public static void removeCameraPreview()
Remove camera preview
Example
GazeTracker.removeCameraPreview();
setCameraPreviewAlpha
public static void setCameraPreviewAlpha(float alpha)
Adjust the alpha value of the camera preview.
Parameters | Type | Description |
---|---|---|
alpha | float | Camera preview alpha (0.0f ~ 1.0f) |
Example
GazeTracker.setCameraPreviewAlpha(0.5f);
setStatusCallback
public static void setStatusCallback(StatusDelegate.onStarted onStarted, StatusDelegate.onStopped onStopped)
Enroll StatusDelegate
delegate implementation to GazeTracker
.
Parameters | Type | Description |
---|---|---|
onStarted | StatusDelegate.onStarted | StatusDelegate onStarted delegate implementation. This will be called when tracking started |
onStopped | StatusDelegate.onStopped | StatusDelegate onStopped delegate implementation. This will be called with error information when tracking stopped |
Example
GazeTracker.setStatusCallback(onStarted, onStoped);
void onStarted()
{
Debug.Log("tracking is started");
}
void onStopped(int error)
{
Debug.Log("tracking is stopped");
if(error == 0) Debug.Log(InitializationErrorType.ERROR_NONE);
if(error == 1) Debug.Log(InitializationErrorType.ERROR_CAMERA_START);
if(error == 2) Debug.Log(InitializationErrorType.ERROR_CAMERA_INTERRUPT);
}
GazeTracker.startTracking();
removeStatusCallback
public static void removeStatusCallback()
Remove all StatusDelegate
implementations registered at GazeTracker
Example
GazeTracker.removeStatusCallback();
setGazeCallback
public static void setGazeCallback(GazeDelegate.onGaze onGaze)
Enroll GazeDelegate
delegate implementation to GazeTracker
.
Parameters | Type | Description |
---|---|---|
onGaze | GazeDelegate.onGaze | GazeDelegate onGaze delegate implementation. |
Example
void onGaze(GazeInfo gazeInfo)
{
Debug.Log("onGaze " + gazeInfo.x + "," + gazeInfo.y);
}
GazeTracker.setGazeCallback(onGaze);
GazeTracker.startTracking();
removeGazeCallback
public void removeGazeCallback()
Remove all GazeDelegate
delegate implementations registered at GazeTracker
Example
GazeTracker.removeGazeCallback();
setFaceCallback
public static void setFaceCallback(FaceDelegate.onFace onFace)
Enroll FaceDelegate
delegate implementation to GazeTracker
.
Parameters | Type | Description |
---|---|---|
onFace | FaceDelegate.onFace | FaceDelegate onFace delegate implementation. |
Example
void onFace(FaceInfo faceInfo)
{
Debug.Log("onFace " + faceInfo.timestamp + "," + faceInfo.score);
}
GazeTracker.setFaceCallback(onFace);
removeFaceCallback
public void removeFaceCallback()
Remove all FaceDelegate
delegate implementations registered at GazeTracker
Example
GazeTracker.removeFaceCallback();
setCalibrationCallback
public void setCalibrationCallback(
CalibrationDelegate.onCalibrationNextPoint onCalibrationNextPoint
CalibrationDelegate.onCalibrationProgress onCalibrationProgress
CalibrationDelegate.onCalibrationFinished onCalibrationFinished
)
Enroll CalibrationDelegate
delegate implementation to GazeTracker
.
Parameters | Type | Description |
---|---|---|
onCalibrationNextPoint | CalibrationDelegate.onCalibrationNextPoint | CalibrationDelegate onCalibrationNextPoint delegate implementation. |
onCalibrationProgress | CalibrationDelegate.onCalibrationProgress | CalibrationDelegate onCalibrationProgress delegate implementation. |
onCalibrationFinished | CalibrationDelegate.onCalibrationFinished | CalibrationDelegate onCalibrationFinished delegate implementation. |
Example
void onCalibrationNextPoint (float x, float y)
{
Debug.Log("current step calibration point will be positioned to " + x + "," + y);
// draw calibration point to x,y in Main Thread
// then call startCollectSamples
// GazeTracker.startCollectSamples();
}
void onCalibrationProgress (float progress)
{
Debug.Log("current point's calibration progress: ");
}
void onCalibrationFinished (double[] calibrationData)
{
Debug.Log("calibration is done");
}
GazeTracker.setCalibrationCallback(onCalibrationNextPoint, onCalibrationProgress, onCalibrationFinished);
GazeTracker.startCalibration();
removeCalibrationCallback
public void removeCalibrationCallback()
Remove all CalibrationDelegate
delegate implementations registered at GazeTracker
Example
GazeTracker.removeCalibrationCallback();
setUserStatusCallback
public static void setUserStatusCallback(UserStatusDelegate.onAttention onAttention, UserStatusDelegate.onBlink onBlink, UserStatusDelegate.onDrowsiness onDrowsiness)
Enroll UserStatusDelegate
delegate implementation to GazeTracker
.
Parameters | Type | Description |
---|---|---|
onAttention | UserStatusDelegate.onAttention | UserStatusDelegate onAttention delegate implementation. |
onBlink | UserStatusDelegate.onBlink | UserStatusDelegate onBlink delegate implementation. |
onDrowsiness | UserStatusDelegate.onDrowsiness | UserStatusDelegate onDrowsiness delegate implementation. |
Example
void onAttention(long timestampBegin, long timestamEnd, float score)
{
Debug.Log("onAttention " + score);
}
void onBlink(long timestamp, bool isBlinkLeft, bool isBlinkRight, bool isBlink, float leftOpenness, float rightOpenness)
{
Debug.Log("onBlink " + isBlinkLeft + ", " + isBlinkRight + ", " + isBlink);
}
void onDrowsiness(long timestamp, bool isDrowsiness, double intensity)
{
Debug.Log("onDrowsiness " + isDrowsiness);
}
GazeTracker.setUserStatusCallback(onAttention, onBlink, onDrowsiness);
GazeTracker.startTracking();
removeUserStatusCallback
public void removeUserStatusCallback()
Remove all UserStatusDelegate
delegate implementations registered at GazeTracker
Example
GazeTracker.removeUserStatusCallback();
isDeviceFound
public static bool isDeviceFound()
Return Type | Description |
---|---|
boolean | if it was true, device was founded. iOS always false |
Example
boolean isFound = GazeTracker.isDeviceFound();
addCameraPosition
public static void addCameraPosition(CameraPosition cameraPosition)
Add CameraPosition to GazeTracker instance.
Parameters | Type | Description |
---|---|---|
cameraPosition | CameraPosition | CameraPosition class |
Example
CameraPosition cameraPosition = new CameraPosition("SM-T720", -72f, -4f, false);// tab s5e
GazeTracker.addCameraPosition(cameraPosition);
getCameraPosition
public CameraPosition getCameraPosition()
Return Type | Description |
---|---|
CameraPosition | CameraPosition class |
Example
CameraPosition cameraPosition = GazeTracker.getCameraPosition();
Debug.Log(cameraPosition.modelName + " : " + cameraPosition.screenOriginX + " : " + cameraPosition.screenOriginY);
getCameraPositionList
public static CameraPosition[] getCameraPositionList()
Return Type | Description |
---|---|
CameraPosition [] | Array of CameraPosition of the device. A device can have multiple CameraPosition (ex. Galaxy Fold) |
Example
CameraPosition[] cameraPositionList = GazeTracker.getCameraPositionList();
for (CameraPosition cameraPosition : cameraPositionList) {
Debug.Log(cameraPosition.modelName + " : " + cameraPosition.screenOriginX + " : " + cameraPosition.screenOriginY);
}
selectCameraPosition
public static void selectCameraPosition(int idx)
Parameters | Type | Description |
---|---|---|
idx | Int | Index of the CameraPosition to use from getCameraPositionList() . |
Example
GazeTracker.selectCameraPosition(0);
InitializationDelegate
public class InitializationDelegate
Summary
function |
---|
onInitialized |
onInitialized
public delegate void onInitialized(InitializationErrorType error);
This is delegate function being called when GazeTracker.initGazeTracker
function has been called.
See Authentication for more details.
Parameters | Type | Description |
---|---|---|
error | InitializationErrorType | Error code |
Example
GazeTracker.initGazeTracker("key", onInitialized);
void onInitialized(InitializationErrorType error)
{
...
}
StatusDelegate
public class StatusDelegate
onStarted
public delegate void onStarted()
The function calld automatically after startTracking of GazeTracker object succeeds. Calibration is available after this call.
Example
void onStarted()
{
Debug.Log("onStarted");
isTracking = true;
}
void onStopped(StatusErrorType error)
{
Debug.Log("onStopped with error : " + error);
isTracking = false;
}
GazeTracker.setStatusCallback(onStarted, onStopped);
GazeTracker.startTracking();
onStopped
public delegate void onStopped(StatusErrorType error)
Parameters | Type | Description |
---|---|---|
error | StatusErrorType | ERROR_NONE , ERROR_CAMERA_START , ERROR_CAMERA_INTERRUPT . |
Example
void onStarted()
{
Debug.Log("onStarted");
isTracking = true;
}
void onStopped(StatusErrorType error)
{
Debug.Log("onStopped with error : " + error);
isTracking = false;
}
GazeTracker.setStatusCallback(onStarted, onStopped);
GazeTracker.startTracking();
GazeDelegate
public class GazeDelegate
onGaze
public delegate void onGaze(GazeInfo gazeInfo)
Parameters | Type | Description |
---|---|---|
gazeInfo | GazeInfo | GazeInfo |
example
void onGaze(GazeInfo gazeInfo)
{
Debug.Log("onGaze " + gazeInfo.timestamp + "," + gazeInfo.x + "," + gazeInfo.y + "," + gazeInfo.trackingState + "," + gazeInfo.eyeMovementState + "," + gazeInfo.screenState);
}
GazeTracker.setGazeCallback(onGaze);
GazeTracker.startTracking();
CalibrationDelegate
public class CalibrationDelegate
onCalibrationNextPoint
public delegate void onCalibrationNextPoint(float x, float y)
The x, y coordinate value of the gaze point that should be focused on during the calibration process. A proper UI should be displayed on the screen to notify the calibration target point. You should call startCollectSamples to process the calibration.
Parameters | Type | Description |
---|---|---|
x | float | The x coordinate value of the gaze point that should be focused on during the calibration process. Origin is the device screen. The unit is pixel(px ). |
y | float | The y coordinate value of the gaze point that should be focused on during the calibration process. Origin is the device screen. The unit is pixel(px ). |
Example
void onCalibrationNextPoint (float x, float y)
{
Debug.Log("current step calibration point will be positioned to " + x + "," + y);
// draw calibration point to x,y in Main Thread
// then call startCollectSamples
// GazeTracker.startCollectSamples();
}
void onCalibrationProgress (float progress)
{
// Debug.Log("current point's calibration progress: " + progress);
}
void onCalibrationFinished (double[] calibrationData)
{
// Debug.Log("calibration is done");
}
GazeTracker.setCalibrationCallback(onCalibrationNextPoint, onCalibrationProgress, onCalibrationFinished);
GazeTracker.startCalibration();
onCalibrationProgress
public delegate void onCalibrationProgress(float progress)
This is callback function that represents the calibration progression. The value will be between 0.0~1.0. The value start increases when startCollectSamples function executed.
For UX, visualize the calibration progression with proper UI is recommended.
Parameters | Type | Description |
---|---|---|
progress | float | Calibration progression for each point. |
Example
void onCalibrationNextPoint (float x, float y)
{
//Debug.Log("current step calibration point will be positioned to " + x + "," + y);
// draw calibration point to x,y in Main Thread
// then call startCollectSamples
// GazeTracker.startCollectSamples();
}
void onCalibrationProgress (float progress)
{
Debug.Log("current point's calibration progress: " + progress);
}
void onCalibrationFinished (double[] calibrationData)
{
//Debug.Log("calibration is done");
}
GazeTracker.setCalibrationCallback(onCalibrationNextPoint, onCalibrationProgress, onCalibrationFinished);
GazeTracker.startCalibration();
onCalibrationFinished
public delegate void onCalibrationFinished(double[] calibrationData)
This is callback function that notify if all calibration steps are finished.
The calibrationData is passed as a parameter, it has already been applied to GazeTracker.
You can save or load this calibration data directly into GazeTracker without new calibration process by calling setCalibrationData(calibrationData) when restarting the app etc..
Parameters | Type | Description |
---|---|---|
calibrationData | double[] | Calibration Data |
Example
void onCalibrationNextPoint (float x, float y)
{
//Debug.Log("current step calibration point will be positioned to " + x + "," + y);
// draw calibration point to x,y in Main Thread
// then call startCollectSamples
// GazeTracker.startCollectSamples();
}
void onCalibrationProgress (float progress)
{
// Debug.Log("current point's calibration progress: " + progress);
}
void onCalibrationFinished (double[] calibrationData)
{
Debug.Log("calibration is done");
// Delete Calibration Point
// The gaze data became robust!
}
GazeTracker.setCalibrationCallback(onCalibrationNextPoint, onCalibrationProgress, onCalibrationFinished);
GazeTracker.startCalibration();
UserStatusDelegate
public class UserStatusDelegate
The User Status includes Attention
, Drowsiness
, and Blink
.
-
Attention: How much the user attention is focused on the screen content for
interval
time (0.0 ~ 1.0) -
Drowsiness: If the user feel drowsiness (True/False)
-
Blink: If the user blink eyes (left eye, right eye, general(both eyes))
onAttention
public void onAttention(long timestampBegin, long timestampEnd, float score)
Parameters | Type | Description |
---|---|---|
timestampBegin | long | Beginning Timestamp of the data. |
timestampEnd | long | Ending Timestamp of the data. |
score | float | User Attention rate score between the timestamps. |
Example
void onAttention(long timestampBegin, long timestamEnd, float score)
{
userStatusAttention = "" + score;
Debug.Log("onAttention " + score);
}
GazeTracker.setUserStatusCallback(onAttention, onBlink, onDrowsiness);
onDrowsiness
public delegate void onDrowsiness(long timestamp, bool isDrowsiness, double intensity)
Parameters | Type | Description |
---|---|---|
timestamp | long | Timestamp of the data. |
isDrowsiness | bool | User Drowsiness flag. |
intensity | double | Level of drowsiness intensity (0 to 1) |
Example
void onDrowsiness(long timestamp, bool isDrowsiness)
{
userStatusDrowsiness = "" + isDrowsiness;
Debug.Log("onDrowsiness " + isDrowsiness);
}
GazeTracker.setUserStatusCallback(onAttention, onBlink, onDrowsiness);
onBlink
public delegate void onBlink(long timestamp, bool isBlinkLeft, bool isBlinkRight, bool isBlink, float leftOpenness, float rightOpenness)
Parameters | Type | Description |
---|---|---|
timestamp | long | Timestamp of the data. |
isBlinkLeft | bool | User Left Blink flag. |
isBlinkRight | bool | User Right Blink flag. |
isBlink | bool | User Blink flag. |
leftOpenness | float | User left eye-openness rate. |
rightOpenness | float | User right eye-openness rate. |
Example
void onBlink(long timestamp, bool isBlinkLeft, bool isBlinkRight, bool isBlink, float leftOpenness, float rightOpenness)
{
userStatusBlink = "blink : " + isBlink;
Debug.Log("onBlink " + isBlinkLeft + ", " + isBlinkRight + ", " + isBlink);
}
GazeTracker.setUserStatusCallback(onAttention, onBlink, onDrowsiness);
GazeInfo
public class GazeInfo
{
public long timestamp;
public float x;
public float y;
public float fixationX;
public float fixationY;
public float leftOpenness;
public float rightOpenness;
public TrackingState trackingState;
public EyeMovementState eyeMovementState;
public ScreenState screenState;
}
Summary
Variables | type | description |
---|---|---|
timestamp | long | Timestamp of gaze point. The unit is millisecond. The time format is UTC. |
x | float | x, y coordinate value of gaze point. Origin is device screen. The unit is pixel |
y | float | x, y coordinate value of gaze point. Origin is device screen. The unit is pixel |
fixationX | float | x coordinate value of last fixation point. Origin is device screen. The unit is in point(px). |
fixationY | float | y coordinate value of last fixation point. Origin is device screen. The unit is in point(px). |
leftOpenness | float | openness degree of left eye(0.0~1.0). value will only return when userStatusOption in on |
rightOpenness | float | openness degree of right eye(0.0~1.0). value will only return when userStatusOption in on |
trackingState | TrackingState | SUCCESS , LOW_CONFIDENCE , UNSUPPORTED , FACE_MISSING |
eyeMovementState | EyeMovementState | FIXATION , SACCADE , UNKNOWN |
screenState | ScreenState | INSIDE_OF_SCREEN , OUTSIDE_OF_SCREEN , UNKNOWN |
FaceInfo
public class FaceInfo
{
public long timestamp;
public float score;
public float frameWidth;
public float frameHeight;
public Rect rect;
public float pitch;
public float yaw;
public Vector3 centerXYZ;
}
Summary
Variables | type | description |
---|---|---|
timestamp | long | Timestamp of gaze point. The unit is millisecond. The time format is UTC. |
score | float | Value of facial recognition confidence (0.0 ~ 1.0). |
frameWidth | float | camera frame width size. |
frameHeight | float | camera frame height size. |
rect | Rect | Indicates the position of the face in the camera frame. |
pitch | float | Degree of vertical tilt of the face. |
yaw | float | Degree of horizontal tilt of the face. |
centerXYZ | Vector3 | The x,y,z distance of the center of the face from the camera. The unit is mm. |
UserStatusOption
public class UserStatusOption
The class contains User Status
options information for GazeTracker
Summary
functions |
---|
isUseAttention |
isUseBlink |
isUseDrowsiness |
useAttention |
useBlink |
useDrowsiness |
useAll |
isUseAttention
Return Type | Description |
---|---|
bool | Return true if Attention flag is on, otherwise return false . |
isUseBlink
Return Type | Description |
---|---|
bool | Return true if Blink flag is on, otherwise return false . |
isUseDrowsiness
Return Type | Description |
---|---|
bool | Return true if Drowsiness flag is on, otherwise return false . |
useAttention
Set Attention flag.
useBlink
Set Blink flag.
useDrowsiness
Set Drowsiness flag.
useAll
Set All User Status flag.
CameraPosition
public class CameraPosition
{
public string modelName;
public float screenOriginX;
public float screenOriginY;
public bool cameraOnLongerAxis;
}
This class indicates the relative position from the camera to the screen origin. GazeTracker uses the information to calculate gaze coordinate.
For more information, see gaze coordinate
Summary
Variables | type | description |
---|---|---|
modelName | String | Device model name |
screenOriginX | float | X's Distance from the camera to the top left corner of the screen (mm) |
screenOriginY | float | Y's Distance from the camera to the top left corner of the screen (mm) |
cameraOnLongerAxis | bool | A bool value representing when the camera is placed on the device's long axis. |
InitializationErrorType
public enum InitializationErrorType
The enum that contains error types of InitializationDelegate.
Please read : Authentication for more details.
StatusErrorType
public enum StatusErrorType
The enum that contains error types of StatusDelegate
Name | Description |
---|---|
ERROR_NONE | Succeed without error |
ERROR_CAMERA_START | GazeTracker.startTracking is called but the front camera of the device is not available |
ERROR_CAMERA_INTERRUPT | The camera stream is disturbed(i.e. used by other applications) or the application running at the background |
TrackingState
public enum TrackingState
The enum that contains state types using at GazeInfo
.
Name | Description |
---|---|
SUCCESS | Face alignment is in a best position (Gaze tracking success, with valid x and y) |
LOW_CONFIDENCE | Face alignment is not in the best position, but can be used for tracking (Gaze tracking success, with less accurate x and y) |
UNSUPPORTED | Face alignment is not suitable for tracking (Gaze tracking fail, with invalid x and y) |
FACE_MISSING | Face is missing (Gaze tracking fail) |
EyeMovementState
public enum EyeMovementState
The Enum that contains eye movement state types using at GazeInfo
Name | Description |
---|---|
FIXATION | Gazes from the past and the gazes up to the present have made a fixation |
SACCADE | Gazes from the past and the gazes up to the present have formed a saccade |
UNKNOWN | Not fixation or saccade |
ScreenState
public enum ScreenState
The Enum that contains screen state types using at GazeInfo
Name | Description |
---|---|
INSIDE_OF_SCREEN | Gaze tracking succeeds and the gaze point is inside of the device screen |
OUTSIDE_OF_SCREEN | Gaze tracking succeeds and the gaze point is outside of the device screen |
UNKNOWN | Gaze tracking failed |
CalibrationModeType
public enum CalibrationModeType
The enum that contains mode of startCalibartion
.
Name | Description |
---|---|
DEFAULT | Set to the recommended mode. In the current version, Five-point calibration mode |
ONE_POINT | One-point calibration mode |
FIVE_POINT | Five-point calibration mode |
SIX_POINT | Six-point calibration mode |
AccuracyCriteria
public enum AccuracyCriteria
The enum that contains accuracy criteria of startCalibartion
.
Name | Description |
---|---|
DEFAULT | Default calibration accuracy criteria |
LOW | Low calibration accuracy criteria |
HIGH | High calibration accuracy criteria |
UIInterfaceOrientation
public enum UIInterfaceOrientation
Constants that specify the orientation of the app's user interface.
Name | Description |
---|---|
UNKNOWN | The orientation of the device is unknown. (Not available for use.) |
PORTRAIT | The device is in portrait mode, with the device upright and the Home button on the bottom. |
PORTRAIT_UPSIDE_DOWN | The device is in portrait mode but is upside down, with the device upright and the Home button at the top. |
LANDSCAPE_RIGHT | The device is in landscape mode, with the device upright and the Home button on the right. |
LANDSCAPE_LEFT | The device is in landscape mode, with the device upright and the Home button on the left. |