【问题标题】:Heart Rate monitor using OpenCV使用 OpenCV 的心率监测器
【发布时间】:2015-12-29 17:53:28
【问题描述】:

我正在尝试构建心率监视器,用户可以将手指放在相机上并打开闪光灯,然后向他显示心率。

到目前为止,我正在从手机中捕获视频,然后在笔记本电脑中使用 OpenCV 对其进行处理。

我遵循的步骤是:

  • 捕捉视频
  • 求每一帧的平均红色平面值
  • 过滤数据以去除不需要的峰
  • 计算峰值,然后显示心率

    import numpy as np
    import cv2
    
    #connecting with the captured video file taken from mobile
    cap = cv2.VideoCapture('heart_rate.mp4')
    
    #getting the number of frames 
    no_of_frames = int(cap.get(7))
    
    #assigning an initial zero red value for every frame
    red_plane = np.zeros(no_of_frames)
    
    #time_list is used for storing occurence time of each frame in the video  
    time_list=[]
    t=0
    
    #camera frame per second is 30 and so each frame acccurs after 1/30th second
    difference = 1/30
    for i in range(no_of_frames):
    
        #reading the frame
        ret,frame = cap.read()
        length,width,channels = frame.shape
    
        #calculating average red value in the frame
        red_plane[i] = np.sum(frame[:,:,2])/(length*width)
        time_list.append(t)
        t = t+ difference
    
    
    cap.release()
    

我无法应用低通滤波器来平滑我的数据,以及如何使用 OpenCV 找到峰值。 任何帮助都会很棒。

【问题讨论】:

  • 请在谷歌上搜索“fft”和“欧拉放大率”
  • 为什么需要低通滤波器?最好通过高斯滤波器来模糊帧以去除细节和噪声。对于峰值,我会在分析完所有帧后处理它
  • @tales_padua 我想要一个低通滤波器来平滑图形,这样可以去除不需要的峰值,只留下所需的峰值。实际上,我正在计算一个描述单个帧的单个红色值,因此我正在为我的视频中的每一帧找到红色值,然后我想找到峰值
  • 还有经典的ICA方法:osapublishing.org/…
  • 为了平滑图像,我会使用高斯滤波器。您可以在这里查看如何使用它,以及其他一些有用的有用方法:docs.opencv.org/master/d4/d13/…

标签: python opencv image-processing


【解决方案1】:

我以 30FPS 制作视频,对每一帧 r 通道求和,并将平均和存储到一个列表中。然后我在 matplotlib 中绘制列表如下。

我们可以很容易地找到从帧90 到帧300 的大约八个峰值。也就是说,有7 periods in 200 frames( taken in 200/30 s),所以心率是7 / (200/30) = 21/20 => 63/60。也就是说,我的心率是63

也许,Fourier Analysis 会有所帮助。但是,不幸的是,我仍然不知道如何在程序中分析这条曲线......

(因为我忘记了AlanV.OppenhSignals & System

ORZ ...


心脏跳动的手指 gif。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-22
    • 2015-03-22
    • 1970-01-01
    相关资源
    最近更新 更多