About This Application
Welcome to the Real-Time Signal Amplification Microscope. This web application demonstrates the principle of Eulerian Video Magnification to reveal subtle, invisible changes in the world around us. Specifically, it is configured to detect minute variations in skin tone caused by the flow of blood, a technique known as remote photoplethysmography (rPPG).
By analyzing the video feed from your webcam, this tool extracts a pulse signal, amplifies it so it becomes visible as a green "throb" in the video, and analyzes it to estimate your heart rate in Beats Per Minute (BPM).
Hardware Compatibility: What if my camera isn't 30 FPS?
Typical webcams operate at 30 Frames Per Second (FPS), but many high-end cameras run at 60 FPS, and older cameras (or cameras in dark rooms) may drop to 15 FPS. This variation typically breaks mathematical analysis.
To solve this, this application uses a Signal Resampling Engine with a virtual clock.
- If your camera is faster (e.g., 60 FPS): The system takes the extra data frames and averages/interpolates them down to a precise 30Hz timing. This actually improves accuracy by reducing noise.
- If your camera is slower (e.g., 15 FPS): The system uses Linear Interpolation to mathematically "fill in the gaps" between the real frames, creating a smooth 30Hz signal that the filters can process without errors.
This ensures that the BPM calculation remains stable and accurate regardless of your specific hardware or lighting conditions.
How It Works: The Technology Behind the Signal
The process of extracting a heart rate from a video stream involves several key steps, all performed in real-time within your browser:
- Video Acquisition & ROI Selection: Your browser securely accesses your webcam. You can then
choose a Region of Interest (ROI), the specific area of the video to analyze.
- Manual Mode: You draw a box on the area you want to measure (e.g., your forehead or cheek).
- Automated Mode: The application uses the MediaPipe Face Mesh model to automatically detect your face and places an ROI on your forehead, an area with good blood perfusion.
- Signal Extraction (rPPG): With every heartbeat, your heart pumps blood into your arteries. This causes the volume of blood in the microvessels of your skin to increase slightly. Blood hemoglobin absorbs green light more than red or blue light. This application averages the intensity of the green color channel across all pixels in the ROI for each frame.
- Signal Processing (The Math):
- Detrending & Resampling: The raw signal is normalized and resampled to a strict 30Hz timeline to remove camera jitter.
- High-Pass Filter (Drift Removal): This removes slow-moving changes, such as shadows moving across your face or the camera auto-exposure adjusting. Without this, the graph would drift off the screen.
- Low-Pass Filter (Noise Removal): This removes fast, jittery noise that is too fast to be a heartbeat.
- Amplification: The clean signal is multiplied by the Amplification Factor to make it visible as a color change in the video.
- Analysis and Visualization:
- Time-Domain Graph: Shows the wave of your pulse over time.
- Frequency-Domain Graph (FFT): Uses a Fast Fourier Transform to break the wave into frequencies. The highest peak in the graph represents your heart rate.
Disclaimer
This is a technology demonstration and an educational tool, NOT a medical device. The BPM readings are estimations and can be affected by many factors, including lighting, movement, and camera quality. The data provided should not be used for medical diagnosis, monitoring, or any health-related decisions. Always consult a qualified healthcare professional for medical advice.
Future Directions
This application is a proof-of-concept. Future improvements could include:
- Multi-Person Tracking: Analyzing multiple faces simultaneously.
- Motion Compensation: Using optical flow to track skin pixels even when the user moves their head significantly.
- Deep Learning: Replacing the standard DSP filters with a trained neural network to extract pulse signals even in total darkness (using IR cameras) or extreme motion.