diff options
Diffstat (limited to 'jni')
-rw-r--r-- | jni/feature_mos/src/mosaic/Blend.cpp | 13 | ||||
-rw-r--r-- | jni/feature_mos/src/mosaic/Blend.h | 16 |
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. */ |