Include AWB

pull/574/head
Mattia Iavarone 6 years ago
parent f26970a042
commit a51b7db5a7
  1. 25
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java
  2. 2
      demo/src/main/res/layout/activity_camera.xml

@ -1276,7 +1276,13 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
mMeteringAEStarted = false; mMeteringAEStarted = false;
mMeteringAEDone = !supportsAE; // If supported, we're not done. mMeteringAEDone = !supportsAE; // If supported, we're not done.
// AWB // AWB
mMeteringAWBDone = true; // TODO support this if possible Integer awbMode = mRepeatingRequestBuilder.get(CaptureRequest.CONTROL_AWB_MODE);
boolean supportsAWB = !isLegacy && awbMode != null && awbMode == CaptureRequest.CONTROL_AWB_MODE_AUTO;
mMeteringAWBDone = !supportsAWB; // legacy devices do not have the awb state
if (supportsAWB) {
// Remove any lock. We're not setting any, but just in case.
mRepeatingRequestBuilder.set(CaptureRequest.CONTROL_AWB_LOCK, false);
}
// 9. Apply everything. // 9. Apply everything.
applyRepeatingRequestBuilder(); applyRepeatingRequestBuilder();
@ -1373,8 +1379,21 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
} }
private void checkMeteringAutoWhiteBalance(@NonNull CaptureResult result) { private void checkMeteringAutoWhiteBalance(@NonNull CaptureResult result) {
if (mMeteringAWBDone) return; if (mMeteringAWBDone || !(result instanceof TotalCaptureResult)) return;
// No op until being implemented. Integer awbState = result.get(CaptureResult.CONTROL_AWB_STATE);
LOG.i("checkMeteringAutoWhiteBalance:", "awbState:", awbState);
if (awbState == null) return;
switch (awbState) {
case CaptureRequest.CONTROL_AWB_STATE_CONVERGED: {
mMeteringAWBDone = true;
break;
}
case CaptureRequest.CONTROL_AWB_STATE_LOCKED: break;
case CaptureRequest.CONTROL_AWB_STATE_INACTIVE: break;
case CaptureRequest.CONTROL_AWB_STATE_SEARCHING: break;
default: break;
}
} }
/** /**

@ -20,7 +20,7 @@
app:cameraPreview="glSurface" app:cameraPreview="glSurface"
app:cameraPlaySounds="true" app:cameraPlaySounds="true"
app:cameraGrid="off" app:cameraGrid="off"
app:cameraFlash="torch" app:cameraFlash="auto"
app:cameraAudio="on" app:cameraAudio="on"
app:cameraFacing="back" app:cameraFacing="back"
app:cameraGestureTap="autoFocus" app:cameraGestureTap="autoFocus"

Loading…
Cancel
Save