how to indentify finger is on the camera lens or not in android?
Asked Answered
S

2

13

I am trying to measure Heart Beat using the camera in android device.

As far as i see, Placing your finger tip on the camera lens and watching the changes in frames in camera. I have tried the application here but it does not seem to be correct.

Sadesadella answered 22/5, 2015 at 10:52 Comment(2)
Are you using any external SDK to use this feature? Or tell us if you are using system camera and any sensor with the application? I can help you with this if you can share your code here.Savoury
#7320640 Check this link it might help you.Mapping
M
5

Please check This Post on Google Code

http://code.google.com/p/android-heart-rate-monitor/issues/detail?id=1#c22

It Explains how to check finger is on the camera or not.

"For anyone interested, I figured out how to detect whether the user has his finger placed on the camera or not. In the imageProcessing.java, in the decodeYUV420SPtoRedAvg() method, we calculate the average value of the pixels of the red color. Doing a small experiment, I found out that when the user has his finger placed on the camera lens, the average has a value of > 200. In other cases, the average value is <200. thus, in the HeartRateActivity you can add an if statement after the call of the decodeYUV420SPtoRedAvg(), to find whether the value returned is >200 or < 199. You can use this to display an alert box or something similar to guide the user to place his finger on the camera lens."

Mapping answered 22/5, 2015 at 11:50 Comment(1)
"Color code varies with outside light, Where you going to test. In brighter light, you will get the high values of Red avg but dim light you will get very low values for red. And one more thing I have tested it with different devices where moto g2 , Lenovo k4 with marshmellow never cross the 100. So putting check for red > 200 or red > 199 is useless. we need to search something else."Botelho
D
0

One Solution

In android, We can open camera in background so we can check colour or RGB when we cover entire camera using our finger tap.

When we get colour same colour at that time we know that camera totally cover with finger tap and now you can measure heart rate.

Other solution

  1. Grab image frame from camera
  2. Compare image metrics of frame to previous frame. You need to figure out what metrics to use: brightness, color, etc.
  3. If metrics are significantly different in one direction, then you have a heartbeat.
  4. Pause some indeterminate amount of time.
  5. Go to 1

Other demo for heart rate if useful HeartRate Demo

All you have to do is open the HeartRateMonitor App and then hold the tip of your index finger over the camera lens of your phone. The entire camera preview image should be red with a lighter area where the tip of your finger is touching. Do not press too hard or you will cut off circulation which will result in an inaccurate reading.

After a second or two, you should see the Android icon on the top of the screen start to flash red when it senses a heart beat. After ten seconds it will compute your heart rate and update the number next to the Android icon. It'll take between ten and thirty seconds to get an accurate heart rate.

Dichasium answered 22/5, 2015 at 11:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.