Reputation: 1186
I have a problem with the camera of my app:
In android 4+ the autofocus work fine, if there is too much or to few ligth it adjust, but in android 2.3 it does not.
I dont understand well the difference between focus, white balancing or autoexposure so maybe I am not doing what I should do.
This is some of my code:
public void surfaceChanged(SurfaceHolder holder, int format, int width,
//// more stuff ///
List<String> focusModes = parameters.getSupportedFocusModes();
if (focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
} else if (focusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
}
myCamera.setParameters(p);
myCamera.startPreview();
myCamera.autoFocus(null);
/// more stuff ////
}
Upvotes: 1
Views: 720
Reputation: 57173
What you describe
In android 4+ the
autofocuswork fine, if there is too much or to few ligth it adjust
is about autoexposure. The purpose of autofocus is to keep the picture sharp, not about darkness. You need setExposureCompensation.
Upvotes: 1