http://pastebin.com/w3vDGZ2F
查了一圈,很多国外的程序猿也在研究这个,也没个所以然来。
目前唯一的线索就是焦距到底是多少!
google的api也找到了,public void getFocusDistances (float[] output)
Since: API Level 9
Gets the distances from the camera to where an object appears to be in focus. The object is sharpest at the optimal focus distance. The depth of field is the far focus distance minus near focus distance.
Focus distances may change after calling autoFocus(AutoFocusCallback), cancelAutoFocus(), or startPreview(). Applications can call getParameters() and this method anytime to get the latest focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS_VIDEO, focus distances may change from time to time.
This method is intended to estimate the distance between the camera and the subject. After autofocus, the subject distance may be within near and far focus distance. However, the precision depends on the camera hardware, autofocus algorithm, the focus area, and the scene. The error can be large and it should be only used as a reference.
Far focus distance >= optimal focus distance >= near focus distance. If the focus distance is infinity, the value will be Float.POSITIVE_INFINITY.
Parameters
output focus distances in meters. output must be a float array with three elements. Near focus distance, optimal focus distance, and far focus distance will be filled in the array.
See Also
FOCUS_DISTANCE_NEAR_INDEX
FOCUS_DISTANCE_OPTIMAL_INDEX
FOCUS_DISTANCE_FAR_INDEX
得到的数据一直是infinite,奶奶的真坑爹! 看来是测不出了
本文探讨了Android设备中获取相机焦距的API使用问题,通过`getFocusDistances`方法尝试估算距离,但发现返回值经常为无穷大(infinite),这表明在实际应用中获取精确的焦距信息可能存在困难。尽管该API旨在用于估计相机与拍摄对象的距离,但其精度受到硬件、自动对焦算法等多种因素影响,可能导致较大误差,仅适合作为参考。
480

被折叠的 条评论
为什么被折叠?



