```html Audience Measurement Engine: Main Page
Audience Measurement Engine  1.0
Audience Measurement Engine Documentation

Overview

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:

Main capabilities

Architecture and key components

Internally, the Audience Measurement Engine builds on a small set of core components:

Processing pipeline

For each incoming frame, AudienceMeasurementEngine::process() executes the following steps:

  1. Pre-processing — resize and pad the input frame to the working resolution and color format expected by the underlying models.
  2. Face detection — run face detection and create core::Detection objects with bounding boxes and (optionally) sparse landmarks.
  3. Landmarks and pose — refine landmarks with the face mesh network, track them over time, and estimate head pose.
  4. Gaze estimation — compute gaze direction and eye openness, which is used to determine whether a viewer is actually looking at the configured region of interest.
  5. Emotion classification — crop the face, run the emotion network, and obtain a probability distribution over the configured emotion classes.
  6. Aggregation — update internal history buffers with the latest attention and emotion scores so that time-based statistics (dwell time, total time per emotion category, trends) can be computed.
  7. Visualization and output — draw optional overlays (halos, info boxes, history charts, watermark) onto an output frame and return it to the caller along with any exported metrics.

Typical usage

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.

Use cases

How to navigate this documentation

Together, these pages give a detailed view of how the Audience Measurement Engine is implemented and how to integrate it into your own applications.

```