Share via


Camera.Parameters.GetFocusDistances(Single[]) Method

Definition

Caution

deprecated

Gets the distances from the camera to where an object appears to be in focus.

[Android.Runtime.Register("getFocusDistances", "([F)V", "GetGetFocusDistances_arrayFHandler")]
[System.Obsolete("deprecated")]
public virtual void GetFocusDistances (float[]? output);
[<Android.Runtime.Register("getFocusDistances", "([F)V", "GetGetFocusDistances_arrayFHandler")>]
[<System.Obsolete("deprecated")>]
abstract member GetFocusDistances : single[] -> unit
override this.GetFocusDistances : single[] -> unit

Parameters

output
Single[]

focus distances in meters. output must be a float array with three elements. Near focus distance, optimal focus distance, and far focus distance will be filled in the array.

Attributes

Remarks

Gets the distances from the camera to where an object appears to be in focus. The object is sharpest at the optimal focus distance. The depth of field is the far focus distance minus near focus distance.

Focus distances may change after calling #autoFocus(AutoFocusCallback), #cancelAutoFocus, or #startPreview(). Applications can call #getParameters() and this method anytime to get the latest focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS_VIDEO, focus distances may change from time to time.

This method is intended to estimate the distance between the camera and the subject. After autofocus, the subject distance may be within near and far focus distance. However, the precision depends on the camera hardware, autofocus algorithm, the focus area, and the scene. The error can be large and it should be only used as a reference.

Far focus distance >= optimal focus distance >= near focus distance. If the focus distance is infinity, the value will be Float.POSITIVE_INFINITY.

Java documentation for android.hardware.Camera.Parameters.getFocusDistances(float[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also