Overview
The EVM Manager provides the main entry point for processing video frames to extract vital signs using Eulerian Video Magnification. It implements an optimized single-pass dual-band approach that is 50-60% faster than traditional methods while maintaining accuracy.process_video_evm_vital_signs
Processes video frames to extract heart rate and respiratory rate using optimized EVM.Parameters
List of ROI video frames in BGR format. Minimum 30 frames required for accurate analysis.
Enable diagnostic messages and progress information during processing.
Returns
Detected heart rate in beats per minute (BPM). Returns
None if detection fails or signal quality is insufficient.Detected respiratory rate in breaths per minute (RPM). Returns
None if detection fails or signal quality is insufficient.Key Features
Optimized Single-Pass Approach
The function implements several optimizations:- Single Pyramid Construction: Builds Laplacian pyramids only once instead of twice
- Dual-Band Processing: Processes both HR and RR frequency bands simultaneously
- Modular Design: Split into separate modules for maintainability
- Performance: Achieves 50-60% speed improvement over traditional implementations
Processing Pipeline
Frequency Bands
Heart Rate Band
- Frequency Range: 0.83 - 3.0 Hz
- BPM Range: 40 - 250 BPM
- Amplification Factor: 30x
- Pyramid Level: 3
Respiratory Rate Band
- Frequency Range: 0.18 - 0.5 Hz
- RPM Range: 8 - 35 RPM
- Amplification Factor: 50x
- Pyramid Level: 2
Usage Example
Complete example from experimental validation:Error Handling
The function handles various error conditions gracefully:- Insufficient Frames: Returns
Nonevalues if fewer than 30 frames provided - Invalid Input: Validates input type and returns
Nonefor invalid data - Processing Errors: Catches exceptions and returns
Nonewith optional verbose logging
Performance
Benchmark Results
Tested on typical video processing scenarios:- Processing Speed: ~25-30 FPS on Raspberry Pi 4
- Time per Frame: ~30-40ms average
- Buffer Processing: ~6-8 seconds for 200 frames
- Accuracy: MAE < 5 BPM for heart rate
Configuration
All frequency bands and thresholds are configured insrc/config.py:
Related Functions
- EVMProcessor - Core EVM processing class
- calculate_frequency_fft - FFT-based frequency extraction
- Temporal Filtering - Bandpass filtering functions