获取Android摄像头设备的视角 [英] Get angle of view of android camera device
问题描述
我想知道相机的视角,就像这个问题,但使用的是android.hardware.camera2。我该如何使用新的camera2库再现下一个代码。
I want to know the angle of view from the camera, just like in this question but using android.hardware.camera2. How can I reproduce the next code using the new camera2 library.
Camera.Parameters p = camera.getParameters();
double thetaV = Math.toRadians(p.getVerticalViewAngle());
double thetaH = Math.toRadians(p.getHorizontalViewAngle());
有没有办法做同样的事情?
Is there a way to do the same thing?
推荐答案
我在Google上搜索一个人显示他通过Camera2 api计算FOV的可能性
I search the google a person show possibility which he calculate FOV by Camera2 api
https://photo.stackexchange.com/questions/54054/calculating-the-关联5的视场
并找到了等式
http://www.bobatkins.com/photography/technical/field_of_view.html
FOV(直线)= 2 * arctan(帧大小/(焦距* 2))
FOV (rectilinear) = 2 * arctan (frame size/(focal length * 2))
因此,我们需要知道帧大小和焦距
thus, we need to know frame size and focal length
帧大小是您可以找到的相机大小链接上的代码
the frame size is size of camera you can find the code on below link
https://stackoverflow.com/ a / 30403558
也可以在下面的链接中找到焦距
also, focal length you can find below link
我将这样的代码合并起来
and i combine the code like this
一个函数calculateFOV()计算FOV角
A function calculateFOV() calculate FOV angle
https://github.com/pchan1401-ICIL/Camera2FOV
这篇关于获取Android摄像头设备的视角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!