diff options
author | mbansal <mayank.bansal@sri.com> | 2011-09-21 14:19:17 -0400 |
---|---|---|
committer | Wei-Ta Chen <weita@google.com> | 2011-09-22 16:59:27 -0700 |
commit | dd28e1cc00373c02adf88dff878dbbe5d8be9e59 (patch) | |
tree | 3d51207c4c12c5b9067c71e7b29d00d1732e0a1f /src/com/android/camera/panorama | |
parent | b2563be21745e389218655625f42802edc911088 (diff) | |
download | packages_apps_LegacyCamera-dd28e1cc00373c02adf88dff878dbbe5d8be9e59.zip packages_apps_LegacyCamera-dd28e1cc00373c02adf88dff878dbbe5d8be9e59.tar.gz packages_apps_LegacyCamera-dd28e1cc00373c02adf88dff878dbbe5d8be9e59.tar.bz2 |
Updates to handle textureless scenes during capture.
1) Starts stitching only when the camera sees a textured scene at the beginning.
2) If a texturess scene is encountered in the middle of a capture, the stitching continues with the intermediate frames translated using the pan velocity estimate.
3) Added more error codes and percolated them up to the java layer.
4) Fix a build error in Mosaic::addFrame() and added comments.
5) Update the javadoc in Mosaic.java to reflect the new returning codes.
Change-Id: I7727ace615ece22adefe313a19ac2cbe8c8d21a8
Diffstat (limited to 'src/com/android/camera/panorama')
-rw-r--r-- | src/com/android/camera/panorama/Mosaic.java | 21 | ||||
-rw-r--r-- | src/com/android/camera/panorama/MosaicFrameProcessor.java | 2 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/com/android/camera/panorama/Mosaic.java b/src/com/android/camera/panorama/Mosaic.java index 9ad2c64..5064cec 100644 --- a/src/com/android/camera/panorama/Mosaic.java +++ b/src/com/android/camera/panorama/Mosaic.java @@ -88,6 +88,9 @@ public class Mosaic { public static final int MOSAIC_RET_OK = 1; public static final int MOSAIC_RET_ERROR = -1; public static final int MOSAIC_RET_CANCELLED = -2; + public static final int MOSAIC_RET_LOW_TEXTURE = -3; + public static final int MOSAIC_RET_FEW_INLIERS = 2; + static { System.loadLibrary("jni_mosaic"); @@ -113,10 +116,11 @@ public class Mosaic { * image to t is computed and returned. * * @param pixels source image of NV21 format. - * @return Float array of length 10; first 9 entries correspond to the 3x3 - * transformation matrix between the first frame and the passed frame, - * and the last entry is the number of the passed frame, - * where the counting starts from 1. + * @return Float array of length 11; first 9 entries correspond to the 3x3 + * transformation matrix between the first frame and the passed frame; + * the 10th entry is the number of the passed frame, where the counting + * starts from 1; and the 11th entry is the returning code, whose value + * is one of those MOSAIC_RET_* returning flags defined above. */ public native float[] setSourceImage(byte[] pixels); @@ -127,10 +131,11 @@ public class Mosaic { * using glReadPixels directly from GPU memory (where it is accessed by * an associated SurfaceTexture). * - * @return Float array of length 10; first 9 entries correspond to the 3x3 - * transformation matrix between the first frame and the passed frame, - * and the last entry is the number of the passed frame, - * where the counting starts from 1. + * @return Float array of length 11; first 9 entries correspond to the 3x3 + * transformation matrix between the first frame and the passed frame; + * the 10th entry is the number of the passed frame, where the counting + * starts from 1; and the 11th entry is the returning code, whose value + * is one of those MOSAIC_RET_* returning flags defined above. */ public native float[] setSourceImageFromGPU(); diff --git a/src/com/android/camera/panorama/MosaicFrameProcessor.java b/src/com/android/camera/panorama/MosaicFrameProcessor.java index 54fc7b8..7660f5e 100644 --- a/src/com/android/camera/panorama/MosaicFrameProcessor.java +++ b/src/com/android/camera/panorama/MosaicFrameProcessor.java @@ -26,6 +26,7 @@ public class MosaicFrameProcessor { private static final String TAG = "MosaicFrameProcessor"; private static final int NUM_FRAMES_IN_BUFFER = 2; private static final int MAX_NUMBER_OF_FRAMES = 100; + private static final int MOSAIC_RET_CODE_INDEX = 10; private static final int FRAME_COUNT_INDEX = 9; private static final int X_COORD_INDEX = 2; private static final int Y_COORD_INDEX = 5; @@ -184,6 +185,7 @@ public class MosaicFrameProcessor { public void calculateTranslationRate(long now) { float[] frameData = mMosaicer.setSourceImageFromGPU(); + int ret_code = (int) frameData[MOSAIC_RET_CODE_INDEX]; mTotalFrameCount = (int) frameData[FRAME_COUNT_INDEX]; float translationCurrX = frameData[X_COORD_INDEX]; float translationCurrY = frameData[Y_COORD_INDEX]; |