确定智能手机相机的视角 [英] Determine angle of view of smartphone camera
问题描述
我正在尝试确定 Droid Incredible 智能手机相机视野的度数大小.我需要知道我正在开发的应用程序的这个值.有谁知道我如何以编程方式找出/计算它?
I'm trying to determine the degree size of the field-of-view of a Droid Incredible smartphone's camera. I need to know this value for an application that I'm developing. Does anyone know how I can find out/calculate it programmatically?
推荐答案
除非有一些 API 调用(我不是 Android 程序员,我不知道),否则我只会从一个已知的距离,看看图中标尺显示了多少,然后使用三角函数找到角度,如 这个:
Unless there's some API call for that (I'm not an Android programmer, I wouldn't know), I would just snap a picture of a ruler from a known distance away, see how much of the ruler is shown in the picture, then use trigonometry to find the angle like this:
现在你有两个距离 l 和 d 到图中.通过一些简单的测角,可以得到:
now you have the two distances l and d from the figure. With some simple goniometry, one can obtain:
tan(α/2) = (l/2)/d,
tan(α/2) = (l/2)/d,
因此
α = 2*atan(l/2d)
α = 2*atan(l/2d)
因此,您可以使用此公式计算相机的水平视野.当然测量垂直 f.o.v.方法完全相同,只是您需要在垂直位置查看对象.
So with this formula you can calculate the horizontal field-of-view of your camera. Of course measuring the vertical f.o.v. goes exactly the same way except that you then need to view the object in its vertical position.
然后您可以将其硬编码为程序中的常量.(当然,一个命名常量,所以很容易改变:-p)
Then you can hard-code it as a constant in your program. (A named constant, of course, so it'd be easy to change :-p)
这篇关于确定智能手机相机的视角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!