improved cloning test

This commit is contained in:
Adrien BAK 2014-09-26 09:55:11 +09:00 committed by Adrien BAK
parent 83ef276697
commit 0a3aab288a

View File

@ -47,6 +47,7 @@
using namespace cv;
using namespace std;
static const double numerical_precision = 1.;
TEST(Photo_SeamlessClone_normal, regression)
{
@ -69,8 +70,9 @@ TEST(Photo_SeamlessClone_normal, regression)
p.y = destination.size().height/2;
seamlessClone(source, destination, mask, p, result, 1);
imwrite(folder + "cloned.png", result);
Mat reference = imread(folder + "reference.png");
double error = norm(reference, result, NORM_L1);
EXPECT_LE(error, numerical_precision);
}
TEST(Photo_SeamlessClone_mixed, regression)
@ -94,7 +96,9 @@ TEST(Photo_SeamlessClone_mixed, regression)
p.y = destination.size().height/2;
seamlessClone(source, destination, mask, p, result, 2);
imwrite(folder + "cloned.png", result);
Mat reference = imread(folder + "reference.png");
double error = norm(reference, result, NORM_L1);
EXPECT_LE(error, numerical_precision);
}
@ -119,7 +123,9 @@ TEST(Photo_SeamlessClone_featureExchange, regression)
p.y = destination.size().height/2;
seamlessClone(source, destination, mask, p, result, 3);
imwrite(folder + "cloned.png", result);
Mat reference = imread(folder + "reference.png");
double error = norm(reference, result, NORM_L1);
EXPECT_LE(error, numerical_precision);
}
@ -138,7 +144,9 @@ TEST(Photo_SeamlessClone_colorChange, regression)
Mat result;
colorChange(source, mask, result, 1.5, .5, .5);
imwrite(folder + "cloned.png", result);
Mat reference = imread(folder + "reference.png");
double error = norm(reference, result, NORM_L1);
EXPECT_LE(error, numerical_precision);
}
@ -157,7 +165,9 @@ TEST(Photo_SeamlessClone_illuminationChange, regression)
Mat result;
illuminationChange(source, mask, result, 0.2f, 0.4f);
imwrite(folder + "cloned.png", result);
Mat reference = imread(folder + "reference.png");
double error = norm(reference, result, NORM_L1);
EXPECT_LE(error, numerical_precision);
}
@ -176,6 +186,8 @@ TEST(Photo_SeamlessClone_textureFlattening, regression)
Mat result;
textureFlattening(source, mask, result, 30, 45, 3);
imwrite(folder + "cloned.png", result);
Mat reference = imread(folder + "reference.png");
double error = norm(reference, result, NORM_L1);
EXPECT_LE(error, numerical_precision);
}