Detecting heart rate using the camera

15,574

Solution 1

In fact can be simple, you have to analyze the pixel values of the captured image. One simple algorithm would be: select and area in the center of the image, convert to gray scale, get the median value of the pixel for each image and you will end up with a 2D function and on this function calculate the distance between to minimums or maximum and problem solved.

If you have a look at the histogram of the acquired images over a period of 5 seconds, you will notice the changes of the gray level distribution. If you want a more robust calculation analyze the histogram.

Solution 2

As a side note, you may be interested in this research paper. This method does not even require a finger (or anything) directly on the lens.

Share:
15,574
Admin
Author by

Admin

Updated on June 06, 2022

Comments

  • Admin
    Admin about 2 years

    I need the same functionality as the application Instant Heart Rate.

    The basic process requires the user to:

    1. Place the tip of the index finger gently on the camera lens.
    2. Apply even pressure and cover the entire lens.
    3. Hold it steady for 10 seconds and get the heart rate.

    This can be accomplished by turning the flash on and watch the light change as the blood moves through the index finger.

    How can I get the light level data from the video capture? Where should I look for this? I looked through the class AVCaptureDevice but didn't find anything useful.

    I also found AVCaptureDeviceSubjectAreaDidChangeNotification, would that be useful?