How habom2310/heart-rate-measurement-using-camera works
Project type and purpose
• This is a standalone real-time computer-vision application (Python) for non-contact heart-rate measurement using a webcam.
File structure
• Top-level scripts:
• GUI.py – main application entry point with live camera feed and controls
• webcam.py / video.py – camera capture modules
• face_detection.py, face_utilities.py – dlib/OpenCV face detector & landmark alignment
• signal_processing.py – buffer management, band-pass filter, FFT, BPM extraction
• amplify_color.py – Eulerian Video Magnification module for visualization
• graph_plot.py – static/real-time plotting utility
• process.py / interface.py – glue code or CLI interface
• new_update/ – refactored code, unit tests for utilities (face & signal processing)
• requirements.txt lists core libraries: numpy, scipy, OpenCV, dlib, matplotlib, tkinter or PySimpleGUI
README for additional insights
• Workflow summary:
a. Main components:
– Camera Input Module (webcam.py / video.py)
– Face Detection & Alignment Service (face_detection.py + shape_predictor models)
– Signal Processing Pipeline (signal_processing.py)
– FFT Analyzer & BPM Estimator
– Visualization Layer
• Real-time GUI (GUI.py)
• Graph Plotter (graph_plot.py)
– Configuration & Models (shape_predictor_*.dat)
b. Relationships & interactions:
– Unidirectional data flow: Camera → Face Detector → ROI Averager → Signal Processor → FFT → BPM → GUI/Plot/Amplifier
– Shared resources: data buffer, model files, config parameters from requirements
c. Architectural patterns & design principles:
– Modular pipeline: each stage is a stateless function or class
– Separation of concerns: detection, processing, visualization decoupled
– Pluggable modules: amplify_color and graph_plot can be invoked independently
– Unit-testable components in new_update/
d. Key technologies/frameworks:
– OpenCV + dlib for computer vision
– NumPy/SciPy for numerical processing and FFT
– Matplotlib or PySimpleGUI/Tkinter for UI and plotting
– Python packaging via requirements.txt
Detail without over-complicating
• Python script or logical service as its own node.
• Two uses of .dat model files (5- and 68-point predictors).
• Buffer size (150 frames) as a queue between ROI and filter.
• Configuration (filter band, sampling rate) alongside the signal processor.
• A Testing module that references new_update/test_*.py to show unit-test coverage.