Android camera2 API gets autofocus focus distance

I am working with Android camera2 API.

I can get the focus distance using LENS_FOCUS_DISTANCE in manual focus mode. However, the property is always zero in autofocus mode. Is there a way to get the focus distance in autofocus mode?

+6
source share
2 answers

The shortest distance from the very front of the lens that can be focused.

If the lens has a fixed focus, it will be 0.

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

In another way, if you want to control the focus, remember that LENS_INFO_MINIMUM_FOCUS_DISTANCE gives you minimal focus, but to get the focus "Max" you have to use LENS_INFO_HYPERFOCAL_DISTANCE . Hope this helps you!

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

Have a nice day!

+1
source

If the value of LENS_INFO_MINIMUM_FOCUS_DISTANCE is 0, this means that it has fixed focus and does not support manual focus. Limited feature - present on all camera devices that report that they are at least HARDWARE_LEVEL_LIMITED

0
source

Source: https://habr.com/ru/post/988760/


All Articles