heart_bpm 套件允許使用者僅使用智慧手機的相機記錄單次血壓讀數。透過分析相機畫面中臉部顏色的微小變化,它能估計心率,並提供一種非侵入性的方式來監測心血管健康。此套件設計簡潔且易於使用,可無縫整合至 Android、iOS 及 Web 平台上的健康應用程式。該套件利用電腦視覺技術即時偵測脈搏變化,為個人健康追蹤提供一種無需額外硬體的便利工具。
適用情境
個人心率監測
無創血壓估計
健身和健康應用
遠端健康檢查
每日健康追蹤
主要特色
基於攝影機的脈搏檢測
即時心率分析
跨平台支援(Android、iOS、Web)
與 Flutter 的簡單整合
輕量且高效的處理
適合對象
健康應用開發者
健身愛好者
遠端醫療應用
移動健康研究
追蹤心血管健康的個人
使用建議
準確性可能因照明和膚色而異
需要穩定的攝像頭輸入
不是醫療級診斷工具
僅限心率,不直接測量血壓
需要用戶配合才能獲得可靠結果
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
heart_bpm
Widget to measure heart rate in beats per minute using the camera of smartphone.
Working principle
Covering the camera lens with the fingertip enables the camera to
measure the subtle changes in skin tone. These are proportional to
the changes in the blood flow through the arteries just below the
skin of the fingertip. This is in-turn correlated to the heart beats.
Hence, the variations in the skin tone can be approximated to the
instances of heart beats. Measuring the time differences between
the peaks provides Beats per Minute.
These values are not stable and hence, an exponential moving average
filter
is implemented. The smoothing factor α, can be controlled by the
user from the calling widget.
Implementation
To access the camera, the module utilizes the
camera package. Hence, the
requirements to use this package have the same requirements.
Android
Minimum android SDK version: 21
Change the minimum Android sdk version to 21 (or higher) in your
android/app/build.gradle file.
minSdkVersion 21
iOS
iOS 10.0 of higher is needed to use the camera plugin. If compiling
for any version lower than 10.0 make sure to check the iOS version
before using the camera plugin. For example, using the
device_info plugin.
Add two rows to the file ios/Runner/Info.plist:
one with the key Privacy - Camera Usage Description and a usage
description.
and one with the key Privacy - Microphone Usage Description and a
usage description.
Or in text format add the key:
<key>NSCameraUsageDescription</key><string>Heart BPM plugin would like to use camera to measure your heart rate.</string><key>NSMicrophoneUsageDescription</key><string>Can I use the mic please?</string>
The microphone key is required though the feature is not being used
and no audio is enabled in the implementation.
Getting Started
The module can be used simply by accessing it as a widget.
Import the module:
import'package:heart_bpm/heart_bpm.dart';
Access the widget as simply as:
/// list to store raw values inList<SensorValue> data = [];
/// variable to store measured BPM valueint bpmValue;
@overrideWidgetbuild(BuildContext context) {
returnScaffold(
appBar: AppBar(
title: Text('Heart BPM Demo'),
),
body: Column(
children: [
isBPMEnabled ? HeartBPMDialog(
context: context,
onRawData: (value) {
setState(() {
// add raw data points to the list// with a maximum length of 100if (data.length == 100)
data.removeAt(0);
data.add(value);
});
},
onBPM: (value) => setState(() {
bpmValue = value;
}),
)
: SizedBox(),
Center(
child: ElevatedButton.icon(
icon: Icon(Icons.favorite_rounded),
label: Text(isBPMEnabled
? "Stop measurement" : "Measure BPM"),
onPressed: () => setState(() =>
isBPMEnabled = !isBPMEnabled
),
),
),
],
),
);