If you know the height of an object, you can get your distance from it using only your device's camera.
Native Android app written in Java, and published to the Google Play Store.
Tested on Pixel 6a, Galaxy A50, and Galaxy J3 with ~ 98% accuracy
- Enter the height of the object
- Hold your device level
- Select the top and bottom of the object on screen
- The device's distance from the object is calculated automatically
- theta: Camera FOV (Retrieved from Camera API)
- h: represents the full height that can be seen with the camera at the given distance
- s: physical height (size) of the object
- d: distance from the object
-The ratio of the Full Screen to the Object on screen can be calculated using pixels
-example ratio: 1920 : 960 => Therefore, h = (1920/960) * s.
-If the object takes up half the screen, then h is twice the size of the object.
-tan(theta/2) can be considered constant when not zooming
-(h/2) / d = tan(theta/2)
-Therefore, d = (h/2)/tan(theta/2), where h = (physical height of object) * (total screen height) / (object height on screen)
This requires the camera to be perpendicular to the object. If the camera is not perpendicular it will be inaccurate.


