API Reference

The SDK’s API is documented per platform, and each page reflects exactly what that platform’s binding exposes β€” nothing more, nothing less. The concepts are the same everywhere (construct a detector, enable features, register a listener, start, process frames), so once you know one binding the others read naturally.

C++ reference

The canonical, most complete surface: detectors, Frame, Face, listeners, the sensor/connector pipeline, and every metric enum.

Python reference

The affvisionpy module: snake_case methods, lowercase enum values, dict metric maps, GIL behavior, and RuntimeError-based error handling.

Android reference

The com.affectiva.vision Java API: detector lifecycle with dispose(), ImageListener results, and the enums nested in Face.

Reading results in each language

The same operation β€” pulling metrics out of the per-frame results callback β€” in each binding’s own idiom:

void onFaceResults(std::map<FaceId, Face> faces, const Frame& frame) override
{
  for (const auto& entry : faces)
  {
    const Face& face = entry.second;
    float smile = face.getExpressions()[Expression::SMILE];
    float joy = face.getEmotions()[Emotion::JOY];
    float yaw = face.getMeasurements()[Measurement::YAW];
  }
}
def results_updated(self, faces, frame):
    for face_id, face in faces.items():
        smile = face.get_expressions()[af.Expression.smile]
        joy = face.get_emotions()[af.Emotion.joy]
        yaw = face.get_measurements()[af.Measurement.yaw]
@Override
public void onImageResults(Map<Integer, Face> faces, Frame frame) {
    for (Face face : faces.values()) {
        Float smile = face.getExpressions().get(Face.Expression.SMILE);
        Float joy = face.getEmotions().get(Face.Emotion.JOY);
        Float yaw = face.getMeasurements().get(Face.Measurement.YAW);
    }
}

Cross-platform naming at a glance

C++PythonAndroid (Java)
Namespace / packageaffdex::visionaffvisionpycom.affectiva.vision
Method naminggetExpressions()get_expressions()getExpressions()
Enum valuesExpression::SMILEaf.Expression.smileFace.Expression.SMILE
Results callbackFaceListener::onFaceResultsFaceListener.results_updatedImageListener.onImageResults
Errorsaffdex::ExceptionRuntimeErrorAffectivaException
Metric mapsstd::map<Enum, float>dictMap<Enum, Float>

Feature availability by platform

CapabilityC++PythonAndroid
Expressions, emotions, measurements, face points, qualitiesβœ“βœ“βœ“
PAIN (continuous, 0–100)βœ“βœ“βœ“
Baseline mode (rolling-average metrics)βœ“βœ“β€”
Sensor / connector pipelineβœ“βœ“β€”
ProcessStatusListenerβœ“βœ“βœ“
Grayscale (GRAY) inputβœ“βœ“β€”
Feature.FACES as an explicit toggleβœ“βœ“β€” (always on)