lundi 2 mars 2015

Count heartBeat from iPhone camera.

I would like to count heartbeat using camera flash. I have checked a lot of tutorial but i was unable to find proper answer. I want to get the heartbeat count using camera flash and accelerometer. I don't know how I will achieve this using code. So if any one will suggest/Provide some sample with explanation or tutorial or any code that will help me to achieve this task.


I have found some code like // Get the default camera device AVCaptureDevice* camera = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; if([camera isTorchModeSupported:AVCaptureTorchModeOn]) { [camera lockForConfiguration:nil]; camera.torchMode=AVCaptureTorchModeOn; [camera unlockForConfiguration]; } // Create a AVCaptureInput with the camera device NSError error=nil; AVCaptureInput cameraInput = [[AVCaptureDeviceInput alloc] initWithDevice:camera error:&error]; if (cameraInput == nil) { NSLog(@"Error to create camera capture:%@",error); }



// Set the output
AVCaptureVideoDataOutput* videoOutput = [[AVCaptureVideoDataOutput alloc] init];

// create a queue to run the capture on
dispatch_queue_t captureQueue=dispatch_queue_create("catpureQueue", NULL);

// setup our delegate
[videoOutput setSampleBufferDelegate:self queue:captureQueue];

// configure the pixel format
videoOutput.videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA], (id)kCVPixelBufferPixelFormatTypeKey,
nil];
// cap the framerate
camera.activeVideoMinFrameDuration=CMTimeMake(1, 10);
// and the size of the frames we want
[session setSessionPreset:AVCaptureSessionPresetLow];

// Add the input and output
[session addInput:cameraInput];
[session addOutput:videoOutput];


but I don't know how I will count the heart beat using this code.


Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire