another fix for #2332 test

This commit is contained in:
Vadim Pisarevsky 2012-10-15 14:12:32 +04:00
parent 78a0b9787c
commit 5b2271c6fb

View File

@ -254,17 +254,15 @@ public:
};
TEST(Highgui_Image, encode_png) { CV_GrfmtPNGEncodeTest test; test.safe_run(); }
#endif
#ifdef HAVE_JPEG
TEST(Highgui_ImreadVSCvtColor, regression)
{
cvtest::TS& ts = *cvtest::TS::ptr();
const int MAX_MEAN_DIFF = 3;
const int MAX_MEAN_DIFF = 1;
const int MAX_ABS_DIFF = 10;
string imgName = string(ts.get_data_path()) + "/../cv/shared/lena.jpg";
string imgName = string(ts.get_data_path()) + "/../cv/shared/lena.png";
Mat original_image = imread(imgName);
Mat gray_by_codec = imread(imgName, 0);
Mat gray_by_cvt;
@ -277,6 +275,7 @@ TEST(Highgui_ImreadVSCvtColor, regression)
double actual_avg_diff = (double)mean(diff)[0];
double actual_maxval, actual_minval;
minMaxLoc(diff, &actual_minval, &actual_maxval);
//printf("actual avg = %g, actual maxdiff = %g, npixels = %d\n", actual_avg_diff, actual_maxval, (int)diff.total());
EXPECT_LT(actual_avg_diff, MAX_MEAN_DIFF);
EXPECT_LT(actual_maxval, MAX_ABS_DIFF);