5

Possible Duplicate:
Detecting heart rate using the camera

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 start

Community
  • 1
  • 1
AITAALI_ABDERRAHMANE
  • 2,499
  • 1
  • 26
  • 31

1 Answers1

5

I'd start by using AVFoundation to turn the light on. The answers in the linked post below include examples of how to do this:

How to turn the iPhone camera flash on/off?

Then as far as detecting the light change goes, you can probably use Brad Larson's GPUImage Framework. This framework includes a couple of helpful functions that you may be able to use to achieve this, including:

  1. GPUImageAverageLuminanceThresholdFilter
  2. GPUImageAverageColor
  3. GPUImageLuminosity

Using the filters listed above you should be able to measure color variations in your finger, and monitor the time intervals between the occurrences of these changes. Using this framework you may even be able to specify an arbitrary variance requirement for the color/luminosity change.

From there all you have to do is convert the time interval in between the color changes to a pulse. Here's an example of how to calculate pulse.

http://www.wikihow.com/Calculate-Your-Target-Heart-Rate

Community
  • 1
  • 1
Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
  • 3
    You're not the only one thinking along these lines: http://stackoverflow.com/questions/14125995/objective-c-peak-detection-accelerate-framework . I did some experimentation around this, and I believe it might not be that hard to use an average color or luminance filter to track the ups and downs here. You might need to confine this to the red channel and use a little temporal smoothing, but then you simply need to find the peak distance. – Brad Larson Jan 21 '13 at 16:41
  • 2
    Brad Larson, Can you put us a sample code of that pls – AITAALI_ABDERRAHMANE Jan 22 '13 at 10:42
  • @BradLarson Can you please share your experimentation. – iOS Dev Jul 11 '14 at 09:37