Android camera2 API get focus distance in AF mode

独自空忆成欢 提交于 2019-12-05 02:24:42
Francisco Durdin Garcia

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

In other way, if you want to manage focus, remember that LENS_INFO_MINIMUM_FOCUS_DISTANCE give you the minimum focus, but to get the "Max" focus you must use LENS_INFO_HYPERFOCAL_DISTANCE.

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

If the value of LENS_INFO_MINIMUM_FOCUS_DISTANCE is 0, it means it is fixed focus and not supporting manual focus. Limited capability - Present on all camera devices that report being at least HARDWARE_LEVEL_LIMITED

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!