Merge pull request #14923 from andrey-golubev:imgproc_tests_update_clean

pull/14932/head
Alexander Alekhin 5 years ago
commit 49805f976a
  1. 68
      modules/gapi/test/common/gapi_imgproc_tests.hpp
  2. 292
      modules/gapi/test/common/gapi_imgproc_tests_inl.hpp
  3. 286
      modules/gapi/test/cpu/gapi_imgproc_tests_cpu.cpp
  4. 196
      modules/gapi/test/cpu/gapi_imgproc_tests_fluid.cpp
  5. 228
      modules/gapi/test/gpu/gapi_imgproc_tests_gpu.cpp

@ -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_HPP
@ -14,35 +14,43 @@
namespace opencv_test
{
struct Filter2DTest : public TestParams <std::tuple<compare_f, MatType,int,cv::Size,int,int,bool,cv::GCompileArgs>> {};
struct BoxFilterTest : public TestParams <std::tuple<compare_f,MatType,int,cv::Size,int,int,bool,cv::GCompileArgs>> {};
struct SepFilterTest : public TestParams <std::tuple<compare_f,MatType,int,cv::Size,int,bool,cv::GCompileArgs>> {};
struct BlurTest : public TestParams <std::tuple<compare_f,MatType,int,cv::Size,int,bool,cv::GCompileArgs>> {};
struct GaussianBlurTest : public TestParams <std::tuple<compare_f,MatType,int,cv::Size,bool,cv::GCompileArgs>> {};
struct MedianBlurTest : public TestParams <std::tuple<compare_f,MatType,int,cv::Size,bool,cv::GCompileArgs>> {};
struct ErodeTest : public TestParams <std::tuple<compare_f,MatType,int,cv::Size,int,bool,cv::GCompileArgs>> {};
struct Erode3x3Test : public TestParams <std::tuple<compare_f,MatType,cv::Size,bool,int,cv::GCompileArgs>> {};
struct DilateTest : public TestParams <std::tuple<compare_f,MatType,int,cv::Size,int,bool,cv::GCompileArgs>> {};
struct Dilate3x3Test : public TestParams <std::tuple<compare_f,MatType,cv::Size,bool,int,cv::GCompileArgs>> {};
struct SobelTest : public TestParams <std::tuple<compare_f,MatType,int,cv::Size,int,int,int,bool,cv::GCompileArgs>> {};
struct SobelXYTest : public TestParams <std::tuple<compare_f,MatType,int,cv::Size,int,int,int,int,cv::GCompileArgs>> {};
struct EqHistTest : public TestParams <std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
struct CannyTest : public TestParams <std::tuple<compare_f,MatType,cv::Size,double,double,int,bool,bool,cv::GCompileArgs>> {};
struct RGB2GrayTest : public TestParams<std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
struct BGR2GrayTest : public TestParams<std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
struct RGB2YUVTest : public TestParams<std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
struct YUV2RGBTest : public TestParams<std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
struct NV12toRGBTest : public TestParams<std::tuple<compare_f,cv::Size,cv::GCompileArgs>> {};
struct NV12toBGRTest : public TestParams<std::tuple<compare_f,cv::Size,cv::GCompileArgs>> {};
struct RGB2LabTest : public TestParams<std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
struct BGR2LUVTest : public TestParams<std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
struct LUV2BGRTest : public TestParams<std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
struct BGR2YUVTest : public TestParams<std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
struct YUV2BGRTest : public TestParams<std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
struct RGB2HSVTest : public TestParams<std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
struct BayerGR2RGBTest : public TestParams<std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
struct RGB2YUV422Test : public TestParams<std::tuple<compare_f,cv::Size,bool,cv::GCompileArgs>> {};
GAPI_TEST_FIXTURE(Filter2DTest, initMatrixRandN, FIXTURE_API(compare_f,int,int), 3,
cmpF, kernSize, borderType)
GAPI_TEST_FIXTURE(BoxFilterTest, initMatrixRandN, FIXTURE_API(compare_f,int,int), 3,
cmpF, filterSize, borderType)
GAPI_TEST_FIXTURE(SepFilterTest, initMatrixRandN, FIXTURE_API(compare_f,int), 2, cmpF, kernSize)
GAPI_TEST_FIXTURE(BlurTest, initMatrixRandN, FIXTURE_API(compare_f,int,int), 3,
cmpF, filterSize, borderType)
GAPI_TEST_FIXTURE(GaussianBlurTest, initMatrixRandN, FIXTURE_API(compare_f,int), 2, cmpF, kernSize)
GAPI_TEST_FIXTURE(MedianBlurTest, initMatrixRandN, FIXTURE_API(compare_f,int), 2, cmpF, kernSize)
GAPI_TEST_FIXTURE(ErodeTest, initMatrixRandN, FIXTURE_API(compare_f,int,int), 3,
cmpF, kernSize, kernType)
GAPI_TEST_FIXTURE(Erode3x3Test, initMatrixRandN, FIXTURE_API(compare_f,int), 2,
cmpF, numIters)
GAPI_TEST_FIXTURE(DilateTest, initMatrixRandN, FIXTURE_API(compare_f,int,int), 3,
cmpF, kernSize, kernType)
GAPI_TEST_FIXTURE(Dilate3x3Test, initMatrixRandN, FIXTURE_API(compare_f,int), 2, cmpF, numIters)
GAPI_TEST_FIXTURE(SobelTest, initMatrixRandN, FIXTURE_API(compare_f,int,int,int), 4,
cmpF, kernSize, dx, dy)
GAPI_TEST_FIXTURE(SobelXYTest, initMatrixRandN, FIXTURE_API(compare_f,int,int,int,int), 5,
cmpF, kernSize, order, border_type, border_val)
GAPI_TEST_FIXTURE(EqHistTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(CannyTest, initMatrixRandN, FIXTURE_API(compare_f,double,double,int,bool), 5,
cmpF, thrLow, thrUp, apSize, l2gr)
GAPI_TEST_FIXTURE(RGB2GrayTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(BGR2GrayTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(RGB2YUVTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(YUV2RGBTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(NV12toRGBTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(NV12toBGRTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(RGB2LabTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(BGR2LUVTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(LUV2BGRTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(BGR2YUVTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(YUV2BGRTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(RGB2HSVTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(BayerGR2RGBTest, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
GAPI_TEST_FIXTURE(RGB2YUV422Test, initMatrixRandN, FIXTURE_API(compare_f), 1, cmpF)
} // opencv_test
#endif //OPENCV_GAPI_IMGPROC_TESTS_HPP

@ -54,19 +54,10 @@ namespace
TEST_P(Filter2DTest, AccuracyTest)
{
compare_f cmpF;
MatType type = 0;
int kernSize = 0, borderType = 0, dtype = 0;
cv::Size sz;
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, borderType, dtype, initOut, compile_args) = GetParam();
initMatrixRandN(type, sz, dtype, initOut);
cv::Point anchor = {-1, -1};
double delta = 0;
cv::Mat kernel = cv::Mat(kernSize, kernSize, CV_32FC1 );
cv::Mat kernel = cv::Mat(kernSize, kernSize, CV_32FC1);
cv::Scalar kernMean = cv::Scalar(1.0);
cv::Scalar kernStddev = cv::Scalar(2.0/3);
randn(kernel, kernMean, kernStddev);
@ -76,7 +67,7 @@ TEST_P(Filter2DTest, AccuracyTest)
auto out = cv::gapi::filter2D(in, dtype, kernel, anchor, delta, borderType);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::filter2D(in_mat1, out_mat_ocv, dtype, kernel, anchor, delta, borderType);
@ -90,27 +81,20 @@ TEST_P(Filter2DTest, AccuracyTest)
TEST_P(BoxFilterTest, AccuracyTest)
{
compare_f cmpF;
MatType type = 0;
int filterSize = 0, borderType = 0, dtype = 0;
cv::Size sz;
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, filterSize, sz, borderType, dtype, initOut, compile_args) = GetParam();
initMatrixRandN(type, sz, dtype, initOut);
cv::Point anchor = {-1, -1};
bool normalize = true;
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::boxFilter(in, dtype, cv::Size(filterSize, filterSize), anchor, normalize, borderType);
auto out = cv::gapi::boxFilter(in, dtype, cv::Size(filterSize, filterSize), anchor, normalize,
borderType);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::boxFilter(in_mat1, out_mat_ocv, dtype, cv::Size(filterSize, filterSize), anchor, normalize, borderType);
cv::boxFilter(in_mat1, out_mat_ocv, dtype, cv::Size(filterSize, filterSize), anchor,
normalize, borderType);
}
// Comparison //////////////////////////////////////////////////////////////
{
@ -121,19 +105,10 @@ TEST_P(BoxFilterTest, AccuracyTest)
TEST_P(SepFilterTest, AccuracyTest)
{
compare_f cmpF;
MatType type = 0;
int kernSize = 0, dtype = 0;
cv::Size sz;
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, dtype, initOut, compile_args) = GetParam();
cv::Mat kernelX(kernSize, 1, CV_32F);
cv::Mat kernelY(kernSize, 1, CV_32F);
randu(kernelX, -1, 1);
randu(kernelY, -1, 1);
initMatrixRandN(type, sz, dtype, initOut);
cv::Point anchor = cv::Point(-1, -1);
@ -142,7 +117,7 @@ TEST_P(SepFilterTest, AccuracyTest)
auto out = cv::gapi::sepFilter(in, dtype, kernelX, kernelY, anchor, cv::Scalar() );
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::sepFilter2D(in_mat1, out_mat_ocv, dtype, kernelX, kernelY );
@ -156,15 +131,6 @@ TEST_P(SepFilterTest, AccuracyTest)
TEST_P(BlurTest, AccuracyTest)
{
compare_f cmpF;
MatType type = 0;
int filterSize = 0, borderType = 0;
cv::Size sz;
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, filterSize, sz, borderType, initOut, compile_args) = GetParam();
initMatrixRandN(type, sz, type, initOut);
cv::Point anchor = {-1, -1};
// G-API code //////////////////////////////////////////////////////////////
@ -172,7 +138,7 @@ TEST_P(BlurTest, AccuracyTest)
auto out = cv::gapi::blur(in, cv::Size(filterSize, filterSize), anchor, borderType);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::blur(in_mat1, out_mat_ocv, cv::Size(filterSize, filterSize), anchor, borderType);
@ -186,15 +152,6 @@ TEST_P(BlurTest, AccuracyTest)
TEST_P(GaussianBlurTest, AccuracyTest)
{
compare_f cmpF;
MatType type = 0;
int kernSize = 0;
cv::Size sz;
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF,type, kernSize, sz, initOut, compile_args) = GetParam();
initMatrixRandN(type, sz, type, initOut);
cv::Size kSize = cv::Size(kernSize, kernSize);
double sigmaX = rand();
@ -203,7 +160,7 @@ TEST_P(GaussianBlurTest, AccuracyTest)
auto out = cv::gapi::gaussianBlur(in, kSize, sigmaX);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::GaussianBlur(in_mat1, out_mat_ocv, kSize, sigmaX);
@ -217,21 +174,12 @@ TEST_P(GaussianBlurTest, AccuracyTest)
TEST_P(MedianBlurTest, AccuracyTest)
{
compare_f cmpF;
MatType type = 0;
int kernSize = 0;
cv::Size sz;
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, initOut, compile_args) = GetParam();
initMatrixRandN(type, sz, type, initOut);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::medianBlur(in, kernSize);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::medianBlur(in_mat1, out_mat_ocv, kernSize);
@ -245,15 +193,6 @@ TEST_P(MedianBlurTest, AccuracyTest)
TEST_P(ErodeTest, AccuracyTest)
{
compare_f cmpF;
MatType type = 0;
int kernSize = 0, kernType = 0;
cv::Size sz;
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, kernType, initOut, compile_args) = GetParam();
initMatrixRandN(type, sz, type, initOut);
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize));
// G-API code //////////////////////////////////////////////////////////////
@ -261,7 +200,7 @@ TEST_P(ErodeTest, AccuracyTest)
auto out = cv::gapi::erode(in, kernel);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::erode(in_mat1, out_mat_ocv, kernel);
@ -275,15 +214,6 @@ TEST_P(ErodeTest, AccuracyTest)
TEST_P(Erode3x3Test, AccuracyTest)
{
compare_f cmpF;
MatType type = 0;
int numIters = 0;
cv::Size sz;
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, sz, initOut, numIters, compile_args) = GetParam();
initMatrixRandN(type, sz, type, initOut);
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3,3));
// G-API code //////////////////////////////////////////////////////////////
@ -291,7 +221,7 @@ TEST_P(Erode3x3Test, AccuracyTest)
auto out = cv::gapi::erode3x3(in, numIters);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::erode(in_mat1, out_mat_ocv, kernel, cv::Point(-1, -1), numIters);
@ -305,15 +235,6 @@ TEST_P(Erode3x3Test, AccuracyTest)
TEST_P(DilateTest, AccuracyTest)
{
compare_f cmpF;
MatType type = 0;
int kernSize = 0, kernType = 0;
cv::Size sz;
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, kernType, initOut, compile_args) = GetParam();
initMatrixRandN(type, sz, type, initOut);
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize));
// G-API code //////////////////////////////////////////////////////////////
@ -321,7 +242,7 @@ TEST_P(DilateTest, AccuracyTest)
auto out = cv::gapi::dilate(in, kernel);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::dilate(in_mat1, out_mat_ocv, kernel);
@ -335,15 +256,6 @@ TEST_P(DilateTest, AccuracyTest)
TEST_P(Dilate3x3Test, AccuracyTest)
{
compare_f cmpF;
MatType type = 0;
int numIters = 0;
cv::Size sz;
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, sz, initOut, numIters, compile_args) = GetParam();
initMatrixRandN(type, sz, type, initOut);
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3,3));
// G-API code //////////////////////////////////////////////////////////////
@ -351,7 +263,7 @@ TEST_P(Dilate3x3Test, AccuracyTest)
auto out = cv::gapi::dilate3x3(in, numIters);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::dilate(in_mat1, out_mat_ocv, kernel, cv::Point(-1,-1), numIters);
@ -363,24 +275,14 @@ TEST_P(Dilate3x3Test, AccuracyTest)
}
}
TEST_P(SobelTest, AccuracyTest)
{
compare_f cmpF;
MatType type = 0;
int kernSize = 0, dtype = 0, dx = 0, dy = 0;
cv::Size sz;
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, dtype, dx, dy, initOut, compile_args) = GetParam();
initMatrixRandN(type, sz, dtype, initOut);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::Sobel(in, dtype, dx, dy, kernSize );
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::Sobel(in_mat1, out_mat_ocv, dtype, dx, dy, kernSize);
@ -394,24 +296,15 @@ TEST_P(SobelTest, AccuracyTest)
TEST_P(SobelXYTest, AccuracyTest)
{
compare_f cmpF;
MatType type = 0;
int kernSize = 0, dtype = 0, order = 0, border_type = 0, border_val = 0;
cv::Size sz;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, kernSize, sz, dtype, order, border_type, border_val, compile_args) = GetParam();
cv::Mat out_mat_ocv2;
cv::Mat out_mat_gapi2;
initMatrixRandN(type, sz, dtype);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::SobelXY(in, dtype, order, kernSize, 1, 0, border_type, border_val);
cv::GComputation c(cv::GIn(in), cv::GOut(std::get<0>(out), std::get<1>(out)));
c.apply(cv::gin(in_mat1), cv::gout(out_mat_gapi, out_mat_gapi2), std::move(compile_args));
c.apply(cv::gin(in_mat1), cv::gout(out_mat_gapi, out_mat_gapi2), getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
// workaround for cv::Sobel
@ -436,19 +329,12 @@ TEST_P(SobelXYTest, AccuracyTest)
TEST_P(EqHistTest, AccuracyTest)
{
compare_f cmpF;
cv::Size sz;
bool initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, sz, initOut, compile_args) = GetParam();
initMatrixRandN(CV_8UC1, sz, CV_8UC1, initOut);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::equalizeHist(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::equalizeHist(in_mat1, out_mat_ocv);
@ -456,29 +342,18 @@ TEST_P(EqHistTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(GetParam()));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}
TEST_P(CannyTest, AccuracyTest)
{
compare_f cmpF;
MatType type;
int apSize = 0;
double thrLow = 0.0, thrUp = 0.0;
cv::Size sz;
bool l2gr = false, initOut = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, sz, thrLow, thrUp, apSize, l2gr, initOut, compile_args) = GetParam();
initMatrixRandN(type, sz, CV_8UC1, initOut);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::Canny(in, thrLow, thrUp, apSize, l2gr);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::Canny(in_mat1, out_mat_ocv, thrLow, thrUp, apSize, l2gr);
@ -492,17 +367,12 @@ TEST_P(CannyTest, AccuracyTest)
TEST_P(RGB2GrayTest, AccuracyTest)
{
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC1, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::RGB2Gray(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2GRAY);
@ -510,23 +380,18 @@ TEST_P(RGB2GrayTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}
TEST_P(BGR2GrayTest, AccuracyTest)
{
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC1, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::BGR2Gray(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2GRAY);
@ -534,23 +399,18 @@ TEST_P(BGR2GrayTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}
TEST_P(RGB2YUVTest, AccuracyTest)
{
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::RGB2YUV(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2YUV);
@ -558,24 +418,18 @@ TEST_P(RGB2YUVTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}
TEST_P(YUV2RGBTest, AccuracyTest)
{
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::YUV2RGB(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_YUV2RGB);
@ -583,19 +437,12 @@ TEST_P(YUV2RGBTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}
TEST_P(NV12toRGBTest, AccuracyTest)
{
compare_f cmpF;
cv::Size sz;
cv::GCompileArgs compile_args;
std::tie(cmpF, sz, compile_args) = GetParam();
initMatrixRandN(CV_8UC1, sz, CV_8UC3);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in_y;
cv::GMat in_uv;
@ -606,7 +453,7 @@ TEST_P(NV12toRGBTest, AccuracyTest)
cv::randn(in_mat_uv, cv::Scalar::all(127), cv::Scalar::all(40.f));
cv::GComputation c(cv::GIn(in_y, in_uv), cv::GOut(out));
c.apply(cv::gin(in_mat1, in_mat_uv), cv::gout(out_mat_gapi), std::move(compile_args));
c.apply(cv::gin(in_mat1, in_mat_uv), cv::gout(out_mat_gapi), getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColorTwoPlane(in_mat1, in_mat_uv, out_mat_ocv, cv::COLOR_YUV2RGB_NV12);
@ -620,13 +467,6 @@ TEST_P(NV12toRGBTest, AccuracyTest)
TEST_P(NV12toBGRTest, AccuracyTest)
{
compare_f cmpF;
cv::Size sz;
cv::GCompileArgs compile_args;
std::tie(cmpF, sz, compile_args) = GetParam();
initMatrixRandN(CV_8UC1, sz, CV_8UC3);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in_y;
cv::GMat in_uv;
@ -637,7 +477,7 @@ TEST_P(NV12toBGRTest, AccuracyTest)
cv::randn(in_mat_uv, cv::Scalar::all(127), cv::Scalar::all(40.f));
cv::GComputation c(cv::GIn(in_y, in_uv), cv::GOut(out));
c.apply(cv::gin(in_mat1, in_mat_uv), cv::gout(out_mat_gapi), std::move(compile_args));
c.apply(cv::gin(in_mat1, in_mat_uv), cv::gout(out_mat_gapi), getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColorTwoPlane(in_mat1, in_mat_uv, out_mat_ocv, cv::COLOR_YUV2BGR_NV12);
@ -651,17 +491,12 @@ TEST_P(NV12toBGRTest, AccuracyTest)
TEST_P(RGB2LabTest, AccuracyTest)
{
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::RGB2Lab(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2Lab);
@ -669,23 +504,18 @@ TEST_P(RGB2LabTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}
TEST_P(BGR2LUVTest, AccuracyTest)
{
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::BGR2LUV(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2Luv);
@ -693,23 +523,18 @@ TEST_P(BGR2LUVTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}
TEST_P(LUV2BGRTest, AccuracyTest)
{
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::LUV2BGR(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_Luv2BGR);
@ -717,23 +542,18 @@ TEST_P(LUV2BGRTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}
TEST_P(BGR2YUVTest, AccuracyTest)
{
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::BGR2YUV(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2YUV);
@ -741,23 +561,18 @@ TEST_P(BGR2YUVTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}
TEST_P(YUV2BGRTest, AccuracyTest)
{
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::YUV2BGR(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_YUV2BGR);
@ -765,23 +580,18 @@ TEST_P(YUV2BGRTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}
TEST_P(RGB2HSVTest, AccuracyTest)
{
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::RGB2HSV(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2HSV);
@ -789,23 +599,18 @@ TEST_P(RGB2HSVTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}
TEST_P(BayerGR2RGBTest, AccuracyTest)
{
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatrixRandN(CV_8UC1, std::get<1>(param), CV_8UC3, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::BayerGR2RGB(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BayerGR2RGB);
@ -813,23 +618,18 @@ TEST_P(BayerGR2RGBTest, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}
TEST_P(RGB2YUV422Test, AccuracyTest)
{
auto param = GetParam();
auto compile_args = std::get<3>(param);
compare_f cmpF = std::get<0>(param);
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC2, std::get<2>(param));
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::RGB2YUV422(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
convertRGB2YUV422Ref(in_mat1, out_mat_ocv);
@ -837,7 +637,7 @@ TEST_P(RGB2YUV422Test, AccuracyTest)
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
EXPECT_EQ(out_mat_gapi.size(), sz);
}
}

@ -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
#include "../test_precomp.hpp"
@ -10,285 +10,329 @@
#include "../common/gapi_imgproc_tests.hpp"
#include <opencv2/gapi/cpu/imgproc.hpp>
#define IMGPROC_CPU cv::gapi::imgproc::cpu::kernels()
namespace
{
#define IMGPROC_CPU [] () { return cv::compile_args(cv::gapi::imgproc::cpu::kernels()); }
} // anonymous namespace
namespace opencv_test
{
INSTANTIATE_TEST_CASE_P(Filter2DTestCPU, Filter2DTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3, 4, 5, 7),
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::BORDER_DEFAULT),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(-1, CV_32F),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
testing::Bool(),
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(3, 4, 5, 7),
Values(cv::BORDER_DEFAULT)));
INSTANTIATE_TEST_CASE_P(BoxFilterTestCPU, BoxFilterTest,
Combine(Values(AbsTolerance(0).to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3,5),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(cv::BORDER_DEFAULT),
Values(-1, CV_32F),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
testing::Bool(),
Values(IMGPROC_CPU),
Values(AbsTolerance(0).to_compare_f()),
Values(3,5),
Values(cv::BORDER_DEFAULT)));
INSTANTIATE_TEST_CASE_P(SepFilterTestCPU_8U, SepFilterTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3),
Values(3),
Combine(Values(CV_8UC1, CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
cv::Size(640, 480)),
Values(-1, CV_16S, CV_32F),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
testing::Bool(),
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(3)));
INSTANTIATE_TEST_CASE_P(SepFilterTestCPU_other, SepFilterTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_16UC1, CV_16SC1, CV_32FC1),
Values(3),
Combine(Values(CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(-1, CV_32F),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
testing::Bool(),
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(3)));
INSTANTIATE_TEST_CASE_P(BlurTestCPU, BlurTest,
Combine(Values(AbsTolerance(0.0).to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3,5),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(cv::BORDER_DEFAULT),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsTolerance(0.0).to_compare_f()),
Values(3,5),
Values(cv::BORDER_DEFAULT)));
INSTANTIATE_TEST_CASE_P(gaussBlurTestCPU, GaussianBlurTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3, 5),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(3, 5)));
INSTANTIATE_TEST_CASE_P(MedianBlurTestCPU, MedianBlurTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3, 5),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(3, 5)));
INSTANTIATE_TEST_CASE_P(ErodeTestCPU, ErodeTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3, 5),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(3, 5),
Values(cv::MorphShapes::MORPH_RECT,
cv::MorphShapes::MORPH_CROSS,
cv::MorphShapes::MORPH_ELLIPSE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
cv::MorphShapes::MORPH_ELLIPSE)));
INSTANTIATE_TEST_CASE_P(Erode3x3TestCPU, Erode3x3Test,
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(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(1,2,4),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(1,2,4)));
INSTANTIATE_TEST_CASE_P(DilateTestCPU, DilateTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3, 5),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(3, 5),
Values(cv::MorphShapes::MORPH_RECT,
cv::MorphShapes::MORPH_CROSS,
cv::MorphShapes::MORPH_ELLIPSE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
cv::MorphShapes::MORPH_ELLIPSE)));
INSTANTIATE_TEST_CASE_P(Dilate3x3TestCPU, Dilate3x3Test,
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(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(1,2,4),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(1,2,4)));
INSTANTIATE_TEST_CASE_P(SobelTestCPU, SobelTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
Values(3, 5),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(-1, CV_16S, CV_32F),
Values(0, 1),
Values(1, 2),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(3, 5),
Values(0, 1),
Values(1, 2)));
INSTANTIATE_TEST_CASE_P(SobelTestCPU32F, SobelTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_32FC1),
Values(3, 5),
Combine(Values(CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_32F),
Values(0, 1),
Values(1, 2),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(3, 5),
Values(0, 1),
Values(1, 2)));
INSTANTIATE_TEST_CASE_P(SobelXYTestCPU, SobelXYTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
Values(3, 5),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(-1, CV_16S, CV_32F),
Values(true),
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(3, 5),
Values(1, 2),
Values(BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT),
Values(0, 1, 255),
Values(cv::compile_args(IMGPROC_CPU))));
Values(0, 1, 255)));
INSTANTIATE_TEST_CASE_P(SobelXYTestCPU32F, SobelXYTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_32FC1),
Values(3, 5),
Combine(Values(CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_32F),
Values(true),
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f()),
Values(3, 5),
Values(1, 2),
Values(BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT),
Values(0, 1, 255),
Values(cv::compile_args(IMGPROC_CPU))));
Values(0, 1, 255)));
INSTANTIATE_TEST_CASE_P(EqHistTestCPU, EqHistTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
cv::Size(640, 480)),
Values(CV_8UC1),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(CannyTestCPU, CannyTest,
Combine(Values(AbsSimilarPoints(0, 0.05).to_compare_f()),
Values(CV_8UC1, CV_8UC3),
Combine(Values(CV_8UC1, CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC1),
/*init output matrices or not*/ testing::Bool(),
Values(IMGPROC_CPU),
Values(AbsSimilarPoints(0, 0.05).to_compare_f()),
Values(3.0, 120.0),
Values(125.0, 240.0),
Values(3, 5),
testing::Bool(),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
testing::Bool()));
INSTANTIATE_TEST_CASE_P(RGB2GrayTestCPU, RGB2GrayTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
cv::Size(640, 480)),
Values(CV_8UC1),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(BGR2GrayTestCPU, BGR2GrayTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC1),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(RGB2YUVTestCPU, RGB2YUVTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(YUV2RGBTestCPU, YUV2RGBTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(NV12toRGBTestCPU, NV12toRGBTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(cv::compile_args(IMGPROC_CPU))));
Values(CV_8UC3),
Values(true),
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(NV12toBGRTestCPU, NV12toBGRTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(cv::compile_args(IMGPROC_CPU))));
Values(CV_8UC3),
Values(true),
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(RGB2LabTestCPU, RGB2LabTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(BGR2LUVTestCPU, BGR2LUVTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(LUV2BGRTestCPU, LUV2BGRTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(BGR2YUVTestCPU, BGR2YUVTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(YUV2BGRTestCPU, YUV2BGRTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(RGB2HSVTestCPU, RGB2HSVTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(BayerGR2RGBTestCPU, BayerGR2RGBTest,
Combine(Values(AbsExact().to_compare_f()),
Combine(Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsExact().to_compare_f())));
INSTANTIATE_TEST_CASE_P(RGB2YUV422TestCPU, RGB2YUV422Test,
Combine(Values(AbsTolerance(1).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC2),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_CPU))));
Values(IMGPROC_CPU),
Values(AbsTolerance(1).to_compare_f())));
} // opencv_test

@ -2,212 +2,240 @@
// 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_imgproc_tests.hpp"
#define IMGPROC_FLUID cv::gapi::imgproc::fluid::kernels()
namespace
{
#define IMGPROC_FLUID [] () { return cv::compile_args(cv::gapi::imgproc::fluid::kernels()); }
} // anonymous namespace
namespace opencv_test
{
INSTANTIATE_TEST_CASE_P(RGB2GrayTestFluid, RGB2GrayTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
cv::Size(640, 480)),
Values(CV_8UC1),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(ToleranceColor(1e-3).to_compare_f())));
INSTANTIATE_TEST_CASE_P(BGR2GrayTestFluid, BGR2GrayTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC1),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(ToleranceColor(1e-3).to_compare_f())));
INSTANTIATE_TEST_CASE_P(RGB2YUVTestFluid, RGB2YUVTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(ToleranceColor(1e-3).to_compare_f())));
INSTANTIATE_TEST_CASE_P(YUV2RGBTestFluid, YUV2RGBTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(ToleranceColor(1e-3).to_compare_f())));
INSTANTIATE_TEST_CASE_P(RGB2LabTestFluid, RGB2LabTest,
Combine(Values(AbsSimilarPoints(1, 0.05).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(AbsSimilarPoints(1, 0.05).to_compare_f())));
// FIXME: Not supported by Fluid yet (no kernel implemented)
INSTANTIATE_TEST_CASE_P(BGR2LUVTestFluid, BGR2LUVTest,
Combine(Values(ToleranceColor(5e-3, 6).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(ToleranceColor(5e-3, 6).to_compare_f())));
INSTANTIATE_TEST_CASE_P(RGB2HSVTestFluid, RGB2HSVTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(ToleranceColor(1e-3).to_compare_f())));
INSTANTIATE_TEST_CASE_P(BayerGR2RGBTestFluid, BayerGR2RGBTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(ToleranceColor(1e-3).to_compare_f())));
INSTANTIATE_TEST_CASE_P(RGB2YUV422TestFluid, RGB2YUV422Test,
Combine(Values(AbsTolerance(1).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC2),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(AbsTolerance(1).to_compare_f())));
INSTANTIATE_TEST_CASE_P(blurTestFluid, BlurTest,
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
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(cv::BORDER_DEFAULT),
Values(SAME_TYPE),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(3), // add kernel size=5 when implementation is ready
Values(cv::BORDER_DEFAULT)));
INSTANTIATE_TEST_CASE_P(gaussBlurTestFluid, GaussianBlurTest,
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
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(SAME_TYPE),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(ToleranceFilter(1e-3f, 0.01).to_compare_f()),
Values(3))); // add kernel size=5 when implementation is ready
INSTANTIATE_TEST_CASE_P(medianBlurTestFluid, MedianBlurTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(3), // add kernel size=5 when implementation is ready
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(SAME_TYPE),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(AbsExact().to_compare_f()),
Values(3))); // add kernel size=5 when implementation is ready
INSTANTIATE_TEST_CASE_P(erodeTestFluid, ErodeTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(3), // add kernel size=5 when implementation is ready
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(SAME_TYPE),
Values(true, false),
Values(IMGPROC_FLUID),
Values(AbsExact().to_compare_f()),
Values(3), // add kernel size=5 when implementation is ready
Values(cv::MorphShapes::MORPH_RECT,
cv::MorphShapes::MORPH_CROSS,
cv::MorphShapes::MORPH_ELLIPSE),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
cv::MorphShapes::MORPH_ELLIPSE)));
INSTANTIATE_TEST_CASE_P(dilateTestFluid, DilateTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(3), // add kernel size=5 when implementation is ready
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(SAME_TYPE),
Values(true, false),
Values(IMGPROC_FLUID),
Values(AbsExact().to_compare_f()),
Values(3), // add kernel size=5 when implementation is ready
Values(cv::MorphShapes::MORPH_RECT,
cv::MorphShapes::MORPH_CROSS,
cv::MorphShapes::MORPH_ELLIPSE),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
cv::MorphShapes::MORPH_ELLIPSE)));
INSTANTIATE_TEST_CASE_P(SobelTestFluid, SobelTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(3), // add kernel size=5 when implementation is ready
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(-1, CV_16S, CV_32F),
Values(0, 1),
Values(1, 2),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(AbsExact().to_compare_f()),
Values(3), // add kernel size=5 when implementation is ready
Values(0, 1),
Values(1, 2)));
INSTANTIATE_TEST_CASE_P(SobelTestFluid32F, SobelTest,
Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(CV_32FC1),
Values(3), // add kernel size=5 when implementation is ready
Combine(Values(CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_32F),
Values(0, 1),
Values(1, 2),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(3), // add kernel size=5 when implementation is ready
Values(0, 1),
Values(1, 2)));
INSTANTIATE_TEST_CASE_P(SobelXYTestFluid, SobelXYTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
Values(3),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(-1, CV_16S, CV_32F),
Values(true),
Values(IMGPROC_FLUID),
Values(AbsExact().to_compare_f()),
Values(3),
Values(1, 2),
Values(BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT_101),
Values(0, 1, 255),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(0, 1, 255)));
INSTANTIATE_TEST_CASE_P(SobelXYTestFluid32F, SobelXYTest,
Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(CV_32FC1),
Values(3),
Combine(Values(CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_32F),
Values(true),
Values(IMGPROC_FLUID),
Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(3),
Values(1, 2),
Values(BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT_101),
Values(0, 1, 255),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(0, 1, 255)));
INSTANTIATE_TEST_CASE_P(boxFilterTestFluid32, BoxFilterTest,
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
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(cv::BORDER_DEFAULT),
Values(-1, CV_32F),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
Values(IMGPROC_FLUID),
Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(3), // add kernel size=5 when implementation is ready
Values(cv::BORDER_DEFAULT)));
INSTANTIATE_TEST_CASE_P(sepFilterTestFluid, SepFilterTest,
Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(CV_32FC1),
Values(3), // add kernel size=5 when implementation is ready
Combine(Values(CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(-1, CV_32F),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
testing::Bool(),
Values(IMGPROC_FLUID),
Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(3))); // add kernel size=5 when implementation is ready
INSTANTIATE_TEST_CASE_P(filter2DTestFluid, Filter2DTest,
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
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480),
cv::Size(128, 128)),
Values(cv::BORDER_DEFAULT),
Values(-1, CV_32F),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
testing::Bool(),
Values(IMGPROC_FLUID),
Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(3), // add kernel size=4,5,7 when implementation ready
Values(cv::BORDER_DEFAULT)));
} // opencv_test

@ -2,237 +2,267 @@
// 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_imgproc_tests.hpp"
#define IMGPROC_GPU cv::gapi::imgproc::gpu::kernels()
namespace
{
#define IMGPROC_GPU [] () { return cv::compile_args(cv::gapi::imgproc::gpu::kernels()); }
} // anonymous namespace
namespace opencv_test
{
INSTANTIATE_TEST_CASE_P(Filter2DTestGPU, Filter2DTest,
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),
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::BORDER_DEFAULT),
Values(-1, CV_32F),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
testing::Bool(),
Values(IMGPROC_GPU),
Values(Tolerance_FloatRel_IntAbs(1e-5, 2).to_compare_f()),
Values(3, 4, 5, 7),
Values(cv::BORDER_DEFAULT)));
INSTANTIATE_TEST_CASE_P(BoxFilterTestGPU, BoxFilterTest,
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),
INSTANTIATE_TEST_CASE_P(BoxFilterTestCPU, BoxFilterTest,
Combine(Values(/*CV_8UC1,*/ CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(cv::BORDER_DEFAULT),
Values(-1, CV_32F),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU)))); //TODO: 8UC1 doesn't work
testing::Bool(),
Values(IMGPROC_GPU),
Values(Tolerance_FloatRel_IntAbs(1e-5, 2).to_compare_f()),
Values(3,5),
Values(cv::BORDER_DEFAULT))); //TODO: 8UC1 doesn't work
INSTANTIATE_TEST_CASE_P(SepFilterTestGPU_8U, SepFilterTest,
Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(CV_8UC1, CV_8UC3),
Values(3),
Combine(Values(CV_8UC1, CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(-1, CV_16S, CV_32F),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
testing::Bool(),
Values(IMGPROC_GPU),
Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(3)));
INSTANTIATE_TEST_CASE_P(SepFilterTestGPU_other, SepFilterTest,
Combine(Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(CV_16UC1, CV_16SC1, CV_32FC1),
Values(3),
Combine(Values(CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(-1, CV_32F),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
testing::Bool(),
Values(IMGPROC_GPU),
Values(ToleranceFilter(1e-4f, 0.01).to_compare_f()),
Values(3)));
INSTANTIATE_TEST_CASE_P(BlurTestGPU, BlurTest,
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),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(cv::BORDER_DEFAULT),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_f()),
Values(3,5),
Values(cv::BORDER_DEFAULT)));
INSTANTIATE_TEST_CASE_P(gaussBlurTestGPU, GaussianBlurTest,
Combine(Values(ToleranceFilter(1e-5f, 0.01).to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3), // FIXIT 5
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(ToleranceFilter(1e-5f, 0.01).to_compare_f()),
Values(3))); // FIXIT 5
INSTANTIATE_TEST_CASE_P(MedianBlurTestGPU, MedianBlurTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3, 5),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(AbsExact().to_compare_f()),
Values(3, 5)));
INSTANTIATE_TEST_CASE_P(ErodeTestGPU, ErodeTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3, 5),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(IMGPROC_GPU),
Values(AbsExact().to_compare_f()),
Values(3, 5),
Values(cv::MorphShapes::MORPH_RECT,
cv::MorphShapes::MORPH_CROSS,
cv::MorphShapes::MORPH_ELLIPSE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
cv::MorphShapes::MORPH_ELLIPSE)));
INSTANTIATE_TEST_CASE_P(Erode3x3TestGPU, Erode3x3Test,
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(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(1,2,4),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(AbsExact().to_compare_f()),
Values(1,2,4)));
INSTANTIATE_TEST_CASE_P(DilateTestGPU, DilateTest,
Combine(Values(AbsExact().to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(3, 5),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(IMGPROC_GPU),
Values(AbsExact().to_compare_f()),
Values(3, 5),
Values(cv::MorphShapes::MORPH_RECT,
cv::MorphShapes::MORPH_CROSS,
cv::MorphShapes::MORPH_ELLIPSE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
cv::MorphShapes::MORPH_ELLIPSE)));
INSTANTIATE_TEST_CASE_P(Dilate3x3TestGPU, Dilate3x3Test,
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(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(1,2,4),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(AbsExact().to_compare_f()),
Values(1,2,4)));
INSTANTIATE_TEST_CASE_P(SobelTestGPU, SobelTest,
Combine(Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_f()),
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
Values(3, 5),
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(-1, CV_16S, CV_32F),
Values(0, 1),
Values(1, 2),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_f()),
Values(3, 5),
Values(0, 1),
Values(1, 2)));
INSTANTIATE_TEST_CASE_P(SobelTestGPU32F, SobelTest,
Combine(Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_f()),
Values(CV_32FC1),
Values(3, 5),
Combine(Values(CV_32FC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_32F),
Values(0, 1),
Values(1, 2),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_f()),
Values(3, 5),
Values(0, 1),
Values(1, 2)));
INSTANTIATE_TEST_CASE_P(EqHistTestGPU, EqHistTest,
Combine(Values(AbsExact().to_compare_f()), // FIXIT Non reliable check
Combine(Values(CV_8UC1),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
cv::Size(640, 480)),
Values(SAME_TYPE),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(AbsExact().to_compare_f()))); // FIXIT Non reliable check
INSTANTIATE_TEST_CASE_P(CannyTestGPU, CannyTest,
Combine(Values(AbsSimilarPoints(0, 0.05).to_compare_f()),
Values(CV_8UC1, CV_8UC3),
Combine(Values(CV_8UC1, CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC1),
/*init output matrices or not*/ testing::Bool(),
Values(IMGPROC_GPU),
Values(AbsSimilarPoints(0, 0.05).to_compare_f()),
Values(3.0, 120.0),
Values(125.0, 240.0),
Values(3, 5),
testing::Bool(),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
testing::Bool()));
INSTANTIATE_TEST_CASE_P(RGB2GrayTestGPU, RGB2GrayTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
cv::Size(640, 480)),
Values(CV_8UC1),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(ToleranceColor(1e-3).to_compare_f())));
INSTANTIATE_TEST_CASE_P(BGR2GrayTestGPU, BGR2GrayTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC1),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(ToleranceColor(1e-3).to_compare_f())));
INSTANTIATE_TEST_CASE_P(RGB2YUVTestGPU, RGB2YUVTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(ToleranceColor(1e-3).to_compare_f())));
INSTANTIATE_TEST_CASE_P(YUV2RGBTestGPU, YUV2RGBTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(ToleranceColor(1e-3).to_compare_f())));
INSTANTIATE_TEST_CASE_P(RGB2LabTestGPU, RGB2LabTest,
Combine(Values(AbsSimilarPoints(1, 0.05).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(AbsSimilarPoints(1, 0.05).to_compare_f())));
INSTANTIATE_TEST_CASE_P(BGR2LUVTestGPU, BGR2LUVTest,
Combine(Values(ToleranceColor(5e-3, 6).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(ToleranceColor(5e-3, 6).to_compare_f())));
INSTANTIATE_TEST_CASE_P(LUV2BGRTestGPU, LUV2BGRTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(ToleranceColor(1e-3).to_compare_f())));
INSTANTIATE_TEST_CASE_P(BGR2YUVTestGPU, BGR2YUVTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(ToleranceColor(1e-3).to_compare_f())));
INSTANTIATE_TEST_CASE_P(YUV2BGRTestGPU, YUV2BGRTest,
Combine(Values(ToleranceColor(1e-3).to_compare_f()),
Combine(Values(CV_8UC3),
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_8UC3),
/*init output matrices or not*/ testing::Bool(),
Values(cv::compile_args(IMGPROC_GPU))));
Values(IMGPROC_GPU),
Values(ToleranceColor(1e-3).to_compare_f())));
} // opencv_test

Loading…
Cancel
Save