[opencv] 19/98: fix bug on border at pyrUp

Mattia Rizzolo mattia at debian.org
Tue Oct 4 17:51:19 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to annotated tag 2.4.13
in repository opencv.

commit bb1c2d71a8714be1b31ee31424ac7dbef1ef36d8
Author: Elena Gvozdeva <elena.gvozdeva at itseez.com>
Date:   Wed Jan 20 13:07:07 2016 +0300

    fix bug on border at pyrUp
---
 modules/imgproc/src/pyramids.cpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/modules/imgproc/src/pyramids.cpp b/modules/imgproc/src/pyramids.cpp
index 4000167..acf5072 100644
--- a/modules/imgproc/src/pyramids.cpp
+++ b/modules/imgproc/src/pyramids.cpp
@@ -349,7 +349,7 @@ pyrUp_( const Mat& _src, Mat& _dst, int)
         for( ; sy <= y + 1; sy++ )
         {
             WT* row = buf + ((sy - sy0) % PU_SZ)*bufstep;
-            int _sy = borderInterpolate(sy*2, dsize.height, BORDER_REFLECT_101)/2;
+            int _sy = borderInterpolate(sy*2, ssize.height*2, BORDER_REFLECT_101)/2;
             const T* src = (const T*)(_src.data + _src.step*_sy);
 
             if( ssize.width == cn )
@@ -370,6 +370,11 @@ pyrUp_( const Mat& _src, Mat& _dst, int)
                 t0 = src[sx - cn] + src[sx]*7;
                 t1 = src[sx]*8;
                 row[dx] = t0; row[dx + cn] = t1;
+
+                if (dsize.width > ssize.width*2)
+                {
+                    row[(_dst.cols-1) + x] = row[dx + cn];
+                }
             }
 
             for( x = cn; x < ssize.width - cn; x++ )
@@ -395,6 +400,17 @@ pyrUp_( const Mat& _src, Mat& _dst, int)
             dst1[x] = t1; dst0[x] = t0;
         }
     }
+
+    if (dsize.height > ssize.height*2)
+    {
+        T* dst0 = _dst.ptr<T>(ssize.height*2-2);
+        T* dst2 = _dst.ptr<T>(ssize.height*2);
+
+        for(x = 0; x < dsize.width ; x++ )
+        {
+            dst2[x] = dst0[x];
+        }
+    }
 }
 
 typedef void (*PyrFunc)(const Mat&, Mat&, int);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list