Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Measuring distance between two iOS Devices

Yeah, I'm currently wondering about this. In my use case the devices will be 50cm to 10m apart and I'd like it to be accurate to at least 10 cm. (Therefore GPS is not an option)

2 Ways spring to mind:

Sound: I asked about this in the dev forums and I'm in contact with laanlabs, about the code of their sonar ruler.

Picture on one device + Camera on the other: Seems easier to set up, since my user case involves the user facing one device at 90 degrees anyway. But it would be more work for the user to face the camero into the direction and it would not react to a change in distance.

Now the question: Is anyone aware of any code that does something like this already? Possibly a non-iPhone general c-Project?

like image 247
Bersaelor Avatar asked Dec 08 '10 16:12

Bersaelor


1 Answers

Method with camera: we already know size for each device. You take a picture of device, calculate it's height/width to determine type of device (iPhone/iPod or iPad), than calculate a distance.

For example - if device is iPhone you know, that its size is 115x58 mm. On picture it NxM pixels. Now you can calculate the distance. (If N & M smaller hence distance is larger)

like image 191
5hrp Avatar answered Sep 27 '22 18:09

5hrp