From f58c5646b0cb9543c7ad41dbdba4ca93d1a3d00a Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 17 Sep 2012 18:30:55 +0400 Subject: [PATCH] fixed wrong condition with interpolation types --- modules/imgproc/src/imgwarp.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index a3e118311a..29919e9aa8 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -1825,9 +1825,12 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, // in case of scale_x && scale_y is equal to 2 // INTER_AREA (fast) also is equal to INTER_LINEAR - if ( interpolation == INTER_LINEAR && - scale_x >= 1 && scale_y >= 1 && is_area_fast) + if ( interpolation == INTER_LINEAR && std::abs(scale_x - 2.0) < DBL_EPSILON && + std::abs(scale_y - 2.0) < DBL_EPSILON) + { interpolation = INTER_AREA; + is_area_fast = true; + } // true "area" interpolation is only implemented for the case (scale_x <= 1 && scale_y <= 1). // In other cases it is emulated using some variant of bilinear interpolation