8

Is it possible to measure the distance between your android phone screen and user face?

I want to change the zoom ratio zoom of your android app screen base on the distance between your face and your phone screen.

Please help me.

Thanks.

Thelinh Truong
  • 564
  • 1
  • 8
  • 19

3 Answers3

12

Yes it is possible, as long as you have a front facing camera in your device. This was more or less my bachelor thesis.

Here is the code https://github.com/philiiiiiipp/Android-Screen-to-Face-Distance-Measurement

and a video of the result https://www.youtube.com/watch?v=-6_pGkPKAL4

and the paper A new context - Screen to Face distance 1 1.pdf

Philiiiiiipp
  • 705
  • 1
  • 9
  • 24
  • 1
    @philiiip i have analysed your code reg measure distance between phone screen to user face. In the logic, by using FaceDetector Facial Points you have calculate the distance. Can you guide me to detect the distance between the phone screen to face using Firebase ML Kit FaceDetection LandMarks. Because i am new to face detection concepts i am really don't have an idea to measure the distance – Nathiya Mar 15 '19 at 13:14
  • I read the thesis and the code, would you mind explaining how you calculated the value of _distanceAtCalibrationPoint in updateMeasurement() function inCameraSurfaceView.java ? – Yacine Benali Sep 21 '20 at 16:58
4

I described how to calculate screen to face distance in a post on my blog. The algorithm is based on the distance between eyes. The further the face, the less the distance between your eyes appears on the camera.

https://ivanludvig.github.io/blog/2019/07/20/calculating-screen-to-face-distance-android

0

I don't believe it's possible.

  1. Not all Android devices are equipped with a proximity sensor
  2. These sensors are just meant to detect wether or not you have your cheek next to the phone.

EDIT following OP comment : Technically, you could indeed use some image recognition algorithm to compute the screen-face distance based on the input from front camera.

But:

  1. Not all Android devices have a front facing camera.
  2. Implementing this from scratch would be extremely complex if you have no background in image processing.
Sébastien
  • 13,831
  • 10
  • 55
  • 70
  • I found this paper about how to Measure Person to Camera Distance Based on Eye-Distance: [link](http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=5319035&url=http%3A%2F%2Fieeexplore.ieee.org%2Fxpls%2Fabs_all.jsp%3Farnumber%3D5319035). Can i use this approach to solve my problem? – Thelinh Truong Feb 01 '13 at 16:18