Java API Documentation (Experimental)

Tracker interface

public interface Tracker

The Tracker interface

public TrackerResultFuture track(ImageHeader imageHeader, long timestamp)

Tracks the given frame asynchronously with the TrackerResultFuture API.

Note

Calling this function is non-blocking, so calling it again with the next frame without waiting for the result is possible. Also see get_concurrent_calculations().

Parameters:
  • imageHeader – image descriptor

  • timestamp – timestamp of the image (in ms)

public java.util.List<EmotionID> getEmotionIDs()

Returns the emotion IDs provided by the loaded model. The order is the same as returned by ResultType.getEmotions().

See also: ResultType

public java.util.List<String> getEmotionNames()

Returns the emotion names provided by the loaded model. The order is the same as returned by ResultType.getEmotions().

See also: ResultType

public float getMinimumFaceRatio()

Gets the current minimum face ratio

See also: setMinimumFaceRatio

public void setMinimumFaceRatio(float minimumFaceRatio)

Sets the minimum face ratio

The minimum face ratio defines the minimum face size the algorithm is looking for. The actual size is calculated from the smaller image dimension multiplied by the set minimum face ratio. The default value is 1/4.8, i.e., in case of VGA resolution input (640x480), the minimum face size is 100x100.

Warning

The shape alignment and classifier performance can degrade in case of low resolution, tracking faces smaller than 75x75 is ill advised.

Parameters:
  • minimumFaceRatio – new minimum face size as a ratio of the smaller image dimension

public boolean isFaceTrackingEnabled()

Returns wether the face tracker is enabled

public void setFaceTrackingEnabled(boolean enable)

Sets the face tracker to be enabled or disabled

Parameters:
  • enable – boolean to set to

public boolean isEmotionEnabled(EmotionID emoID)

Returns wether the specified emotion is enabled

Parameters:
  • emoID – emotion to query

public void setEmotionEnabled(EmotionID emoID, boolean enable)

Sets the specified emotion to enabled or disabled

Parameters:
  • emoID – emotion to set

  • enable – boolean to set to

public String getModelName()

Returns the name (version etc) of the loaded model.

Returns:

name of the model

public Version getSdkVersion()

Returns the version of the SDK (and not the model)

Returns:

version of the SDK

public String getSdkVersionString()

Returns the version string of the SDK (and not the model)

Returns:

version string of the SDK

NelTracker class

public class NelTracker implements Tracker

The NEL Tracker class which implements the tracker interface

public NelTracker(String modelFile)

Constructor

Parameters:
  • modelFile (str) – path for the used model

public NelTracker(String modelFile, int max_concurrency)

Constructor

Parameters:
  • modelFile (str) – path for the used model

  • max_concurrency (int) – maximum allowed concurrency, 0 means automatic (using all cores), default: 0

ImageHeader class

public class ImageHeader

Descriptor class for image data (non-owning)

public ImageHeader()

Constructor

public java.nio.ByteBuffer getData()
Returns:

pointer to the byte array of the image

public void setData(java.nio.ByteBuffer value)
Parameters:
  • value – pointer to the byte array of the image

public ImageFormat getFormat()
Returns:

image format

public void setFormat(ImageFormat value)
Parameters:
  • value – image format

public int getHeight()
Returns:

height of the image in pixels

public void setHeight(int value)
Returns:

height of the image in pixels

public int getStride()
Returns:

length of one row of pixels in bytes (e.g: 3*width + padding)

public void setStride(int value)
Parameters:
  • value – length of one row of pixels in bytes (e.g: 3*width + padding)

public int getWidth()
Returns:

width of the image in pixels

public void setWidth(int value)
Parameters:
  • value – width of the image in pixels

public enum ImageFormat
public static final ImageFormat BGR

24-bit BGR

public static final ImageFormat BGRA

32-bit BGRA or 32-bit BGR_

public static final ImageFormat Grayscale

8-bit grayscale

public static final ImageFormat RGB

24-bit RGB

public static final ImageFormat RGBA

32-bit RGBA or 32-bit RGB_

Result classes

EmotionID

public enum EmotionID

IDs for the supported emotions/behaviours

public static final EmotionID ATTENTION
public static final EmotionID CONFUSION
public static final EmotionID CONTEMPT
public static final EmotionID DISGUST
public static final EmotionID EMPATHY
public static final EmotionID FEAR
public static final EmotionID HAPPY
public static final EmotionID PRESENCE
public static final EmotionID SURPRISE
public static final EmotionID EYES_ON_SCREEN
public static final EmotionID FACE_DETECTION

TrackerResultFuture

public interface TrackerResultFuture

Simple wrapper over the C++ future class

ResultType get()

Blocks until the future is ready and returns the result.

ResultType

public interface ResultType

The ResultType struct.

java.util.List<EmotionData> getEmotions()

Detected emotions.

LandmarkData getLandmarks()

Tracked landmarks.

LandmarkData

public interface LandmarkData
double getScale()

Scale of the face.

double getRoll()

Roll pose angle.

double getPitch()

Pitch pose angle.

double getYaw()

Yaw pose angle.

Point2d getTranslate()

Position of the head center in image coordinates.

java.util.List<Point2d> getLandmarks2d()

Positions of the 49 landmarks, in image coordinates.

java.util.List<Point3d> getLandmarks3d()

Positions of the 49 landmarks, in an un-scaled face-centered 3D space.

boolean getIsGood()

Whether the tracking is good quality or not.

Point2d

public interface Point2d
double getX()
double getY()

Point3d

public interface Point3d
long Point3d_GetInterfaceCPtr()
double getX()
double getY()
double getZ()

EmotionData

public interface EmotionData
EmotionID getEmotionID()

ID of the emotion.

boolean getIsActive()

Whether the probability is higher than an internal threshold.

boolean getIsDetectionSuccessful()

Whether the tracking quality was good enough to reliable detect this emotion.

double getProbability()

Probability of the emotion.