#
.NET API Documentation
Namespace: Realeyes.EmotionTracking
#
EmotionTracker class
#
class EmotionTracker
The Emotion Tracker class. Implements IDisposable.
#
EmotionTracker(string modelPath, int maxConcurrency = 0)
public EmotionTracker(string modelPath, int maxConcurrency = 0)
EmotionTracker constructor: loads model file, sets up the processing.
Parameters:
modelPath(string) - Path to the tracking model file (.realZ)maxConcurrency(int) - Maximum concurrency (0 for automatic/all cores), default: 0
Throws:
ArgumentNullException- When modelPath is nullEmotionTrackingException- When model loading fails
#
TrackAsync(ImageHeader imageHeader, TimeSpan timestamp)
public Task<TrackingResult> TrackAsync(ImageHeader imageHeader, TimeSpan timestamp)
Tracks emotions in an image asynchronously. Multiple images can be submitted for processing without waiting, and results can be awaited later, allowing for concurrent processing, but the frames must be submitted in chronological order.
Parameters:
imageHeader(ImageHeader) - Image to processtimestamp(TimeSpan) - Timestamp of the image
Returns: Task
Throws:
EmotionTrackingException- When tracking fails
Example:
var tracker = new EmotionTracker("model.realZ");
// Submit multiple images for processing
var task1 = tracker.TrackAsync(image1, TimeSpan.FromMilliseconds(0));
var task2 = tracker.TrackAsync(image2, TimeSpan.FromMilliseconds(33));
var task3 = tracker.TrackAsync(image3, TimeSpan.FromMilliseconds(66));
// Await results
var result1 = await task1;
var result2 = await task2;
var result3 = await task3;
#
ResetTracking()
public void ResetTracking()
Resets the internal tracking state. Should be called when a new video sequence starts.
#
GetEmotionIDs()
public EmotionID[] GetEmotionIDs()
Gets the emotion IDs provided by the loaded model.
Returns: EmotionID[] -- Array of emotion IDs
#
GetEmotionNames()
public string[] GetEmotionNames()
Gets the names of emotions provided by the loaded model.
Returns: string[] -- Array of emotion names
#
IsEmotionEnabled(EmotionID emotionId)
public bool IsEmotionEnabled(EmotionID emotionId)
Checks if a specific emotion is enabled for tracking.
Parameters:
emotionId(EmotionID) - The emotion ID to check
Returns: bool -- True if enabled, false otherwise
#
SetEmotionEnabled(EmotionID emotionId, bool enabled)
public void SetEmotionEnabled(EmotionID emotionId, bool enabled)
Enables or disables tracking for a specific emotion.
Parameters:
emotionId(EmotionID) - The emotion ID to configureenabled(bool) - True to enable, false to disable
#
Dispose()
public void Dispose()
Releases resources used by the tracker.
#
GetSdkVersion()
public static Version GetSdkVersion()
Gets the SDK version.
Returns: Version -- SDK version information
#
GetSdkVersionString()
public static string GetSdkVersionString()
Gets the SDK version as a string.
Returns: string -- SDK version string
#
ConcurrentCalculations
public int ConcurrentCalculations { get; }
Gets the number of concurrent calculations.
#
IsFaceTrackingEnabled
#
ImageFormat enum
#
enum ImageFormat
Values:
Grayscale = 0RGB = 1RGBA = 2BGR = 3BGRA = 4
#
ImageHeader struct
#
struct ImageHeader
The ImageHeader readonly record struct.
Properties:
Data(byte[]) - Image data.Width(int) - Width of image.Height(int) - Height of image.Stride(int) - Stride of image.Format(ImageFormat) - Format of image.
#
Result classes
#
class EmotionTrackingException
Exception thrown when emotion tracking operations fail. Inherits from Exception.
#
class TrackingResult
Contains the results after a successful tracking.
Properties:
Landmarks(LandmarkData) - Landmark data from face tracking.Emotions(Emotions) - Detected emotion data.
#
class Emotions
Record containing individual emotion detection results. Each property is nullable EmotionData.
Properties:
Confusion(EmotionData?)Contempt(EmotionData?)Disgust(EmotionData?)Fear(EmotionData?)Happy(EmotionData?)Empathy(EmotionData?)Surprise(EmotionData?)Attention(EmotionData?)Presence(EmotionData?)EyesOnScreen(EmotionData?)FaceDetection(EmotionData?)
#
class LandmarkData
Contains information about face landmarks.
Properties:
Scale(double)Roll(double)Yaw(double)Pitch(double)Translate(Point2d)Landmarks2d(Point2d[])Landmarks3d(Point3d[])IsGood(bool)
#
class EmotionData
Contains information about a specific emotion detection.
Properties:
Probability(double)IsActive(bool)IsDetectionSuccessful(bool)
#
struct Point2d
Readonly record struct representing a 2D point.
Properties:
X(double)Y(double)
#
struct Point3d
Readonly record struct representing a 3D point.
Properties:
X(double)Y(double)Z(double)
#
struct Version
Readonly record struct representing SDK version information.
Properties:
Major(int)Minor(int)Patch(int)
#
EmotionID enum
#
enum EmotionID
Enum representing emotion types.
Values:
Confusion = 0Contempt = 1Disgust = 2Fear = 3Happy = 4Empathy = 5Surprise = 6Attention = 100Presence = 101EyesOnScreen = 102FaceDetection = 103