This source file includes following definitions.
- TEST
- TEST
- TEST
- TEST
- TEST
#include "test_precomp.hpp"
#include "opencv2/photo.hpp"
#include <string>
using namespace cv;
using namespace std;
static const double numerical_precision = 100.;
TEST(Photo_NPR_EdgePreserveSmoothing_RecursiveFilter, regression)
{
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/";
string original_path = folder + "test1.png";
Mat source = imread(original_path, IMREAD_COLOR);
ASSERT_FALSE(source.empty()) << "Could not load input image " << original_path;
Mat result;
edgePreservingFilter(source,result,1);
Mat reference = imread(folder + "smoothened_RF_reference.png");
double error = cvtest::norm(reference, result, NORM_L1);
EXPECT_LE(error, numerical_precision);
}
TEST(Photo_NPR_EdgePreserveSmoothing_NormConvFilter, regression)
{
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/";
string original_path = folder + "test1.png";
Mat source = imread(original_path, IMREAD_COLOR);
ASSERT_FALSE(source.empty()) << "Could not load input image " << original_path;
Mat result;
edgePreservingFilter(source,result,2);
Mat reference = imread(folder + "smoothened_NCF_reference.png");
double error = cvtest::norm(reference, result, NORM_L1);
EXPECT_LE(error, numerical_precision);
}
TEST(Photo_NPR_DetailEnhance, regression)
{
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/";
string original_path = folder + "test1.png";
Mat source = imread(original_path, IMREAD_COLOR);
ASSERT_FALSE(source.empty()) << "Could not load input image " << original_path;
Mat result;
detailEnhance(source,result);
Mat reference = imread(folder + "detail_enhanced_reference.png");
double error = cvtest::norm(reference, result, NORM_L1);
EXPECT_LE(error, numerical_precision);
}
TEST(Photo_NPR_PencilSketch, regression)
{
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/";
string original_path = folder + "test1.png";
Mat source = imread(original_path, IMREAD_COLOR);
ASSERT_FALSE(source.empty()) << "Could not load input image " << original_path;
Mat pencil_result, color_pencil_result;
pencilSketch(source,pencil_result, color_pencil_result, 10, 0.1f, 0.03f);
Mat pencil_reference = imread(folder + "pencil_sketch_reference.png", 0 );
double pencil_error = norm(pencil_reference, pencil_result, NORM_L1);
EXPECT_LE(pencil_error, numerical_precision);
Mat color_pencil_reference = imread(folder + "color_pencil_sketch_reference.png");
double color_pencil_error = cvtest::norm(color_pencil_reference, color_pencil_result, NORM_L1);
EXPECT_LE(color_pencil_error, numerical_precision);
}
TEST(Photo_NPR_Stylization, regression)
{
string folder = string(cvtest::TS::ptr()->get_data_path()) + "npr/";
string original_path = folder + "test1.png";
Mat source = imread(original_path, IMREAD_COLOR);
ASSERT_FALSE(source.empty()) << "Could not load input image " << original_path;
Mat result;
stylization(source,result);
Mat stylized_reference = imread(folder + "stylized_reference.png");
double stylized_error = cvtest::norm(stylized_reference, result, NORM_L1);
EXPECT_LE(stylized_error, numerical_precision);
}