Android camera2 API在AF模式下获得焦距

前端之家收集整理的这篇文章主要介绍了Android camera2 API在AF模式下获得焦距前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用 Android camera2 API.

我可以在手动对焦模式下使用LENS_FOCUS_DISTANCE获得焦距值.但是,AF模式下的属性始终为零.在AF模式下有没有办法获得焦距?

解决方法

Shortest distance from frontmost surface of the lens that can be
brought into sharp focus.

If the lens is fixed-focus,this will be 0.

http://developer.android.com/intl/es/reference/android/hardware/camera2/CameraCharacteristics.html

换句话说,如果您想要管理焦点,请记住LENS_INFO_MINIMUM_FOCUS_DISTANCE为您提供最小焦点,但要获得“最大”焦点,您必须使用LENS_INFO_HYPERFOCAL_DISTANCE.

float yourMinFocus = mCameraCharacteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE);
float yourMaxFocus = mCameraCharacteristics.get(CameraCharacteristics.LENS_INFO_HYPERFOCAL_DISTANCE);

猜你在找的Android相关文章