Merge pull request #14757 from andrey-golubev:core_tests_update

G-API: Introduce new approach to write accuracy tests (#14757)

* G-API: Introduce new common accuracy test fixture

* Enable Range<> to Seq<> implicit conversion

* Fix shadowing parameters

* Update license headers

* Rename ALIGNED_TYPE to SAME_TYPE

* Move MkRange to tests

* Fix TODO(agolubev) in test instantiations

* Squash simple fixture declarations in one line

* Remove unused line

* Fix Windows issues with macro expansion

* Choose between 1 or 2 matrix initialization

* Redesign common class behavior

Use "views" for GetParam() provided by GTest
base class instead of doing segregation
(with copy!) of common and specific parameters:
request common or specific parameter directly
by index from GetParam()-returned parameters

* Refine user-level API and usage of new test model

* Fix -fpermissive errors

* Remove unnecessary init calls

* Replace GCompileArgs member variable with func ptr

* Rename initMatsRandN to make its behavior explicit

Rename initMatsRandN to initMatrixRandN to eliminate confusion:
initMatsRandN only initialized first matrix (similarly to
initMatrixRandU)

* Fix common of initNothing

* Update copyright dates in missed files

* Add check for specific parameters

* Fix coment stlye
This commit is contained in:
Andrey Golubev 2019-06-28 13:07:41 +03:00 committed by Alexander Alekhin
parent b95e93c20a
commit 75c567b6ab
9 changed files with 884 additions and 784 deletions

View File

@ -2,7 +2,7 @@
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018 Intel Corporation
// Copyright (C) 2018-2019 Intel Corporation
#ifndef OPENCV_GAPI_IMGPROC_PERF_TESTS_INL_HPP
@ -68,7 +68,7 @@ PERF_TEST_P_(SepFilterPerfTest, TestPerformance)
cv::Mat kernelY(kernSize, 1, CV_32F);
randu(kernelX, -1, 1);
randu(kernelY, -1, 1);
initMatsRandN(type, sz, dtype, false);
initMatrixRandN(type, sz, dtype, false);
cv::Point anchor = cv::Point(-1, -1);
@ -110,7 +110,7 @@ PERF_TEST_P_(Filter2DPerfTest, TestPerformance)
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, borderType, dtype, compile_args) = GetParam();
initMatsRandN(type, sz, dtype, false);
initMatrixRandN(type, sz, dtype, false);
cv::Point anchor = {-1, -1};
double delta = 0;
@ -160,7 +160,7 @@ PERF_TEST_P_(BoxFilterPerfTest, TestPerformance)
cv::GCompileArgs compile_args;
std::tie(cmpF, type, filterSize, sz, borderType, dtype, compile_args) = GetParam();
initMatsRandN(type, sz, dtype, false);
initMatrixRandN(type, sz, dtype, false);
cv::Point anchor = {-1, -1};
bool normalize = true;
@ -204,7 +204,7 @@ PERF_TEST_P_(BlurPerfTest, TestPerformance)
cv::GCompileArgs compile_args;
std::tie(cmpF, type, filterSize, sz, borderType, compile_args) = GetParam();
initMatsRandN(type, sz, type, false);
initMatrixRandN(type, sz, type, false);
cv::Point anchor = {-1, -1};
@ -250,7 +250,7 @@ PERF_TEST_P_(GaussianBlurPerfTest, TestPerformance)
cv::Size kSize = cv::Size(kernSize, kernSize);
auto& rng = cv::theRNG();
double sigmaX = rng();
initMatsRandN(type, sz, type, false);
initMatrixRandN(type, sz, type, false);
// OpenCV code ///////////////////////////////////////////////////////////
cv::GaussianBlur(in_mat1, out_mat_ocv, kSize, sigmaX);
@ -289,7 +289,7 @@ PERF_TEST_P_(MedianBlurPerfTest, TestPerformance)
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, compile_args) = GetParam();
initMatsRandN(type, sz, type, false);
initMatrixRandN(type, sz, type, false);
// OpenCV code /////////////////////////////////////////////////////////////
{
@ -330,7 +330,7 @@ PERF_TEST_P_(ErodePerfTest, TestPerformance)
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, kernType, compile_args) = GetParam();
initMatsRandN(type, sz, type, false);
initMatrixRandN(type, sz, type, false);
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize));
@ -373,7 +373,7 @@ PERF_TEST_P_(Erode3x3PerfTest, TestPerformance)
cv::GCompileArgs compile_args;
std::tie(cmpF, type, sz, numIters, compile_args) = GetParam();
initMatsRandN(type, sz, type, false);
initMatrixRandN(type, sz, type, false);
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3, 3));
@ -416,7 +416,7 @@ PERF_TEST_P_(DilatePerfTest, TestPerformance)
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, kernType, compile_args) = GetParam();
initMatsRandN(type, sz, type, false);
initMatrixRandN(type, sz, type, false);
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize));
@ -459,7 +459,7 @@ PERF_TEST_P_(Dilate3x3PerfTest, TestPerformance)
cv::GCompileArgs compile_args;
std::tie(cmpF, type, sz, numIters, compile_args) = GetParam();
initMatsRandN(type, sz, type, false);
initMatrixRandN(type, sz, type, false);
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3, 3));
@ -502,7 +502,7 @@ PERF_TEST_P_(SobelPerfTest, TestPerformance)
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, dtype, dx, dy, compile_args) = GetParam();
initMatsRandN(type, sz, dtype, false);
initMatrixRandN(type, sz, dtype, false);
// OpenCV code /////////////////////////////////////////////////////////////
{
@ -545,7 +545,7 @@ PERF_TEST_P_(SobelXYPerfTest, TestPerformance)
cv::Mat out_mat_ocv2;
cv::Mat out_mat_gapi2;
initMatsRandN(type, sz, dtype, false);
initMatrixRandN(type, sz, dtype, false);
// OpenCV code /////////////////////////////////////////////////////////////
{
@ -590,7 +590,7 @@ PERF_TEST_P_(CannyPerfTest, TestPerformance)
cv::GCompileArgs compile_args;
std::tie(cmpF, type, sz, thrLow, thrUp, apSize, l2gr, compile_args) = GetParam();
initMatsRandN(type, sz, CV_8UC1, false);
initMatrixRandN(type, sz, CV_8UC1, false);
// OpenCV code /////////////////////////////////////////////////////////////
{
@ -628,7 +628,7 @@ PERF_TEST_P_(EqHistPerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC1, sz, CV_8UC1, false);
initMatrixRandN(CV_8UC1, sz, CV_8UC1, false);
// OpenCV code /////////////////////////////////////////////////////////////
{
@ -666,7 +666,7 @@ PERF_TEST_P_(RGB2GrayPerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC3, sz, CV_8UC1, false);
initMatrixRandN(CV_8UC3, sz, CV_8UC1, false);
// OpenCV code /////////////////////////////////////////////////////////////
{
@ -704,7 +704,7 @@ PERF_TEST_P_(BGR2GrayPerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC3, sz, CV_8UC1, false);
initMatrixRandN(CV_8UC3, sz, CV_8UC1, false);
// OpenCV code /////////////////////////////////////////////////////////////
{
@ -742,7 +742,7 @@ PERF_TEST_P_(RGB2YUVPerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
initMatrixRandN(CV_8UC3, sz, CV_8UC3, false);
// OpenCV code /////////////////////////////////////////////////////////////
{
@ -780,7 +780,7 @@ PERF_TEST_P_(YUV2RGBPerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
initMatrixRandN(CV_8UC3, sz, CV_8UC3, false);
// OpenCV code /////////////////////////////////////////////////////////////
{
@ -818,7 +818,7 @@ PERF_TEST_P_(RGB2LabPerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
initMatrixRandN(CV_8UC3, sz, CV_8UC3, false);
// OpenCV code /////////////////////////////////////////////////////////////
{
@ -856,7 +856,7 @@ PERF_TEST_P_(BGR2LUVPerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
initMatrixRandN(CV_8UC3, sz, CV_8UC3, false);
// OpenCV code /////////////////////////////////////////////////////////////
{
@ -894,7 +894,7 @@ PERF_TEST_P_(LUV2BGRPerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
initMatrixRandN(CV_8UC3, sz, CV_8UC3, false);
// OpenCV code /////////////////////////////////////////////////////////////
{
@ -932,7 +932,7 @@ PERF_TEST_P_(BGR2YUVPerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
initMatrixRandN(CV_8UC3, sz, CV_8UC3, false);
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2YUV);
@ -962,7 +962,7 @@ PERF_TEST_P_(YUV2BGRPerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
initMatrixRandN(CV_8UC3, sz, CV_8UC3, false);
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_YUV2BGR);
@ -990,7 +990,7 @@ PERF_TEST_P_(BayerGR2RGBPerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC1, sz, CV_8UC3, false);
initMatrixRandN(CV_8UC1, sz, CV_8UC3, false);
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BayerGR2RGB);
@ -1018,7 +1018,7 @@ PERF_TEST_P_(RGB2HSVPerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
initMatrixRandN(CV_8UC3, sz, CV_8UC3, false);
cv::cvtColor(in_mat1, in_mat1, cv::COLOR_BGR2RGB);
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2HSV);
@ -1047,7 +1047,7 @@ PERF_TEST_P_(RGB2YUV422PerfTest, TestPerformance)
Size sz = get<1>(GetParam());
cv::GCompileArgs compile_args = get<2>(GetParam());
initMatsRandN(CV_8UC3, sz, CV_8UC2, false);
initMatrixRandN(CV_8UC3, sz, CV_8UC2, false);
cv::cvtColor(in_mat1, in_mat1, cv::COLOR_BGR2RGB);
convertRGB2YUV422Ref(in_mat1, out_mat_ocv);

View File

@ -2,7 +2,7 @@
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018 Intel Corporation
// Copyright (C) 2018-2019 Intel Corporation
#ifndef OPENCV_GAPI_CORE_TESTS_HPP
@ -46,16 +46,18 @@ struct PrintMathOpCoreParams
std::string operator()(const ::testing::TestParamInfo<TestParams>& info) const
{
std::stringstream ss;
cv::Size sz = std::get<4>(info.param);
ss<<MathOperations[std::get<0>(info.param)]
<<"_"<<std::get<1>(info.param)
<<"_"<<std::get<2>(info.param)
<<"_"<<(int)std::get<3>(info.param)
using AllParams = Params<mathOp,bool,double,bool>;
const AllParams::params_t& params = info.param;
cv::Size sz = AllParams::getCommon<1>(params); // size
ss<<MathOperations[AllParams::getSpecific<0>(params)] // mathOp
<<"_"<<AllParams::getSpecific<1>(params) // testWithScalar
<<"_"<<AllParams::getCommon<0>(params) // type
<<"_"<<(int)AllParams::getSpecific<2>(params) // scale
<<"_"<<sz.width
<<"x"<<sz.height
<<"_"<<(std::get<5>(info.param)+1)
<<"_"<<std::get<6>(info.param)
<<"_"<<std::get<7>(info.param);
<<"_"<<(AllParams::getCommon<2>(params)+1) // dtype
<<"_"<<AllParams::getCommon<3>(params) // createOutputMatrices
<<"_"<<AllParams::getSpecific<3>(params); // doReverseOp
return ss.str();
}
};
@ -66,13 +68,15 @@ struct PrintCmpCoreParams
std::string operator()(const ::testing::TestParamInfo<TestParams>& info) const
{
std::stringstream ss;
cv::Size sz = std::get<3>(info.param);
ss<<CompareOperations[std::get<0>(info.param)]
<<"_"<<std::get<1>(info.param)
<<"_"<<std::get<2>(info.param)
using AllParams = Params<CmpTypes,bool>;
const AllParams::params_t& params = info.param;
cv::Size sz = AllParams::getCommon<1>(params); // size
ss<<CompareOperations[AllParams::getSpecific<0>(params)] // CmpType
<<"_"<<AllParams::getSpecific<1>(params) // testWithScalar
<<"_"<<AllParams::getCommon<0>(params) // type
<<"_"<<sz.width
<<"x"<<sz.height
<<"_"<<std::get<4>(info.param);
<<"_"<<AllParams::getCommon<3>(params); // createOutputMatrices
return ss.str();
}
};
@ -83,12 +87,14 @@ struct PrintBWCoreParams
std::string operator()(const ::testing::TestParamInfo<TestParams>& info) const
{
std::stringstream ss;
cv::Size sz = std::get<2>(info.param);
ss<<BitwiseOperations[std::get<0>(info.param)]
<<"_"<<std::get<1>(info.param)
using AllParams = Params<bitwiseOp>;
const AllParams::params_t& params = info.param;
cv::Size sz = AllParams::getCommon<1>(params); // size
ss<<BitwiseOperations[AllParams::getSpecific<0>(params)] // bitwiseOp
<<"_"<<AllParams::getCommon<0>(params) // type
<<"_"<<sz.width
<<"x"<<sz.height
<<"_"<<std::get<3>(info.param);
<<"_"<<AllParams::getCommon<3>(params); // createOutputMatrices
return ss.str();
}
};
@ -99,56 +105,64 @@ struct PrintNormCoreParams
std::string operator()(const ::testing::TestParamInfo<TestParams>& info) const
{
std::stringstream ss;
cv::Size sz = std::get<2>(info.param);
ss<<NormOperations[std::get<0>(info.param)]
<<"_"<<std::get<1>(info.param)
using AllParams = Params<compare_scalar_f,NormTypes>;
const AllParams::params_t& params = info.param;
cv::Size sz = AllParams::getCommon<1>(params); // size
ss<<NormOperations[AllParams::getSpecific<1>(params)] // NormTypes
<<"_"<<AllParams::getCommon<0>(params) // type
<<"_"<<sz.width
<<"x"<<sz.height;
return ss.str();
}
};
struct MathOpTest : public TestParams<std::tuple<mathOp,bool,int,double,cv::Size,int,bool,bool,cv::GCompileArgs>>{};
struct MulDoubleTest : public TestParams<std::tuple<int,cv::Size,int,bool,cv::GCompileArgs>>{};
struct DivTest : public TestParams<std::tuple<int,cv::Size,int,bool, cv::GCompileArgs>>{};
struct DivCTest : public TestParams<std::tuple<int,cv::Size,int,bool, cv::GCompileArgs>>{};
struct MeanTest : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
struct MaskTest : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
struct Polar2CartTest : public TestParams<std::tuple<cv::Size,bool, cv::GCompileArgs>> {};
struct Cart2PolarTest : public TestParams<std::tuple<cv::Size,bool, cv::GCompileArgs>> {};
struct CmpTest : public TestParams<std::tuple<CmpTypes,bool,int,cv::Size,bool, cv::GCompileArgs>>{};
struct BitwiseTest : public TestParams<std::tuple<bitwiseOp,int,cv::Size,bool, cv::GCompileArgs>>{};
struct NotTest : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
struct SelectTest : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
struct MinTest : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>>{};
struct MaxTest : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>>{};
struct AbsDiffTest : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>>{};
struct AbsDiffCTest : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
struct SumTest : public TestParams<std::tuple<int, cv::Size,bool, compare_scalar_f, cv::GCompileArgs>> {};
struct AddWeightedTest : public TestParams<std::tuple<int,cv::Size,int,bool, compare_f,cv::GCompileArgs>>{};
struct NormTest : public TestParams<std::tuple<NormTypes,int,cv::Size, compare_scalar_f, cv::GCompileArgs>>{};
struct IntegralTest : public TestWithParam<std::tuple<int,cv::Size, cv::GCompileArgs>> {};
struct ThresholdTest : public TestParams<std::tuple<int,cv::Size,int,bool, cv::GCompileArgs>> {};
struct ThresholdOTTest : public TestParams<std::tuple<int,cv::Size,int,bool, cv::GCompileArgs>> {};
struct InRangeTest : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
struct Split3Test : public TestParams<std::tuple<cv::Size, cv::GCompileArgs>> {};
struct Split4Test : public TestParams<std::tuple<cv::Size, cv::GCompileArgs>> {};
struct ResizeTest : public TestWithParam<std::tuple<compare_f, int, int, cv::Size, cv::Size, cv::GCompileArgs>> {};
struct ResizeTestFxFy : public TestWithParam<std::tuple<compare_f, int, int, cv::Size, double, double, cv::GCompileArgs>> {};
struct Merge3Test : public TestParams<std::tuple<cv::Size, cv::GCompileArgs>> {};
struct Merge4Test : public TestParams<std::tuple<cv::Size, cv::GCompileArgs>> {};
struct RemapTest : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
struct FlipTest : public TestParams<std::tuple<int, int, cv::Size,bool, cv::GCompileArgs>> {};
struct CropTest : public TestParams<std::tuple<int,cv::Rect,cv::Size,bool, cv::GCompileArgs>> {};
struct ConcatHorTest : public TestWithParam<std::tuple<int, cv::Size, cv::GCompileArgs>> {};
struct ConcatVertTest : public TestWithParam<std::tuple<int, cv::Size, cv::GCompileArgs>> {};
struct ConcatVertVecTest : public TestWithParam<std::tuple<int, cv::Size, cv::GCompileArgs>> {};
struct ConcatHorVecTest : public TestWithParam<std::tuple<int, cv::Size, cv::GCompileArgs>> {};
struct LUTTest : public TestParams<std::tuple<int, int, cv::Size,bool, cv::GCompileArgs>> {};
struct ConvertToTest : public TestParams<std::tuple<int, int, cv::Size, double, double, compare_f, cv::GCompileArgs>> {};
struct PhaseTest : public TestParams<std::tuple<int, cv::Size, bool, cv::GCompileArgs>> {};
struct SqrtTest : public TestParams<std::tuple<int, cv::Size, cv::GCompileArgs>> {};
struct NormalizeTest : public TestParams<std::tuple<compare_f,MatType,cv::Size,double,double,int,MatType,bool,cv::GCompileArgs>> {};
GAPI_TEST_FIXTURE(MathOpTest, initMatsRandU, FIXTURE_API(mathOp,bool,double,bool), 4,
opType, testWithScalar, scale, doReverseOp)
GAPI_TEST_FIXTURE(MulDoubleTest, initMatrixRandU, <>, 0)
GAPI_TEST_FIXTURE(DivTest, initMatrixRandU, <>, 0)
GAPI_TEST_FIXTURE(DivCTest, initMatrixRandU, <>, 0)
GAPI_TEST_FIXTURE(MeanTest, initMatrixRandU, <>, 0)
GAPI_TEST_FIXTURE(MaskTest, initMatrixRandU, <>, 0)
GAPI_TEST_FIXTURE(Polar2CartTest, initMatsRandU, <>, 0)
GAPI_TEST_FIXTURE(Cart2PolarTest, initMatsRandU, <>, 0)
GAPI_TEST_FIXTURE(CmpTest, initMatsRandU, FIXTURE_API(CmpTypes,bool), 2, opType, testWithScalar)
GAPI_TEST_FIXTURE(BitwiseTest, initMatsRandU, FIXTURE_API(bitwiseOp), 1, opType)
GAPI_TEST_FIXTURE(NotTest, initMatrixRandU, <>, 0)
GAPI_TEST_FIXTURE(SelectTest, initMatsRandU, <>, 0)
GAPI_TEST_FIXTURE(MinTest, initMatsRandU, <>, 0)
GAPI_TEST_FIXTURE(MaxTest, initMatsRandU, <>, 0)
GAPI_TEST_FIXTURE(AbsDiffTest, initMatsRandU, <>, 0)
GAPI_TEST_FIXTURE(AbsDiffCTest, initMatsRandU, <>, 0)
GAPI_TEST_FIXTURE(SumTest, initMatrixRandU, FIXTURE_API(compare_scalar_f), 1, cmpF)
GAPI_TEST_FIXTURE(AddWeightedTest, initMatsRandU, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(NormTest, initMatrixRandU, FIXTURE_API(compare_scalar_f,NormTypes), 2,
cmpF, opType)
GAPI_TEST_FIXTURE(IntegralTest, initNothing, <>, 0)
GAPI_TEST_FIXTURE(ThresholdTest, initMatrixRandU, FIXTURE_API(int), 1, tt)
GAPI_TEST_FIXTURE(ThresholdOTTest, initMatrixRandU, FIXTURE_API(int), 1, tt)
GAPI_TEST_FIXTURE(InRangeTest, initMatrixRandU, <>, 0)
GAPI_TEST_FIXTURE(Split3Test, initMatrixRandU, <>, 0)
GAPI_TEST_FIXTURE(Split4Test, initMatrixRandU, <>, 0)
GAPI_TEST_FIXTURE(ResizeTest, initNothing, FIXTURE_API(compare_f,int,cv::Size), 3,
cmpF, interp, sz_out)
GAPI_TEST_FIXTURE(ResizeTestFxFy, initNothing, FIXTURE_API(compare_f,int,double,double), 4,
cmpF, interp, fx, fy)
GAPI_TEST_FIXTURE(Merge3Test, initMatsRandU, <>, 0)
GAPI_TEST_FIXTURE(Merge4Test, initMatsRandU, <>, 0)
GAPI_TEST_FIXTURE(RemapTest, initMatrixRandU, <>, 0)
GAPI_TEST_FIXTURE(FlipTest, initMatrixRandU, FIXTURE_API(int), 1, flipCode)
GAPI_TEST_FIXTURE(CropTest, initMatrixRandU, FIXTURE_API(cv::Rect), 1, rect_to)
GAPI_TEST_FIXTURE(ConcatHorTest, initNothing, <>, 0)
GAPI_TEST_FIXTURE(ConcatVertTest, initNothing, <>, 0)
GAPI_TEST_FIXTURE(ConcatVertVecTest, initNothing, <>, 0)
GAPI_TEST_FIXTURE(ConcatHorVecTest, initNothing, <>, 0)
GAPI_TEST_FIXTURE(LUTTest, initNothing, <>, 0)
GAPI_TEST_FIXTURE(ConvertToTest, initNothing, FIXTURE_API(compare_f, double, double), 3,
cmpF, alpha, beta)
GAPI_TEST_FIXTURE(PhaseTest, initMatsRandU, FIXTURE_API(bool), 1, angle_in_degrees)
GAPI_TEST_FIXTURE(SqrtTest, initMatrixRandU, <>, 0)
GAPI_TEST_FIXTURE(NormalizeTest, initNothing, FIXTURE_API(compare_f,double,double,int,MatType), 5,
cmpF, a, b, norm_type, ddepth)
} // opencv_test
#endif //OPENCV_GAPI_CORE_TESTS_HPP

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018 Intel Corporation
// Copyright (C) 2018-2019 Intel Corporation
#ifndef OPENCV_GAPI_IMGPROC_TESTS_INL_HPP
@ -61,7 +61,7 @@ TEST_P(Filter2DTest, AccuracyTest)
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, borderType, dtype, initOut, compile_args) = GetParam();
initMatsRandN(type, sz, dtype, initOut);
initMatrixRandN(type, sz, dtype, initOut);
cv::Point anchor = {-1, -1};
double delta = 0;
@ -97,7 +97,7 @@ TEST_P(BoxFilterTest, AccuracyTest)
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, filterSize, sz, borderType, dtype, initOut, compile_args) = GetParam();
initMatsRandN(type, sz, dtype, initOut);
initMatrixRandN(type, sz, dtype, initOut);
cv::Point anchor = {-1, -1};
bool normalize = true;
@ -133,7 +133,7 @@ TEST_P(SepFilterTest, AccuracyTest)
cv::Mat kernelY(kernSize, 1, CV_32F);
randu(kernelX, -1, 1);
randu(kernelY, -1, 1);
initMatsRandN(type, sz, dtype, initOut);
initMatrixRandN(type, sz, dtype, initOut);
cv::Point anchor = cv::Point(-1, -1);
@ -163,7 +163,7 @@ TEST_P(BlurTest, AccuracyTest)
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, filterSize, sz, borderType, initOut, compile_args) = GetParam();
initMatsRandN(type, sz, type, initOut);
initMatrixRandN(type, sz, type, initOut);
cv::Point anchor = {-1, -1};
@ -193,7 +193,7 @@ TEST_P(GaussianBlurTest, AccuracyTest)
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF,type, kernSize, sz, initOut, compile_args) = GetParam();
initMatsRandN(type, sz, type, initOut);
initMatrixRandN(type, sz, type, initOut);
cv::Size kSize = cv::Size(kernSize, kernSize);
double sigmaX = rand();
@ -224,7 +224,7 @@ TEST_P(MedianBlurTest, AccuracyTest)
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, initOut, compile_args) = GetParam();
initMatsRandN(type, sz, type, initOut);
initMatrixRandN(type, sz, type, initOut);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -252,7 +252,7 @@ TEST_P(ErodeTest, AccuracyTest)
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, kernType, initOut, compile_args) = GetParam();
initMatsRandN(type, sz, type, initOut);
initMatrixRandN(type, sz, type, initOut);
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize));
@ -282,7 +282,7 @@ TEST_P(Erode3x3Test, AccuracyTest)
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, sz, initOut, numIters, compile_args) = GetParam();
initMatsRandN(type, sz, type, initOut);
initMatrixRandN(type, sz, type, initOut);
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3,3));
@ -312,7 +312,7 @@ TEST_P(DilateTest, AccuracyTest)
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, kernType, initOut, compile_args) = GetParam();
initMatsRandN(type, sz, type, initOut);
initMatrixRandN(type, sz, type, initOut);
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize));
@ -342,7 +342,7 @@ TEST_P(Dilate3x3Test, AccuracyTest)
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, sz, initOut, numIters, compile_args) = GetParam();
initMatsRandN(type, sz, type, initOut);
initMatrixRandN(type, sz, type, initOut);
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3,3));
@ -373,7 +373,7 @@ TEST_P(SobelTest, AccuracyTest)
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, dtype, dx, dy, initOut, compile_args) = GetParam();
initMatsRandN(type, sz, dtype, initOut);
initMatrixRandN(type, sz, dtype, initOut);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -404,7 +404,7 @@ TEST_P(SobelXYTest, AccuracyTest)
cv::Mat out_mat_ocv2;
cv::Mat out_mat_gapi2;
initMatsRandN(type, sz, dtype);
initMatrixRandN(type, sz, dtype);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -441,7 +441,7 @@ TEST_P(EqHistTest, AccuracyTest)
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, sz, initOut, compile_args) = GetParam();
initMatsRandN(CV_8UC1, sz, CV_8UC1, initOut);
initMatrixRandN(CV_8UC1, sz, CV_8UC1, initOut);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -471,7 +471,7 @@ TEST_P(CannyTest, AccuracyTest)
cv::GCompileArgs compile_args;
std::tie(cmpF, type, sz, thrLow, thrUp, apSize, l2gr, initOut, compile_args) = GetParam();
initMatsRandN(type, sz, CV_8UC1, initOut);
initMatrixRandN(type, sz, CV_8UC1, initOut);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -495,7 +495,7 @@ TEST_P(RGB2GrayTest, AccuracyTest)
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatsRandN(CV_8UC3, std::get<1>(param), CV_8UC1, std::get<2>(param));
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC1, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -519,7 +519,7 @@ TEST_P(BGR2GrayTest, AccuracyTest)
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatsRandN(CV_8UC3, std::get<1>(param), CV_8UC1, std::get<2>(param));
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC1, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -543,7 +543,7 @@ TEST_P(RGB2YUVTest, AccuracyTest)
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatsRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -567,7 +567,7 @@ TEST_P(YUV2RGBTest, AccuracyTest)
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatsRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
@ -594,7 +594,7 @@ TEST_P(NV12toRGBTest, AccuracyTest)
cv::GCompileArgs compile_args;
std::tie(cmpF, sz, compile_args) = GetParam();
initMatsRandN(CV_8UC1, sz, CV_8UC3);
initMatrixRandN(CV_8UC1, sz, CV_8UC3);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in_y;
@ -625,7 +625,7 @@ TEST_P(NV12toBGRTest, AccuracyTest)
cv::GCompileArgs compile_args;
std::tie(cmpF, sz, compile_args) = GetParam();
initMatsRandN(CV_8UC1, sz, CV_8UC3);
initMatrixRandN(CV_8UC1, sz, CV_8UC3);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in_y;
@ -654,7 +654,7 @@ TEST_P(RGB2LabTest, AccuracyTest)
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatsRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -678,7 +678,7 @@ TEST_P(BGR2LUVTest, AccuracyTest)
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatsRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -702,7 +702,7 @@ TEST_P(LUV2BGRTest, AccuracyTest)
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatsRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -726,7 +726,7 @@ TEST_P(BGR2YUVTest, AccuracyTest)
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatsRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -750,7 +750,7 @@ TEST_P(YUV2BGRTest, AccuracyTest)
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatsRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -774,7 +774,7 @@ TEST_P(RGB2HSVTest, AccuracyTest)
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatsRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -798,7 +798,7 @@ TEST_P(BayerGR2RGBTest, AccuracyTest)
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatsRandN(CV_8UC1, std::get<1>(param), CV_8UC3, std::get<2>(param));
initMatrixRandN(CV_8UC1, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
@ -822,7 +822,7 @@ TEST_P(RGB2YUV422Test, AccuracyTest)
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatsRandN(CV_8UC3, std::get<1>(param), CV_8UC2, std::get<2>(param));
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC2, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;

View File

@ -2,13 +2,20 @@
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018 Intel Corporation
// Copyright (C) 2018-2019 Intel Corporation
#ifndef OPENCV_GAPI_TESTS_COMMON_HPP
#define OPENCV_GAPI_TESTS_COMMON_HPP
#include <iostream>
#include <tuple>
#include <type_traits>
#include <opencv2/ts.hpp>
#include <opencv2/gapi.hpp>
#include <opencv2/gapi/util/util.hpp>
#include "gapi_tests_helpers.hpp"
namespace
{
@ -41,6 +48,15 @@ public:
return cv::Scalar(s1, s2, s3, s4);
}
void initOutMats(cv::Size sz_in, int dtype)
{
if (dtype != -1)
{
out_mat_gapi = cv::Mat(sz_in, dtype);
out_mat_ocv = cv::Mat(sz_in, dtype);
}
}
void initMatsRandU(int type, cv::Size sz_in, int dtype, bool createOutputMatrices = true)
{
in_mat1 = cv::Mat(sz_in, type);
@ -50,10 +66,9 @@ public:
cv::randu(in_mat1, cv::Scalar::all(0), cv::Scalar::all(255));
cv::randu(in_mat2, cv::Scalar::all(0), cv::Scalar::all(255));
if (createOutputMatrices && dtype != -1)
if (createOutputMatrices)
{
out_mat_gapi = cv::Mat (sz_in, dtype);
out_mat_ocv = cv::Mat (sz_in, dtype);
initOutMats(sz_in, dtype);
}
}
@ -62,28 +77,28 @@ public:
in_mat1 = cv::Mat(sz_in, type);
sc = initScalarRandU(100);
cv::randu(in_mat1, cv::Scalar::all(0), cv::Scalar::all(255));
if (createOutputMatrices && dtype != -1)
if (createOutputMatrices)
{
out_mat_gapi = cv::Mat (sz_in, dtype);
out_mat_ocv = cv::Mat (sz_in, dtype);
initOutMats(sz_in, dtype);
}
}
void initMatsRandN(int type, cv::Size sz_in, int dtype, bool createOutputMatrices = true)
void initMatrixRandN(int type, cv::Size sz_in, int dtype, bool createOutputMatrices = true)
{
in_mat1 = cv::Mat(sz_in, type);
in_mat1 = cv::Mat(sz_in, type);
cv::randn(in_mat1, cv::Scalar::all(127), cv::Scalar::all(40.f));
if (createOutputMatrices && dtype != -1)
if (createOutputMatrices)
{
out_mat_gapi = cv::Mat(sz_in, dtype);
out_mat_ocv = cv::Mat(sz_in, dtype);
initOutMats(sz_in, dtype);
}
}
// empty function intended to show that nothing is to be initialized via TestFunctional methods
void initNothing(int, cv::Size, int, bool = true) {}
static cv::Mat nonZeroPixels(const cv::Mat& mat)
{
int channels = mat.channels();
@ -117,6 +132,100 @@ using compare_f = std::function<bool(const cv::Mat &a, const cv::Mat &b)>;
using compare_scalar_f = std::function<bool(const cv::Scalar &a, const cv::Scalar &b)>;
// Universal parameter wrapper for common (pre-defined) and specific (user-defined) parameters
template<typename ...SpecificParams>
struct Params
{
using gcomp_args_function_t = cv::GCompileArgs(*)();
// TODO: delete bool (createOutputMatrices) from common parameters
using common_params_t = std::tuple<int, cv::Size, int, bool, gcomp_args_function_t>;
using specific_params_t = std::tuple<SpecificParams...>;
using params_t = std::tuple<int, cv::Size, int, bool, gcomp_args_function_t, SpecificParams...>;
static constexpr const size_t common_params_size = std::tuple_size<common_params_t>::value;
static constexpr const size_t specific_params_size = std::tuple_size<specific_params_t>::value;
template<size_t I>
static const typename std::tuple_element<I, common_params_t>::type&
getCommon(const params_t& t)
{
static_assert(I < common_params_size, "Index out of range");
return std::get<I>(t);
}
template<size_t I>
static const typename std::tuple_element<I, specific_params_t>::type&
getSpecific(const params_t& t)
{
static_assert(specific_params_size > 0,
"Impossible to call this function: no specific parameters specified");
static_assert(I < specific_params_size, "Index out of range");
return std::get<common_params_size + I>(t);
}
};
// Base class for test fixtures
template<typename ...SpecificParams>
struct TestWithParamBase : TestFunctional,
TestWithParam<typename Params<SpecificParams...>::params_t>
{
using AllParams = Params<SpecificParams...>;
MatType type = getCommonParam<0>();
cv::Size sz = getCommonParam<1>();
MatType dtype = getCommonParam<2>();
bool createOutputMatrices = getCommonParam<3>();
TestWithParamBase()
{
if (dtype == SAME_TYPE) { dtype = type; }
}
// Get common (pre-defined) parameter value by index
template<size_t I>
inline auto getCommonParam() const
-> decltype(AllParams::template getCommon<I>(this->GetParam()))
{
return AllParams::template getCommon<I>(this->GetParam());
}
// Get specific (user-defined) parameter value by index
template<size_t I>
inline auto getSpecificParam() const
-> decltype(AllParams::template getSpecific<I>(this->GetParam()))
{
return AllParams::template getSpecific<I>(this->GetParam());
}
// Return G-API compile arguments specified for test fixture
inline cv::GCompileArgs getCompileArgs() const
{
return getCommonParam<4>()();
}
};
/**
* @private
* @brief Create G-API test fixture with TestWithParamBase base class
* @param Fixture test fixture name
* @param InitF callable that will initialize default available members (from TestFunctional)
* @param API base class API. Specifies types of user-defined parameters. If there are no such
* parameters, empty angle brackets ("<>") must be specified.
* @param Number number of user-defined parameters (corresponds to the number of types in API).
* if there are no such parameters, 0 must be specified.
* @param ... list of names of user-defined parameters. if there are no parameters, the list
* must be empty.
*/
#define GAPI_TEST_FIXTURE(Fixture, InitF, API, Number, ...) \
struct Fixture : public TestWithParamBase API { \
static_assert(Number == AllParams::specific_params_size, \
"Number of user-defined parameters doesn't match size of __VA_ARGS__"); \
__WRAP_VAARGS(DEFINE_SPECIFIC_PARAMS_##Number(__VA_ARGS__)) \
Fixture() { InitF(type, sz, dtype, createOutputMatrices); } \
};
// Wrapper for test fixture API. Use to specify multiple types.
// Example: FIXTURE_API(int, bool) expands to <int, bool>
#define FIXTURE_API(...) <__VA_ARGS__>
template<typename T>
struct Wrappable
@ -341,3 +450,5 @@ namespace
return os << "compare_scalar_f";
}
}
#endif //OPENCV_GAPI_TESTS_COMMON_HPP

View File

@ -0,0 +1,73 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2019 Intel Corporation
#ifndef OPENCV_GAPI_TESTS_HELPERS_HPP
#define OPENCV_GAPI_TESTS_HELPERS_HPP
#include <tuple>
#include <limits>
namespace opencv_test
{
// out_type == in_type in matrices initialization if out_type is marked as SAME_TYPE
enum {
// TODO: why is it different from -1?
SAME_TYPE = std::numeric_limits<int>::max()
};
// Ensure correct __VA_ARGS__ expansion on Windows
#define __WRAP_VAARGS(x) x
#define __TUPLE_PARAM_TYPE(i) std::tuple_element<i, AllParams::specific_params_t>::type
// implementation of recursive in-class declaration and initialization of member variables
#define __DEFINE_PARAMS_IMPL1(index, param_name) \
__TUPLE_PARAM_TYPE(index) param_name = getSpecificParam<index>();
#define __DEFINE_PARAMS_IMPL2(index, param_name, ...) \
__TUPLE_PARAM_TYPE(index) param_name = getSpecificParam<index>(); \
__WRAP_VAARGS(__DEFINE_PARAMS_IMPL1(index+1, __VA_ARGS__))
#define __DEFINE_PARAMS_IMPL3(index, param_name, ...) \
__TUPLE_PARAM_TYPE(index) param_name = getSpecificParam<index>(); \
__WRAP_VAARGS(__DEFINE_PARAMS_IMPL2(index+1, __VA_ARGS__))
#define __DEFINE_PARAMS_IMPL4(index, param_name, ...) \
__TUPLE_PARAM_TYPE(index) param_name = getSpecificParam<index>(); \
__WRAP_VAARGS(__DEFINE_PARAMS_IMPL3(index+1, __VA_ARGS__))
#define __DEFINE_PARAMS_IMPL5(index, param_name, ...) \
__TUPLE_PARAM_TYPE(index) param_name = getSpecificParam<index>(); \
__WRAP_VAARGS(__DEFINE_PARAMS_IMPL4(index+1, __VA_ARGS__))
#define __DEFINE_PARAMS_IMPL6(index, param_name, ...) \
__TUPLE_PARAM_TYPE(index) param_name = getSpecificParam<index>(); \
__WRAP_VAARGS(__DEFINE_PARAMS_IMPL5(index+1, __VA_ARGS__))
// user interface to define member variables of specified names
#define DEFINE_SPECIFIC_PARAMS_0()
#define DEFINE_SPECIFIC_PARAMS_1(...) \
__WRAP_VAARGS(__DEFINE_PARAMS_IMPL1(0, __VA_ARGS__))
#define DEFINE_SPECIFIC_PARAMS_2(...) \
__WRAP_VAARGS(__DEFINE_PARAMS_IMPL2(0, __VA_ARGS__))
#define DEFINE_SPECIFIC_PARAMS_3(...) \
__WRAP_VAARGS(__DEFINE_PARAMS_IMPL3(0, __VA_ARGS__))
#define DEFINE_SPECIFIC_PARAMS_4(...) \
__WRAP_VAARGS(__DEFINE_PARAMS_IMPL4(0, __VA_ARGS__))
#define DEFINE_SPECIFIC_PARAMS_5(...) \
__WRAP_VAARGS(__DEFINE_PARAMS_IMPL5(0, __VA_ARGS__))
#define DEFINE_SPECIFIC_PARAMS_6(...) \
__WRAP_VAARGS(__DEFINE_PARAMS_IMPL6(0, __VA_ARGS__))
} // namespace opencv_test
#endif //OPENCV_GAPI_TESTS_HELPERS_HPP

View File

@ -2,74 +2,76 @@
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018 Intel Corporation
// Copyright (C) 2018-2019 Intel Corporation
#include "../test_precomp.hpp"
#include "../common/gapi_core_tests.hpp"
#include <opencv2/gapi/cpu/core.hpp>
#define CORE_CPU cv::gapi::core::cpu::kernels()
namespace
{
#define CORE_CPU [] () { return cv::compile_args(cv::gapi::core::cpu::kernels()); }
} // anonymous namespace
namespace opencv_test
{
// FIXME: Wut? See MulTestCPU/MathOpTest below (duplicate?)
INSTANTIATE_TEST_CASE_P(AddTestCPU, MathOpTest,
Combine(Values(ADD, MUL),
testing::Bool(),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(1.0),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
Values(false),
Values(cv::compile_args(CORE_CPU))),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_CPU),
Values(ADD, MUL),
testing::Bool(),
Values(1.0),
Values(false)),
opencv_test::PrintMathOpCoreParams());
INSTANTIATE_TEST_CASE_P(MulTestCPU, MathOpTest,
Combine(Values(MUL),
testing::Bool(),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(1.0, 0.5, 2.0),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
Values(false),
Values(cv::compile_args(CORE_CPU))),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_CPU),
Values(MUL),
testing::Bool(),
Values(1.0, 0.5, 2.0),
Values(false)),
opencv_test::PrintMathOpCoreParams());
INSTANTIATE_TEST_CASE_P(SubTestCPU, MathOpTest,
Combine(Values(SUB),
testing::Bool(),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values (1.0),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_CPU),
Values(SUB),
testing::Bool(),
Values(cv::compile_args(CORE_CPU))),
Values (1.0),
testing::Bool()),
opencv_test::PrintMathOpCoreParams());
INSTANTIATE_TEST_CASE_P(DivTestCPU, MathOpTest,
Combine(Values(DIV),
testing::Bool(),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values (1.0, 0.5, 2.0),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_CPU),
Values(DIV),
testing::Bool(),
Values(cv::compile_args(CORE_CPU))),
Values (1.0, 0.5, 2.0),
testing::Bool()),
opencv_test::PrintMathOpCoreParams());
INSTANTIATE_TEST_CASE_P(MulTestCPU, MulDoubleTest,
@ -78,8 +80,8 @@ INSTANTIATE_TEST_CASE_P(MulTestCPU, MulDoubleTest,
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
/*init output matrices or not*/ testing::Bool(),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(DivTestCPU, DivTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
@ -87,8 +89,8 @@ INSTANTIATE_TEST_CASE_P(DivTestCPU, DivTest,
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
/*init output matrices or not*/ testing::Bool(),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(DivCTestCPU, DivCTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
@ -96,81 +98,94 @@ INSTANTIATE_TEST_CASE_P(DivCTestCPU, DivCTest,
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
/*init output matrices or not*/ testing::Bool(),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(MeanTestCPU, MeanTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(-1, SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(MaskTestCPU, MaskTest,
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(SelectTestCPU, SelectTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(Polar2CartCPU, Polar2CartTest,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(CV_32FC1),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(Cart2PolarCPU, Cart2PolarTest,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(CV_32FC1),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(PhaseCPU, PhaseTest,
Combine(Values(CV_32F, CV_32FC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(SAME_TYPE),
Values(true),
Values(CORE_CPU),
testing::Bool()));
INSTANTIATE_TEST_CASE_P(SqrtCPU, SqrtTest,
Combine(Values(CV_32F, CV_32FC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_CPU))));
Values(SAME_TYPE),
Values(true),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(CompareTestCPU, CmpTest,
Combine(Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
testing::Bool(),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(CV_8U),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))),
Values(CORE_CPU),
Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
testing::Bool()),
opencv_test::PrintCmpCoreParams());
INSTANTIATE_TEST_CASE_P(BitwiseTestCPU, BitwiseTest,
Combine(Values(AND, OR, XOR),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))),
Values(CORE_CPU),
Values(AND, OR, XOR)),
opencv_test::PrintBWCoreParams());
INSTANTIATE_TEST_CASE_P(BitwiseNotTestCPU, NotTest,
@ -178,50 +193,56 @@ INSTANTIATE_TEST_CASE_P(BitwiseNotTestCPU, NotTest,
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(MinTestCPU, MinTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(MaxTestCPU, MaxTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(SumTestCPU, SumTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
//Values(1e-5),
Values(AbsToleranceScalar(1e-5).to_compare_f()),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU),
Values(AbsToleranceScalar(1e-5).to_compare_f())));
INSTANTIATE_TEST_CASE_P(AbsDiffTestCPU, AbsDiffTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(AbsDiffCTestCPU, AbsDiffCTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(AddWeightedTestCPU, AddWeightedTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
@ -230,18 +251,20 @@ INSTANTIATE_TEST_CASE_P(AddWeightedTestCPU, AddWeightedTest,
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
Values(Tolerance_FloatRel_IntAbs(1e-6, 1).to_compare_f()),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU),
Values(Tolerance_FloatRel_IntAbs(1e-6, 1).to_compare_f())));
INSTANTIATE_TEST_CASE_P(NormTestCPU, NormTest,
Combine(Values(NORM_INF, NORM_L1, NORM_L2),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
Values(false),
//Values(1e-5),
Values(CORE_CPU),
Values(AbsToleranceScalar(1e-5).to_compare_f()),
Values(cv::compile_args(CORE_CPU))),
Values(NORM_INF, NORM_L1, NORM_L2)),
opencv_test::PrintNormCoreParams());
INSTANTIATE_TEST_CASE_P(IntegralTestCPU, IntegralTest,
@ -249,25 +272,30 @@ INSTANTIATE_TEST_CASE_P(IntegralTestCPU, IntegralTest,
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_CPU))));
Values(-1),
Values(false),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(ThresholdTestCPU, ThresholdTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU),
Values(cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC,
cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV)));
INSTANTIATE_TEST_CASE_P(ThresholdTestCPU, ThresholdOTTest,
Combine(Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::THRESH_OTSU, cv::THRESH_TRIANGLE),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU),
Values(cv::THRESH_OTSU, cv::THRESH_TRIANGLE)));
INSTANTIATE_TEST_CASE_P(InRangeTestCPU, InRangeTest,
@ -275,147 +303,177 @@ INSTANTIATE_TEST_CASE_P(InRangeTestCPU, InRangeTest,
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(Split3TestCPU, Split3Test,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_CPU))));
Values(CV_8UC1),
Values(true),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(Split4TestCPU, Split4Test,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_8UC4),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_CPU))));
Values(CV_8UC1),
Values(true),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(ResizeTestCPU, ResizeTest,
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),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(-1),
Values(false),
Values(CORE_CPU),
Values(AbsSimilarPoints(2, 0.05).to_compare_f()),
Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
Values(cv::Size(64,64),
cv::Size(30,30)),
Values(cv::compile_args(CORE_CPU))));
cv::Size(30,30))));
INSTANTIATE_TEST_CASE_P(ResizeTestCPU, ResizeTestFxFy,
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),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(-1),
Values(false),
Values(CORE_CPU),
Values(AbsSimilarPoints(2, 0.05).to_compare_f()),
Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
Values(0.5, 0.1),
Values(0.5, 0.1),
Values(cv::compile_args(CORE_CPU))));
Values(0.5, 0.1)));
INSTANTIATE_TEST_CASE_P(Merge3TestCPU, Merge3Test,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_CPU))));
Values(CV_8UC3),
Values(true),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(Merge4TestCPU, Merge4Test,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_CPU))));
Values(CV_8UC4),
Values(true),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(RemapTestCPU, RemapTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(FlipTestCPU, FlipTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(0,1,-1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(SAME_TYPE),
/*init output matrices or not*/ Values(false),
Values(CORE_CPU),
Values(0,1,-1)));
INSTANTIATE_TEST_CASE_P(CropTestCPU, CropTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Rect(10, 8, 20, 35), cv::Rect(4, 10, 37, 50)),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(SAME_TYPE),
/*init output matrices or not*/ Values(false),
Values(CORE_CPU),
Values(cv::Rect(10, 8, 20, 35), cv::Rect(4, 10, 37, 50))));
INSTANTIATE_TEST_CASE_P(LUTTestCPU, LUTTest,
Combine(Values(CV_8UC1, CV_8UC3),
Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CV_8UC1),
/*init output matrices or not*/ Values(true),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(LUTTestCustomCPU, LUTTest,
Combine(Values(CV_8UC3),
Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(CV_8UC3),
/*init output matrices or not*/ Values(true),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(ConvertToCPU, ConvertToTest,
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(CV_8U, CV_16U, CV_16S, CV_32F),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(2.5, 1.0, -1.0),
Values(250.0, 0.0, -128.0),
Values(CV_8U, CV_16U, CV_16S, CV_32F),
Values(false),
Values(CORE_CPU),
Values(AbsExact().to_compare_f()),
Values(cv::compile_args(CORE_CPU))));
Values(2.5, 1.0, -1.0),
Values(250.0, 0.0, -128.0)));
INSTANTIATE_TEST_CASE_P(ConcatHorTestCPU, ConcatHorTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_CPU))));
Values(SAME_TYPE),
Values(false),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(ConcatVertTestCPU, ConcatVertTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_CPU))));
Values(SAME_TYPE),
Values(false),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(ConcatVertVecTestCPU, ConcatVertVecTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_CPU))));
Values(SAME_TYPE),
Values(false),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(ConcatHorVecTestCPU, ConcatHorVecTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_CPU))));
Values(SAME_TYPE),
Values(false),
Values(CORE_CPU)));
INSTANTIATE_TEST_CASE_P(NormalizeTestCPU, NormalizeTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(-1),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_CPU),
Values(AbsExact().to_compare_f()),
Values(0.0, 15.0),
Values(1.0, 120.0, 255.0),
Values(NORM_MINMAX, NORM_INF, NORM_L1, NORM_L2),
Values(-1, CV_8U, CV_16U, CV_16S, CV_32F),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_CPU))));
Values(-1, CV_8U, CV_16U, CV_16S, CV_32F)));
}

View File

@ -2,32 +2,34 @@
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018 Intel Corporation
// Copyright (C) 2018-2019 Intel Corporation
#include "../test_precomp.hpp"
#include "../common/gapi_core_tests.hpp"
namespace
{
#define CORE_FLUID [] () { return cv::compile_args(cv::gapi::core::fluid::kernels()); }
} // anonymous namespace
namespace opencv_test
{
#define CORE_FLUID cv::gapi::core::fluid::kernels()
// FIXME: Windows accuracy problems after recent update!
INSTANTIATE_TEST_CASE_P(MathOpTestFluid, MathOpTest,
Combine(Values(ADD, SUB, DIV, MUL),
testing::Bool(),
Values(CV_8UC3, CV_8UC1, CV_16SC1, CV_32FC1),
Values(1.0),
Combine(Values(CV_8UC3, CV_8UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1920, 1080),
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(-1, CV_8U, CV_32F),
testing::Bool(),
Values(CORE_FLUID),
Values(ADD, SUB, DIV, MUL),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))),
Values(1.0),
testing::Bool()),
opencv_test::PrintMathOpCoreParams());
INSTANTIATE_TEST_CASE_P(MulSTestFluid, MulDoubleTest,
@ -37,7 +39,7 @@ INSTANTIATE_TEST_CASE_P(MulSTestFluid, MulDoubleTest,
cv::Size(128, 128)),
Values(-1), // FIXME: extend with more types
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(DivCTestFluid, DivCTest,
Combine(Values(CV_8UC1, CV_16SC1, CV_32FC1),
@ -46,33 +48,36 @@ INSTANTIATE_TEST_CASE_P(DivCTestFluid, DivCTest,
cv::Size(128, 128)),
Values(CV_8U, CV_32F),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(AbsDiffTestFluid, AbsDiffTest,
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(AbsDiffCTestFluid, AbsDiffCTest,
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(BitwiseTestFluid, BitwiseTest,
Combine(Values(AND, OR, XOR),
Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_16SC1),
Combine(Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_16SC1),
Values(cv::Size(1920, 1080),
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))),
Values(CORE_FLUID),
Values(AND, OR, XOR)),
opencv_test::PrintBWCoreParams());
INSTANTIATE_TEST_CASE_P(BitwiseNotTestFluid, NotTest,
@ -81,8 +86,9 @@ INSTANTIATE_TEST_CASE_P(BitwiseNotTestFluid, NotTest,
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(MinTestFluid, MinTest,
Combine(Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_16SC1, CV_32FC1),
@ -90,8 +96,9 @@ INSTANTIATE_TEST_CASE_P(MinTestFluid, MinTest,
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(MaxTestFluid, MaxTest,
Combine(Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_16SC1, CV_32FC1),
@ -99,19 +106,21 @@ INSTANTIATE_TEST_CASE_P(MaxTestFluid, MaxTest,
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(CompareTestFluid, CmpTest,
Combine(Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
testing::Bool(),
Values(CV_8UC3, CV_8UC1, CV_16SC1, CV_32FC1),
Combine(Values(CV_8UC3, CV_8UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1920, 1080),
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(CV_8U),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))),
Values(CORE_FLUID),
Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
testing::Bool()),
opencv_test::PrintCmpCoreParams());
INSTANTIATE_TEST_CASE_P(AddWeightedTestFluid, AddWeightedTest,
@ -121,57 +130,70 @@ INSTANTIATE_TEST_CASE_P(AddWeightedTestFluid, AddWeightedTest,
cv::Size(128, 128)),
Values(-1, CV_8U, CV_32F),
testing::Bool(),
Values(Tolerance_FloatRel_IntAbs(1e-5, 2).to_compare_f()),
//Values(0.5000005),
Values(cv::compile_args(CORE_FLUID))));
Values(CORE_FLUID),
Values(Tolerance_FloatRel_IntAbs(1e-5, 2).to_compare_f())));
INSTANTIATE_TEST_CASE_P(LUTTestFluid, LUTTest,
Combine(Values(CV_8UC1, CV_8UC3),
Values(CV_8UC1),
Values(cv::Size(1920, 1080),
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(CV_8UC1),
/*init output matrices or not*/ Values(true),
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(ConvertToFluid, ConvertToTest,
Combine(Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_32FC1),
Values(CV_8U, CV_16U, CV_32F),
Values(cv::Size(1920, 1080),
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(2.5, 1.0, -1.0),
Values(250.0, 0.0, -128.0),
Values(CV_8U, CV_16U, CV_32F),
Values(true),
Values(CORE_FLUID),
Values(Tolerance_FloatRel_IntAbs(1e-5, 2).to_compare_f()),
Values(cv::compile_args(CORE_FLUID))));
Values(2.5, 1.0, -1.0),
Values(250.0, 0.0, -128.0)));
INSTANTIATE_TEST_CASE_P(Split3TestFluid, Split3Test,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_FLUID))));
Values(CV_8UC1),
Values(true),
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(Split4TestFluid, Split4Test,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_8UC4),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_FLUID))));
Values(CV_8UC1),
Values(true),
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(Merge3TestFluid, Merge3Test,
Combine(Values(cv::Size(1920, 1080),
Combine(Values(CV_8UC1),
Values(cv::Size(1920, 1080),
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_FLUID))));
Values(CV_8UC3),
Values(true),
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(Merge4TestFluid, Merge4Test,
Combine(Values(cv::Size(1920, 1080),
Combine(Values(CV_8UC1),
Values(cv::Size(1920, 1080),
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_FLUID))));
Values(CV_8UC4),
Values(true),
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(SelectTestFluid, SelectTest,
Combine(Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_16SC1),
@ -179,37 +201,46 @@ INSTANTIATE_TEST_CASE_P(SelectTestFluid, SelectTest,
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(Polar2CartFluid, Polar2CartTest,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(CV_32FC1),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(Cart2PolarFluid, Cart2PolarTest,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(CV_32FC1),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(PhaseFluid, PhaseTest,
Combine(Values(CV_32F, CV_32FC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(SAME_TYPE),
Values(true),
Values(CORE_FLUID),
testing::Bool()));
INSTANTIATE_TEST_CASE_P(SqrtFluid, SqrtTest,
Combine(Values(CV_32F, CV_32FC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_FLUID))));
Values(SAME_TYPE),
Values(true),
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(ThresholdTestFluid, ThresholdTest,
Combine(Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_16SC1),
@ -217,11 +248,12 @@ INSTANTIATE_TEST_CASE_P(ThresholdTestFluid, ThresholdTest,
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
testing::Bool(),
Values(CORE_FLUID),
Values(cv::THRESH_BINARY, cv::THRESH_BINARY_INV,
cv::THRESH_TRUNC,
cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV)));
INSTANTIATE_TEST_CASE_P(InRangeTestFluid, InRangeTest,
Combine(Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_16SC1, CV_32FC1),
@ -229,25 +261,27 @@ INSTANTIATE_TEST_CASE_P(InRangeTestFluid, InRangeTest,
cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
testing::Bool(),
Values(cv::compile_args(CORE_FLUID))));
Values(CORE_FLUID)));
INSTANTIATE_TEST_CASE_P(
ResizeTestFluid, ResizeTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC3/*CV_8UC1, CV_16UC1, CV_16SC1*/),
INSTANTIATE_TEST_CASE_P(ResizeTestFluid, ResizeTest,
Combine(Values(CV_8UC3/*CV_8UC1, CV_16UC1, CV_16SC1*/),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128),
cv::Size(64, 64),
cv::Size(30, 30)),
Values(-1),
Values(false),
Values(CORE_FLUID),
Values(AbsExact().to_compare_f()),
Values(/*cv::INTER_NEAREST,*/ cv::INTER_LINEAR/*, cv::INTER_AREA*/),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128),
cv::Size(64, 64),
cv::Size(30, 30)),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128),
cv::Size(64, 64),
cv::Size(30, 30)),
Values(cv::compile_args(CORE_FLUID))));
cv::Size(30, 30))));
//----------------------------------------------------------------------
// FIXME: Clean-up test configurations which are enabled already
@ -476,7 +510,7 @@ INSTANTIATE_TEST_CASE_P(LUTTestCPU, LUTTest,
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool()));
/*init output matrices or not*/ Values(true)));
INSTANTIATE_TEST_CASE_P(LUTTestCustomCPU, LUTTest,
Combine(Values(CV_8UC3),
@ -484,7 +518,7 @@ INSTANTIATE_TEST_CASE_P(LUTTestCustomCPU, LUTTest,
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool()));
/*init output matrices or not*/ Values(true)));
INSTANTIATE_TEST_CASE_P(ConvertToCPU, ConvertToTest,
Combine(Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_32FC1),

View File

@ -2,72 +2,75 @@
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018 Intel Corporation
// Copyright (C) 2018-2019 Intel Corporation
#include "../test_precomp.hpp"
#include "../common/gapi_core_tests.hpp"
#define CORE_GPU cv::gapi::core::gpu::kernels()
namespace
{
#define CORE_GPU [] () { return cv::compile_args(cv::gapi::core::gpu::kernels()); }
} // anonymous namespace
namespace opencv_test
{
// FIXME: Wut? See MulTestGPU/MathOpTest below (duplicate?)
INSTANTIATE_TEST_CASE_P(AddTestGPU, MathOpTest,
Combine(Values(ADD, MUL),
testing::Bool(),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(1.0),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
Values(false),
Values(cv::compile_args(CORE_GPU))),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_GPU),
Values(ADD, MUL),
testing::Bool(),
Values(1.0),
Values(false)),
opencv_test::PrintMathOpCoreParams());
INSTANTIATE_TEST_CASE_P(MulTestGPU, MathOpTest,
Combine(Values(MUL),
testing::Bool(),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(1.0, 0.5, 2.0),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
Values(false),
Values(cv::compile_args(CORE_GPU))),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_GPU),
Values(MUL),
testing::Bool(),
Values(1.0, 0.5, 2.0),
Values(false)),
opencv_test::PrintMathOpCoreParams());
INSTANTIATE_TEST_CASE_P(SubTestGPU, MathOpTest,
Combine(Values(SUB),
testing::Bool(),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values (1.0),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_GPU),
Values(SUB),
testing::Bool(),
Values(cv::compile_args(CORE_GPU))),
Values (1.0),
testing::Bool()),
opencv_test::PrintMathOpCoreParams());
INSTANTIATE_TEST_CASE_P(DivTestGPU, MathOpTest,
Combine(Values(DIV),
testing::Bool(),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values (1.0, 0.5, 2.0),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_GPU),
Values(DIV),
testing::Bool(),
Values(cv::compile_args(CORE_GPU))),
Values (1.0, 0.5, 2.0),
testing::Bool()),
opencv_test::PrintMathOpCoreParams());
INSTANTIATE_TEST_CASE_P(MulTestGPU, MulDoubleTest,
@ -76,8 +79,8 @@ INSTANTIATE_TEST_CASE_P(MulTestGPU, MulDoubleTest,
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
/*init output matrices or not*/ testing::Bool(),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(DivTestGPU, DivTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
@ -85,8 +88,8 @@ INSTANTIATE_TEST_CASE_P(DivTestGPU, DivTest,
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
/*init output matrices or not*/ testing::Bool(),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(DivCTestGPU, DivCTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
@ -94,16 +97,17 @@ INSTANTIATE_TEST_CASE_P(DivCTestGPU, DivCTest,
cv::Size(640, 480),
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
/*init output matrices or not*/ testing::Bool(),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(MeanTestGPU, MeanTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_GPU)));
//TODO: mask test doesn't work
#if 0
@ -113,7 +117,7 @@ INSTANTIATE_TEST_CASE_P(MaskTestGPU, MaskTest,
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU)));
#endif
INSTANTIATE_TEST_CASE_P(SelectTestGPU, SelectTest,
@ -121,42 +125,49 @@ INSTANTIATE_TEST_CASE_P(SelectTestGPU, SelectTest,
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(Polar2CartGPU, Polar2CartTest,
Combine(Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
INSTANTIATE_TEST_CASE_P(Cart2PolarGPU, Cart2PolarTest,
Combine(Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
INSTANTIATE_TEST_CASE_P(CompareTestGPU, CmpTest,
Combine(Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
testing::Bool(),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Combine(Values(CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(CV_32FC1),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(Cart2PolarGPU, Cart2PolarTest,
Combine(Values(CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(CV_32FC1),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(CompareTestGPU, CmpTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(CV_8U),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_GPU),
Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
testing::Bool()),
opencv_test::PrintCmpCoreParams());
INSTANTIATE_TEST_CASE_P(BitwiseTestGPU, BitwiseTest,
Combine(Values(AND, OR, XOR),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))),
Values(CORE_GPU),
Values(AND, OR, XOR)),
opencv_test::PrintBWCoreParams());
INSTANTIATE_TEST_CASE_P(BitwiseNotTestGPU, NotTest,
@ -164,49 +175,55 @@ INSTANTIATE_TEST_CASE_P(BitwiseNotTestGPU, NotTest,
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(MinTestGPU, MinTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(MaxTestGPU, MaxTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(SumTestGPU, SumTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(AbsToleranceScalar(1e-3).to_compare_f()),//TODO: too relaxed?
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU),
Values(AbsToleranceScalar(1e-3).to_compare_f())));//TODO: too relaxed?
INSTANTIATE_TEST_CASE_P(AbsDiffTestGPU, AbsDiffTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(AbsDiffCTestGPU, AbsDiffCTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(AddWeightedTestGPU, AddWeightedTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
@ -215,17 +232,19 @@ INSTANTIATE_TEST_CASE_P(AddWeightedTestGPU, AddWeightedTest,
cv::Size(128, 128)),
Values( -1, CV_8U, CV_16U, CV_32F ),
/*init output matrices or not*/ testing::Bool(),
Values(Tolerance_FloatRel_IntAbs(1e-6, 1).to_compare_f()),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU),
Values(Tolerance_FloatRel_IntAbs(1e-6, 1).to_compare_f())));
INSTANTIATE_TEST_CASE_P(NormTestGPU, NormTest,
Combine(Values(NORM_INF, NORM_L1, NORM_L2),
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
Values(false),
Values(CORE_GPU),
Values(AbsToleranceScalar(1e-3).to_compare_f()), //TODO: too relaxed?
Values(cv::compile_args(CORE_GPU))),
Values(NORM_INF, NORM_L1, NORM_L2)),
opencv_test::PrintNormCoreParams());
INSTANTIATE_TEST_CASE_P(IntegralTestGPU, IntegralTest,
@ -233,25 +252,30 @@ INSTANTIATE_TEST_CASE_P(IntegralTestGPU, IntegralTest,
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_GPU))));
Values(-1),
Values(false),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(ThresholdTestGPU, ThresholdTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU),
Values(cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC,
cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV)));
INSTANTIATE_TEST_CASE_P(ThresholdTestGPU, ThresholdOTTest,
Combine(Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::THRESH_OTSU, cv::THRESH_TRIANGLE),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU),
Values(cv::THRESH_OTSU, cv::THRESH_TRIANGLE)));
INSTANTIATE_TEST_CASE_P(InRangeTestGPU, InRangeTest,
@ -259,123 +283,148 @@ INSTANTIATE_TEST_CASE_P(InRangeTestGPU, InRangeTest,
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(Split3TestGPU, Split3Test,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_GPU))));
Values(CV_8UC1),
Values(true),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(Split4TestGPU, Split4Test,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_8UC4),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_GPU))));
Values(CV_8UC1),
Values(true),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(ResizeTestGPU, ResizeTest,
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),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(-1),
Values(false),
Values(CORE_GPU),
Values(AbsSimilarPoints(2, 0.05).to_compare_f()),
Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
Values(cv::Size(64,64),
cv::Size(30,30)),
Values(cv::compile_args(CORE_GPU))));
cv::Size(30,30))));
INSTANTIATE_TEST_CASE_P(ResizeTestGPU, ResizeTestFxFy,
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),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(-1),
Values(false),
Values(CORE_GPU),
Values(AbsSimilarPoints(2, 0.05).to_compare_f()),
Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
Values(0.5, 0.1),
Values(0.5, 0.1),
Values(cv::compile_args(CORE_GPU))));
Values(0.5, 0.1)));
INSTANTIATE_TEST_CASE_P(Merge3TestGPU, Merge3Test,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_GPU))));
Values(CV_8UC3),
Values(true),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(Merge4TestGPU, Merge4Test,
Combine(Values(cv::Size(1280, 720),
Combine(Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_GPU))));
Values(CV_8UC4),
Values(true),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(RemapTestGPU, RemapTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(FlipTestGPU, FlipTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(0,1,-1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(SAME_TYPE),
/*init output matrices or not*/ Values(false),
Values(CORE_GPU),
Values(0,1,-1)));
INSTANTIATE_TEST_CASE_P(CropTestGPU, CropTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Rect(10, 8, 20, 35), cv::Rect(4, 10, 37, 50)),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(SAME_TYPE),
/*init output matrices or not*/ Values(false),
Values(CORE_GPU),
Values(cv::Rect(10, 8, 20, 35), cv::Rect(4, 10, 37, 50))));
INSTANTIATE_TEST_CASE_P(LUTTestGPU, LUTTest,
Combine(Values(CV_8UC1, CV_8UC3),
Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(CV_8UC1),
/*init output matrices or not*/ Values(true),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(LUTTestCustomGPU, LUTTest,
Combine(Values(CV_8UC3),
Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(CORE_GPU))));
Values(CV_8UC3),
/*init output matrices or not*/ Values(true),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(ConvertToGPU, ConvertToTest,
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(CV_8U, CV_16U, CV_16S, CV_32F),
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(2.5, 1.0, -1.0),
Values(250.0, 0.0, -128.0),
Values(CV_8U, CV_16U, CV_16S, CV_32F),
Values(false),
Values(CORE_GPU),
Values(AbsExact().to_compare_f()),
Values(cv::compile_args(CORE_GPU))));
Values(2.5, 1.0, -1.0),
Values(250.0, 0.0, -128.0)));
INSTANTIATE_TEST_CASE_P(ConcatHorTestGPU, ConcatHorTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_GPU))));
Values(SAME_TYPE),
Values(false),
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(ConcatVertTestGPU, ConcatVertTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_GPU))));
Values(SAME_TYPE),
Values(false),
Values(CORE_GPU)));
//TODO: fix this backend to allow ConcatVertVec ConcatHorVec
#if 0
@ -384,13 +433,13 @@ INSTANTIATE_TEST_CASE_P(ConcatVertVecTestGPU, ConcatVertVecTest,
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU)));
INSTANTIATE_TEST_CASE_P(ConcatHorVecTestGPU, ConcatHorVecTest,
Combine(Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::compile_args(CORE_GPU))));
Values(CORE_GPU)));
#endif
}