From 6be2a79fb9047eff85a9317022a1edd24cc2bb7c Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Fri, 3 Jun 2011 13:25:44 +0000 Subject: [PATCH] fixed incorrect output of resize(...scalex, scaley, INTER_NEAREST) when scalex and scaley are even integers (ticket #1013) --- modules/imgproc/src/imgwarp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index 0a0e788a08..f372cd8586 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -253,14 +253,14 @@ resizeNN( const Mat& src, Mat& dst, double fx, double fy ) for( x = 0; x < dsize.width; x++ ) { - int sx = saturate_cast(x*ifx); + int sx = cvFloor(x*ifx); x_ofs[x] = std::min(sx, ssize.width-1)*pix_size; } for( y = 0; y < dsize.height; y++ ) { uchar* D = dst.data + dst.step*y; - int sy = std::min(saturate_cast(y*ify), ssize.height-1); + int sy = std::min(cvFloor(y*ify), ssize.height-1); const uchar* S = src.data + src.step*sy; switch( pix_size )