Hello, I just fixed a bug in the Ketai library, in its module for the android “camera”.
This library contains obsolete code for autofocus and it needs to be corrected, I would appreciate it if someone would recompile the library with the necessary correction and share it, I have corrected it for my project and I am using the source code from the sketch but I would like to share the progress .
/**
* Auto settings - set camera to use auto adjusting settings
*/
public void autoSettings() {
if (camera == null)
return;
// PApplet.println("KetaiCamera: setting camera settings to auto...");
Parameters cameraParameters = camera.getParameters();
if (cameraParameters.isAutoExposureLockSupported())
cameraParameters.setAutoExposureLock(false);
if (cameraParameters.isAutoWhiteBalanceLockSupported())
cameraParameters.setAutoWhiteBalanceLock(false);
List<String> fModes = cameraParameters.getSupportedFocusModes();
for (String s : fModes) {
PApplet.println("FocusMode: " + s);
/*
if (s.equalsIgnoreCase(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE))
cameraParameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
*/
// this is the repaired bug for auto focus!!
if (s.equalsIgnoreCase("FocusMode: auto")){
cameraParameters.setFocusMode(Parameters.FOCUS_MODE_AUTO);
}
}
camera.setParameters(cameraParameters);
camera.autoFocus(autofocusCB);
// PApplet.println("KetaiCamera autoSettings: "
// + camera.getParameters().flatten());
}