Taking photo every 66 milliseconds on Android phon

2019-03-21 01:20发布

问题:

I'm doing a final year project at university which involves making a medical application for Android, as a practice I have to make a heart rate monitor app.

I have worked out that the best way to do this is to look for colour changes in your blood when holding the camera against your finger with the flash switched on.

This is where the problems come into play, is it possible to take a photo every 66 milliseconds on the camera, then compare each pair of photos for any intensity changes in order to count a heart beat? or am I better off recording a video and analysing each frame looking for a change.

Heck is it even possible to just look at the video preview and compare each frame.

The questions I need answering for this problem are neatly listed below

  • What is the best method for this, taking photos, recording video or looking at the live preview.

  • Is there any posts or pages I can visit on the internet where people have attempted similar things

  • Anyone got a basic method I should do to get two images that I can compare within the time frame.

  • Lastly If I do take the basic take a picture every 66 milliseconds approach, what can I do to ensure the picture is taken at the correct time intervals

回答1:

What is the best method for this, taking photos, recording video or looking at the live preview.

I would think that live preview would be the right answer. Taking photos is not -- they will not happen anywhere near that quickly. Recording video and post-processing it would be possible, but I fail to see how this will be applicable for a real-time heart monitor.

Is there any posts or pages I can visit on the internet where people have attempted similar things

You can examine the Barcode Scanner source code, which uses the live preview to scan for barcodes.

Lastly If I do take the basic take a picture every 66 milliseconds approach, what can I do to ensure the picture is taken at the correct time intervals

Android is not a hard RTOS. AFAIK it will be impossible for you to precisely time things to be 66 milliseconds.