The built in Camcorder App (like the one on the HTC EVO) seems to call camera.autoFocus()
only when the preview image changes. If you hold the camera steady no camera.autoFocus()
happens.
I would like to duplicate this behavior while camera.startPreview()
is active as in the initial preview setup code below:
camera = camera.open();
Camera.Parameters parameters = camera.getParameters();
List<String> focusModes = parameters.getSupportedFocusModes();
if (focusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO))
{
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
}
camera.setParameters(parameters);
camera.setPreviewDisplay(holder);
camera.startPreview();
All the examples I found for autoFocus()
seem to be calling it every 500ms to 2000ms, or once the instant before the picture is taken or recording is started.
The EVO Camcorder app seems to use a sensor or an algorithm to trigger autoFocus()
. However this autoFocus()
trigger is done it works exceptionally well. Does anyone have any knowledge of how to trigger autoFocus()
on demand when it is needed, such as when the camera is moved close or farther from the subject or is panned slightly?
Thank you,
Gerry
Android has introduced continuous auto focus since API Level 9 (Gingerbread). It works better than calling Camera.autoFocus periodically.