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).
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.
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. This average green value becomes our raw physiological signal.
- Signal Processing: The raw signal is noisy and contains unwanted variations from lighting changes or small movements.
- Detrending: A moving average of the signal is calculated and subtracted from the current signal. This removes slow-moving "drift" and centers the signal around zero.
- Band-Pass Filtering: A digital filter is applied to isolate only the frequencies relevant to a human heart rate (typically 0.7 Hz to 3.0 Hz, or 42 to 180 BPM). This is the most critical step for cleaning the signal.
- Amplification: The cleaned, filtered signal is very faint. It is multiplied by the Amplification Factor to make it large enough to see on the graphs and as a color change in the video.
- Analysis and Visualization:
- Time-Domain Graph: This graph plots the filtered signal over time, showing the clear, periodic wave of your pulse.
- Frequency-Domain Graph: A mathematical technique called a Fast Fourier Transform (FFT) is used to convert the time-based signal into its constituent frequencies. The strongest frequency detected within our band-pass range is identified as the heart rate.
- BPM Calculation: The peak frequency (in Hertz, or cycles per second) is multiplied by 60 to calculate the Beats Per Minute. A smoothing algorithm is applied to provide a more stable reading.
Understanding the Controls
- Amplification Factor: Controls how much the filtered pulse signal is magnified. Higher values result in a more pronounced visual effect and a larger waveform on the graph.
- Processing FPS: Sets the target frames-per-second for signal processing. A higher rate can provide a more detailed signal but requires more computational power. For best results, try to match this to your camera's actual framerate.
- Low/High Cutoff (Hz): These values define the frequency range for the band-pass filter. The default range is suitable for a typical resting and active adult heart rate.
- Show Raw Signal: Toggles the display of the detrended (but unfiltered) signal on the graphs, allowing you to see the effect of the band-pass filter.
- Enable Sonification: Converts the amplified signal into an audible tone, allowing you to "hear" your pulse.
Future Directions & Known Limitations
This application is a proof-of-concept and has several areas for potential improvement:
- ROI Placement: In the current "Automated ROI" mode, the region of interest might be placed too low on the forehead, potentially overlapping with eyebrows. Eyebrow movements can introduce significant noise. A future enhancement would be to refine the facial landmark calculations to position the ROI more centrally and higher on the forehead, avoiding hair and eyebrows.
- Motion Robustness: The current algorithm is highly sensitive to head movements and changes in facial expression. More advanced rPPG techniques could be implemented to better distinguish between motion artifacts and the true pulse signal.
- Lighting Independence: Performance is best under stable, bright, and even lighting. Algorithms that can adapt to or compensate for changes in ambient light would significantly improve reliability.
- Performance Optimization: All calculations are done in JavaScript on your computer. For more complex algorithms or higher resolutions, critical code paths could be moved to WebAssembly for near-native performance.