测量两个 iOS 设备之间的距离 [英] Measuring distance between two iOS Devices

查看:47
本文介绍了测量两个 iOS 设备之间的距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,我目前正在考虑这个问题.在我的用例中,这些设备将相距 50 厘米到 10 米,我希望它至少精确到 10 厘米.(因此 GPS 不是一个选项)

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种方式:

声音:我在开发论坛上询问了这个问题,我正在与 laanlabs 联系,关于他们的 声纳尺.

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

一台设备上的图片 + 另一台设备上的相机:似乎更容易设置,因为我的用户案例涉及用户以 90 度角面对一台设备.但是,用户将摄像头朝向某个方向会需要更多的工作,并且它不会对距离的变化做出反应.

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.

现在的问题是:有没有人知道任何代码已经做了这样的事情?可能是非 iPhone 通用 c-Project?

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

推荐答案

使用相机的方法:我们已经知道每个设备的尺寸.您拍摄设备照片,计算其高度/宽度以确定设备类型(iPhone/iPod 或 iPad),然后计算距离.

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.

例如 - 如果设备是 iPhone,你知道它的尺寸是 115x58 毫米.在图片上它是 NxM 像素.现在您可以计算距离.(如果 N & M 更小,则距离更大)

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)

这篇关于测量两个 iOS 设备之间的距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆