![]() |
Heart Rate Engine
1.0
|
The Heart Rate Engine is a software library designed to estimate a person's heart rate in real-time from a standard video stream of their face. This is achieved using a non-invasive technique that analyzes subtle color changes in the skin caused by blood flow (remote photoplethysmography - rPPG). The engine detects a face, tracks a region of interest, and processes the color signal from this region to calculate the beats per minute (BPM).
Sensor instances.core::face::FaceDetectorYunet: The engine first uses this class to robustly detect and locate faces in the input video stream.
core::face::FaceMesh: After detection, this class generates a detailed mesh of facial landmarks. These landmarks are crucial for identifying and tracking a stable Region of Interest (ROI) on the face (e.g., the forehead), which is essential for accurate signal extraction.
core::filter::LandmarkFlowFilter: To ensure the ROI remains stable even with minor head movements, this filter is used to track the facial landmarks smoothly across consecutive frames, preventing signal noise caused by jitter.
HeartRateEngine::init(resourcePath) initializes the engine and all its sub-components, including the face detector and pulse sensor.HeartRateEngine::process(input, output) runs the full pipeline on each frame, performing face detection, updating the pulse sensor, and visualizing the results.PulseSensor::update(frame, userId, landmarks, bpm) is the key function for getting a new heart rate reading. It takes the latest frame and landmarks for a user and updates the internal Sensor, returning the calculated BPM.Sensor::process(frame, mask, bpm) performs the low-level color analysis on a masked facial region to extract the raw pulse signal and compute the heart rate.FaceDetectorYunet::process(frame) finds all faces present in the video frame.FaceMesh::process(frame, detections) provides the detailed facial landmark points for each detected face.The project files are organized in the C:/Projects/Engine/AntalEngine/Engine directory. Key header files include: