Yevgeny Simkin
Yevgeny Simkin

Reputation: 28419

Is it possible in Android to have the camera focus on a specific point in the preview?

I'm looking at the doc http://developer.android.com/reference/android/hardware/Camera.Parameters.html and I'm not seeing anything that would allow me to make it possible for the user to tap on a specific point in the camera preview and have that become the point on which the camera would try to focus.

Is this simply missing? or am I overlooking how this can be done?

Upvotes: 1

Views: 3127

Answers (1)

Eddy Talvala
Eddy Talvala

Reputation: 18137

In Android 4.x, this is possible, with the setFocusAreas. You'll have to check getMaxNumFocusAreas first to see if this feature is supported on your device, and how many areas to use.

Then, you'll need to convert the user's touch coordinates to the coordinates used by the Camera.Area object (described here), and call setFocusAreas with the coordinates. From then on, calls to autoFocus will use that region for selecting focus.

Upvotes: 2

Related Questions