summaryrefslogtreecommitdiffstats
path: root/jni
diff options
context:
space:
mode:
authormbansal <mayank.bansal@sri.com>2011-11-07 14:42:25 -0500
committerWei-Ta Chen <weita@google.com>2011-11-08 10:20:07 -0800
commit8252bf716c798a1007e7869569b35815d2df3c6c (patch)
treead43715a25722a19e67d53475b79c14207820c5e /jni
parenta47a149f34aedd355cdc7754ff91c41138974f8d (diff)
downloadpackages_apps_LegacyCamera-8252bf716c798a1007e7869569b35815d2df3c6c.zip
packages_apps_LegacyCamera-8252bf716c798a1007e7869569b35815d2df3c6c.tar.gz
packages_apps_LegacyCamera-8252bf716c798a1007e7869569b35815d2df3c6c.tar.bz2
Changes to resolve jagged horizontal edge and blurred vertical edge issues.
1) Made the strip width and cross-fading parameters absolute pixel values. 2) Updated the above parameters to use thinner strips with lower cross-fading radius. 3) Added another parameter to limit the number of pyramid levels at which cross-fading is applied. Bug: 5578488 Change-Id: I69161bfbb535dc5bfcd647cfa6d6e050b6ad0068
Diffstat (limited to 'jni')
-rw-r--r--jni/feature_mos/src/mosaic/Blend.cpp13
-rw-r--r--jni/feature_mos/src/mosaic/Blend.h16
2 files changed, 18 insertions, 11 deletions
diff --git a/jni/feature_mos/src/mosaic/Blend.cpp b/jni/feature_mos/src/mosaic/Blend.cpp
index cce89ff..e37755d 100644
--- a/jni/feature_mos/src/mosaic/Blend.cpp
+++ b/jni/feature_mos/src/mosaic/Blend.cpp
@@ -445,7 +445,7 @@ int Blend::DoMergeAndBlend(MosaicFrame **frames, int nsite,
{
// Set the number of pixels around the seam to cross-fade between
// the two component images,
- int tw = STRIP_CROSS_FADE_WIDTH * width;
+ int tw = STRIP_CROSS_FADE_WIDTH_PXLS;
// Proceed with the image index calculation for cross-fading
// only if the cross-fading width is larger than 0
@@ -498,7 +498,7 @@ int Blend::DoMergeAndBlend(MosaicFrame **frames, int nsite,
{
// Set the number of pixels around the seam to cross-fade between
// the two component images,
- int tw = STRIP_CROSS_FADE_WIDTH * height;
+ int tw = STRIP_CROSS_FADE_WIDTH_PXLS;
// Proceed with the image index calculation for cross-fading
// only if the cross-fading width is larger than 0
@@ -941,7 +941,10 @@ void Blend::ProcessPyramidForThisFrame(CSite *csite, BlendRect &vcrect, BlendRec
{
if(inMask && imgMos.Y.ptr[jj][ii] != 255)
{
- if(imgMos.V.ptr[jj][ii] == 128) // Not on a seam
+ // If not on a seam OR pyramid level exceeds
+ // maximum level for cross-fading.
+ if((imgMos.V.ptr[jj][ii] == 128) ||
+ (dscale > STRIP_CROSS_FADE_MAX_PYR_LEVEL))
{
wt0 = 0.0;
wt1 = 1.0;
@@ -1216,8 +1219,8 @@ void Blend::SelectRelevantFrames(MosaicFrame **frames, int frames_size,
double deltaY = currY - prevY;
double center2centerDist = sqrt(deltaY * deltaY + deltaX * deltaX);
- if (fabs(deltaX) > STRIP_SEPARATION_THRESHOLD * last->width ||
- fabs(deltaY) > STRIP_SEPARATION_THRESHOLD * last->height)
+ if (fabs(deltaX) > STRIP_SEPARATION_THRESHOLD_PXLS ||
+ fabs(deltaY) > STRIP_SEPARATION_THRESHOLD_PXLS)
{
relevant_frames[relevant_frames_size] = mb;
relevant_frames_size++;
diff --git a/jni/feature_mos/src/mosaic/Blend.h b/jni/feature_mos/src/mosaic/Blend.h
index ebb3bdc..6371fde 100644
--- a/jni/feature_mos/src/mosaic/Blend.h
+++ b/jni/feature_mos/src/mosaic/Blend.h
@@ -35,14 +35,18 @@ const float TIME_PERCENT_FINAL = 5.0;
// This threshold determines the minimum separation between the image centers
// of the input image frames for them to be accepted for blending in the
-// STRIP_TYPE_WIDE mode. This threshold is specified as a fraction of the
-// input image frame width.
-const float STRIP_SEPARATION_THRESHOLD = 0.10;
+// STRIP_TYPE_WIDE mode.
+const float STRIP_SEPARATION_THRESHOLD_PXLS = 10;
// This threshold determines the number of pixels on either side of the strip
-// to cross-fade using the images contributing to each seam. This threshold
-// is specified as a fraction of the input image frame width.
-const float STRIP_CROSS_FADE_WIDTH = 0.002;
+// to cross-fade using the images contributing to each seam.
+const float STRIP_CROSS_FADE_WIDTH_PXLS = 2;
+// This specifies the maximum pyramid level to which cross-fading is applied.
+// The original image resolution is Level-0, half of that size is Level-1 and
+// so on. BLEND_RANGE_DEFAULT specifies the number of pyramid levels used by
+// the blending algorithm.
+const int STRIP_CROSS_FADE_MAX_PYR_LEVEL = 2;
+
/**
* Class for pyramid blending a mosaic.
*/