Skip to main content

Advanced Remote Photoplethysmography Application with real-time heart rate and HRV estimation

Project description

Advanced rPPG (Remote Photoplethysmography) Application

A cross-platform Python application for remote heart rate monitoring using computer vision techniques. This advanced application provides real-time heart rate estimation, HRV analysis, and comprehensive signal quality assessment.

๐ŸŒŸ Features

  • Live Video Processing: Real-time heart rate monitoring from webcam
  • File-based Processing: Analyze pre-recorded video files
  • Advanced Face Detection: Using MediaPipe for robust face tracking
  • Multiple rPPG Algorithms: Chrominance, POS, and Green Channel methods
  • Signal Quality Metrics: Comprehensive quality assessment and recommendations
  • Real-time Visualization: Live plots of heart rate, HRV, and signal quality
  • HRV Analysis: Time-domain, frequency-domain, and non-linear metrics
  • Cross-platform GUI: Built with PyQt5 for Windows, Linux, and macOS
  • Data Export: Save results to CSV/JSON formats with detailed reports

๐Ÿ“‹ Requirements

  • Python: 3.8 or higher
  • Operating System: Windows, Linux, or macOS
  • Hardware: Webcam (for live processing)
  • Memory: Minimum 4GB RAM (8GB recommended)
  • Storage: 1GB free space

๐Ÿš€ Quick Installation

Option 1: Automated Installation (Recommended)

# Clone the repository
git clone https://github.com/Sherin-SEF-AI/advanced-rPPG.git
cd advanced-rPPG

# Run the installation script
./install.sh

Option 2: Manual Installation

# Clone the repository
git clone https://github.com/Sherin-SEF-AI/advanced-rPPG.git
cd advanced-rPPG

# Create virtual environment
python3 -m venv rppg_env

# Activate virtual environment
# On Linux/macOS:
source rppg_env/bin/activate
# On Windows:
rppg_env\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Install the application
pip install -e .

Option 3: Using pip (if published)

pip install advanced-rppg

๐ŸŽฏ Usage

Starting the Application

# Activate virtual environment (if using manual installation)
source rppg_env/bin/activate

# Run the application
python main.py

# Or use the command-line tool
rppg-app

Using the Application

  1. Live Monitoring:

    • Click "Start Live" to begin real-time heart rate monitoring
    • Position your face in the camera view
    • Ensure good lighting conditions
    • Stay relatively still for best results
  2. Video File Analysis:

    • Click "Load Video" to select a video file
    • The application will process the video and display results
  3. Viewing Results:

    • Real-time heart rate is displayed in the control panel
    • Signal quality metrics are shown with color-coded indicators
    • HRV metrics are calculated and displayed
    • Live plots show signal trends over time
  4. Saving Data:

    • Use File โ†’ Save Data to export results
    • Choose between CSV and JSON formats
    • Comprehensive reports are generated automatically

๐Ÿ“Š Understanding the Results

Heart Rate Display

  • Green: Normal range (60-100 BPM)
  • Orange: Slightly elevated/depressed (50-60 or 100-120 BPM)
  • Red: Outside normal range (<50 or >120 BPM)

Signal Quality Metrics

  • Overall Quality: Combined score of all quality factors
  • SNR: Signal-to-Noise Ratio
  • Stability: Signal consistency over time
  • Lighting Consistency: Uniformity of illumination
  • Face Quality: Face detection confidence

HRV Metrics

  • RMSSD: Root Mean Square of Successive Differences
  • SDNN: Standard Deviation of NN Intervals
  • pNN50: Percentage of successive RR intervals >50ms
  • LF/HF Ratio: Low Frequency to High Frequency ratio

โš™๏ธ Configuration

Algorithm Selection

Choose from three rPPG algorithms:

  • Chrominance: Advanced color-based method (default)
  • POS: Plane-Orthogonal-to-Skin method
  • Green Channel: Simple green channel analysis

Processing Parameters

  • FPS: Frame rate for processing (15-60 fps)
  • Face Landmarks: Toggle face landmark visualization
  • Quality Metrics: Enable/disable quality assessment

๐Ÿ”ง Troubleshooting

Common Issues

  1. No Face Detected:

    • Ensure face is clearly visible in camera
    • Check lighting conditions
    • Try adjusting camera position
  2. Poor Signal Quality:

    • Improve lighting (avoid shadows and glare)
    • Reduce movement during measurement
    • Ensure consistent camera distance
  3. Application Won't Start:

    • Check Python version (3.8+ required)
    • Verify all dependencies are installed
    • Check system requirements
  4. Camera Not Working:

    • Ensure camera permissions are granted
    • Check if camera is being used by another application
    • Try different camera index in settings

Performance Optimization

  • Lower FPS: Reduce processing load for better performance
  • Smaller Window: Process smaller video regions
  • Quality vs Speed: Balance between accuracy and real-time performance

๐Ÿ“ Project Structure

advanced-rPPG/
โ”œโ”€โ”€ main.py                 # Main application entry point
โ”œโ”€โ”€ requirements.txt        # Python dependencies
โ”œโ”€โ”€ setup.py               # Installation script
โ”œโ”€โ”€ install.sh             # Automated installation
โ”œโ”€โ”€ README.md              # This file
โ”œโ”€โ”€ rppg_core/             # Core rPPG processing
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ face_detector.py   # Face detection and tracking
โ”‚   โ”œโ”€โ”€ signal_processor.py # rPPG signal processing
โ”‚   โ”œโ”€โ”€ quality_metrics.py # Signal quality assessment
โ”‚   โ””โ”€โ”€ hrv_analyzer.py    # HRV analysis
โ”œโ”€โ”€ gui/                   # User interface
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ main_window.py     # Main application window
โ”‚   โ”œโ”€โ”€ video_widget.py    # Video display and processing
โ”‚   โ”œโ”€โ”€ plot_widget.py     # Real-time plotting
โ”‚   โ””โ”€โ”€ control_panel.py   # Control panel
โ”œโ”€โ”€ utils/                 # Utility functions
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ file_utils.py      # File operations
โ””โ”€โ”€ data/                  # Data storage directory
    โ””โ”€โ”€ .gitkeep

๐Ÿงช Technical Details

rPPG Algorithms

  1. Chrominance Method:

    • Uses color space transformations
    • Combines RGB channels for optimal signal extraction
    • Most robust for varying lighting conditions
  2. POS Method:

    • Projects signals onto plane orthogonal to skin tone
    • Reduces motion artifacts
    • Good for stationary subjects
  3. Green Channel Method:

    • Simple green channel analysis
    • Baseline method for comparison
    • Fastest processing

Signal Processing Pipeline

  1. Face Detection: MediaPipe-based face detection and landmark extraction
  2. ROI Selection: Forehead region extraction for signal processing
  3. Signal Extraction: RGB signal extraction from ROI
  4. Filtering: Bandpass filtering (0.7-4.0 Hz)
  5. Frequency Analysis: FFT-based heart rate estimation
  6. Quality Assessment: Multi-factor quality evaluation

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup

# Clone repository
git clone https://github.com/Sherin-SEF-AI/advanced-rPPG.git
cd advanced-rPPG

# Install development dependencies
pip install -e .[dev]

# Run tests
pytest

# Format code
black .

# Type checking
mypy .

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • MediaPipe: Face detection and landmark extraction
  • OpenCV: Computer vision processing
  • PyQt5: Cross-platform GUI framework
  • SciPy: Signal processing algorithms
  • NumPy: Numerical computing

๐Ÿ“ž Support

๐Ÿ”ฌ Research Applications

This application is suitable for:

  • Clinical Research: Heart rate monitoring studies
  • Sports Science: Exercise physiology research
  • Human-Computer Interaction: Stress detection
  • Telemedicine: Remote health monitoring
  • Wearable Technology: Validation studies

Note: This application is for research and educational purposes. It is not intended for medical diagnosis or treatment. Always consult healthcare professionals for medical concerns.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

advanced_rppg-1.0.1.tar.gz (51.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

advanced_rppg-1.0.1-py3-none-any.whl (32.8 kB view details)

Uploaded Python 3

File details

Details for the file advanced_rppg-1.0.1.tar.gz.

File metadata

  • Download URL: advanced_rppg-1.0.1.tar.gz
  • Upload date:
  • Size: 51.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for advanced_rppg-1.0.1.tar.gz
Algorithm Hash digest
SHA256 66b704f814abbd0d18f3010a3f745b5500e9e15a2c70e0e2301d0b2e5f53bae2
MD5 8688ad8ab63894c32b05032e28049a36
BLAKE2b-256 953a7819eacf3c0727eda71d17736c07f688da2a3cba1a1e53d05992c071b46d

See more details on using hashes here.

File details

Details for the file advanced_rppg-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: advanced_rppg-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 32.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for advanced_rppg-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3fe309cc2ff496e6faf7aad42c80f6b99bbb4f19998b209ac84a0938ac5d40f6
MD5 2d8b07a791f228105e83cca91183d3bd
BLAKE2b-256 349f261cc00bc0e585315eb916397498dce62f10982cd03e9b984a7d4ef441e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page