[move sift.cpp] sift: avoid inplace calls of GaussianBlur
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Thu, 16 Apr 2020 14:46:38 +0000 (14:46 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Thu, 16 Apr 2020 17:58:45 +0000 (17:58 +0000)
- should unlock IPP optimizations

original commit: https://github.com/opencv/opencv_contrib/commit/ce7c8f2646ccf3f5e657ab1241e22c0c32cd9d41

modules/features2d/src/sift.cpp

index e8950e6..74e46c5 100644 (file)
@@ -209,14 +209,16 @@ static Mat createInitialImage( const Mat& img, bool doubleImageSize, float sigma
 #else
         resize(gray_fpt, dbl, Size(gray_fpt.cols*2, gray_fpt.rows*2), 0, 0, INTER_LINEAR);
 #endif
-        GaussianBlur(dbl, dbl, Size(), sig_diff, sig_diff);
-        return dbl;
+        Mat result;
+        GaussianBlur(dbl, result, Size(), sig_diff, sig_diff);
+        return result;
     }
     else
     {
         sig_diff = sqrtf( std::max(sigma * sigma - SIFT_INIT_SIGMA * SIFT_INIT_SIGMA, 0.01f) );
-        GaussianBlur(gray_fpt, gray_fpt, Size(), sig_diff, sig_diff);
-        return gray_fpt;
+        Mat result;
+        GaussianBlur(gray_fpt, result, Size(), sig_diff, sig_diff);
+        return result;
     }
 }