Rahul Savsani
Rahul Savsani

Reputation: 5

Android Camera2 API How to get initial focus point distance with inbuilt AUTOFOCUS routine of camera?

So basically I want to get the focus distance of lens when the focus mode is AUTO.

Currently I am working like this:

Is it the correct logic?

Upvotes: 0

Views: 492

Answers (1)

esentsov
esentsov

Reputation: 6532

Generally the logic is correct. Just check a few details:

  1. Make sure your device and specific camera support auto focus by checking LENS_INFO_MINIMUM_FOCUS_DISTANCE.
  2. Make sure CONTROL_AF_STATE is at least not CONTROL_AF_STATE_INACTIVE. Most likely you need to wait until it's actually focused.

Also note the type of this value is different on different devices. Check LENS_INFO_FOCUS_DISTANCE_CALIBRATION to find out if it's a real distance or just some synthetic value.

Upvotes: 1

Related Questions