betaFeedback

WorksEngineering

A Real-Time Low-Cost Platform for Non-Contact Respiratory Rate Monitoring: A Comparative Evaluation of RGB Optical Flow and Time-of-Flight Depth Sensing

Abstract

Respiratory rate (RR) is one of the earliest indicators of clinical deterioration, which makes its continuous measurement clinically valuable. In routine practice, however, RR is monitored almost exclusively with contact-based sensors, which require skin attachment, may alter natural breathing, and are poorly tolerated by vulnerable groups such as newborns and elderly patients. Non-contact sensing removes these constraints, with RGB video and depth imaging among its most accessible modalities. In this work, we present a low-cost, real-time platform based on a single multimodal sensor that provides both RGB and time-of-flight (ToF) data streams, implemented on a Raspberry Pi 5 edge device. The system integrates three RGB optical-flow pipelines, namely Farnebäck, Horn–Schunck, and Lucas–Kanade, together with a depth-based pipeline incorporating region-of-interest stabilization and distance-derived signal extraction, enabling the two modalities to be evaluated independently under the same experimental protocol. The proposed approach was evaluated on twelve healthy volunteers following a controlled protocol, including normal breathing, hyperventilation, and breath-holding, using a piezoresistive respiratory belt as a reference. RGB-based methods achieved lower RR estimation errors, with Lucas–Kanade attaining the lowest median MAE (3.83 BPM), whereas the ToF-based pipeline, although less accurate for RR estimation (median MAE 6.24 BPM), reached a higher apnea detection sensitivity (0.66 vs 0.51-0.55). These findings highlight the complementary strengths of both modalities and support their integration into unified low-cost platforms.

Correspondence: [email protected]

Introduction

Respiratory rate (RR) is one of the most sensitive indicators of physiological deterioration in clinical practice. Changes in breathing often precede alterations in heart rate or blood pressure by several hours, allowing for the early detection of conditions such as cardiopulmonary failure or sepsis [1, 2]. Consequently, RR is a key component of early-warning systems (e.g. National Early Warning Score), where deviations from normal adult resting values of 12–20 breaths per minute (BPM) indicate elevated risk [3, 4]. Importantly, normal ranges vary with age: newborns can exceed 40 BPM, decreasing within the first years of life [5], while older adults (>65 years) can reach 28 BPM at rest [6]. These differences highlight the need for monitoring systems that remain reliable across populations and capture both slow and rapid breathing dynamics.

Despite its clinical importance, RR is still predominantly measured using contact-based techniques. Common solutions include respiratory belts, strain sensors, inertial measurement units (IMUs), surface electromyography (sEMG), and indirect estimation from photoplethysmography (PPG) or electrocardiography (ECG) signals [7, 8, 9, 10]. Although these methods can provide accurate measurements under controlled conditions, they share several practical limitations. The need for body contact can cause discomfort, particularly in vulnerable populations such as newborns or elderly patients, and can alter natural breathing patterns due to sensor awareness. In addition, these systems often require wiring, consumables, and trained personnel, which restricts their applicability for long-term monitoring, home care, and large-scale deployment while also increasing the risk of contamination. These limitations have motivated the development of non-contact alternatives that can preserve comfort while maintaining clinical reliability.

Non-contact RR monitoring has been explored using three main sensing modalities: RGB vision, thermal imaging, and active sensing (depth or radar). Vision-based methods extract breathing signals from subtle chest movements or pixel intensity variations and may include remote photoplethysmography (rPPG) techniques [11]. They benefit from low cost and high resolution but remain sensitive to illumination and occlusions [3, 12]. Thermal imaging, by contrast, detects cyclic temperature changes near the nostrils, allowing operation in darkness, though at a higher cost [13]. Active sensing techniques, such as depth cameras and radar, directly measure chest displacement and are robust to lighting and skin conditions, albeit at moderate resolution.

Although these approaches have demonstrated promising results, two key gaps remain. First, most studies evaluate individual sensing modalities in isolation, making it difficult to establish fair comparisons under consistent experimental conditions and reference standards. Second, many proposed solutions rely on expensive hardware setups and workstation-level processing, limiting their translation to real-world and resource-constrained environments. In this context, low-cost embedded systems that integrate multiple sensing modalities while maintaining reliable performance remain largely underexplored.

To address these challenges, this work proposes a unified, low-cost framework for non-contact respiratory monitoring based on a compact multimodal sensor integrating RGB and depth data on a Raspberry Pi 5. The system evaluates three RGB-based pipelines based on optical flow alongside a depth-based approach under the same cohort and experimental protocol, using the same respiratory-belt reference system, while processing each modality independently to enable a controlled and unbiased comparison. This unified design facilitates a direct assessment of the modalities in terms of RR estimation accuracy, waveform agreement, phase-specific behavior, apnea detection capability, and computational performance in an embedded setting.

Related Work

Vision-based approaches have emerged as a promising alternative for non-contact respiratory monitoring, aiming to recover the breathing signal either from subtle cyclic variations in pixel intensity or from the motion of the chest wall. Early studies demonstrated that, under controlled conditions, these methods can achieve high accuracy. For instance, Massaroni et al. [12] reported a near-zero bias of 0.01±1.810.01 \pm1.81 BPM using an intensity-based approach in six volunteers. Similarly, Romano et al. [3] validated an optical-flow pipeline in 24 subjects, obtaining a bias of −0.03±1.38-0.03 \pm1.38 BPM at a distance of two meters. However, these results also revealed an intrinsic limitation of RGB-based methods, namely their sensitivity to illumination variations, motion artifacts, and partial occlusion of the thoracic region.

To overcome these constraints, subsequent research shifted towards identifying alternative regions of interest that remain informative even when the chest is not fully visible. This led to the exploration of micro-motions of the head mechanically coupled with respiration [14], the suprasternal notch, and lateral body profiles [15].

Moving beyond controlled laboratory settings, Zhu et al. [16] demonstrated that vision-based approaches can retain acceptable performance under more realistic conditions, reporting a root-mean-square (RMS) error of 2.10±1.642.10 \pm1.64 BPM against polysomnography in 50 adults during overnight monitoring, with limited sensitivity to sleep position, sleep stage, or bedding coverage. More recent research has further advanced the field by replacing hand-crafted pipelines with learning-based solutions, such as motion magnification combined with convolutional neural networks [17] and hybrid architectures integrating optical-flow and monocular-depth cues [18].

In parallel, thermal imaging has been investigated as a complementary modality, utilizing cyclic temperature variations around the nostrils to estimate the respiratory signal. Because it does not depend on external illumination, thermal imaging enables operation in complete darkness [13]. Clinical studies have reported competitive accuracy, with Alves et al. [19] achieving a mean absolute error (MAE) between 0.64 and 0.91 BPM in overnight hospital recordings. Methodological developments in this area have focused on robust nasal-region tracking [20, 21] and, more recently, on deep spatio-temporal models [22]. Nevertheless, the high cost of long-wave infrared sensors compared to consumer-grade RGB cameras continues to limit their widespread adoption, particularly in ambulatory or home-care settings.

Active sensing technologies provide an alternative route to overcoming the limitations of passive vision systems. Among them, time-of-flight (ToF) depth cameras are particularly relevant, as they directly measure thoracic displacement by capturing distance maps that are largely independent of ambient lighting and skin pigmentation. This capability enables the extraction of stable respiratory waveforms and the detection of events such as apnea [1]. LiDAR-based implementations have further extended this principle [23], incorporating thermally guided region selection [24] and demonstrating robustness from multiple viewpoints, including frontal, dorsal, and lateral configurations [25]. Radar-based systems constitute another complementary class of illumination-independent approaches that are capable of operating through clothing or light bedding. These include a Frequency-Modulated Continuous-Wave (FMCW) radar for simultaneous monitoring of respiration and heart rate [26], a validated Ultra-Wideband impulse radio range (UWB-IR) radar in sensitive populations such as newborns [27], and monopulse radar systems combined with source separation techniques for multi-subject monitoring [28].

Despite substantial methodological advances across RGB, thermal, and active sensing approaches, the current body of literature remains limited in aspects that affect the translation of these solutions into practical systems. Existing studies predominantly focus on a single sensing modality evaluated in isolation; therefore, the reported performance is strongly influenced by dataset-specific factors, acquisition setups, and evaluation protocols. This makes it difficult to establish fair comparisons between modalities, while direct side-by-side evaluations of RGB and depth-based methods under identical conditions—same subjects, protocol and reference signal—remain scarce. At the same time, many proposed systems rely on dedicated hardware configurations and workstation-level processing, which restrict their applicability in realworld scenarios that require portability, low cost, and real-time performance. Although individual components of the pipeline, such as optical flow, have been extensively studied, their integration within a unified, resource-constrained embedded platform has received comparatively limited attention.

In this context, the present work introduces a unified multimodal framework that jointly addresses these limitations. Unlike previous studies, the proposed system integrates RGB and ToF depth sensing within a single compact sensor, enabling a direct comparison of both modalities under identical acquisition conditions. These modalities were selected because they provide complementary information while remaining suitable for low-cost embedded deployment. Optical flow estimates thoracic motion directly from RGB imagery without requiring task-specific training data [3, 15], whereas ToF sensing provides direct measurements of thoracic displacement and is largely insensitive to illumination and skin pigmentation [1, 23]. Moreover, acquiring both streams from the same device ensures a common viewpoint and hardware setup, which are essential for a controlled comparison.

To assess the impact of motion estimation strategies within the RGB modality, the evaluation includes three representative optical-flow approaches: Lucas–Kanade, Horn–Schunck, and Farnebäck. These methods span the principal formulations of optical flow, namely sparse feature-based, dense variational, and dense polynomial-expansion approaches, respectively, enabling a systematic analysis of algorithmic variability within a unified framework. While the present study focuses on these optical-flow methods and ToF depth sensing, the proposed architecture remains modular and can accommodate alternative motion estimation algorithms or depth sensing technologies.

Beyond the comparison of sensing modalities and motion estimation approaches, the platform is designed for real-time operation on a Raspberry Pi 5, demonstrating that multimodal respiratory monitoring can be achieved without specialized hardware or high-performance computing resources. Furthermore, the evaluation extends beyond conventional RR estimation accuracy by incorporating waveform-level agreement, phase-specific analysis, apnea detection performance, and computational efficiency, providing a comprehensive characterization of respiratory monitoring performance.

Materials and Methods

System Architecture and Data Acquisition

System Architecture and Data Acquisition. The proposed platform was developed around a single low-cost multimodal sensor (MaidSense A075V), which integrates an RGB camera and a ToF depth camera and is connected to a Raspberry Pi 5 responsible for data acquisition, processing, and visualization via a lightweight server. Data were retrieved through the sensor’s HTTP interface over a local network. In the RGB configuration, JPEG-compressed color images were decoded at approximately 30 fps. In the depth configuration, the ToF camera operated in raw 16-bit mode, providing uncompressed distance measurements in millimeters. A longer exposure time was selected to reduce measurement noise, resulting in an operating frame rate of approximately 15 fps at a resolution of 320 × 240 pixels.

Respiratory Monitoring Pipelines

Respiratory Monitoring Pipelines. Both sensing modalities follow the same workflow: subject identification, respiratory signal extraction, and respiratory analysis. Each modality is processed independently, producing its own respiratory waveform and RR estimate. The complete architecture is shown in Figure 1.

Figure 1. Overview of the proposed low-cost platform and the two independent respiratory monitoring pipelines, each producing its own RR estimate.

RGB Pipeline

RGB Pipeline. Figure 2 summarizes the RGB processing chain.

Overview of the RGB pipeline

Figure 2. Overview of the RGB pipeline. The three optical-flow methods are applied in parallel to the same thoracic ROI, each yielding an independent respiratory signal.

Subject Identification and Region-of-Interest (ROI) Extraction The thoracic region is localized using a pretrained Lightweight OpenPose network [29], derived from the original OpenPose framework [30]. Each frame is resized to 192 × 192 pixels, and the keypoint locations are estimated from the corresponding confidence heatmaps, retaining only detections above a predefined confidence threshold. The thoracic ROI is constructed from geometric relationships between the neck and shoulder landmarks, scaled according to shoulder width and upper-body proportions using empirically tuned factors, while physiologically implausible aspect ratios are rejected. To reduce computational cost and temporal jitter, detections are periodically updated and smoothed using an exponential moving average.

Respiratory Signal Extraction Respiratory motion is estimated from the transverse displacement of the thoracic ROI between consecutive frames. Following grayscale conversion and percentile-based contrast normalization, motion is quantified using three optical-flow methods: Lucas–Kanade, Horn–Schunck, and Farnebäck. All methods are applied independently to the same thoracic ROI and the same pair of consecutive frames, yielding separate respiratory waveforms and RR estimates. Their outputs are not combined, allowing each method to act as an independent estimator whose performance is directly compared in § 4. All three approaches rely on the brightness-constancy assumption, which states that the intensity of a moving surface point remains unchanged between consecutive frames. Under this assumption, the image brightness function satisfies the following equation:

Ixu+Iyv+It=0(1)I_x u + I_y v + I_t = 0 \tag*{(1)}

where (u,v)(u,v) denotes the horizontal and vertical components of the optical flow vector, and IxI_x, IyI_y, and ItI_t represent the partial derivatives of the image intensity with respect to xx, yy, and tt, respectively.

Lucas–Kanade method [31] assumes locally constant motion within a small spatial neighborhood around each tracked point and estimates sparse motion vectors by solving a local least-squares problem on selected corner features [32]. The respiratory signal is derived as the median vertical displacement of the tracked features. Horn–Schunck method [33] computes a dense flow field by minimizing a global energy functional that balances brightness constancy and spatial smoothness:

E=∬[(Ixu+Iyv+It)2+α2(∥∇u∥2+∥∇v∥2)] dx dy(2)E = \iint\left[(I_xu + I_yv + I_t)^2 + \alpha^2 \left(\lVert\nabla u\rVert^2 + \lVert\nabla v\rVert^2\right)\right]\,dx\,dy \tag*{(2)}

where α\alpha denotes a regularization parameter, and ∇u\nabla u and ∇v\nabla v represent the spatial gradients of the optical flow components. The flow is estimated iteratively using Jacobi relaxation, and the respiratory signal corresponds to the spatial mean of the transverse component.

Farnebäck method [34] models local image neighborhoods through quadratic polynomial expansions and estimates dense motion from changes in polynomial parameters across frames. As in Horn–Schunck, the respiratory signal is computed from the mean transverse flow component.

Because all optical-flow outputs represent velocity-like quantities, they are normalized, smoothed, and converted into a displacement-like respiratory waveform through a leaky in tegrator:

s(t)=γs(t−1)+v~(t)Δt(3)s(t) = \gamma s(t-1) + \tilde{v}(t)\Delta t \tag*{(3)}

where v~(t)\tilde{v}(t) denotes the smoothed velocity estimate, γ=0.98\gamma= 0.98 is the decay factor, Δt\Delta t is the interval between frames, and s(t)s(t) is the one-dimensional respiratory signal.

Respiratory Signal Processing Respiratory analysis is performed using a sliding-window approach. Slow baseline variations are first removed via linear detrending, followed by zero-phase forward–backward filtering with a fourth-order Butterworth band-pass filter (0.08–2.5 Hz). Apnea detection relies on two complementary characteristics of the filtered signal: amplitude, quantified as the standard deviation within a short sliding window, and periodicity, assessed through the normalized autocorrelation function. A segment is classified as breathing only when both measures exceed their respective thresholds, and individual decisions are temporally withdrawn to improve robustness against transient fluctuations. Whenever a valid breathing pattern is detected, the RR is estimated from the intervals between successive signal peaks identified under minimum prominence and spacing constraints. In parallel, evidence of respiratory absence is accumulated over time using a leaky integrator with hysteresis:

Ia(t)={Ia(t−1)+ca,apneaγaIa(t−1),breathing(4)I_a(t) = \begin{cases} I_a(t-1) + c_a, & \text{apnea} \\ \gamma_a I_a(t-1), & \text{breathing} \end{cases} \tag*{(4)}

where Ia(t)I_a(t) is the accumulation state of apnea in frame tt, cac_a is the fixed increment added for each frame classified as apnea, and γa<1\gamma_a < 1 is the decay factor applied during frames classified as breathing.

ToF Pipeline

The ToF processing chain is shown in Figure 3.

Figure 3. Overview of the ToF pipeline.

Subject Identification and ROI Extraction Unlike the RGB approach, the ToF pipeline identifies the subject directly in the depth image. During calibration, pixel-wise temporal mean and standard deviation maps are computed from a set of depth frames; the mean depth separates the subject from the background, while the standard deviation highlights respiratory motion. A binary mask obtained by depth and variability thresholding is refined through morphological operations. The largest connected component is then retained, and a fixed-size ROI is initialized around its centroid. During monitoring, the subject is tracked by selecting depth pixels near the reference distance and identifying the connected component closest to the previous location, with the ROI position and reference depth updated using exponential moving averages.

Respiratory Signal Extraction For each frame, the respiratory signal is computed as the average depth within the ROI. Because ToF measurements provide an absolute distance in millimeters, the resulting signal directly reflects the thoracic displacement and does not require integration.

Respiratory Signal Processing The depth signal is processed using the same respiratory-analysis framework as the RGB pipeline, the main differences being mean-based detrending and a narrower band-pass filter (0.05–1.5 Hz), reflecting the lower sampling rate and smoother characteristics of the depth signal. To compensate for the reduced temporal resolution, detected peaks are refined through quadratic interpolation of the samples adjacent to each peak, and the RR is computed from recent inter-peak intervals after median-based outlier rejection and adaptive exponential smoothing. Apnea detection additionally compares the periodicity of long-term and short-term windows. When a recent change in the breathing pattern is detected, older samples are discarded to accelerate adaptation and avoid false apnea detections.

Study Design and Experimental Protocol

Participants

The platform was evaluated in a cohort of twelve healthy adult volunteers without known respiratory disorders or clinically diagnosed lung conditions. All procedures involving human participants were reviewed and approved by the Research Ethics Committee of the Jagiellonian University Medical College (Resolution No. 47/2026, 22 January 2026) and were conducted according to the Declaration of Helsinki. Written informed consent was obtained from all participants in the study.

The cohort comprised 7 male and 5 female participants, whose demographic characteristics are summarized in Table 1.

CharacteristicMean ± SDRange
Age [years]29.0 ± 11.521–54
Body height [cm]174.7 ± 9.5156–187
Body mass [kg]72.7 ± 9.655–85
Body-mass index [kg/m²]23.8 ± 2.021.4–27.8

Table 1. Demographic Characteristics of the Study Cohort (n=12n = 12; 7 Male, 5 Female)

Experimental Protocol

All recordings were conducted indoors under ambient daylight conditions, with participants seated facing the sensing device and the MaiXSense A075V positioned approximately 60 cm in front of the thorax. Each participant completed two separate recording sessions, one using the RGB modality and one using the ToF modality, following the same experimental protocol. Each session had its own corresponding respiratory-belt recording, which served as the reference signal for that modality.

Each session consisted of a calibration stage during which participants maintained normal breathing while modality-specific parameters were initialized (a statistical depth model of the scene for the ToF pipeline, a baseline respiratory amplitude for the detection of apnea in the RGB pipeline), followed by a structured breathing protocol comprising three consecutive phases: (i) normal resting breathing, (ii) voluntary hyperventilation to induce an elevated RR, and (iii) breath-holding to simulate apnea. Both pipelines provided visual feedback in real-time on the processing stages. Representative outputs, including detected ROI, respiratory waveform, and estimated RR, are shown in Figure 4.

Real-time visualization of the proposed respiratory monitoring system

Figure 4. Real-time visualization of the proposed respiratory monitoring system. (a) RGB pipeline showing pose keypoints, thoracic ROI, respiratory waveform, and RR estimated using the three optical flow methods. (b) ToF pipeline showing the tracked ROI, centroid, and depth-derived respiratory waveform with RR estimate.

Data Preparation

The study includes 24 recordings, one per participant and modality, all processed offline. The RGB and ToF data are treated as independent measurements rather than frame-wise paired signals. To handle the non-stationary structure of the protocol, the breath-hold and hyperventilation segments were manually annotated in each recording, allowing the reference RR to be set to zero during apnea and to be estimated using phase-appropriate parameters during rapid breathing. Since camera-derived and reference signals were acquired with independent devices, both were resampled on a common 20 Hz grid using linear interpolation, normalized to zero mean and unit variance, and temporally aligned by estimating the delay that maximized their cross-correlation.

Results

Real-Time Performance on the Edge Device

To verify that the proposed pipelines operate within the constraints of a low-cost edge platform, the instantaneous frame rate and CPU load were logged at 1 Hz during a continuous one-minute run on the Raspberry Pi 5, with each modality measured independently. In the RGB configuration, the three optical-flow estimators were executed concurrently within a single process, so the reported throughput corresponds to their combined computational cost. The CPU load is reported as a system-wide average across all four cores, where 100% corresponds to full utilization. The measured throughput and computational load are summarized in Table 2.

MetricRGBToF
Mean frame rate [fps]15.613.1
Target frame rate [fps]3015
Mean CPU load [% all cores]25.34.5
Logging duration [s]6876

Table 2. Real-Time Performance of the RGB and ToF Pipelines on the Raspberry Pi 5

The RGB pipeline operated below the nominal sensor capability of 30 fps, mainly due to the computational cost of pose estimation and optical-flow processing on a CPU-only platform, although pose inference is performed only once every five frames. The ToF pipeline operated close to its target rate with a much lower computational demand, consistent with the absence of neural-network inference. Therefore, both pipelines meet the timing requirements for continuous respiratory monitoring on the target edge device, with the ToF pipeline retaining significant computational headroom for additional concurrent tasks.

Waveform-Level Agreement Evaluation

The first level of comparison assessed whether the estimated respiratory signals followed the reference over time. For each volunteer and method, the z-score-normalized respiratory waveform was paired sample-wise with the belt-derived reference waveform on the common 20 Hz grid, and the Spearman rank correlation coefficient was computed, yielding one value per pair (volunteer, method). The per-subject distributions are shown in Figure 5, and summary statistics are reported in Table 3.

Figure 5. Per-subject Spearman correlation between the estimated and the reference (belt) respiratory waveforms (z-score normalized, 20 Hz), by method.

MethodMedianIQRMean ± SD
ToF0.6340.1350.644 ± 0.100
Farnebäck0.6300.1500.595 ± 0.137
Horn-Schunck0.6340.1560.587 ± 0.146
Lucas-Kanade0.6440.1480.601 ± 0.137

Table 3. Per-subject Spearman correlation of the estimated respiratory waveform with the reference belt waveform

All four methods exhibited comparable waveform-level agreement with the reference signal, as shown in Table 3. The median Spearman correlations were closely clustered,

Waveform-Level Agreement Evaluation

with substantial overlap of the interquartile ranges between the methods (Figure 5). The ToF pipeline showed slightly more consistent performance across subjects, reflected in a lower dispersion of correlation values. In contrast, the three RGB-based optical-flow methods each exhibited a single low-correlation outlier corresponding to the same volunteer, who displayed limited thoracic motion during the experiment.

To complement population-level statistics, Figure 6 illustrates a representative recording in which all methods closely follow the reference signal, along with a more challenging example in which deviations emerge during demanding protocol phases. The two recordings were selected according to a predefined criterion based on the Lucas–Kanade waveform correlation reported in Table 3: the typical case corresponds to the subject whose correlation is closest to the cohort median, and the challenging case to the subject with the lowest correlation, that is, the volunteer with limited thoracic motion mentioned above. These examples are provided for illustration only; the cohort-level evidence is given by the per-subject distributions in Figure 5 and Figure 7 and by the median statistics in Table 3–Table 5, which are computed over all twelve subjects and are insensitive to individual outlying segments. For visualization, all signals were normalized to a zero mean and unit variance.

MethodPhaseMean ± SD [BPM]Median [BPM]
ToFnormal7.78 ± 9.754.23
hyperventilation12.55 ± 18.453.70
Farnebäcknormal3.96 ± 1.153.62
hyperventilation4.54 ± 2.603.94
Horn-Schuncknormal4.33 ± 1.403.83
hyperventilation4.54 ± 2.683.85
Lucas-Kanadenormal3.86 ± 1.113.45
hyperventilation4.56 ± 2.623.90

Table 5. Per-Subject MAE of the Estimated Instantaneous RR, Split by Protocol Phase (Normal vs. Hyperventilation)

Figure 6. Estimated and reference signals for a typical and a challenging recording. (a) Z-score-normalized respiratory waveforms (typical case). (b) Instantaneous RR estimates (typical case). (c) Z-score-normalized respiratory waveforms (challenging case). (d) Instantaneous RR estimates (challenging case). Shaded backgrounds indicate protocol phases: normal breathing (green), hyperventilation (yellow), and breath-hold (red).

Figure 7. Per-subject mean absolute error of the estimated instantaneous RR with respect to the reference belt rate, by method.

Respiratory Rate Estimation Evaluation

A second analysis evaluated the absolute accuracy of the RR estimates relative to the reference rate. For each subject and method, the MAE and the signed error were computed throughout the recording. Across the cohort, Lucas–Kanade achieved the lowest median MAE (3.83 BPM), followed by Farnebäck (4.24 BPM) and Horn–Schunck (4.26 BPM), while the ToF pipeline yielded 6.24 BPM. The distributions are shown in Figure 7, with detailed statistics reported in Table 4.

MethodMAE median [BPM]MAE mean ± SD [BPM]Bias [BPM]
ToF6.248.80 ± 9.41+3.38
Farnebäck4.244.39 ± 1.43+1.71
Horn-Schunck4.264.79 ± 1.65+2.11
Lucas-Kanade3.834.29 ± 1.47+1.60

Table 4. Per-Method RR Error and Bland–Altman Statistics

A complementary view is provided by the Bland–Altman analysis [35] in Figure 8. The breath-holding phase was excluded because the reference rate is zero in this regime, and apnea performance is evaluated separately.

Bland–Altman plots comparing instantaneous RR estimates with the reference signal for ToF, Farnebäck, Horn–Schunck, and Lucas–Kanade

Figure 8. Bland–Altman plots comparing instantaneous RR estimates with the reference signal. (a) ToF. (b) Farnebäck. (c) Horn-Schunck. (d) Lucas-Kanade.

The numerical bias values are reported in Table 4.

The three RGB-based methods exhibit a small positive bias and similar limits of agreement, indicating a consistent tendency to slightly overestimate RR. In contrast, the ToF pipeline shows a larger bias and wider limits of agreement, consistent with the heavier upper tail observed in the MAE distribution (Figure 7). This pattern is characteristic of occasional large deviations rather than of a uniform loss of accuracy: the median MAE of the ToF pipeline remains of the same order as that of the RGB methods, while its mean is accompanied by a standard deviation exceeding it, and its limits of agreement are wide despite a comparatively modest bias.

The same asymmetry between median and mean is observed within each breathing phase (Table 5), and it coexists with the least dispersed waveform-level agreement of all methods (Table 3), indicating that the extracted depth waveform follows the reference throughout the recording. The most likely origin of these deviations is a brief perturbation of the tracked ROI, during which the depth-derived rate momentarily loses its correspondence with the thoracic motion; this interpreta-

tion is supported by the lowest apnea specificity among all methods (Table 6), which reflects isolated intervals in which the depth-based estimate collapses during active breathing.

MethodSensitivitySpecificityF1F_1
ToF0.6600.9510.662
Farnebäck0.5300.9830.647
Horn-Schunck0.5120.9830.632
Lucas-Kanade0.5490.9840.667

Table 6. Apnea-Detection Performance per Method

Breathing Phases Analysis

The protocol includes three phases: normal breathing, voluntary hyperventilation, and breath-hold. To evaluate performance across different respiratory dynamics, the MAE was recomputed per window for the normal and hyperventilation phases, excluding apnea due to the zero-reference condition. The results are shown in Figure 9, with numerical values reported in Table 5.

Per-subject MAE of the estimated instantaneous RR, split by protocol phase

Figure 9. Per-subject MAE of the estimated instantaneous RR, split by protocol phase (normal vs. hyperventilation).

The three RGB pipelines exhibit relatively stable behavior between phases, with only a modest increase in MAE during hyperventilation and a limited growth in inter-subject variability, indicating that the optical-flow methods scale reasonably well from resting to elevated RRs. The ToF pipeline shows a markedly stronger phase dependence, with both the mean MAE and the inter-subject variability increasing substantially during hyperventilation. This degradation is driven by the larger thoracic excursions associated with rapid breathing, which exacerbate the sensitivity of the depth-based estimator to small displacements of the tracked ROI.

Apnea Detection

The breath-hold phase was analyzed as a binary apnea-detection task since the reference RR drops to zero. Each 1 Hz sample was labeled as apnea or non-apnea according to the reference and compared with the pipeline output. Sensitivity, specificity, and F1F_1 score are reported in Table 6.

All pipelines achieve high specificity (0.95–0.98), indicating a low false-alarm rate during active breathing. Differences emerge in sensitivity: the ToF pipeline reaches 0.66, while RGB methods range between 0.51 and 0.55. This reflects the direct measurement of thoracic displacement in depth data, whereas RGB-based estimates depend on the magnitude of motion, which becomes less distinguishable from noise during apnea. The experimental evaluation reported in § 4 addresses the central question motivating this work: how RGB optical flow and ToF pipelines compare when implemented on the same low-cost edge platform, applied to the same cohort, and validated against a common reference. The three RGB methods exhibited closely aligned accuracy metrics, whereas the depth-based pipeline showed a higher median error and greater inter-subject variability. In contrast, apnea detection revealed the opposite trend, with the ToF modality achieving a higher sensitivity.

Discussion

A closer examination of the RGB results clarifies this behavior. Within this modality, the three optical-flow algorithms behaved as practically equivalent estimators of RR. Their interquartile ranges largely overlapped in Figure 5 and Figure 7, and the limits of agreement (Table 4) were also similar, spanning approximately ±13 to ±17 BPM around small positive biases of +1.60 to +2.11 BPM. These findings suggest that the choice of optical-flow algorithm can be guided by secondary criteria such as computational cost or implementation simplicity, without a clear loss in accuracy. Under this criterion, the sparse Lucas–Kanade estimator becomes an attractive option compared to the dense Farnebäck and Horn–Schunck methods, since it evaluates motion over a limited set of feature points. This result also addresses one of the gaps identified in § 1, namely the lack of side-by-side comparisons under a common protocol.

The apparent discrepancy between waveform agreement and RR accuracy provides further insight into the characteristics of the evaluated modalities. Although the ToF pipeline achieved waveform correlations comparable to, or slightly higher than, those of the RGB methods (Table 3), it also exhibited the largest RR errors (Table 4). This finding indicates that preserving the temporal structure of the respiratory signal does not necessarily translate into accurate rate estimation. The depth-based approach consistently captured the overall respiratory pattern, suggesting robust tracking of thoracic motion; however, small deviations in peak localization and rate calculation accumulated into a larger systematic bias (+3.38 BPM) and wider limits of agreement. In contrast, the RGB pipelines showed slightly lower waveform agreement but more accurate RR estimates. These observations emphasize that waveform fidelity and rate accuracy assess complementary aspects of performance and should therefore be interpreted jointly. A similar consideration applies to apnea detection, where the preservation of respiratory periodicity and amplitude is more relevant than the precision of individual RR estimates.

In contrast, the depth-based pipeline exhibits more variable behavior. Although its median error remained of the same order of magnitude, both the limits of agreement and the inter-subject variability were larger. Phase analysis helps to explain this difference. Although the median error per subject remained comparable in all breathing conditions, the cohort mean increased markedly during hyperventilation. This effect was driven by recordings with larger thoracic excursions, where increased ROI displacement introduced transient fluctuations in the depth signal. At the same time, the depth-based pipeline achieved the highest sensitivity for apnea detection. This is consistent with the underlying measurement principle: during apnea, the distance signal becomes nearly constant, facilitating detection, whereas RGB methods rely on motion estimates that approach noise levels.

These observations are consistent with the literature discussed in § 2. Vision-based studies conducted under highly controlled conditions, such as those of Massaroni et al. [12] and Romano et al. [3], represent a lower bound in terms of error but rely on constrained acquisition setups. The results reported here are closer to those obtained under less controlled conditions, such as the overnight recordings by Zhu et al. [16]. For depth sensing, the observed bias aligns with previous ToF- and LiDAR-based studies, although the increased variability likely reflects the inclusion of more demanding breathing regimes, such as hyperventilation.

From an implementation perspective, the real-time measurements in Table 2 confirm that both pipelines operate within the constraints of a low-cost embedded platform. The ToF pipeline retains a significantly lower computational demand, whereas the RGB pipeline is primarily limited by pose estimation and dense optical-flow computation. This suggests that both modalities could be executed jointly on the same device, supporting the multimodal approach proposed in this work and addressing the deployment-related gap identified in § 1.

Finally, several limitations should be acknowledged. The evaluation was conducted on a relatively small cohort of healthy adults, and RGB and ToF data were acquired during separate recording sessions, precluding direct signal-level fusion and synchronized multimodal analysis. In addition, all measurements were performed under ambient lighting conditions, and apnea episodes were voluntarily induced rather than clinically observed. The study was also not powered to assess sex-related differences. Although the cohort included both male and female participants (Table 1), the sample size within each subgroup was insufficient for meaningful statistical comparison. Nevertheless, sex-specific anatomical and respiratory characteristics, including differences in thoracic morphology and breathing patterns, may influence the magnitude and distribution of respiratory motion captured by both sensing modalities. These limitations motivate future studies involving larger and more diverse populations, synchronized multimodal acquisition, evaluation under more challenging conditions such as low illumination and partial occlusion, and adequately powered analyzes to investigate potential sex-specific effects on respiratory monitoring performance.

Conclusion

This work presents a low-cost, real-time platform for non-contact respiratory rate monitoring based on RGB and time-of-flight depth sensing, implemented using a single consumer-grade multimodal sensor on a Raspberry Pi 5 edge device. Three RGB optical-flow methods (Lucas–Kanade, Farnebäck, and Horn–Schunck) and a depth-based pipeline were evaluated on a cohort of twelve healthy volunteers under a structured protocol comprising normal breathing, voluntary hyperventilation, and apnea, against a common piezoresistive respiratory belt reference. The evaluation covered waveform agreement, RR estimation accuracy, phase-dependent behavior, apnea detection, and real-time performance.

The RGB optical-flow methods provided consistent waveform tracking and lower RR estimation errors, with Lucas–Kanade achieving the lowest median MAE (3.83 BPM) and similar error distributions across the three methods. The ToF pipeline exhibited a higher estimation error (median MAE 6.24 BPM) and greater variability between subjects, but a higher sensitivity in apnea detection (0.66 compared with 0.51-0.55 for the RGB methods). Both pipelines satisfied real-time constraints on the target edge device. These results demonstrate that RGB optical flow and depth sensing fulfill distinct and complementary roles within a unified low-cost platform, and that signal-level fusion of the two streams is a natural next step. Future work will focus on validating this approach in broader clinical populations and under challenging conditions such as low-light environments.

Authors’ contributions Dominik Jasiówka: Conceptualization, Methodology, Software, Investigation, Formal analysis, Data curation, Visualization, Validation, Writing – original draft. Ludwin Molina Arias: Conceptualization, Methodology, Formal analysis, Validation, Supervision, Writing – review & editing. Patryk Ciężarek: Investigation, Resources, Validation. Joanna Żyżnawska: Investigation, Resources, Validation. All authors read and approved the final manuscript.

Funding This work was supported by a statutory research subvention from the Polish Ministry of Science and Higher Education (Contract No. 16.16.120.773) and by the National Science Centre, Poland (NCN), under Grant No. DEC-2025/09/X/ST7/00737.

Availability of data and materials The dataset generated and analyzed during the current study is publicly available in the RODBUK repository of AGH University of Krakow at https://doi.org/10.58032/AGH/EGVPXQ. The source code for data acquisition, signal processing, and analysis is available on GitHub at https://github.com/ludwin-molina/Contacless-RespiratoryAnalysis.

Declaration of generative AI and AI-assisted technologies in the writing process During the preparation of this manuscript, generative AI tools were used exclusively for language editing, including grammar correction and improvement of readability. The authors reviewed and approved all revisions and take full responsibility for the final content of the manuscript.

Compliance with ethical standards

Conflict of interest The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Ethics approval All procedures involving human participants were approved by the Research Ethics Committee of the Jagiellonian University Medical College (Resolution No. 47/2026, 22 January 2026) and were conducted in accordance with the principles of the Declaration of Helsinki.

Consent to participate Written informed consent was obtained from all participants prior to their inclusion in the study.

Ethics in publishing This manuscript is original, has not been published previously, and is not under consideration for publication elsewhere.

References

  1. [1]Anthony P. Addison, Paul S. Addison, Philip Smit, Dominique Jacquel, and Ulf R. Borg. Non-contact respiratory monitoring using depth sensing cameras: A review of current literature. Sensors, 21:1135, 2 2021. ISSN 1424-8220. doi: 10.3390/s21041135.DOI
  2. [2]Michelle A Cretikos, Rinaldo Bellomo, Ken Hillman, Jack Chen, Simon Finfer, and Arthas Flabouris. Respiratory rate: the neglected vital sign. Medical Journal of Australia, 188: 657–659, 6 2008. ISSN 0025-729X. doi: 10.5694/j.1326-5377.2008.tb01825.x.DOI
  3. [3]Chiara Romano, Emiliano Schena, Sergio Silvestri, and Carlo Massaroni. Non-contact respiratory monitoring using an rgb camera for real-world applications. Sensors, 21:5126, 7 2021. ISSN 1424-8220. doi: 10.3390/s21155126.DOI
  4. [4]Gary B Smith, Oliver C Redfern, Marco AF Pimentel, Stephen Gerry, Gary S Collins, James Madiba, David Prytherch, Paul E Schmidt, and Peter J Watkinson. The national early warning score 2 (news2). Clinical Medicine, 19:260, 5 2019. ISSN 14702118. doi: 10.7861/clinmedicine.19-3-260.DOI
  5. [5]Susannah Fleming, Matthew Thompson, Richard Stevens, Carl Heneghan, Annette Plüddemann, Ian Maconochie, Lionel Tarassenko, and David Mant. Normal ranges of heart rate and respiratory rate in children from birth to 18 years of age: a systematic review of observational studies. The Lancet, 377:1011–1018, 3 2011. ISSN 01406736. doi: 10.1016/S0140-6736(10)62226-X.DOI
  6. [6]Alejandro Rodríguez-Molinero, Leire Narvaiza, Jorge Ruiz, and César Gálvez-Barrón. Normal respiratory rate and peripheral blood oxygen saturation in the elderly population. Journal of the American Geriatrics Society, 61:2238–2240, 12 2013. ISSN 0002-8614. doi: 10.1111/jgs.12580.
  7. [7]Tauseef Hussain, Sana Ullah, Raúl Fernández-García, and Ignacio Gil. Wearable sensors for respiration monitoring: A review. Sensors, 23:7518, 8 2023. ISSN 1424-8220. doi: 10.3390/s23177518.DOI
  8. [8]Ambra Cesareo, Ylenia Previtali, Emilia Biffi, and Andrea Aliverti. Assessment of breathing parameters using an inertial measurement unit (imu)-based system. Sensors, 19:88, 12 2018. ISSN 1424-8220. doi: 10.3390/s19010088.DOI
  9. [9]Peter H. Charlton, Drew A. Birrenkott, Timothy Bonnici, Marco A. F. Pimentel, Alistair E. W. Johnson, Jordi Alastreuy, Lionel Tarassenko, Peter J. Watkinson, Richard Beale, and David A. Clifton. Breathing rate estimation from the electrocardiogram and photoplethysmogram: A review. IEEE Reviews in Biomedical Engineering, 11:2–20, 10 2018. ISSN 1937-3333. doi: 10.1109/RBME.2017.2763681.DOI
  10. [10]Amit Krishan Kumar, M. Ritam, Lina Han, Shuli Guo, and Rohitash Chandra. Deep learning for predicting respiratory rate from biosignals. Computers in Biology and Medicine, 144:105338, 5 2022. ISSN 00104825. doi: 10.1016/j.compbiomed.2022.105338.
  11. [11]Wim Verkruysse, Lars O Svaasand, and J Stuart Nelson. Remote plethysmographic imaging using ambient light. Optics Express, 16:21434, 12 2008. ISSN 1094-4087. doi: 10.1364/OE.16.021434.
  12. [12]Carlo Massaroni, Emiliano Schena, Sergio Silvestri, Fabrizio Taffoni, and Mario Merone. Measurement system based on rgb camera signal for contactless breathing pattern and respiratory rate monitoring. In 2018 IEEE International Symposium on Medical Measurements and Applications (MeMeA), pages 1–6. IEEE, 6 2018. ISBN 978-1-5386-3392-2. doi: 10.1109/MeMeA.2018.8438692.
  13. [13]Carlo Massaroni, Andrea Nicolo, Massimo Sacchetti, and Emiliano Schena. Contactless methods for measuring respiratory rate: A review. IEEE Sensors Journal, 21:12821–12839, 6 2021. ISSN 1530-437X. doi: 10.1109/JSEN.2020.3024386.DOI
  14. [14]Fabian Schrumpf, Christoph Monch, Gerold Bausch, and Mirco Fuchs. Exploiting weak head movements for camera-based respiration detection. In 2019 41st Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), pages 6059–6062. IEEE, 7 2019. ISBN 978-1-5386-1311-5. doi: 10.1109/EMBC.2019.8856387.DOI
  15. [15]Marc Mateu-Mateus, Federico Guede-Fernandez, Miguel Angel Garcia-Gonzalez, Juan Jose Ramos-Castro, and Mireya Fernandez-Chimeno. Camera-based method for respiratory rhythm extraction from a lateral perspective. IEEE Access, 8:154924–154939, 2020. ISSN 2169-3536. doi: 10.1109/ACCESS.2020.3018616.
  16. [16]Kaiyin Zhu, Michael Li, Sina Akbarian, Maziar Hafezi, Azadeh Yadollahi, and Babak Taati. Vision-based heart and respiratory rate monitoring during sleep – a validation study for the population at risk of sleep apnea. IEEE Journal of Translational Engineering in Health and Medicine, 7:1–8, 2019. ISSN 2168-2372. doi: 10.1109/JTEHM.2019.2946147.DOI
  17. [17]Jorge Brieva, Hiram Ponce, and Ernesto Moya-Albor. A contactless respiratory rate estimation method using a hermite magnification technique and convolutional neural networks. Applied Sciences, 10:607, 1 2020. ISSN 2076-3417. doi: 10.3390/app10020607.DOI
  18. [18]Omar Ghezzi, Giuseppe Boccignone, Giuliano Grossi, Raffaella Lanzarotti, and Alessandro D’Amelio. Cliffphys: Camera-based respiratory measurement using clifford neural networks. In Computer Vision – ECCV 2024, pages 221–238. Springer Nature Switzerland, 2025. doi: 10.1007/978-3-031-73013-9_13.
  19. [19]Raquel Alves, Folkke van Meulen, Sebastiaan Overeem, Hennie Janssen, Pauline van Hirtum, Svitlana Zinger, and Sander Stuitje. Thermal cameras for overnight measuring of respiration in a clinical setting. Sensors, 25:5956, 9 2025. ISSN 1424-8220. doi: 10.3390/s25195956.DOI
  20. [20]Ta-Chi Chiang, Meng-Hsiung Tung, Hendrick Rick, Dedi Kurniadi, Zhi-Hao Wang, and Gwo-Jia Jong. The non-contact respiratory monitoring system using thermal image processing. In 2016 3rd International Conference on Green Technology and Sustainable Development (GTSD), pages 86–92. IEEE, 11 2016. ISBN 978-1-5090-3638-7. doi: 10.1109/GTSD.2016.30.DOI
  21. [21]Sonomi NAGATA, Atsuya ISHIDA, and Kazuhito MURAKAMI. Breath monitoring by thermal vision. In 2018 IEEE 7th Global Conference on Consumer Electronics (GCCE), pages 325–326. IEEE, 10 2018. ISBN 978-1-5386-6309-7. doi: 10.1109/GCCE.2018.8574879.DOI
  22. [22]Mohsen Mozafari, Andrew J. Law, Rafik A. Goubran, and James R. Green. Respiratory rate estimation from thermal video data using spatio-temporal deep learning. Sensors, 24:6386, 10 2024. ISSN 1424-8220. doi: 10.3390/s24196386.
  23. [23]Bryce Hill, Ryan Stapley, Mad SIddat Bin Nesar, and Bradley M. Whitaker. Touchless respiratory monitor preliminary data and results. In 2021 IEEE Aerospace Conference (50100), volume 2021-March, pages 1–7. IEEE, 3 2021. ISBN 978-1-7281-7436-5. doi: 10.1109/AERO50100.2021.9483154.DOI
  24. [24]Md Siddat Bin Nesar, Karis Trippe, Ryan Stapley, Bradley M. Whitaker, and Bryce Hill. Improving touchless respiratory monitoring via lidar orientation and thermal imaging. In 2022 IEEE Aerospace Conference (AERO), volume 2022-March, pages 1–8. IEEE, 3 2022. ISBN 978-1-6654-3760-8. doi: 10.1109/AERO53065.2022.9843494.DOI
  25. [25]Omar Hinrich, Ahmad Alsharoa, and Denise A. Baker. Remote breathing monitoring using lidar technology. In 2024 46th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), pages 1–6. IEEE, 7 2024. ISBN 978-3-9503-7149-9. doi: 10.1109/EMBC53108.2024.10782856.
  26. [26]Wenjie Lv, Wangdong He, Xiping Lin, and Jungang Miao. Non-contact monitoring of human vital signs using fmcw millimeter wave radar in the 120 ghz band. Sensors, 21:2732, 4 2021. ISSN 1424-8220. doi: 10.3390/s21082732.DOI
  27. [27]Jong Deok Kim, Won Hyuk Lee, Yongue Lee, Hyun Ju Lee, Taehyen Cha, Seung Hyun Kim, Ki-Min Song, Young-Hyo Lim, Seok Hyun Cho, Sung Ho Cho, and Hyun-Kyung Park. Non-contact respiration monitoring using impulse radio ultrawideband radar in neonates. Royal Society Open Science, 6:190149, 6 2019. ISSN 2054-5703. doi: 10.1098/rsos.190149.
  28. [28]Shekh M. M. Islam, Olga Boric-Lubecke, and Victor M. Lubecke. Concurrent respiration monitoring of multiple subjects by phase-comparison monopulse radar using independent component analysis (ica) with jade algorithm and direction of arrival (doa). IEEE Access, 8:73558–73569, 2020. ISSN 2169-3536. doi: 10.1109/ACCESS.2020.2988038.DOI
  29. [29]Daniil Osokin. Real-time 2d multi-person pose estimation on cpu: Lightweight openpose. In Proceedings of the 8th International Conference on Pattern Recognition Applications and Methods, volume 1, pages 744–748. SCITEPRESS - Science and Technology Publications, 2019. ISBN 978-989-758-351-3. doi: 10.5220/0007555407440748.
  30. [30]Zhe Cao, Gines Hidalgo, Tomas Simon, Shih-En Wei, and Yaser Sheikh. Openpose: Realtime multi-person 2d pose estimation using part affinity fields. IEEE Transactions on Pattern Analysis and Machine Intelligence, 43:172–186, 1 2021. ISSN 0162-8828. doi: 10.1109/TPAMI.2019.2929257.
  31. [31]Bruce D. Lucas and Takeo Kanade. An iterative image registration technique with an application to stereo vision. In International Joint Conference on Artificial Intelligence, 1981.
  32. [32]Jianbo Shi and Tomasi. Good features to track. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition CVPR-94, pages 593–600. IEEE Comput. Soc. Press, 1994. ISBN 0-8186-5825-8. doi: 10.1109/CVPR.1994.323794.DOI
  33. [33]Berthold K.P. Horn and Brian G. Schunck. Determining optical flow. Artificial Intelligence, 17:185–203, 8 1981. ISSN 00043702. doi: 10.1016/0004-3702(81)90024-2.DOI
  34. [34]Gunnar Farnebäck. Two-frame motion estimation based on polynomial expansion. In Image Analysis, pages 363–370. Springer Berlin Heidelberg, 2003. doi: 10.1007/3-540-45103-X\_50.DOI
  35. [35]J. Martin Bland and Douglas G. Altman. Statistical methods for assessing agreement between two methods of clinical measurement. The Lancet, 327:307–310, 2 1986. ISSN 01406736. doi: 10.1016/S0140-6736(86)90837-8.DOI

Paper details

vlnc:W_a93fnnva
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
  • Engineering

Not recorded for this paper

View statement
Looking for related papers…
Contents