```html
![]() |
Audience Measurement Engine
1.0
|
The Audience Measurement Engine is a C++ computer vision library that measures how people interact with a product or display that appears in a camera image (for example a shop window, a product stand, or a digital signage screen). It processes video frames, detects faces, estimates gaze and emotions, and produces both enriched images and numeric indicators that can be consumed by an analytics layer.
At a high level, the engine answers three key questions for a configured region of interest in the scene:
Internally, the Audience Measurement Engine builds on a small set of core components:
EngineBase that wires together face detection, face mesh, gaze estimation, and emotion classification into a single processing pipeline exposed via init() and process().core::face::FaceDetectorYunet — finds faces in the input frame using OpenCV’s DNN-based YuNet detector.core::face::FaceMesh — predicts dense facial landmarks for each detected face.core::filter::LandmarkFlowFilter — tracks landmarks over time using optical flow to obtain stable trajectories in video.core::filter::PoseKalmanFilter (used by gaze modules) — smooths noisy pose estimates with a Kalman filter.gaze::HeadGazeEstimation — estimates 3D head pose and gaze direction.gaze::EyeGazeEstimation — refines gaze using eye-region landmarks and also estimates eye openness.gaze::GazeEstimation — wrapper that combines head and eye gaze into a single interface used by the engine.core::NeuralBase — common infrastructure for loading, configuring and running OpenCV DNN models.core::NeuralClassifierBase — convenience wrapper that runs a classification network and returns a map of class probabilities.core::face::EmotionClassifier — concrete classifier for facial emotions; its outputs are normalized by AudienceMeasurementEngine::normalizeMap() and aggregated over time.visualization namespace:
FaceDrawer).
For each incoming frame, AudienceMeasurementEngine::process() executes the following steps:
core::Detection objects with bounding boxes and (optionally) sparse landmarks.The engine is designed to be embedded into a host application that acquires video frames from a camera and forwards them to the processing pipeline. A minimal integration in C++ looks like this:
AudienceMeasurementEngine engine;
// Load models, configuration files and visual assets from a resource folder.
engine.init("path/to/resources");
cv::Mat inputFrame;
cv::Mat outputFrame;
for (;;)
{
// 1. Grab a frame from the camera into inputFrame.
// 2. Process the frame with the engine.
engine.process(inputFrame, outputFrame);
// 3. Display or stream outputFrame, and collect exported metrics
// (viewer counts, attention scores, emotion statistics).
}
The resource directory passed to init() typically contains the neural network model files (for face detection, face mesh, gaze, emotion recognition), class label files, and any visual assets required by the on-frame overlays.
visualization and core.AudienceMeasurementEngine, EngineBase, EmotionClassifier, and the gaze-related components.Together, these pages give a detailed view of how the Audience Measurement Engine is implemented and how to integrate it into your own applications.