summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Wilson <jwilson@cyngn.com>2015-11-23 12:52:09 -0800
committerMichael Bestas <mikeioannina@gmail.com>2017-01-04 22:00:43 +0200
commitdde6d7ec36120db7dbb52bbdb0c7ffeaf7e46e93 (patch)
treee77d019923720075b7c321e65a9ccbff30229770
parentaa0733567c3065f4a1188a2607fc13bbbd5dc1d1 (diff)
downloadandroid_packages_apps_Snap-dde6d7ec36120db7dbb52bbdb0c7ffeaf7e46e93.zip
android_packages_apps_Snap-dde6d7ec36120db7dbb52bbdb0c7ffeaf7e46e93.tar.gz
android_packages_apps_Snap-dde6d7ec36120db7dbb52bbdb0c7ffeaf7e46e93.tar.bz2
CameraNext: Update focus behavior for panoramas
Panorama was using Infinity for the focus mode all the time for panoramas. Change to use continuous-picture in viewfinder before the actual mosaic is started then change to fixed to lock in. This allows indoor panoramas to not suck. Change-Id: Ida01ca1ded1e1058d76da851cd20e5b7072e15be (cherry picked from commit 33ece020c28796f004f28843fda28092e315c9dc)
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index 424d849..d7a3d54 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -125,10 +125,6 @@ public class WideAnglePanoramaModule extends BaseModule<WideAnglePanoramaUI> imp
private float mHorizontalViewAngle;
private float mVerticalViewAngle;
- // Prefer FOCUS_MODE_INFINITY to FOCUS_MODE_CONTINUOUS_VIDEO because of
- // getting a better image quality by the former.
- private String mTargetFocusMode = Parameters.FOCUS_MODE_INFINITY;
-
private PanoOrientationEventListener mOrientationEventListener;
// The value could be 0, 90, 180, 270 for the 4 different orientations measured in clockwise
// respectively.
@@ -464,12 +460,13 @@ public class WideAnglePanoramaModule extends BaseModule<WideAnglePanoramaUI> imp
parameters.setPreviewFpsRange(minFps, maxFps);
Log.d(TAG, "preview fps: " + minFps + ", " + maxFps);
+ // use CAF for viewfinder until starting the real mosaic, then lock
List<String> supportedFocusModes = parameters.getSupportedFocusModes();
- if (supportedFocusModes.indexOf(mTargetFocusMode) >= 0) {
- parameters.setFocusMode(mTargetFocusMode);
+ if (supportedFocusModes.indexOf(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE) >= 0) {
+ parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
} else {
// Use the default focus mode and log a message
- Log.w(TAG, "Cannot set the focus mode to " + mTargetFocusMode +
+ Log.w(TAG, "Cannot set the focus mode to " + Parameters.FOCUS_MODE_CONTINUOUS_PICTURE +
" becuase the mode is not supported.");
}
@@ -567,15 +564,25 @@ public class WideAnglePanoramaModule extends BaseModule<WideAnglePanoramaUI> imp
public void startCapture() {
// Reset values so we can do this again.
+
+ Parameters parameters = mCameraDevice.getParameters();
+ List<String> supportedFocusModes = parameters.getSupportedFocusModes();
+ if (supportedFocusModes.indexOf(Parameters.FOCUS_MODE_FIXED) >= 0) {
+ parameters.setFocusMode(Parameters.FOCUS_MODE_FIXED);
+ } else {
+ // Use the default focus mode and log a message
+ Log.w(TAG, "Cannot set the focus mode to " + Parameters.FOCUS_MODE_FIXED +
+ " becuase the mode is not supported.");
+ }
+ parameters.setAutoExposureLock(true);
+ parameters.setAutoWhiteBalanceLock(true);
+ configureCamera(parameters);
+
mCancelComputation = false;
mTimeTaken = System.currentTimeMillis();
mActivity.setSwipingEnabled(false);
mCaptureState = CAPTURE_STATE_MOSAIC;
mUI.onStartCapture();
- Parameters parameters = mCameraDevice.getParameters();
- parameters.setAutoExposureLock(true);
- parameters.setAutoWhiteBalanceLock(true);
- configureCamera(parameters);
final int sweepAngle = (mDeviceOrientation == 90 || mDeviceOrientation == 270) ?
DEFAULT_SWEEP_ANGLE_LANDSCAPE : DEFAULT_SWEEP_ANGLE_PORTRAIT;
@@ -627,6 +634,14 @@ public class WideAnglePanoramaModule extends BaseModule<WideAnglePanoramaUI> imp
Parameters parameters = mCameraDevice.getParameters();
parameters.setAutoExposureLock(false);
parameters.setAutoWhiteBalanceLock(false);
+ List<String> supportedFocusModes = parameters.getSupportedFocusModes();
+ if (supportedFocusModes.indexOf(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE) >= 0) {
+ parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
+ } else {
+ // Use the default focus mode and log a message
+ Log.w(TAG, "Cannot set the focus mode to " + Parameters.FOCUS_MODE_CONTINUOUS_PICTURE +
+ " becuase the mode is not supported.");
+ }
configureCamera(parameters);
mMosaicFrameProcessor.setProgressListener(null);