test: change condition in Photo_Decolor

This commit is contained in:
Alexander Alekhin 2016-10-19 14:16:32 +03:00
parent 4439ba09f9
commit ee4b78fcce

View File

@ -47,8 +47,6 @@
using namespace cv;
using namespace std;
static const double numerical_precision = 10.;
TEST(Photo_Decolor, regression)
{
string folder = string(cvtest::TS::ptr()->get_data_path()) + "decolor/";
@ -57,16 +55,16 @@ TEST(Photo_Decolor, regression)
Mat original = imread(original_path, IMREAD_COLOR);
ASSERT_FALSE(original.empty()) << "Could not load input image " << original_path;
ASSERT_FALSE(original.channels()!=3) << "Load color input image " << original_path;
ASSERT_EQ(3, original.channels()) << "Load color input image " << original_path;
Mat grayscale, color_boost;
decolor(original, grayscale, color_boost);
Mat reference_grayscale = imread(folder + "grayscale_reference.png", 0 /* == grayscale image*/);
double error_grayscale = cvtest::norm(reference_grayscale, grayscale, NORM_L1);
EXPECT_LE(error_grayscale, numerical_precision);
double gray_psnr = cvtest::PSNR(reference_grayscale, grayscale);
EXPECT_GT(gray_psnr, 60.0);
Mat reference_boost = imread(folder + "boost_reference.png");
double error_boost = cvtest::norm(reference_boost, color_boost, NORM_L1);
EXPECT_LE(error_boost, numerical_precision);
double boost_psnr = cvtest::PSNR(reference_boost, color_boost);
EXPECT_GT(boost_psnr, 60.0);
}