# QRS检测

QRS检测是心电图（ECG）记录中定位QRS波群的信号处理步骤，它标出每一次心搏，从而可测量心搏位置、RR间期与心率。检测器的输出是一串心搏位置的时间序列，通常为R峰索引，RR间期与心率变异性（HRV）即由此导出；QRS位置同时也是测量其他心电图波形与间期的参照。<sup>[1](https://link.springer.com/article/10.1007/s11831-023-09916-x)</sup><sup> • </sup><sup>[2](https://iopscience.iop.org/article/10.1088/2057-1976/ad16c0)</sup> 由于下游的每一项心电图分析都依赖正确的心搏位置，漏检波群、多检波群与时序抖动会叠加为心率与HRV结果中更大的误差。<sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0309739)</sup>

| 关键事实 | 数值 |
|---|---|
| 输出 | R峰（心搏）位置；RR间期与心率在下游导出<sup>[2](https://iopscience.iop.org/article/10.1088/2057-1976/ad16c0)</sup> |
| 标准流程 | 带通滤波、非线性变换（微分、平方、积分）、阈值判定、决策逻辑<sup>[4](https://people.ece.cornell.edu/land/courses/ece5030/labs/s2014/QRS_detect_review.pdf)</sup> |
| 常用带通 | 约5–15 Hz（亦有报道称截止频率约为10–25 Hz）<sup>[5](https://www.nature.com/articles/s41598-026-53724-9)</sup><sup> • </sup><sup>[4](https://people.ece.cornell.edu/land/courses/ece5030/labs/s2014/QRS_detect_review.pdf)</sup> |
| Pan–Tompkins在MIT-BIH上 | 正确检出99.3%的QRS波群<sup>[6](https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Pan+Tompkins.pdf)</sup> |
| 抖动感知评分（JF） | 尽管灵敏度达99.3%，Pan–Tompkins仅为75.3 ± 19.1<sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0309739)</sup> |
| 运动的影响 | 17种算法中有15种在步行时表现变差；17种在跑步时均比静坐时差<sup>[5](https://www.nature.com/articles/s41598-026-53724-9)</sup> |
| 对HRV的影响 | 在八种检测器上，23项HRV指标的一致性从0.99到零乃至略为负值不等<sup>[7](https://www.nature.com/articles/s41598-026-49215-6)</sup> |

## 原理

心电图信号由[P波](https://www.edgepedia.org/zh/p-wave)、[QRS波群](https://www.edgepedia.org/zh/qrs-complex)与[T波](https://www.edgepedia.org/zh/t-wave)组成，R峰是QRS波群的最高峰；临床医生在查看QRS或R峰时，将这一定位视为心脏诊断分析的必备步骤。<sup>[1](https://link.springer.com/article/10.1007/s11831-023-09916-x)</sup> 一阶微分可捕捉QRS波群陡峭的上升与下降斜率，这是检测的一项关键特征。<sup>[5](https://www.nature.com/articles/s41598-026-53724-9)</sup>

许多经典检测器都采用自动QRS检测早期形成的两级结构：先是进行线性与非线性滤波的预处理或特征提取级，随后是包含峰检测与决策逻辑的判决级。<sup>[4](https://people.ece.cornell.edu/land/courses/ece5030/labs/s2014/QRS_detect_review.pdf)</sup> [带通滤波](https://www.edgepedia.org/zh/bandpass-filtering)通过QRS能量所在频段，典型为5–15 Hz，同时衰减P波、T波、基线漂移与耦合噪声。<sup>[5](https://www.nature.com/articles/s41598-026-53724-9)</sup><sup> • </sup><sup>[4](https://people.ece.cornell.edu/land/courses/ece5030/labs/s2014/QRS_detect_review.pdf)</sup>

## 实现方法

参考实现是Pan–Tompkins算法，它通过对斜率、幅度与宽度的数字分析来识别QRS波群，并用带通滤波器减少干扰引起的误检。<sup>[6](https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Pan+Tompkins.pdf)</sup> 其各级依次为：

1. 带通滤波（在实际实现中为5–15 Hz）去除基线漂移与高频噪声；滤波后可采用较低的阈值，从而提高灵敏度。<sup>[8](https://pypi.org/project/pantompkins/)</sup><sup> • </sup><sup>[6](https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Pan+Tompkins.pdf)</sup>
2. 微分（五点微分）突出R波斜率。<sup>[9](https://www.frontiersin.org/journals/physiology/articles/10.3389/fphys.2024.1384356/full)</sup>
3. 平方使所有数值为正，并放大幅度大的斜率。<sup>[6](https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Pan+Tompkins.pdf)</sup>
4. 滑动窗口积分除R波斜率外还生成波形特征信息，计算式为 \( y(nT) = \tfrac{1}{N} \left[ x(nT-(N-1)T) + x(nT-(N-2)T) + \cdots \right] \)。<sup>[6](https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Pan+Tompkins.pdf)</sup>
5. 自适应双阈值：两组阈值，其中一组为另一组的一半，持续根据最新的信号峰与噪声峰调整；每个检出的峰都依据阈值判为QRS或噪声。<sup>[6](https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Pan+Tompkins.pdf)</sup><sup> • </sup><sup>[10](https://www.mathworks.com/help/dsp/ug/real-time-ecg-qrs-detection.html)</sup>
6. 决策逻辑：检测器在每次检出后设定200 ms的不应期；当在当前平均RR间期的166%范围内未检出QRS时，触发回溯搜索程序<sup>[23](https://site.physiciansresource.net/PhilipsIntellivueMP70PatientMonitor.pdf)</sup>；对于二联律、三联律等不规则心律，将两组阈值均减半以提高灵敏度；T波鉴别可防止将高尖T波计为心搏。<sup>[6](https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Pan+Tompkins.pdf)</sup>

## 起源

Pan–Tompkins算法由潘（Jiapu Pan）与汤普金斯（Willis J. Tompkins）在《一种实时QRS检测算法》（A Real-Time QRS Detection Algorithm）中报道，载于《IEEE生物医学工程汇刊》1985年第BME-32卷第3期，第230–236页。<sup>[11](https://doi.org/10.1109/tbme.1985.325532)</sup> 它最初用汇编语言为Z80微处理器编写，设计为在200 Hz下处理单一心电图导联，后由汉密尔顿（Hamilton）与汤普金斯改进并移植到C语言。<sup>[12](https://physlab.org/wp-content/uploads/2022/04/Open-Source-ECG-Analysis.pdf)</sup> 这项后续工作《利用MIT/BIH心律失常数据库对QRS检测规则的定量研究》，作者为汉密尔顿（Patrick S. Hamilton）与汤普金斯（Willis J. Tompkins）（载于《IEEE生物医学工程汇刊》，1986年），对Pan–Tompkins的预处理略有修改，并以更复杂的规则判定QRS波群。<sup>[13](https://doi.org/10.1109/tbme.1986.325695)</sup><sup> • </sup><sup>[9](https://www.frontiersin.org/journals/physiology/articles/10.3389/fphys.2024.1384356/full)</sup>

## 变体

各具名算法族的主要差别在于所用的变换与所施加的决策规则：

- **汉密尔顿–汤普金斯（Hamilton–Tompkins）**：先低通后高通滤波、微分、滑动平均与峰检测，与Pan–Tompkins十分相似。<sup>[14](https://www.scitepress.org/publishedPapers/2021/102346/pdf/index.html)</sup>
- **匹配滤波**：先用带50 Hz陷波和15–40 Hz带通的梳状滤波器处理数字化心电图，再用匹配滤波器。<sup>[4](https://people.ece.cornell.edu/land/courses/ece5030/labs/s2014/QRS_detect_review.pdf)</sup>
- **小波变换与滤波器组**：通过多尺度分解定位QRS能量；自20世纪90年代中期以来，小波波形定位一直是重要的研究方向。<sup>[4](https://people.ece.cornell.edu/land/courses/ece5030/labs/s2014/QRS_detect_review.pdf)</sup><sup> • </sup><sup>[15](https://link.springer.com/article/10.1186/1475-925X-10-23)</sup> 一种连续样条小波变换检测器还能对QRS形态进行分类，并自适应心率、幅度与形态的变化。<sup>[2](https://iopscience.iop.org/article/10.1088/2057-1976/ad16c0)</sup>
- **非线性变换与决策级替代方案**：希尔伯特变换法与香农能量法、隐马尔可夫模型、神经网络、遗传算法、句法方法、过零法与奇异性方法。<sup>[16](https://pmc.ncbi.nlm.nih.gov/articles/PMC3883654/)</sup>
- **基于知识的优化检测器**：埃尔金迪（Mohamed Elgendi）的快速检测器，在11个标准心电图数据库上评估（《PLoS ONE》，2013年）。<sup>[17](https://doi.org/10.1371/journal.pone.0073557)</sup>
- **机器学习与深度学习检测器**：面向可穿戴设备的[全卷积网络](https://www.edgepedia.org/zh/fully-convolutional-network)、RNN、CNN及U-Net式架构。<sup>[5](https://www.nature.com/articles/s41598-026-53724-9)</sup><sup> • </sup><sup>[18](https://www.mdpi.com/2072-666X/16/6/631)</sup>
- **动态贝叶斯网络检测器**：用动态规划推断最可能的QRS位置，在强噪声干扰下的MIT-BIH-NST与CPSC2019上表现优异。<sup>[19](https://www.sciencedirect.com/science/article/abs/pii/S0933365726000229)</sup>

## 应用

QRS检测是心率变异性分析与临床监护的基础，QRS位置也是测量其他心电图波形与间期的参照。<sup>[1](https://link.springer.com/article/10.1007/s11831-023-09916-x)</sup><sup> • </sup><sup>[2](https://iopscience.iop.org/article/10.1088/2057-1976/ad16c0)</sup> 在一项针对25名健康受试者、比较八种广泛使用的检测器的研究中，没有一种算法能始终优于其他算法；23项HRV指标的一致性相关系数从0.99降至零乃至略为负值，具体取决于检测器与条件，其中two_average检测器与真值HRV的一致性最佳，engzee最差。<sup>[7](https://www.nature.com/articles/s41598-026-49215-6)</sup>

## 局限与替代方案

主要伪差包括：呼吸或电极移动引起的基线漂移，它带来低频漂移并使波形边界失真；50或60 Hz的工频干扰；以及肌电噪声。<sup>[20](https://www.frontiersin.org/journals/digital-health/articles/10.3389/fdgth.2025.1649923/full)</sup> 运动会令所有检测器的性能出现可测量的下降：在一项17种算法的基准测试中，15种在步行时表现变差，17种在跑步时均比静坐时差。<sup>[5](https://www.nature.com/articles/s41598-026-53724-9)</sup> 反复出现的失效模式包括：依赖心律的方法在心律失常数据上假阴性率升高，基于阈值的方法在高噪声下性能退化，以及在窄分布上训练的深度学习模型泛化能力有限。<sup>[5](https://www.nature.com/articles/s41598-026-53724-9)</sup> 弗里森（Friesen）等人在1990年针对五种合成噪声类型比较了九种算法，发现在最高噪声水平下，没有一种算法能在不产生假阳性的情况下检出全部QRS波群。<sup>[21](https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Friesen1990.pdf)</sup>

仅报告灵敏度可能高估质量。在惩罚时间不准的抖动感知F分数（JF）下，Pan–Tompkins尽管经确认灵敏度达99.3%，得分仅为75.3 ± 19.1；一款报告灵敏度达99.88%的平稳小波检测器，其抖动容限却很低。<sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0309739)</sup> 在远程医疗级单导联心电图上，对18种开源检测器的基准测试发现，12种在临床监督下采集的记录上F1 ≥ 0.96，但在质量较差的SAFER远程医疗数据上，只有三种达到0.78–0.84的F1值。<sup>[22](https://journals.plos.org/digitalhealth/article?id=10.1371%2Fjournal.pdig.0000538)</sup>

一项可复现的2026年基准测试评估了15种算法——8种传统算法与7种机器学习算法（含6种深度学习方法），并以Pan–Tompkins与汉密尔顿–汤普金斯作为参照——在此前未见过的数据库上开箱即用，全部参数公布于公开代码库。<sup>[5](https://www.nature.com/articles/s41598-026-53724-9)</sup> 在该基准测试中，韩（Han）等人的RNN与CNN在最差记录与全部记录合并两种情形下均取得最高F1分数，是被测算法中对噪声最稳健的。<sup>[5](https://www.nature.com/articles/s41598-026-53724-9)</sup> 误差会传播：漏检波群、多检波群与时序抖动会叠加为HRV中大得多的误差，而HRV正是由相邻检出心搏之间的间期序列计算得出的。<sup>[3](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0309739)</sup>

## References

1. [A Comprehensive Review of Computer-based Techniques for R-Peaks/QRS Complex Detection in ECG Signal (Archives of Computational Methods in Engineering, 2023)](https://link.springer.com/article/10.1007/s11831-023-09916-x)
2. [Robust algorithm for the detection and classification of QRS complexes with different morphologies using the continuous spline wavelet transform (Biomedical Physics & Engineering Express)](https://iopscience.iop.org/article/10.1088/2057-1976/ad16c0)
3. [A new QRS detector stress test combining temporal jitter and F-score (JF) (PLOS One, 2024)](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0309739)
4. [The principles of software QRS detection (Köhler et al., IEEE Engineering in Medicine and Biology Magazine, 2002)](https://people.ece.cornell.edu/land/courses/ece5030/labs/s2014/QRS_detect_review.pdf)
5. [A reproducible benchmark of QRS detection algorithms across diverse ECG datasets and noise conditions (Scientific Reports)](https://www.nature.com/articles/s41598-026-53724-9)
6. [A Real-Time QRS Detection Algorithm (Pan & Tompkins, IEEE Trans. Biomedical Engineering, 1985)](https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Pan+Tompkins.pdf)
7. [Effects of electrocardiogram QRS detection algorithms in heart rate variability metrics (Scientific Reports)](https://www.nature.com/articles/s41598-026-49215-6)
8. [pantompkins v1.0.0 (PyPI package documentation)](https://pypi.org/project/pantompkins/)
9. [A simple and effective deep neural network based QRS complex detection method on ECG signal (Frontiers in Physiology, 2024)](https://www.frontiersin.org/journals/physiology/articles/10.3389/fphys.2024.1384356/full)
10. [Real-Time ECG QRS Detection, MATLAB & Simulink (MathWorks documentation)](https://www.mathworks.com/help/dsp/ug/real-time-ecg-qrs-detection.html)
11. [Jiapu Pan, Willis J. Tompkins (1985). A Real-Time QRS Detection Algorithm. IEEE Transactions on Biomedical Engineering.](https://doi.org/10.1109/tbme.1985.325532)
12. [Open Source ECG Analysis (Hamilton)](https://physlab.org/wp-content/uploads/2022/04/Open-Source-ECG-Analysis.pdf)
13. [Patrick S. Hamilton, Willis J. Tompkins (1986). Quantitative Investigation of QRS Detection Rules Using the MIT/BIH Arrhythmia Database. IEEE Transactions on Biomedical Engineering.](https://doi.org/10.1109/tbme.1986.325695)
14. [Comparison of QRS detection algorithms (SCITEPRESS conference paper, 2021)](https://www.scitepress.org/publishedPapers/2021/102346/pdf/index.html)
15. [A wavelet-based ECG delineation algorithm for 32-bit integer online processing (BioMedical Engineering OnLine)](https://link.springer.com/article/10.1186/1475-925X-10-23)
16. [Revisiting QRS Detection Methodologies for Portable, Wearable, Battery-Operated, and Wireless ECG Systems (BioMed Research International)](https://pmc.ncbi.nlm.nih.gov/articles/PMC3883654/)
17. [Mohamed Elgendi (2013). Fast QRS Detection with an Optimized Knowledge-Based Method: Evaluation on 11 Standard ECG Databases. PLoS ONE.](https://doi.org/10.1371/journal.pone.0073557)
18. [An Artificial Intelligence QRS Detection Algorithm for Wearable Electrocardiogram Devices (Micromachines, 2025)](https://www.mdpi.com/2072-666X/16/6/631)
19. [A novel ECG QRS complex detection algorithm based on dynamic Bayesian network (Artificial Intelligence in Medicine, Elsevier)](https://www.sciencedirect.com/science/article/abs/pii/S0933365726000229)
20. [Advances in machine and deep learning for ECG beat classification: a systematic review (Frontiers in Digital Health, 2025)](https://www.frontiersin.org/journals/digital-health/articles/10.3389/fdgth.2025.1649923/full)
21. [A comparison of the noise sensitivity of nine QRS detection algorithms (Friesen et al., IEEE Trans. Biomed. Eng., 1990)](https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Friesen1990.pdf)
22. [QRS detection in single-lead, telehealth electrocardiogram signals: Benchmarking open-source algorithms (PLOS Digital Health)](https://journals.plos.org/digitalhealth/article?id=10.1371%2Fjournal.pdig.0000538)
23. [PhilipsIntellivueMP70PatientMonitor (site.physiciansresource.net)](https://site.physiciansresource.net/PhilipsIntellivueMP70PatientMonitor.pdf)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*

Topic: 生命与健康 › 人类健康与医学 › 临床评估与诊疗操作 › Diagnosis and clinical assessment › Vision and ophthalmic assessment

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/qrs-detection

English original: https://www.edgepedia.org/qrs-detection
