Commit 8f33e805 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

fixed bug in the new version of cornerSubPix

parent 16d825ad
...@@ -113,8 +113,8 @@ void cv::cornerSubPix( InputArray _image, InputOutputArray _corners, ...@@ -113,8 +113,8 @@ void cv::cornerSubPix( InputArray _image, InputOutputArray _corners,
for( j = 0; j < win_w; j++, k++ ) for( j = 0; j < win_w; j++, k++ )
{ {
double m = mask[k]; double m = mask[k];
double tgx = subpix[1] - subpix[-1]; double tgx = subpix[j+1] - subpix[j-1];
double tgy = subpix[win_w+2] - subpix[-win_w-2]; double tgy = subpix[j+win_w+2] - subpix[j-win_w-2];
double gxx = tgx * tgx * m; double gxx = tgx * tgx * m;
double gxy = tgx * tgy * m; double gxy = tgx * tgy * m;
double gyy = tgy * tgy * m; double gyy = tgy * tgy * m;
...@@ -139,6 +139,8 @@ void cv::cornerSubPix( InputArray _image, InputOutputArray _corners, ...@@ -139,6 +139,8 @@ void cv::cornerSubPix( InputArray _image, InputOutputArray _corners,
cI2.y = (float)(cI.y - b*scale*bb1 + a*scale*bb2); cI2.y = (float)(cI.y - b*scale*bb1 + a*scale*bb2);
err = (cI2.x - cI.x) * (cI2.x - cI.x) + (cI2.y - cI.y) * (cI2.y - cI.y); err = (cI2.x - cI.x) * (cI2.x - cI.x) + (cI2.y - cI.y) * (cI2.y - cI.y);
cI = cI2; cI = cI2;
if( cI.x < 0 || cI.x >= src.cols || cI.y < 0 || cI.y >= src.rows )
break;
} }
while( ++iter < max_iters && err > eps ); while( ++iter < max_iters && err > eps );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment