Detecting heart rate using the camera
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.
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on June 06, 2022Comments
-
Admin about 2 years
I need the same functionality as the application Instant Heart Rate.
The basic process requires the user to:
- Place the tip of the index finger gently on the camera lens.
- Apply even pressure and cover the entire lens.
- 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?