1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

gapi(test): more reliable checks

avoid `countNonZero()`, use `norm()`
This commit is contained in:
Alexander Alekhin
2018-11-09 14:11:13 +03:00
parent dd6f5949c2
commit 6189b47648
14 changed files with 202 additions and 285 deletions
@@ -871,8 +871,8 @@ TEST_P(ThresholdTest, AccuracyTestBinary)
}
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_EQ(0, cv::countNonZero(out_mat_ocv != out_mat_gapi));
EXPECT_EQ(out_mat_gapi.size(), sz_in);
ASSERT_EQ(out_mat_gapi.size(), sz_in);
EXPECT_EQ(0, cv::norm(out_mat_ocv, out_mat_gapi, NORM_L1));
}
}
+83 -175
View File
@@ -134,7 +134,7 @@ public:
AbsExact() {}
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
{
if (cv::countNonZero(in1 != in2) != 0)
if (cv::norm(in1, in2, NORM_INF) != 0)
{
std::cout << "AbsExact error: G-API output and reference output matrixes are not bitexact equal." << std::endl;
return false;
@@ -153,8 +153,7 @@ public:
AbsTolerance(double tol) : _tol(tol) {}
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
{
cv::Mat absDiff; cv::absdiff(in1, in2, absDiff);
if(cv::countNonZero(absDiff > _tol))
if (cv::norm(in1, in2, NORM_INF) > _tol)
{
std::cout << "AbsTolerance error: Number of different pixels in " << std::endl;
std::cout << "G-API output and reference output matrixes exceeds " << _tol << " pixels threshold." << std::endl;
@@ -169,19 +168,22 @@ private:
double _tol;
};
class AbsTolerance_Float_Int : public Wrappable<AbsTolerance_Float_Int>
class Tolerance_FloatRel_IntAbs : public Wrappable<Tolerance_FloatRel_IntAbs>
{
public:
AbsTolerance_Float_Int(double tol, double tol8u) : _tol(tol), _tol8u(tol8u) {}
Tolerance_FloatRel_IntAbs(double tol, double tol8u) : _tol(tol), _tol8u(tol8u) {}
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
{
if (CV_MAT_DEPTH(in1.type()) == CV_32F)
int depth = CV_MAT_DEPTH(in1.type());
{
if (cv::countNonZero(cv::abs(in1 - in2) > (_tol)*cv::abs(in2)))
double err = depth >= CV_32F ? cv::norm(in1, in2, NORM_L1 | NORM_RELATIVE)
: cv::norm(in1, in2, NORM_INF);
double tolerance = depth >= CV_32F ? _tol : _tol8u;
if (err > tolerance)
{
std::cout << "AbsTolerance_Float_Int error (Float): One or more of pixels in" << std::endl;
std::cout << "G-API output exceeds relative threshold value defined by reference_pixel_value * tolerance" << std::endl;
std::cout << "for tolerance " << _tol << std::endl;
std::cout << "Tolerance_FloatRel_IntAbs error: err=" << err
<< " tolerance=" << tolerance
<< " depth=" << cv::typeToString(depth) << std::endl;
return false;
}
else
@@ -189,193 +191,99 @@ public:
return true;
}
}
else
{
if (cv::countNonZero(in1 != in2) <= (_tol8u)* in2.total())
{
return true;
}
else
{
std::cout << "AbsTolerance_Float_Int error (Integer): Number of different pixels in" << std::endl;
std::cout << "G-API output and reference output matrixes exceeds relative threshold value" << std::endl;
std::cout << "defined by reference_total_pixels_number * tolerance" << std::endl;
std::cout << "for tolerance " << _tol8u << std::endl;
return false;
}
}
}
private:
double _tol;
double _tol8u;
};
class AbsToleranceSepFilter : public Wrappable<AbsToleranceSepFilter>
{
public:
AbsToleranceSepFilter(double tol) : _tol(tol) {}
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
{
if ((cv::countNonZero(cv::abs(in1 - in2) > (_tol)* cv::abs(in2)) <= 0.01 * in2.total()))
{
return true;
}
else
{
std::cout << "AbsToleranceSepFilter error: Number of different pixels in" << std::endl;
std::cout << "G-API output and reference output matrixes which exceeds relative threshold value" << std::endl;
std::cout << "defined by reference_pixel_value * tolerance" << std::endl;
std::cout << "for tolerance " << _tol << " is more then 1% of total number of pixels in the reference matrix." << std::endl;
return false;
}
}
private:
double _tol;
};
class AbsToleranceGaussianBlur_Float_Int : public Wrappable<AbsToleranceGaussianBlur_Float_Int>
class AbsSimilarPoints : public Wrappable<AbsSimilarPoints>
{
public:
AbsToleranceGaussianBlur_Float_Int(double tol, double tol8u) : _tol(tol), _tol8u(tol8u) {}
AbsSimilarPoints(double tol, double percent) : _tol(tol), _percent(percent) {}
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
{
if (CV_MAT_DEPTH(in1.type()) == CV_32F || CV_MAT_DEPTH(in1.type()) == CV_64F)
{
if (cv::countNonZero(cv::abs(in1 - in2) > (_tol)*cv::abs(in2)))
{
std::cout << "AbsToleranceGaussianBlur_Float_Int error (Float): Number of different pixels in" << std::endl;
std::cout << "G-API output and reference output matrixes which exceeds relative threshold value" << std::endl;
std::cout << "defined by reference_pixel_value * tolerance" << std::endl;
std::cout << "for tolerance " << _tol << " is more then 0." << std::endl;
return false;
}
else
{
return true;
}
}
else
{
if (CV_MAT_DEPTH(in1.type()) == CV_8U)
{
bool a = (cv::countNonZero(cv::abs(in1 - in2) > 1) <= _tol8u * in2.total());
if (((a == 1 ? 0 : 1) && ((cv::countNonZero(cv::abs(in1 - in2) > 2) <= 0) == 1 ? 0 : 1)) == 1)
{
std::cout << "AbsToleranceGaussianBlur_Float_Int error (8U): Number of pixels in" << std::endl;
std::cout << "G-API output and reference output matrixes with absolute difference which is more than 1 but less than 3" << std::endl;
std::cout << "exceeds relative threshold value defined by reference_total_pixels_number * tolerance" << std::endl;
std::cout << "for tolerance " << _tol8u << std::endl;
return false;
}
else
{
return true;
}
}
else
{
if (cv::countNonZero(in1 != in2) != 0)
{
std::cout << "AbsToleranceGaussianBlur_Float_Int error: G-API output and reference output matrixes are not bitexact equal." << std::endl;
return false;
}
else
{
return true;
}
}
}
}
private:
double _tol;
double _tol8u;
};
class ToleranceRGBBGR : public Wrappable<ToleranceRGBBGR>
{
public:
ToleranceRGBBGR(double tol) : _tol(tol) {}
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
{
bool a = (cv::countNonZero((in1 - in2) > 0) <= _tol * in2.total());
if (((a == 1 ? 0 : 1) && ((cv::countNonZero((in1 - in2) > 1) <= 0) == 1 ? 0 : 1)) == 1)
{
std::cout << "ToleranceRGBBGR error: Number of pixels in" << std::endl;
std::cout << "G-API output and reference output matrixes with difference which is more than 0 but no more than 1" << std::endl;
std::cout << "exceeds relative threshold value defined by reference_total_pixels_number * tolerance" << std::endl;
std::cout << "for tolerance " << _tol << std::endl;
return false;
}
else
{
return true;
}
}
private:
double _tol;
};
class ToleranceTriple: public Wrappable<ToleranceTriple>
{
public:
ToleranceTriple(double tol1, double tol2, double tol3) : _tol1(tol1), _tol2(tol2), _tol3(tol3) {}
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
{
bool a = (cv::countNonZero((in1 - in2) > 0) <= _tol1 * in2.total());
if ((((a == 1 ? 0 : 1) &&
((cv::countNonZero((in1 - in2) > 1) <= _tol2 * in2.total()) == 1 ? 0 : 1) &&
((cv::countNonZero((in1 - in2) > 2) <= _tol3 * in2.total()) == 1 ? 0 : 1))) == 1)
{
std::cout << "ToleranceTriple error: Number of pixels in" << std::endl;
std::cout << "G-API output and reference output matrixes with difference which is more than 0 but no more than 1" << std::endl;
std::cout << "exceeds relative threshold value defined by reference_total_pixels_number * tolerance1" << std::endl;
std::cout << "for tolerance1 " << _tol1 << std::endl;
std::cout << "AND with difference which is more than 1 but no more than 2" << std::endl;
std::cout << "exceeds relative threshold value defined by reference_total_pixels_number * tolerance2" << std::endl;
std::cout << "for tolerance2 " << _tol2 << std::endl;
std::cout << "AND with difference which is more than 2" << std::endl;
std::cout << "exceeds relative threshold value defined by reference_total_pixels_number * tolerance3" << std::endl;
std::cout << "for tolerance3 " << _tol3 << std::endl;
return false;
}
else
{
return true;
}
}
private:
double _tol1, _tol2, _tol3;
};
class AbsToleranceSobel : public Wrappable<AbsToleranceSobel>
{
public:
AbsToleranceSobel(double tol) : _tol(tol) {}
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
{
cv::Mat diff, a1, a2, b, base;
Mat diff;
cv::absdiff(in1, in2, diff);
a1 = cv::abs(in1);
a2 = cv::abs(in2);
cv::max(a1, a2, b);
cv::max(1, b, base); // base = max{1, |in1|, |in2|}
if(cv::countNonZero(diff > _tol*base) != 0)
Mat err_mask = diff > _tol;
int err_points = cv::countNonZero(err_mask.reshape(1));
double max_err_points = _percent * std::max((size_t)1000, in1.total());
if (err_points > max_err_points)
{
std::cout << "AbsToleranceSobel error: Number of pixels in" << std::endl;
std::cout << "G-API output and reference output matrixes with absolute difference which is more than relative threshold defined by tolerance * max{1, |in1|, |in2|}" << std::endl;
std::cout << "relative threshold defined by tolerance * max{1, |in1|, |in2|} exceeds 0"<< std::endl;
std::cout << "for tolerance " << _tol << std::endl;
std::cout << "AbsSimilarPoints error: err_points=" << err_points
<< " max_err_points=" << max_err_points << " (total=" << in1.total() << ")"
<< " diff_tolerance=" << _tol << std::endl;
return false;
}
else
{
return true;
}
}
private:
double _tol;
double _percent;
};
class ToleranceFilter : public Wrappable<ToleranceFilter>
{
public:
ToleranceFilter(double tol, double tol8u, double inf_tol = 2.0) : _tol(tol), _tol8u(tol8u), _inf_tol(inf_tol) {}
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
{
int depth = CV_MAT_DEPTH(in1.type());
{
double err_Inf = cv::norm(in1, in2, NORM_INF);
if (err_Inf > _inf_tol)
{
std::cout << "ToleranceFilter error: err_Inf=" << err_Inf << " tolerance=" << _inf_tol << std::endl;
return false;
}
double err = cv::norm(in1, in2, NORM_L2 | NORM_RELATIVE);
double tolerance = depth >= CV_32F ? _tol : _tol8u;
if (err > tolerance)
{
std::cout << "ToleranceFilter error: err=" << err << " tolerance=" << tolerance
<< " depth=" << cv::depthToString(depth)
<< std::endl;
return false;
}
}
return true;
}
private:
double _tol;
double _tol8u;
double _inf_tol;
};
class ToleranceColor : public Wrappable<ToleranceColor>
{
public:
ToleranceColor(double tol, double inf_tol = 2.0) : _tol(tol), _inf_tol(inf_tol) {}
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
{
{
double err_Inf = cv::norm(in1, in2, NORM_INF);
if (err_Inf > _inf_tol)
{
std::cout << "ToleranceColor error: err_Inf=" << err_Inf << " tolerance=" << _inf_tol << std::endl;;
return false;
}
double err = cv::norm(in1, in2, NORM_L1 | NORM_RELATIVE);
if (err > _tol)
{
std::cout << "ToleranceColor error: err=" << err << " tolerance=" << _tol << std::endl;;
return false;
}
}
return true;
}
private:
double _tol;
double _inf_tol;
};
} // namespace opencv_test
@@ -275,7 +275,7 @@ INSTANTIATE_TEST_CASE_P(Split4TestCPU, Split4Test,
Values(cv::compile_args(CORE_CPU))));
INSTANTIATE_TEST_CASE_P(ResizeTestCPU, ResizeTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(AbsSimilarPoints(2, 0.05).to_compare_f()),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
Values(cv::Size(1280, 720),
@@ -286,7 +286,7 @@ INSTANTIATE_TEST_CASE_P(ResizeTestCPU, ResizeTest,
Values(cv::compile_args(CORE_CPU))));
INSTANTIATE_TEST_CASE_P(ResizeTestCPU, ResizeTestFxFy,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(AbsSimilarPoints(2, 0.05).to_compare_f()),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
Values(cv::Size(1280, 720),
@@ -161,7 +161,7 @@ INSTANTIATE_TEST_CASE_P(EqHistTestCPU, EqHistTest,
Values(cv::compile_args(IMGPROC_CPU))));
INSTANTIATE_TEST_CASE_P(CannyTestCPU, CannyTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(AbsSimilarPoints(0, 0.05).to_compare_f()),
Values(CV_8UC1, CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
@@ -15,35 +15,35 @@ namespace opencv_test
{
INSTANTIATE_TEST_CASE_P(RGB2GrayTestFluid, RGB2GrayTest,
Combine(Values(ToleranceRGBBGR(0.001).to_compare_f()),
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
INSTANTIATE_TEST_CASE_P(BGR2GrayTestFluid, BGR2GrayTest,
Combine(Values(ToleranceRGBBGR(0.001).to_compare_f()),
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
INSTANTIATE_TEST_CASE_P(RGB2YUVTestFluid, RGB2YUVTest,
Combine(Values(ToleranceRGBBGR(0.15*3).to_compare_f()),
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
INSTANTIATE_TEST_CASE_P(YUV2RGBTestFluid, YUV2RGBTest,
Combine(Values(ToleranceTriple(0.25 * 3, 0.01 * 3, 1e-5 * 3).to_compare_f()),
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
INSTANTIATE_TEST_CASE_P(RGB2LabTestFluid, RGB2LabTest,
Combine(Values(ToleranceTriple(0.25 * 3, 0.0, 1e-5 * 3).to_compare_f()),
Combine(Values(AbsSimilarPoints(1, 0.05).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(true, false),
@@ -51,14 +51,14 @@ INSTANTIATE_TEST_CASE_P(RGB2LabTestFluid, RGB2LabTest,
// FIXME: Not supported by Fluid yet (no kernel implemented)
INSTANTIATE_TEST_CASE_P(BGR2LUVTestFluid, BGR2LUVTest,
Combine(Values(ToleranceTriple(0.25 * 3, 0.01 * 3, 0.0001 * 3).to_compare_f()),
Combine(Values(ToleranceColor(5e-3, 6).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
INSTANTIATE_TEST_CASE_P(blurTestFluid, BlurTest,
Combine(Values(AbsTolerance(0.0).to_compare_f()),
Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(3), // add kernel size=5 when implementation is ready
Values(cv::Size(1280, 720),
@@ -68,7 +68,7 @@ INSTANTIATE_TEST_CASE_P(blurTestFluid, BlurTest,
Values(cv::compile_args(IMGPROC_FLUID))));
INSTANTIATE_TEST_CASE_P(gaussBlurTestFluid, GaussianBlurTest,
Combine(Values(AbsToleranceGaussianBlur_Float_Int(1e-6, 1e-6).to_compare_f()),
Combine(Values(ToleranceFilter(1e-3f, 0.01).to_compare_f()),
Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(3), // add kernel size=5 when implementation is ready
Values(cv::Size(1280, 720),
@@ -122,7 +122,7 @@ INSTANTIATE_TEST_CASE_P(SobelTestFluid, SobelTest,
Values(cv::compile_args(IMGPROC_FLUID))));
INSTANTIATE_TEST_CASE_P(SobelTestFluid32F, SobelTest,
Combine(Values(AbsToleranceSobel(1e-3).to_compare_f()),
Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(CV_32FC1),
Values(3), // add kernel size=5 when implementation is ready
Values(cv::Size(1280, 720),
@@ -134,7 +134,7 @@ INSTANTIATE_TEST_CASE_P(SobelTestFluid32F, SobelTest,
Values(cv::compile_args(IMGPROC_FLUID))));
INSTANTIATE_TEST_CASE_P(boxFilterTestFluid32, BoxFilterTest,
Combine(Values(AbsTolerance_Float_Int(1e-6, 1e-4).to_compare_f()),
Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(3), // add kernel size=5 when implementation is ready
Values(cv::Size(1280, 720),
@@ -145,7 +145,7 @@ INSTANTIATE_TEST_CASE_P(boxFilterTestFluid32, BoxFilterTest,
Values(cv::compile_args(IMGPROC_FLUID))));
INSTANTIATE_TEST_CASE_P(sepFilterTestFluid, SepFilterTest,
Combine(Values(AbsToleranceSepFilter(1e-5f).to_compare_f()),
Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(CV_32FC1),
Values(3), // add kernel size=5 when implementation is ready
Values(cv::Size(1280, 720),
@@ -155,7 +155,7 @@ INSTANTIATE_TEST_CASE_P(sepFilterTestFluid, SepFilterTest,
Values(cv::compile_args(IMGPROC_FLUID))));
INSTANTIATE_TEST_CASE_P(filter2DTestFluid, Filter2DTest,
Combine(Values(AbsTolerance_Float_Int(1e-6, 1e-4).to_compare_f()),
Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(3), // add kernel size=4,5,7 when implementation ready
Values(cv::Size(1280, 720),
@@ -30,7 +30,7 @@ INSTANTIATE_TEST_CASE_P(MathOperatorTestCPU, MathOperatorMatMatTest,
INSTANTIATE_TEST_CASE_P(MathOperatorTestCPU, MathOperatorMatScalarTest,
Combine(Values(AbsExact().to_compare_f()),
Values( opPlus, opPlusR, opMinus, opMinusR, opMul, opMulR, opDiv, opDivR,
Values( opPlus, opPlusR, opMinus, opMinusR, opMul, opMulR, // FIXIT avoid division by values near zero: opDiv, opDivR,
opGT, opLT, opGE, opLE, opEQ, opNE,
opGTR, opLTR, opGER, opLER, opEQR, opNER),
Values(CV_8UC1, CV_16SC1, CV_32FC1),
@@ -29,7 +29,7 @@ INSTANTIATE_TEST_CASE_P(MathOperatorTestFluid, MathOperatorMatMatTest,
//FIXME: Some Mat/Scalar Fluid kernels are not there yet!
INSTANTIATE_TEST_CASE_P(DISABLED_MathOperatorTestFluid, MathOperatorMatScalarTest,
Combine(Values(AbsExact().to_compare_f()),
Values( opPlus, opPlusR, opMinus, opMinusR, opMul, opMulR, opDiv, opDivR,
Values( opPlus, opPlusR, opMinus, opMinusR, opMul, opMulR, // FIXIT avoid division by values near zero: opDiv, opDivR,
opGT, opLT, opGE, opLE, opEQ, opNE,
opGTR, opLTR, opGER, opLER, opEQR, opNER),
Values(CV_8UC1, CV_16SC1, CV_32FC1),
@@ -277,7 +277,7 @@ INSTANTIATE_TEST_CASE_P(Split4TestGPU, Split4Test,
Values(cv::compile_args(CORE_GPU))));
INSTANTIATE_TEST_CASE_P(ResizeTestGPU, ResizeTest,
Combine(Values(AbsTolerance_Float_Int(1e-3, 1e-0).to_compare_f()), //TODO: too relaxed?
Combine(Values(AbsSimilarPoints(2, 0.05).to_compare_f()),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
Values(cv::Size(1280, 720),
@@ -288,7 +288,7 @@ INSTANTIATE_TEST_CASE_P(ResizeTestGPU, ResizeTest,
Values(cv::compile_args(CORE_GPU))));
INSTANTIATE_TEST_CASE_P(ResizeTestGPU, ResizeTestFxFy,
Combine(Values(AbsTolerance_Float_Int(1e-1, 1e-0).to_compare_f()), //TODO: too relaxed?
Combine(Values(AbsSimilarPoints(2, 0.05).to_compare_f()),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
Values(cv::Size(1280, 720),
@@ -17,7 +17,7 @@ namespace opencv_test
INSTANTIATE_TEST_CASE_P(Filter2DTestGPU, Filter2DTest,
Combine(Values(AbsTolerance_Float_Int(1e-5, 1e-3).to_compare_f()),
Combine(Values(Tolerance_FloatRel_IntAbs(1e-5, 2).to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3, 4, 5, 7),
Values(cv::Size(1280, 720),
@@ -29,7 +29,7 @@ INSTANTIATE_TEST_CASE_P(Filter2DTestGPU, Filter2DTest,
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(BoxFilterTestGPU, BoxFilterTest,
Combine(Values(AbsTolerance_Float_Int(1e-5, 1e-3).to_compare_f()),
Combine(Values(Tolerance_FloatRel_IntAbs(1e-5, 2).to_compare_f()),
Values(/*CV_8UC1,*/ CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3,5),
Values(cv::Size(1280, 720),
@@ -40,7 +40,7 @@ INSTANTIATE_TEST_CASE_P(BoxFilterTestGPU, BoxFilterTest,
Values(cv::compile_args(IMGPROC_GPU)))); //TODO: 8UC1 doesn't work
INSTANTIATE_TEST_CASE_P(SepFilterTestGPU_8U, SepFilterTest,
Combine(Values(AbsToleranceSepFilter(1e-4f).to_compare_f()),
Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(CV_8UC1, CV_8UC3),
Values(3),
Values(cv::Size(1280, 720),
@@ -50,7 +50,7 @@ INSTANTIATE_TEST_CASE_P(SepFilterTestGPU_8U, SepFilterTest,
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(SepFilterTestGPU_other, SepFilterTest,
Combine(Values(AbsToleranceSepFilter(1e-4f).to_compare_f()),
Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(CV_16UC1, CV_16SC1, CV_32FC1),
Values(3),
Values(cv::Size(1280, 720),
@@ -60,7 +60,7 @@ INSTANTIATE_TEST_CASE_P(SepFilterTestGPU_other, SepFilterTest,
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(BlurTestGPU, BlurTest,
Combine(Values(AbsTolerance_Float_Int(1e-4, 1e-2).to_compare_f()),
Combine(Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3,5),
Values(cv::Size(1280, 720),
@@ -70,9 +70,9 @@ INSTANTIATE_TEST_CASE_P(BlurTestGPU, BlurTest,
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(gaussBlurTestGPU, GaussianBlurTest,
Combine(Values(AbsToleranceGaussianBlur_Float_Int(1e-5, 0.05).to_compare_f()), //TODO: too relaxed?
Combine(Values(ToleranceFilter(1e-5f, 0.01).to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3, 5),
Values(3), // FIXIT 5
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
/*init output matrices or not*/ testing::Bool(),
@@ -130,7 +130,7 @@ INSTANTIATE_TEST_CASE_P(Dilate3x3TestGPU, Dilate3x3Test,
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(SobelTestGPU, SobelTest,
Combine(Values(AbsTolerance_Float_Int(1e-4, 1e-4).to_compare_f()),
Combine(Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1/*, CV_32FC1*/), //TODO: CV_32FC1 fails accuracy
Values(3, 5),
Values(cv::Size(1280, 720),
@@ -142,14 +142,14 @@ INSTANTIATE_TEST_CASE_P(SobelTestGPU, SobelTest,
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(EqHistTestGPU, EqHistTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(AbsExact().to_compare_f()), // FIXIT Non reliable check
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(CannyTestGPU, CannyTest,
Combine(Values(AbsTolerance_Float_Int(1e-4, 1e-2).to_compare_f()),
Combine(Values(AbsSimilarPoints(0, 0.05).to_compare_f()),
Values(CV_8UC1, CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
@@ -161,63 +161,63 @@ INSTANTIATE_TEST_CASE_P(CannyTestGPU, CannyTest,
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(RGB2GrayTestGPU, RGB2GrayTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(BGR2GrayTestGPU, BGR2GrayTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(RGB2YUVTestGPU, RGB2YUVTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(YUV2RGBTestGPU, YUV2RGBTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(RGB2LabTestGPU, RGB2LabTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(AbsSimilarPoints(1, 0.05).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(BGR2LUVTestGPU, BGR2LUVTest,
Combine(Values(ToleranceTriple(0.25 * 3, 0.01 * 3, 0.0001 * 3).to_compare_f()),
Combine(Values(ToleranceColor(5e-3, 6).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(LUV2BGRTestGPU, LUV2BGRTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(BGR2YUVTestGPU, BGR2YUVTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
INSTANTIATE_TEST_CASE_P(YUV2BGRTestGPU, YUV2BGRTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
/*init output matrices or not*/ testing::Bool(),
@@ -16,7 +16,7 @@ namespace opencv_test
INSTANTIATE_TEST_CASE_P(MathOperatorTestGPU, MathOperatorMatMatTest,
Combine(Values(AbsTolerance_Float_Int(1e-5, 1e-3).to_compare_f()),
Combine(Values(Tolerance_FloatRel_IntAbs(1e-5, 2).to_compare_f()),
Values( opPlusM, opMinusM, opDivM,
opGreater, opLess, opGreaterEq, opLessEq, opEq, opNotEq),
Values(CV_8UC1, CV_16SC1, CV_32FC1),
@@ -28,8 +28,8 @@ INSTANTIATE_TEST_CASE_P(MathOperatorTestGPU, MathOperatorMatMatTest,
Values(cv::compile_args(CORE_GPU))));
INSTANTIATE_TEST_CASE_P(MathOperatorTestGPU, MathOperatorMatScalarTest,
Combine(Values(AbsTolerance_Float_Int(1e-4, 1e-2).to_compare_f()),
Values( opPlus, opPlusR, opMinus, opMinusR, opMul, opMulR, opDiv, opDivR,
Combine(Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_f()),
Values( opPlus, opPlusR, opMinus, opMinusR, opMul, opMulR, // FIXIT avoid division by values near zero: opDiv, opDivR,
opGT, opLT, opGE, opLE, opEQ, opNE,
opGTR, opLTR, opGER, opLER, opEQR, opNER),
Values(CV_8UC1, CV_16SC1, CV_32FC1),