Git Product home page Git Product logo

vpglib's Introduction

VPGLIB

VPGLIB is the library for the blood pulse extraction from the video of the human face. HR measurement ranges from 55 bpm to 175 bpm and absolute error in most cases should be less than 5 bpm. Pay attention that ordinary PC is not certified as measurement tool, so measurement error could be high. Use library only at your own risk, no warranties are granted.

How to use:

#include <iostream>

using namespace std;

#include "vpg.h"

int main()
{
    cv::VideoCapture capture;
    // open default video capture device
    if(capture.open(0)) {
        // CASCADE_FILENAME is a path to haarcascade or lbpcascade file for the face detection
        vpg::FaceProcessor faceproc(CASCADE_FILENAME);
        // measure discretization period of the video
        float framePeriod = faceproc.measureFramePeriod(&capture);
        printf("measured frame period: %.2f ms",framePeriod);
        // create object that performs harmonic analysis of vpg-signal
        vpg::PulseProcessor pulseproc(framePeriod);
        cv::Mat frame;
        unsigned int k = 0; // frame counter
        float s = 0.0, t = 0.0; // 's' for vpg-signal count, 't' for actual frame time
        while(true) {
            if(capture.read(frame)) {
                // perform frame enrollment
                faceproc.enrollImage(frame, s, t);
                // update vpg-signal if face tracked
                if(faceproc.getFaceRect().area() > 0) {
                    pulseproc.update(s,t);
                    // draw rect for tracked face
                    cv::rectangle(frame,faceproc.getFaceRect(),cv::Scalar(127,255,127),1,CV_AA);
                    // periodically compute heart rate estimation
                    if(k % 64 == 0)
                        printf("\nHR measurement: %.0f bpm", pulseproc.computeFrequency());
                }
                cv::imshow("Video probe", frame);
            }
            // increment counter
            k++;
            // exit if user pressed 'escape'
            if( cv::waitKey(1) == 27 )
                break;
        }
    }
    return 0;
}

Dependencies:

  1. OpenCV

Designed by Alex A. Taranov, 2015, list of the project sources

vpglib's People

Contributors

pi-null-mezon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vpglib's Issues

Build instructions for linux docker

Starting with an opencv docker container, what are build instructions for this project? I started with a docker container janza/docker-python3-opencv and installed qt/qmake using apt-get install g++ qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x. Then I don't know how to proceed. I tried doing qmake inside Shared folder and make but it fails with the following error.

/usr/bin/ld: cannot find -lvpg
/usr/bin/ld: cannot find -lopencv_face

Measure reasonable HR values even using a picture.

Hi, thanks for this nice work.
I've played around with the Examples/hrvanalyser. But when I hold a picture of face in front of the camera, it still reports a reasonable heart beat rate.
Is it supposed to be like that, or I've made something wrong ?

compile failure

Hi, I am trying to build the project under windows 10 with vs2013, got the 7 "unresolved external symbol" erros.
ERROR LNK2019: unresolved external symbo vpg::FaceProcessor::__skinColor(*) which is referenced at vpg::FaceProcessor::enrollImage()
same errors for:

  1. FaceProcessor::vftable
  2. PeakDetector::__loop
  3. PeakDetector::__seek
  4. PulseProcessor::__loop
  5. PulseProcessor::__seek
  6. PulseProcessor::vftable

all these symbols are defined in there include file, but no implementation in source files.
BTW, I don't use the buildvpglib.pro to build the vpglib, jusr add source files and include files to the project with opencv headers & libs, then build directly.
What should I do to get these errors solved?

How to calculate breath rate and SPO2?

Excuse me.I know this project is extracted from QPULSECAPTURE,that project included breath rate and SPO2,but vpg only include heart rate,could you tell me how to do it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.