11

I am working on a project in which i have to calculate my device height from ground. I have searched all over the internet but could not find any solution.

Please, Anyone tell me what to do..??

Saurav
  • 111
  • 1
  • 1
  • 3
  • 1
    This might help: http://stackoverflow.com/questions/9361870/android-how-to-get-accurate-altitude – Jong Jul 03 '13 at 09:12
  • Use GPS, or barometer if present, or do some trigonometry with camera (as used in many scale tools apps). – S.D. Jul 03 '13 at 09:13
  • All I can tell you is : don't use the GPS, it's far too much inaccurate! – WhiskThimble Jul 03 '13 at 09:14
  • This is a duplicate of: http://stackoverflow.com/questions/8221300/calculate-height-where-my-phone-is-being-held – Qben Jul 03 '13 at 09:14
  • Forgive me for stating the obvious but consider using a ruler/tape measure, I think this is the simplest solution :) – Ken Wolf Jul 03 '13 at 09:16
  • oncerning the trigonometry using the camera, it can be really precise if you have 2 cameras in either the front or the back of the phone. Otherwise it won't. As sonicWinc said, you can use the accelerometer (put the phone on the ground and go up) . But again it depends on the precision you want cm, mm, ... nm. – user2497624 Jul 03 '13 at 09:20

3 Answers3

1

First it has to be clarified, if "height from ground" means altitude in meaning "height from sea level" or you mean, how far the phone is away from the floor, when you have it in your hands.

For the second case:

Like SonicWind states, you could do the trick using the camera.
It would require calibration of the camera and to have a standard object.
Take a picture of the standard object which has to be positioned on the ground with standard zoom.
Recognize the object size - or select it in the picture, and calculate the distance to the object.
-> you have the distance to the ground.

The object might be also your shoes etc. So if the application should be for multiple users, you might allow them to enter their shoe sizes ;)

Wolfie
  • 27,562
  • 7
  • 28
  • 55
user2144067
  • 122
  • 2
  • 7
1

Take it with a grain of salt, a bit of humor and a sense of philosophy. Change the barometer by your smartphone.

http://naturelovesmath-en.blogspot.ca/2011/06/niels-bohr-barometer-question-myth.html

Syl OR
  • 117
  • 1
  • 10
0

This is an odd one..but OK..I like a challenge. The only way to realistically do this is to run a sonar sensor on the phone(easily done on arduino). Other than that..all you can do is set up the code to read the accelerators to guesstimate the distance(put the phone on the ground and pick it up to the height you want. It appears to be impossible to do otherwise(maybe some concept use of the camera..)

SonicWind
  • 58
  • 1
  • 6