fixed #2118
authorMaria Dimashova <no@email>
Mon, 2 Jul 2012 20:21:34 +0000 (20:21 +0000)
committerMaria Dimashova <no@email>
Mon, 2 Jul 2012 20:21:34 +0000 (20:21 +0000)
modules/imgproc/src/grabcut.cpp

index 98dbf74..4fb9b8d 100644 (file)
@@ -305,7 +305,7 @@ static void calcNWeights( const Mat& img, Mat& leftW, Mat& upleftW, Mat& upW, Ma
             }
             else
                 upW.at<double>(y,x) = 0;
-            if( x+1<img.cols-1 && y-1>=0 ) // upright
+            if( x+1<img.cols && y-1>=0 ) // upright
             {
                 Vec3d diff = color - (Vec3d)img.at<Vec3b>(y-1,x+1);
                 uprightW.at<double>(y,x) = gammaDivSqrt2 * exp(-beta*diff.dot(diff));