pull/25/head
Bellaktris 11 years ago
parent cc9fd5af57
commit 1268717921
  1. 4
      modules/xphoto/src/dct_image_denoising.cpp
  2. 5
      modules/xphoto/test/dct_image_denoising.cpp
  3. 1
      modules/xphoto/test/test_precomp.hpp

@ -61,6 +61,8 @@ namespace cv
Mat_<float> res( src.size(), 0.0f ),
num( src.size(), 0.0f );
double threshold = 2.0*log(psize)*sigma;
for (int i = 0; i <= src.rows - psize; ++i)
for (int j = 0; j <= src.cols - psize; ++j)
{
@ -69,7 +71,7 @@ namespace cv
dct(patch, patch);
float * ptr = (float *) patch.data;
for (int k = 0; k < psize*psize; ++k)
if (fabs(ptr[k]) < 3.0f*sigma)
if (fabs(ptr[k]) < threshold)
ptr[k] = 0.0f;
idct(patch, patch);

@ -14,13 +14,14 @@ namespace cvtest
for (int i = 0; i < nTests; ++i)
{
cv::String srcName = dir + cv::format( "sources/%02d.png", i + 1);
cv::Mat src = cv::imread( srcName );
cv::Mat src = cv::imread( srcName, 1 );
cv::String previousResultName = dir + cv::format( "results/%02d.png", i + 1 );
cv::Mat previousResult = cv::imread( previousResultName, 1 );
cv::Mat currentResult;
cv::Mat currentResult, fastNlMeansResult;
cv::dctDenoising(src, currentResult, sigma, psize);
cv::fastNlMeansDenoising(src, fastNlMeansResult);
cv::Mat sqrError = ( currentResult - previousResult )
.mul( currentResult - previousResult );

@ -13,6 +13,7 @@
#include "opencv2/imgproc.hpp"
#include "opencv2/imgproc/types_c.h"
#include "opencv2/highgui.hpp"
#include "opencv2/photo.hpp"
#include "opencv2/xphoto.hpp"
#include "opencv2/ts.hpp"
#include <iostream>

Loading…
Cancel
Save