Determine angle of view of smartphone camera

前端 未结 3 1874
面向向阳花
面向向阳花 2020-11-30 22:17

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.

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-30 22:43

    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:

    enter image description here

    now you have the two distances l and d from the figure. With some simple goniometry, one can obtain:

    tan(α/2) = (l/2)/d,

    hence

    α = 2*atan(l/2d)

    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.

    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)

提交回复
热议问题