lehn0058 / atheartrate Goto Github PK
View Code? Open in Web Editor NEWiOS heart rate detection using a device's camera
License: MIT License
iOS heart rate detection using a device's camera
License: MIT License
Hi,
Thanks you for this great class.
But I'm a newbie and tried to use your lib today and result: camera flash start and stop directly on iphone 5c IOS 9.
Not sure what I did wrong.
My viewController.h:
@interface ViewController : UIViewController
and my viewController.m
@interface ViewController ()
@EnD
@implementation ViewController
Like I said, still I newbie, any idea why flash just start and stop?
Thank you in advance for your help.
Dams
Hi,
I am new to this thing,
I get your library and checked the code.
It is written awesome.
I am facing issue to integrate into my code.
I am using Xcode 7.3 and checking on iOS 9.3
Here is my code...
in ViewController.h file
@interface ViewController : UIViewController
@Property (nonatomic, strong) HeartRateDetectionModel *hr;
@EnD
in ViewController.m file
@interface ViewController ()
@implementation ViewController
@synthesize hr;
(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.hr = [[HeartRateDetectionModel alloc] init];
self.hr.delegate = self;
[self.hr startDetection];
}
(void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)heartRateStart
{
NSLog(@"started!");
}
when I didn't wrote the method "heartRateStart" it was crashing saying "unrecognized selector sent to instance"
now if I do so,
It says
"-[ViewController heartRateUpdate:atTime:]: unrecognized selector sent to instance"
am I following correct guidelines for implementation.
Every time when I integrate your files in any app, do I need to declare all these delegates methods and call to them externally....?
So I implemented all the functions required below like this:
-(void)heartRateStart
{
NSLog(@"started!");
}
Which function actually returns my heartrate? I come from a swift background so objective-c is shaky for me.
Hi, I was using your code gist to calculate the heart rate from iPhone camera but it seems I am missing some essential part here.
I am setting frame rate at 30fps and making all calculations as per the frame rate, however, the heart rate value keeps on increasing with each call. Initially, my app was crashing because the percentage value comes <1 and we cannot divide by zero let heartRate = peakCount / percentage
I added a check for percentage, and execute the above code only if percentage >0. But it seems it affects the overall result.
Trying to achieve this in Swift 5, here is my code snippet:
if (self.hueDataSet.count % framePerSeconds == 0) {
let displaySeconds = hueDataSet.count / framePerSeconds
let bandpassFilteredItems = self.butterworthBandpassFilter(inputData: self.hueDataSet)
let smoothedBandpassItems = self.medianSmoothing(inputData: bandpassFilteredItems)
let peakCount = self.peakCount(inputData: smoothedBandpassItems)
let secondsPassed = smoothedBandpassItems.count / framePerSeconds
let percentage = secondsPassed / 60
if percentage > 0 {
let heartRate = peakCount / percentage
print("heart rate: ", heartRate, "in seconds: ", displaySeconds)
}
}
Also, attaching log here:
heart rate: 139 in seconds: 60
heart rate: 142 in seconds: 61
heart rate: 145 in seconds: 62
heart rate: 147 in seconds: 63
heart rate: 149 in seconds: 64
heart rate: 151 in seconds: 65
heart rate: 153 in seconds: 66
heart rate: 155 in seconds: 67
heart rate: 158 in seconds: 68
heart rate: 160 in seconds: 69
heart rate: 161 in seconds: 70
heart rate: 163 in seconds: 71
heart rate: 165 in seconds: 72
heart rate: 167 in seconds: 73
heart rate: 169 in seconds: 74
heart rate: 171 in seconds: 75
heart rate: 173 in seconds: 76
heart rate: 175 in seconds: 77
heart rate: 178 in seconds: 78
heart rate: 179 in seconds: 79
heart rate: 182 in seconds: 80
heart rate: 185 in seconds: 81
heart rate: 187 in seconds: 82
heart rate: 189 in seconds: 83
heart rate: 193 in seconds: 84
heart rate: 196 in seconds: 85
heart rate: 198 in seconds: 86
I am not sure which place to debug the code. Any help is would be helpful thanks ๐๐ผ
Hi this is not an issue regarding your project. But I saw your Real time Heart data using WatchKit in StackOverflow. So can you help me out here ResearchKit/ResearchKit#530 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.