gpt4 book ai didi

Android camera2 API 在自动对焦模式下获取焦距

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:39:30 48 4
gpt4 key购买 nike

我正在使用 Android camera2 API。

我可以在手动对焦模式下使用 LENS_FOCUS_DISTANCE 获取焦距值。但是,该属性在 AF 模式下始终为零。 AF模式下有什么方法可以获取焦距吗?

最佳答案

Shortest distance from frontmost surface of the lens that can bebrought 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);

对于 2021 年使用 CameraX 时,以下是查找相机特征(例如 LENS_INFO_MINIMUM_FOCUS_DISTANCE)的方法:

theCamera = cameraProvider.bindToLifecycle(...
CameraCharacteristics camChars = Camera2CameraInfo
.extractCameraCharacteristics(theCamera.getCameraInfo());
float discoveredMinFocusDistance = camChars
.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE);
Log.i("dev", "min focus is " + discoveredMinFocusDistance);

关于Android camera2 API 在自动对焦模式下获取焦距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30724839/

48 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com