From cb2077054836ed0835c72ad9ac0a1821ff9a8160 Mon Sep 17 00:00:00 2001 From: Bellaktris Date: Tue, 8 Jul 2014 14:20:01 +0700 Subject: [PATCH] deleted redundunt code --- modules/xphoto/test/dct_image_denoising.cpp | 40 +++------------------ 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/modules/xphoto/test/dct_image_denoising.cpp b/modules/xphoto/test/dct_image_denoising.cpp index e2d5b6201..a1eaefc6a 100644 --- a/modules/xphoto/test/dct_image_denoising.cpp +++ b/modules/xphoto/test/dct_image_denoising.cpp @@ -1,7 +1,5 @@ #include "test_precomp.hpp" -#define NO_COMPARISON - namespace cvtest { TEST(xphoto_dctimagedenoising, regression) @@ -29,44 +27,14 @@ namespace cvtest cv::Mat currentResult, fastNlMeansResult; -#ifndef NO_COMPARISON - double currentTime = clock() / double(CLOCKS_PER_SEC); -#endif cv::dctDenoising(src, currentResult, sigma[i], psize[i]); -#ifndef NO_COMPARISON - currentTime = clock() / double(CLOCKS_PER_SEC) - currentTime; - std::cout << "---- dct denoising time = " << currentTime << " (sec) ----" << std::endl; -#endif - cv::Mat sqrError1 = ( currentResult - previousResult ) + cv::Mat sqrError = ( currentResult - previousResult ) .mul( currentResult - previousResult ); - cv::Scalar mse1 = cv::sum(sqrError1) / cv::Scalar::all( sqrError1.total()*sqrError1.channels() ); - double psnr1 = 10*log10(3*255*255/(mse1[0] + mse1[1] + mse1[2])) - psnr; -#ifndef NO_COMPARISON - std::cout << "---- dct PSNR rate = " << psnr1 << " ----" << std::endl; -#endif - -#ifndef NO_COMPARISON - double fastNlMeansTime = clock() / double(CLOCKS_PER_SEC); - - if ( src.channels() == 3 ) - cv::fastNlMeansDenoisingColored(src, fastNlMeansResult); - else if ( src.channels() == 1 ) - cv::fastNlMeansDenoising(src, fastNlMeansResult); - - fastNlMeansTime = clock() / double(CLOCKS_PER_SEC) - fastNlMeansTime; -#ifdef NO_COMPARISON - std::cout << "---- nonlocal means denoising time = " << fastNlMeansTime << " (sec) ----" << std::endl; -#endif - - cv::Mat sqrError2 = ( fastNlMeansResult - previousResult ) - .mul( fastNlMeansResult - previousResult ); - cv::Scalar mse2 = cv::sum(sqrError2) / cv::Scalar::all( sqrError2.total()*sqrError2.channels() ); - double psnr2 = 10*log10(3*255*255/(mse2[0] + mse2[1] + mse2[2])) - psnr; - std::cout << "---- nonlocal means PSNR rate = " << psnr2 << " ----" << std::endl; -#endif + cv::Scalar mse = cv::sum(sqrError) / cv::Scalar::all( sqrError.total()*sqrError.channels() ); + double psnr = 10*log10(3*255*255/(mse[0] + mse[1] + mse[2])) - psnr; - EXPECT_GE( psnr1, psnrThreshold[i] ); + EXPECT_GE( psnr, psnrThreshold[i] ); } } } \ No newline at end of file