mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 12:40:05 +08:00
Merge pull request #12944 from dbudniko:dbudniko/tests_thresholds
* added threshold to g-api imgproc tests * trailing spaces remove * try to fix warnings * fix license header * fix random numbers issue * fix Sobel test * license headers + precompiled headers included
This commit is contained in:
parent
853f5111c2
commit
220b278575
9
modules/gapi/perf/common/gapi_core_perf_tests.cpp
Normal file
9
modules/gapi/perf/common/gapi_core_perf_tests.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
// 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) 2018 Intel Corporation
|
||||
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "gapi_core_perf_tests_inl.hpp"
|
File diff suppressed because it is too large
Load Diff
1784
modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp
Normal file
1784
modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp
Normal file
File diff suppressed because it is too large
Load Diff
9
modules/gapi/perf/common/gapi_imgproc_perf_tests.cpp
Normal file
9
modules/gapi/perf/common/gapi_imgproc_perf_tests.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
// 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) 2018 Intel Corporation
|
||||
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "gapi_imgproc_perf_tests_inl.hpp"
|
@ -5,6 +5,11 @@
|
||||
// Copyright (C) 2018 Intel Corporation
|
||||
|
||||
|
||||
#ifndef OPENCV_GAPI_IMGPROC_PERF_TESTS_HPP
|
||||
#define OPENCV_GAPI_IMGPROC_PERF_TESTS_HPP
|
||||
|
||||
|
||||
|
||||
#include "../../test/common/gapi_tests_common.hpp"
|
||||
#include "opencv2/gapi/imgproc.hpp"
|
||||
|
||||
@ -13,870 +18,29 @@ namespace opencv_test
|
||||
|
||||
using namespace perf;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class SepFilterPerfTest : public TestPerfParams<tuple<MatType, int, cv::Size, int>> {};
|
||||
PERF_TEST_P_(SepFilterPerfTest, TestPerformance)
|
||||
{
|
||||
MatType type = 0;
|
||||
int kernSize = 0, dtype = 0;
|
||||
cv::Size sz;
|
||||
std::tie(type, kernSize, sz, dtype) = GetParam();
|
||||
|
||||
cv::Mat kernelX(kernSize, 1, CV_32F);
|
||||
cv::Mat kernelY(kernSize, 1, CV_32F);
|
||||
randu(kernelX, -1, 1);
|
||||
randu(kernelY, -1, 1);
|
||||
initMatsRandN(type, sz, dtype, false);
|
||||
|
||||
cv::Point anchor = cv::Point(-1, -1);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::sepFilter2D(in_mat1, out_mat_ocv, dtype, kernelX, kernelY );
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::sepFilter(in, dtype, kernelX, kernelY, anchor, cv::Scalar() );
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class Filter2DPerfTest : public TestPerfParams<tuple<MatType,int,cv::Size,int,int>> {};
|
||||
PERF_TEST_P_(Filter2DPerfTest, TestPerformance)
|
||||
{
|
||||
MatType type = 0;
|
||||
int kernSize = 0, borderType = 0, dtype = 0;
|
||||
cv::Size sz;
|
||||
std::tie(type, kernSize, sz, borderType, dtype) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, dtype, false);
|
||||
|
||||
cv::Point anchor = {-1, -1};
|
||||
double delta = 0;
|
||||
|
||||
cv::Mat kernel = cv::Mat(kernSize, kernSize, CV_32FC1 );
|
||||
cv::Scalar kernMean = cv::Scalar::all(1.0);
|
||||
cv::Scalar kernStddev = cv::Scalar::all(2.0/3);
|
||||
randn(kernel, kernMean, kernStddev);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::filter2D(in_mat1, out_mat_ocv, dtype, kernel, anchor, delta, borderType);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::filter2D(in, dtype, kernel, anchor, delta, borderType);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class BoxFilterPerfTest : public TestPerfParams<tuple<MatType,int,cv::Size,int,int,double>> {};
|
||||
PERF_TEST_P_(BoxFilterPerfTest, TestPerformance)
|
||||
{
|
||||
MatType type = 0;
|
||||
int filterSize = 0, borderType = 0, dtype = 0;
|
||||
cv::Size sz;
|
||||
double tolerance = 0.0;
|
||||
std::tie(type, filterSize, sz, borderType, dtype, tolerance) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, dtype, false);
|
||||
|
||||
cv::Point anchor = {-1, -1};
|
||||
bool normalize = true;
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::boxFilter(in_mat1, out_mat_ocv, dtype, cv::Size(filterSize, filterSize), anchor, normalize, borderType);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::boxFilter(in, dtype, cv::Size(filterSize, filterSize), anchor, normalize, borderType);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::Mat absDiff;
|
||||
cv::absdiff(out_mat_gapi, out_mat_ocv, absDiff);
|
||||
EXPECT_EQ(0, cv::countNonZero(absDiff > tolerance));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class BlurPerfTest : public TestPerfParams<tuple<MatType,int,cv::Size,int,double>> {};
|
||||
PERF_TEST_P_(BlurPerfTest, TestPerformance)
|
||||
{
|
||||
MatType type = 0;
|
||||
int filterSize = 0, borderType = 0;
|
||||
cv::Size sz;
|
||||
double tolerance = 0.0;
|
||||
std::tie(type, filterSize, sz, borderType, tolerance) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
cv::Point anchor = {-1, -1};
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::blur(in_mat1, out_mat_ocv, cv::Size(filterSize, filterSize), anchor, borderType);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::blur(in, cv::Size(filterSize, filterSize), anchor, borderType);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::Mat absDiff;
|
||||
cv::absdiff(out_mat_gapi, out_mat_ocv, absDiff);
|
||||
EXPECT_EQ(0, cv::countNonZero(absDiff > tolerance));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class GaussianBlurPerfTest : public TestPerfParams<tuple<MatType, int, cv::Size>> {};
|
||||
PERF_TEST_P_(GaussianBlurPerfTest, TestPerformance)
|
||||
{
|
||||
MatType type = 0;
|
||||
int kernSize = 0;
|
||||
cv::Size sz;
|
||||
std::tie(type, kernSize, sz) = GetParam();
|
||||
|
||||
cv::Size kSize = cv::Size(kernSize, kernSize);
|
||||
auto& rng = cv::theRNG();
|
||||
double sigmaX = rng();
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
// OpenCV code ///////////////////////////////////////////////////////////
|
||||
cv::GaussianBlur(in_mat1, out_mat_ocv, kSize, sigmaX);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::gaussianBlur(in, kSize, sigmaX);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison ////////////////////////////////////////////////////////////
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class MedianBlurPerfTest : public TestPerfParams<tuple<MatType,int,cv::Size>> {};
|
||||
PERF_TEST_P_(MedianBlurPerfTest, TestPerformance)
|
||||
{
|
||||
MatType type = 0;
|
||||
int kernSize = 0;
|
||||
cv::Size sz;
|
||||
std::tie(type, kernSize, sz) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::medianBlur(in_mat1, out_mat_ocv, kernSize);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::medianBlur(in, kernSize);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class ErodePerfTest : public TestPerfParams<tuple<MatType,int,cv::Size,int>> {};
|
||||
PERF_TEST_P_(ErodePerfTest, TestPerformance)
|
||||
{
|
||||
MatType type = 0;
|
||||
int kernSize = 0, kernType = 0;
|
||||
cv::Size sz;
|
||||
std::tie(type, kernSize, sz, kernType) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::erode(in_mat1, out_mat_ocv, kernel);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::erode(in, kernel);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class Erode3x3PerfTest : public TestPerfParams<tuple<MatType,cv::Size,int>> {};
|
||||
PERF_TEST_P_(Erode3x3PerfTest, TestPerformance)
|
||||
{
|
||||
MatType type = 0;
|
||||
int numIters = 0;
|
||||
cv::Size sz;
|
||||
std::tie(type, sz, numIters) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3, 3));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::erode(in_mat1, out_mat_ocv, kernel, cv::Point(-1, -1), numIters);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::erode3x3(in, numIters);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class DilatePerfTest : public TestPerfParams<tuple<MatType,int,cv::Size,int>> {};
|
||||
PERF_TEST_P_(DilatePerfTest, TestPerformance)
|
||||
{
|
||||
MatType type = 0;
|
||||
int kernSize = 0, kernType = 0;
|
||||
cv::Size sz;
|
||||
std::tie(type, kernSize, sz, kernType) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::dilate(in_mat1, out_mat_ocv, kernel);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::dilate(in, kernel);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class Dilate3x3PerfTest : public TestPerfParams<tuple<MatType,cv::Size,int>> {};
|
||||
PERF_TEST_P_(Dilate3x3PerfTest, TestPerformance)
|
||||
{
|
||||
MatType type = 0;
|
||||
int numIters = 0;
|
||||
cv::Size sz;
|
||||
std::tie(type, sz, numIters) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3, 3));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::dilate(in_mat1, out_mat_ocv, kernel, cv::Point(-1,-1), numIters);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::dilate3x3(in, numIters);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class SobelPerfTest : public TestPerfParams<tuple<MatType,int,cv::Size,int,int,int>> {};
|
||||
PERF_TEST_P_(SobelPerfTest, TestPerformance)
|
||||
{
|
||||
MatType type = 0;
|
||||
int kernSize = 0, dtype = 0, dx = 0, dy = 0;
|
||||
cv::Size sz;
|
||||
std::tie(type, kernSize, sz, dtype, dx, dy) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, dtype, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::Sobel(in_mat1, out_mat_ocv, dtype, dx, dy, kernSize);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::Sobel(in, dtype, dx, dy, kernSize );
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class CannyPerfTest : public TestPerfParams<tuple<MatType,cv::Size,double,double,int,bool>> {};
|
||||
PERF_TEST_P_(CannyPerfTest, TestPerformance)
|
||||
{
|
||||
MatType type;
|
||||
int apSize = 0;
|
||||
double thrLow = 0.0, thrUp = 0.0;
|
||||
cv::Size sz;
|
||||
bool l2gr = false;
|
||||
std::tie(type, sz, thrLow, thrUp, apSize, l2gr) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, CV_8UC1, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::Canny(in_mat1, out_mat_ocv, thrLow, thrUp, apSize, l2gr);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::Canny(in, thrLow, thrUp, apSize, l2gr);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class EqHistPerfTest : public TestPerfParams<cv::Size> {};
|
||||
PERF_TEST_P_(EqHistPerfTest, TestPerformance)
|
||||
{
|
||||
cv::Size sz = GetParam();
|
||||
|
||||
initMatsRandN(CV_8UC1, sz, CV_8UC1, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::equalizeHist(in_mat1, out_mat_ocv);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::equalizeHist(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class RGB2GrayPerfTest : public TestPerfParams<cv::Size> {};
|
||||
PERF_TEST_P_(RGB2GrayPerfTest, TestPerformance)
|
||||
{
|
||||
cv::Size sz = GetParam();
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC1, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2GRAY);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::RGB2Gray(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class BGR2GrayPerfTest : public TestPerfParams<cv::Size> {};
|
||||
PERF_TEST_P_(BGR2GrayPerfTest, TestPerformance)
|
||||
{
|
||||
cv::Size sz = GetParam();
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC1, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2GRAY);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::BGR2Gray(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class RGB2YUVPerfTest : public TestPerfParams<cv::Size> {};
|
||||
PERF_TEST_P_(RGB2YUVPerfTest, TestPerformance)
|
||||
{
|
||||
cv::Size sz = GetParam();
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2YUV);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::RGB2YUV(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class YUV2RGBPerfTest : public TestPerfParams<cv::Size> {};
|
||||
PERF_TEST_P_(YUV2RGBPerfTest, TestPerformance)
|
||||
{
|
||||
cv::Size sz = GetParam();
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_YUV2RGB);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::YUV2RGB(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class RGB2LabPerfTest : public TestPerfParams<cv::Size> {};
|
||||
PERF_TEST_P_(RGB2LabPerfTest, TestPerformance)
|
||||
{
|
||||
cv::Size sz = GetParam();
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2Lab);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::RGB2Lab(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class BGR2LUVPerfTest : public TestPerfParams<cv::Size> {};
|
||||
PERF_TEST_P_(BGR2LUVPerfTest, TestPerformance)
|
||||
{
|
||||
cv::Size sz = GetParam();
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2Luv);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::BGR2LUV(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class LUV2BGRPerfTest : public TestPerfParams<cv::Size> {};
|
||||
PERF_TEST_P_(LUV2BGRPerfTest, TestPerformance)
|
||||
{
|
||||
cv::Size sz = GetParam();
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_Luv2BGR);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::LUV2BGR(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class BGR2YUVPerfTest : public TestPerfParams<cv::Size> {};
|
||||
PERF_TEST_P_(BGR2YUVPerfTest, TestPerformance)
|
||||
{
|
||||
cv::Size sz = GetParam();
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2YUV);
|
||||
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::BGR2YUV(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class YUV2BGRPerfTest : public TestPerfParams<cv::Size> {};
|
||||
PERF_TEST_P_(YUV2BGRPerfTest, TestPerformance)
|
||||
{
|
||||
cv::Size sz = GetParam();
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_YUV2BGR);
|
||||
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::YUV2BGR(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class SepFilterPerfTest : public TestPerfParams<tuple<compare_f, MatType, int, cv::Size, int, cv::GCompileArgs>> {};
|
||||
class Filter2DPerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int,int, cv::GCompileArgs>> {};
|
||||
class BoxFilterPerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int,int, cv::GCompileArgs>> {};
|
||||
class BlurPerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int, cv::GCompileArgs>> {};
|
||||
class GaussianBlurPerfTest : public TestPerfParams<tuple<compare_f, MatType, int, cv::Size, cv::GCompileArgs>> {};
|
||||
class MedianBlurPerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size, cv::GCompileArgs>> {};
|
||||
class ErodePerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int, cv::GCompileArgs>> {};
|
||||
class Erode3x3PerfTest : public TestPerfParams<tuple<compare_f, MatType, cv::Size, int, cv::GCompileArgs>> {};
|
||||
class DilatePerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int, cv::GCompileArgs>> {};
|
||||
class Dilate3x3PerfTest : public TestPerfParams<tuple<compare_f, MatType,cv::Size,int, cv::GCompileArgs>> {};
|
||||
class SobelPerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int,int,int, cv::GCompileArgs>> {};
|
||||
class CannyPerfTest : public TestPerfParams<tuple<compare_f, MatType,cv::Size,double,double,int,bool, cv::GCompileArgs>> {};
|
||||
class EqHistPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs >> {};
|
||||
class RGB2GrayPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs >> {};
|
||||
class BGR2GrayPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs >> {};
|
||||
class RGB2YUVPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs >> {};
|
||||
class YUV2RGBPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs >> {};
|
||||
class RGB2LabPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
class BGR2LUVPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
class LUV2BGRPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
class BGR2YUVPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
class YUV2BGRPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
}
|
||||
#endif //OPENCV_GAPI_IMGPROC_PERF_TESTS_HPP
|
||||
|
910
modules/gapi/perf/common/gapi_imgproc_perf_tests_inl.hpp
Normal file
910
modules/gapi/perf/common/gapi_imgproc_perf_tests_inl.hpp
Normal file
@ -0,0 +1,910 @@
|
||||
// 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) 2018 Intel Corporation
|
||||
|
||||
|
||||
#ifndef OPENCV_GAPI_IMGPROC_PERF_TESTS_INL_HPP
|
||||
#define OPENCV_GAPI_IMGPROC_PERF_TESTS_INL_HPP
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "gapi_imgproc_perf_tests.hpp"
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
|
||||
using namespace perf;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(SepFilterPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int kernSize = 0, dtype = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, kernSize, sz, dtype, 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);
|
||||
initMatsRandN(type, sz, dtype, false);
|
||||
|
||||
cv::Point anchor = cv::Point(-1, -1);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::sepFilter2D(in_mat1, out_mat_ocv, dtype, kernelX, kernelY );
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::sepFilter(in, dtype, kernelX, kernelY, anchor, cv::Scalar() );
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(Filter2DPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int kernSize = 0, borderType = 0, dtype = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, kernSize, sz, borderType, dtype, compile_args) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, dtype, false);
|
||||
|
||||
cv::Point anchor = {-1, -1};
|
||||
double delta = 0;
|
||||
|
||||
cv::Mat kernel = cv::Mat(kernSize, kernSize, CV_32FC1 );
|
||||
cv::Scalar kernMean = cv::Scalar::all(1.0);
|
||||
cv::Scalar kernStddev = cv::Scalar::all(2.0/3);
|
||||
randn(kernel, kernMean, kernStddev);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::filter2D(in_mat1, out_mat_ocv, dtype, kernel, anchor, delta, borderType);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::filter2D(in, dtype, kernel, anchor, delta, borderType);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(BoxFilterPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int filterSize = 0, borderType = 0, dtype = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, filterSize, sz, borderType, dtype, compile_args) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, dtype, false);
|
||||
|
||||
cv::Point anchor = {-1, -1};
|
||||
bool normalize = true;
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::boxFilter(in_mat1, out_mat_ocv, dtype, cv::Size(filterSize, filterSize), anchor, normalize, borderType);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::boxFilter(in, dtype, cv::Size(filterSize, filterSize), anchor, normalize, borderType);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(BlurPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int filterSize = 0, borderType = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, filterSize, sz, borderType, compile_args) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
cv::Point anchor = {-1, -1};
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::blur(in_mat1, out_mat_ocv, cv::Size(filterSize, filterSize), anchor, borderType);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::blur(in, cv::Size(filterSize, filterSize), anchor, borderType);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(GaussianBlurPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int kernSize = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, kernSize, sz, compile_args) = GetParam();
|
||||
|
||||
cv::Size kSize = cv::Size(kernSize, kernSize);
|
||||
auto& rng = cv::theRNG();
|
||||
double sigmaX = rng();
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
// OpenCV code ///////////////////////////////////////////////////////////
|
||||
cv::GaussianBlur(in_mat1, out_mat_ocv, kSize, sigmaX);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::gaussianBlur(in, kSize, sigmaX);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(MedianBlurPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int kernSize = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, kernSize, sz, compile_args) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::medianBlur(in_mat1, out_mat_ocv, kernSize);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::medianBlur(in, kernSize);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(ErodePerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int kernSize = 0, kernType = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, kernSize, sz, kernType, compile_args) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::erode(in_mat1, out_mat_ocv, kernel);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::erode(in, kernel);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(Erode3x3PerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int numIters = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, sz, numIters, compile_args) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3, 3));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::erode(in_mat1, out_mat_ocv, kernel, cv::Point(-1, -1), numIters);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::erode3x3(in, numIters);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(DilatePerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int kernSize = 0, kernType = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, kernSize, sz, kernType, compile_args) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::dilate(in_mat1, out_mat_ocv, kernel);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::dilate(in, kernel);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(Dilate3x3PerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int numIters = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, sz, numIters, compile_args) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, type, false);
|
||||
|
||||
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3, 3));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::dilate(in_mat1, out_mat_ocv, kernel, cv::Point(-1,-1), numIters);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::dilate3x3(in, numIters);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(SobelPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int kernSize = 0, dtype = 0, dx = 0, dy = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, kernSize, sz, dtype, dx, dy, compile_args) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, dtype, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::Sobel(in_mat1, out_mat_ocv, dtype, dx, dy, kernSize);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::Sobel(in, dtype, dx, dy, kernSize );
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(CannyPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type;
|
||||
int apSize = 0;
|
||||
double thrLow = 0.0, thrUp = 0.0;
|
||||
cv::Size sz;
|
||||
bool l2gr = false;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, sz, thrLow, thrUp, apSize, l2gr, compile_args) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, CV_8UC1, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::Canny(in_mat1, out_mat_ocv, thrLow, thrUp, apSize, l2gr);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::Canny(in, thrLow, thrUp, apSize, l2gr);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(EqHistPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF = get<0>(GetParam());
|
||||
Size sz = get<1>(GetParam());
|
||||
cv::GCompileArgs compile_args = get<2>(GetParam());
|
||||
|
||||
initMatsRandN(CV_8UC1, sz, CV_8UC1, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::equalizeHist(in_mat1, out_mat_ocv);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::equalizeHist(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(RGB2GrayPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF = get<0>(GetParam());
|
||||
Size sz = get<1>(GetParam());
|
||||
cv::GCompileArgs compile_args = get<2>(GetParam());
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC1, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2GRAY);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::RGB2Gray(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(BGR2GrayPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF = get<0>(GetParam());
|
||||
Size sz = get<1>(GetParam());
|
||||
cv::GCompileArgs compile_args = get<2>(GetParam());
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC1, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2GRAY);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::BGR2Gray(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(RGB2YUVPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF = get<0>(GetParam());
|
||||
Size sz = get<1>(GetParam());
|
||||
cv::GCompileArgs compile_args = get<2>(GetParam());
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2YUV);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::RGB2YUV(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(YUV2RGBPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF = get<0>(GetParam());
|
||||
Size sz = get<1>(GetParam());
|
||||
cv::GCompileArgs compile_args = get<2>(GetParam());
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_YUV2RGB);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::YUV2RGB(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(RGB2LabPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF = get<0>(GetParam());
|
||||
Size sz = get<1>(GetParam());
|
||||
cv::GCompileArgs compile_args = get<2>(GetParam());
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2Lab);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::RGB2Lab(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(BGR2LUVPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF = get<0>(GetParam());
|
||||
Size sz = get<1>(GetParam());
|
||||
cv::GCompileArgs compile_args = get<2>(GetParam());
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2Luv);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::BGR2LUV(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(LUV2BGRPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF = get<0>(GetParam());
|
||||
Size sz = get<1>(GetParam());
|
||||
cv::GCompileArgs compile_args = get<2>(GetParam());
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_Luv2BGR);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::LUV2BGR(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(BGR2YUVPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF = get<0>(GetParam());
|
||||
Size sz = get<1>(GetParam());
|
||||
cv::GCompileArgs compile_args = get<2>(GetParam());
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2YUV);
|
||||
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::BGR2YUV(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(YUV2BGRPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF = get<0>(GetParam());
|
||||
Size sz = get<1>(GetParam());
|
||||
cv::GCompileArgs compile_args = get<2>(GetParam());
|
||||
|
||||
initMatsRandN(CV_8UC3, sz, CV_8UC3, false);
|
||||
|
||||
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_YUV2BGR);
|
||||
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::YUV2BGR(in);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
}
|
||||
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
}
|
||||
#endif //OPENCV_GAPI_IMGPROC_PERF_TESTS_INL_HPP
|
@ -7,214 +7,271 @@
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "../common/gapi_core_perf_tests.hpp"
|
||||
#include "opencv2/gapi/cpu/core.hpp"
|
||||
|
||||
#define CORE_CPU cv::gapi::core::cpu::kernels()
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AddPerfTestCPU, AddPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values( -1, CV_8U, CV_16U, CV_32F )));
|
||||
INSTANTIATE_TEST_CASE_P(AddPerfTestCPU, AddPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(-1, CV_8U, CV_16U, CV_32F),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AddCPerfTestCPU, AddCPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values( -1, CV_8U, CV_16U, CV_32F )));
|
||||
INSTANTIATE_TEST_CASE_P(AddCPerfTestCPU, AddCPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(-1, CV_8U, CV_16U, CV_32F),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SubPerfTestCPU, SubPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values( -1, CV_8U, CV_16U, CV_32F )));
|
||||
INSTANTIATE_TEST_CASE_P(SubPerfTestCPU, SubPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(-1, CV_8U, CV_16U, CV_32F),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SubCPerfTestCPU, SubCPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values( -1, CV_8U, CV_16U, CV_32F )));
|
||||
INSTANTIATE_TEST_CASE_P(SubCPerfTestCPU, SubCPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(-1, CV_8U, CV_16U, CV_32F),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SubRCPerfTestCPU, SubRCPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values( -1, CV_8U, CV_16U, CV_32F )));
|
||||
INSTANTIATE_TEST_CASE_P(SubRCPerfTestCPU, SubRCPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(-1, CV_8U, CV_16U, CV_32F),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MulPerfTestCPU, MulPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values( -1, CV_8U, CV_16U, CV_32F )));
|
||||
INSTANTIATE_TEST_CASE_P(MulPerfTestCPU, MulPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(-1, CV_8U, CV_16U, CV_32F),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MulDoublePerfTestCPU, MulDoublePerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values( -1, CV_8U, CV_16U, CV_32F )));
|
||||
INSTANTIATE_TEST_CASE_P(MulDoublePerfTestCPU, MulDoublePerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(-1, CV_8U, CV_16U, CV_32F),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MulCPerfTestCPU, MulCPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values( -1, CV_8U, CV_16U, CV_32F )));
|
||||
INSTANTIATE_TEST_CASE_P(MulCPerfTestCPU, MulCPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(-1, CV_8U, CV_16U, CV_32F),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(DivPerfTestCPU, DivPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values( -1, CV_8U, CV_16U, CV_32F )));
|
||||
INSTANTIATE_TEST_CASE_P(DivPerfTestCPU, DivPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(-1, CV_8U, CV_16U, CV_32F),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(DivCPerfTestCPU, DivCPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values( -1, CV_8U, CV_16U, CV_32F )));
|
||||
INSTANTIATE_TEST_CASE_P(DivCPerfTestCPU, DivCPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(-1, CV_8U, CV_16U, CV_32F),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(DivRCPerfTestCPU, DivRCPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values( -1, CV_8U, CV_16U, CV_32F )));
|
||||
INSTANTIATE_TEST_CASE_P(DivRCPerfTestCPU, DivRCPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(-1, CV_8U, CV_16U, CV_32F),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MaskPerfTestCPU, MaskPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_16UC1, CV_16SC1)));
|
||||
INSTANTIATE_TEST_CASE_P(MaskPerfTestCPU, MaskPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MeanPerfTestCPU, MeanPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(MeanPerfTestCPU, MeanPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Polar2CartPerfTestCPU, Polar2CartPerfTest, Values( szSmall128, szVGA, sz720p, sz1080p ));
|
||||
INSTANTIATE_TEST_CASE_P(Polar2CartPerfTestCPU, Polar2CartPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Cart2PolarPerfTestCPU, Cart2PolarPerfTest, Values( szSmall128, szVGA, sz720p, sz1080p ));
|
||||
INSTANTIATE_TEST_CASE_P(Cart2PolarPerfTestCPU, Cart2PolarPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(CmpPerfTestCPU, CmpPerfTest,
|
||||
Combine(Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
|
||||
Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(CmpPerfTestCPU, CmpPerfTest,
|
||||
Combine(Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
|
||||
Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(CmpWithScalarPerfTestCPU, CmpWithScalarPerfTest,
|
||||
Combine(Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
|
||||
Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(CmpWithScalarPerfTestCPU, CmpWithScalarPerfTest,
|
||||
Combine(Values(CMP_EQ, CMP_GE, CMP_NE, CMP_GT, CMP_LT, CMP_LE),
|
||||
Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BitwisePerfTestCPU, BitwisePerfTest,
|
||||
Combine(Values(AND, OR, XOR),
|
||||
Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1)));
|
||||
INSTANTIATE_TEST_CASE_P(BitwisePerfTestCPU, BitwisePerfTest,
|
||||
Combine(Values(AND, OR, XOR),
|
||||
Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BitwiseNotPerfTestCPU, BitwiseNotPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(BitwiseNotPerfTestCPU, BitwiseNotPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SelectPerfTestCPU, SelectPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(SelectPerfTestCPU, SelectPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MinPerfTestCPU, MinPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(MinPerfTestCPU, MinPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MaxPerfTestCPU, MaxPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(MaxPerfTestCPU, MaxPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AbsDiffPerfTestCPU, AbsDiffPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(AbsDiffPerfTestCPU, AbsDiffPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AbsDiffCPerfTestCPU, AbsDiffCPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(AbsDiffCPerfTestCPU, AbsDiffCPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SumPerfTestCPU, SumPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(SumPerfTestCPU, SumPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AddWeightedPerfTestCPU, AddWeightedPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values( -1, CV_8U, CV_16U, CV_32F )));
|
||||
INSTANTIATE_TEST_CASE_P(AddWeightedPerfTestCPU, AddWeightedPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(-1, CV_8U, CV_16U, CV_32F),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(NormPerfTestCPU, NormPerfTest,
|
||||
Combine(Values(NORM_INF, NORM_L1, NORM_L2),
|
||||
Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(NormPerfTestCPU, NormPerfTest,
|
||||
Combine(Values(NORM_INF, NORM_L1, NORM_L2),
|
||||
Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(IntegralPerfTestCPU, IntegralPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(IntegralPerfTestCPU, IntegralPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ThresholdPerfTestCPU, ThresholdPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values(cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV)));
|
||||
INSTANTIATE_TEST_CASE_P(ThresholdPerfTestCPU, ThresholdPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ThresholdPerfTestCPU, ThresholdOTPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1 ),
|
||||
Values(cv::THRESH_OTSU, cv::THRESH_TRIANGLE)));
|
||||
INSTANTIATE_TEST_CASE_P(ThresholdPerfTestCPU, ThresholdOTPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1),
|
||||
Values(cv::THRESH_OTSU, cv::THRESH_TRIANGLE),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(InRangePerfTestCPU, InRangePerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(InRangePerfTestCPU, InRangePerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Split3PerfTestCPU, Split3PerfTest, Values( szSmall128, szVGA, sz720p, sz1080p ));
|
||||
INSTANTIATE_TEST_CASE_P(Split3PerfTestCPU, Split3PerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Split4PerfTestCPU, Split4PerfTest, Values( szSmall128, szVGA, sz720p, sz1080p ));
|
||||
INSTANTIATE_TEST_CASE_P(Split4PerfTestCPU, Split4PerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Merge3PerfTestCPU, Merge3PerfTest, Values( szSmall128, szVGA, sz720p, sz1080p ));
|
||||
INSTANTIATE_TEST_CASE_P(Merge3PerfTestCPU, Merge3PerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Merge4PerfTestCPU, Merge4PerfTest, Values( szSmall128, szVGA, sz720p, sz1080p ));
|
||||
INSTANTIATE_TEST_CASE_P(Merge4PerfTestCPU, Merge4PerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RemapPerfTestCPU, RemapPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(RemapPerfTestCPU, RemapPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FlipPerfTestCPU, FlipPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values(0,1,-1)));
|
||||
INSTANTIATE_TEST_CASE_P(FlipPerfTestCPU, FlipPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(0, 1, -1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(CropPerfTestCPU, CropPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 ),
|
||||
Values(cv::Rect(10, 8, 20, 35), cv::Rect(4, 10, 37, 50))));
|
||||
INSTANTIATE_TEST_CASE_P(CropPerfTestCPU, CropPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
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::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ConcatHorPerfTestCPU, ConcatHorPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(ConcatHorPerfTestCPU, ConcatHorPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ConcatHorVecPerfTestCPU, ConcatHorVecPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(ConcatHorVecPerfTestCPU, ConcatHorVecPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ConcatVertPerfTestCPU, ConcatVertPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(ConcatVertPerfTestCPU, ConcatVertPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ConcatVertVecPerfTestCPU, ConcatVertVecPerfTest,
|
||||
Combine(Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values( CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1 )));
|
||||
INSTANTIATE_TEST_CASE_P(ConcatVertVecPerfTestCPU, ConcatVertVecPerfTest,
|
||||
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(LUTPerfTestCPU, LUTPerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3),
|
||||
Values(CV_8UC1),
|
||||
Values( szSmall128, szVGA, sz720p, sz1080p )));
|
||||
INSTANTIATE_TEST_CASE_P(LUTPerfTestCPU, LUTPerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3),
|
||||
Values(CV_8UC1),
|
||||
Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(LUTPerfTestCustomCPU, LUTPerfTest,
|
||||
Combine(Values(CV_8UC3),
|
||||
Values(CV_8UC3),
|
||||
Values( szSmall128, szVGA, sz720p, sz1080p )));
|
||||
INSTANTIATE_TEST_CASE_P(LUTPerfTestCustomCPU, LUTPerfTest,
|
||||
Combine(Values(CV_8UC3),
|
||||
Values(CV_8UC3),
|
||||
Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ConvertToPerfTestCPU, ConvertToPerfTest,
|
||||
Combine(Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_32FC1),
|
||||
Values(CV_8U, CV_16U, CV_16S, CV_32F),
|
||||
Values( szSmall128, szVGA, sz720p, sz1080p )));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ResizePerfTestCPU, ResizePerfTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
|
||||
Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values(cv::Size(64,64),
|
||||
cv::Size(30,30)),
|
||||
Values(0.0)));
|
||||
INSTANTIATE_TEST_CASE_P(ConvertToPerfTestCPU, ConvertToPerfTest,
|
||||
Combine(Values(CV_8UC3, CV_8UC1, CV_16UC1, CV_32FC1),
|
||||
Values(CV_8U, CV_16U, CV_16S, CV_32F),
|
||||
Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ResizeFxFyPerfTestCPU, ResizeFxFyPerfTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
|
||||
Values( szSmall128, szVGA, sz720p, sz1080p ),
|
||||
Values(0.5, 0.1),
|
||||
Values(0.5, 0.1),
|
||||
Values(0.0)));
|
||||
INSTANTIATE_TEST_CASE_P(ResizePerfTestCPU, ResizePerfTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
|
||||
Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(cv::Size(64, 64),
|
||||
cv::Size(30, 30)),
|
||||
Values(0.0),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ResizeFxFyPerfTestCPU, ResizeFxFyPerfTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
|
||||
Values(szSmall128, szVGA, sz720p, sz1080p),
|
||||
Values(0.5, 0.1),
|
||||
Values(0.5, 0.1),
|
||||
Values(0.0),
|
||||
Values(cv::compile_args(CORE_CPU))));
|
||||
}
|
||||
|
@ -7,114 +7,196 @@
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "../common/gapi_imgproc_perf_tests.hpp"
|
||||
#include "opencv2/gapi/cpu/imgproc.hpp"
|
||||
|
||||
|
||||
#define IMGPROC_CPU cv::gapi::imgproc::cpu::kernels()
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SepFilterPerfTestCPU_8U, SepFilterPerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3),
|
||||
Values(3),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(-1, CV_16S, CV_32F)));
|
||||
class AbsExact : public Wrappable<AbsExact>
|
||||
{
|
||||
public:
|
||||
AbsExact() {}
|
||||
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const { return cv::countNonZero(in1 != in2) == 0; }
|
||||
private:
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SepFilterPerfTestCPU_other, SepFilterPerfTest,
|
||||
Combine(Values(CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(-1, CV_32F)));
|
||||
class AbsTolerance : public Wrappable<AbsTolerance>
|
||||
{
|
||||
public:
|
||||
AbsTolerance(double tol) : _tol(tol) {}
|
||||
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
|
||||
{
|
||||
cv::Mat absDiff; cv::absdiff(in1, in2, absDiff);
|
||||
return cv::countNonZero(absDiff > _tol) == 0;
|
||||
}
|
||||
private:
|
||||
double _tol;
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter2DPerfTestCPU, Filter2DPerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 4, 5, 7),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::BORDER_DEFAULT),
|
||||
Values(-1, CV_32F)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BoxFilterPerfTestCPU, BoxFilterPerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3,5),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::BORDER_DEFAULT),
|
||||
Values(-1, CV_32F),
|
||||
Values(0.0)));
|
||||
INSTANTIATE_TEST_CASE_P(SepFilterPerfTestCPU_8U, SepFilterPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3),
|
||||
Values(3),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(-1, CV_16S, CV_32F),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BlurPerfTestCPU, BlurPerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::BORDER_DEFAULT),
|
||||
Values(0.0)));
|
||||
INSTANTIATE_TEST_CASE_P(SepFilterPerfTestCPU_other, SepFilterPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(-1, CV_32F),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GaussianBlurPerfTestCPU, GaussianBlurPerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MedianBlurPerfTestCPU, MedianBlurPerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ErodePerfTestCPU, ErodePerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::MorphShapes::MORPH_RECT,
|
||||
cv::MorphShapes::MORPH_CROSS,
|
||||
cv::MorphShapes::MORPH_ELLIPSE)));
|
||||
INSTANTIATE_TEST_CASE_P(Filter2DPerfTestCPU, Filter2DPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 4, 5, 7),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::BORDER_DEFAULT),
|
||||
Values(-1, CV_32F),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Erode3x3PerfTestCPU, Erode3x3PerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(1,2,4)));
|
||||
INSTANTIATE_TEST_CASE_P(BoxFilterPerfTestCPU, BoxFilterPerfTest,
|
||||
Combine(Values(AbsTolerance(1e-6).to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::BORDER_DEFAULT),
|
||||
Values(-1, CV_32F),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(DilatePerfTestCPU, DilatePerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::MorphShapes::MORPH_RECT,
|
||||
cv::MorphShapes::MORPH_CROSS,
|
||||
cv::MorphShapes::MORPH_ELLIPSE)));
|
||||
INSTANTIATE_TEST_CASE_P(BlurPerfTestCPU, BlurPerfTest,
|
||||
Combine(Values(AbsTolerance(1e-6).to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::BORDER_DEFAULT),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GaussianBlurPerfTestCPU, GaussianBlurPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MedianBlurPerfTestCPU, MedianBlurPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ErodePerfTestCPU, ErodePerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::MorphShapes::MORPH_RECT,
|
||||
cv::MorphShapes::MORPH_CROSS,
|
||||
cv::MorphShapes::MORPH_ELLIPSE),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Erode3x3PerfTestCPU, Erode3x3PerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(1, 2, 4),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(DilatePerfTestCPU, DilatePerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::MorphShapes::MORPH_RECT,
|
||||
cv::MorphShapes::MORPH_CROSS,
|
||||
cv::MorphShapes::MORPH_ELLIPSE),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Dilate3x3PerfTestCPU, Dilate3x3PerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(1,2,4)));
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(1, 2, 4),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SobelPerfTestCPU, SobelPerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(-1, CV_32F),
|
||||
Values(0, 1),
|
||||
Values(1, 2)));
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(-1, CV_32F),
|
||||
Values(0, 1),
|
||||
Values(1, 2),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(CannyPerfTestCPU, CannyPerfTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(3.0, 120.0),
|
||||
Values(125.0, 240.0),
|
||||
Values(3, 5),
|
||||
Values(true, false)));
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(3.0, 120.0),
|
||||
Values(125.0, 240.0),
|
||||
Values(3, 5),
|
||||
Values(true, false),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(EqHistPerfTestCPU, EqHistPerfTest, Values(szVGA, sz720p, sz1080p));
|
||||
INSTANTIATE_TEST_CASE_P(EqHistPerfTestCPU, EqHistPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RGB2GrayPerfTestCPU, RGB2GrayPerfTest, Values(szVGA, sz720p, sz1080p));
|
||||
INSTANTIATE_TEST_CASE_P(RGB2GrayPerfTestCPU, RGB2GrayPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BGR2GrayPerfTestCPU, BGR2GrayPerfTest, Values(szVGA, sz720p, sz1080p));
|
||||
INSTANTIATE_TEST_CASE_P(BGR2GrayPerfTestCPU, BGR2GrayPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RGB2YUVPerfTestCPU, RGB2YUVPerfTest, Values(szVGA, sz720p, sz1080p));
|
||||
INSTANTIATE_TEST_CASE_P(RGB2YUVPerfTestCPU, RGB2YUVPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(YUV2RGBPerfTestCPU, YUV2RGBPerfTest, Values(szVGA, sz720p, sz1080p));
|
||||
INSTANTIATE_TEST_CASE_P(YUV2RGBPerfTestCPU, YUV2RGBPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RGB2LabPerfTestCPU, RGB2LabPerfTest, Values(szVGA, sz720p, sz1080p));
|
||||
INSTANTIATE_TEST_CASE_P(RGB2LabPerfTestCPU, RGB2LabPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BGR2LUVPerfTestCPU, BGR2LUVPerfTest, Values(szVGA, sz720p, sz1080p));
|
||||
INSTANTIATE_TEST_CASE_P(BGR2LUVPerfTestCPU, BGR2LUVPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(LUV2BGRPerfTestCPU, LUV2BGRPerfTest, Values(szVGA, sz720p, sz1080p));
|
||||
INSTANTIATE_TEST_CASE_P(LUV2BGRPerfTestCPU, LUV2BGRPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BGR2YUVPerfTestCPU, BGR2YUVPerfTest, Values(szVGA, sz720p, sz1080p));
|
||||
INSTANTIATE_TEST_CASE_P(BGR2YUVPerfTestCPU, BGR2YUVPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(YUV2BGRPerfTestCPU, YUV2BGRPerfTest, Values(szVGA, sz720p, sz1080p));
|
||||
INSTANTIATE_TEST_CASE_P(YUV2BGRPerfTestCPU, YUV2BGRPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
}
|
||||
|
@ -878,8 +878,7 @@ TEST_P(ThresholdOTTest, AccuracyTestOtsu)
|
||||
int tt = std::get<2>(param);
|
||||
|
||||
auto compile_args = std::get<4>(param);
|
||||
auto& rng = cv::theRNG();
|
||||
cv::Scalar maxval = cv::Scalar(50 + rng(50),50 + rng(50),50 + rng(50),50 + rng(50));
|
||||
cv::Scalar maxval = initScalarRandU(50) + cv::Scalar(50, 50, 50, 50);
|
||||
initMatrixRandU(type, sz_in, type, std::get<3>(param));
|
||||
cv::Scalar out_gapi_scalar;
|
||||
double ocv_res;
|
||||
@ -911,9 +910,8 @@ TEST_P(InRangeTest, AccuracyTest)
|
||||
cv::Size sz_in = std::get<1>(param);
|
||||
|
||||
auto compile_args = std::get<3>(param);
|
||||
auto& rng = cv::theRNG();
|
||||
cv::Scalar thrLow = cv::Scalar(rng(100),rng(100),rng(100),rng(100));
|
||||
cv::Scalar thrUp = cv::Scalar(100 + rng(100),100 + rng(100),100 + rng(100),100 + rng(100));
|
||||
cv::Scalar thrLow = initScalarRandU(100);
|
||||
cv::Scalar thrUp = initScalarRandU(100) + cv::Scalar(100, 100, 100, 100);
|
||||
initMatrixRandU(type, sz_in, type, std::get<2>(param));
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
|
@ -14,28 +14,29 @@
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
struct Filter2DTest : public TestParams <std::tuple<MatType,int,cv::Size,int,int,bool,cv::GCompileArgs>> {};
|
||||
struct BoxFilterTest : public TestParams <std::tuple<MatType,int,cv::Size,int,int,double,bool,cv::GCompileArgs>> {};
|
||||
struct SepFilterTest : public TestParams <std::tuple<MatType,int,cv::Size,int,bool,cv::GCompileArgs>> {};
|
||||
struct BlurTest : public TestParams <std::tuple<MatType,int,cv::Size,int,double,bool,cv::GCompileArgs>> {};
|
||||
struct GaussianBlurTest : public TestParams <std::tuple<MatType,int,cv::Size,bool,cv::GCompileArgs>> {};
|
||||
struct MedianBlurTest : public TestParams <std::tuple<MatType,int,cv::Size,bool,cv::GCompileArgs>> {};
|
||||
struct ErodeTest : public TestParams <std::tuple<MatType,int,cv::Size,int,bool,cv::GCompileArgs>> {};
|
||||
struct Erode3x3Test : public TestParams <std::tuple<MatType,cv::Size,bool,int,cv::GCompileArgs>> {};
|
||||
struct DilateTest : public TestParams <std::tuple<MatType,int,cv::Size,int,bool,cv::GCompileArgs>> {};
|
||||
struct Dilate3x3Test : public TestParams <std::tuple<MatType,cv::Size,bool,int,cv::GCompileArgs>> {};
|
||||
struct SobelTest : public TestParams <std::tuple<MatType,int,cv::Size,int,int,int,bool,cv::GCompileArgs>> {};
|
||||
struct EqHistTest : public TestParams <std::tuple<cv::Size,bool, cv::GCompileArgs>> {};
|
||||
struct CannyTest : public TestParams <std::tuple<MatType,cv::Size,double,double,int,bool,bool,cv::GCompileArgs>> {};
|
||||
struct RGB2GrayTest : public TestParams<std::tuple<cv::Size,bool,cv::GCompileArgs>> {};
|
||||
struct BGR2GrayTest : public TestParams<std::tuple<cv::Size,bool,cv::GCompileArgs>> {};
|
||||
struct RGB2YUVTest : public TestParams<std::tuple<cv::Size,bool,cv::GCompileArgs>> {};
|
||||
struct YUV2RGBTest : public TestParams<std::tuple<cv::Size,bool,cv::GCompileArgs>> {};
|
||||
struct RGB2LabTest : public TestParams<std::tuple<cv::Size,bool,cv::GCompileArgs>> {};
|
||||
struct BGR2LUVTest : public TestParams<std::tuple<cv::Size,bool,cv::GCompileArgs>> {};
|
||||
struct LUV2BGRTest : public TestParams<std::tuple<cv::Size,bool,cv::GCompileArgs>> {};
|
||||
struct BGR2YUVTest : public TestParams<std::tuple<cv::Size,bool,cv::GCompileArgs>> {};
|
||||
struct YUV2BGRTest : public TestParams<std::tuple<cv::Size,bool,cv::GCompileArgs>> {};
|
||||
|
||||
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 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 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>> {};
|
||||
} // opencv_test
|
||||
|
||||
#endif //OPENCV_GAPI_IMGPROC_TESTS_HPP
|
||||
|
@ -15,12 +15,13 @@ namespace opencv_test
|
||||
{
|
||||
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(type, kernSize, sz, borderType, dtype, initOut, compile_args) = GetParam();
|
||||
std::tie(cmpF, type, kernSize, sz, borderType, dtype, initOut, compile_args) = GetParam();
|
||||
initMatsRandN(type, sz, dtype, initOut);
|
||||
|
||||
cv::Point anchor = {-1, -1};
|
||||
@ -43,36 +44,20 @@ TEST_P(Filter2DTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
// TODO: Control this choice with test's especial parameter
|
||||
#if 1
|
||||
// Allow some rounding error
|
||||
if (CV_MAT_DEPTH(out_mat_gapi.type()) == CV_32F)
|
||||
{
|
||||
// 6 decimal digits is nearly best accuracy we can expect of FP32 arithmetic here
|
||||
EXPECT_EQ(0, cv::countNonZero(cv::abs(out_mat_gapi - out_mat_ocv) > 1e-6*cv::abs(out_mat_ocv)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// allow wrong rounding if result fractional part is nearly 0.5,
|
||||
// assume there would be not more than 0.01% of such cases
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi != out_mat_ocv), 1e-4*out_mat_ocv.total());
|
||||
}
|
||||
#else
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
#endif
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(BoxFilterTest, AccuracyTest)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int filterSize = 0, borderType = 0, dtype = 0;
|
||||
cv::Size sz;
|
||||
double tolerance = 0.0;
|
||||
bool initOut = false;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(type, filterSize, sz, borderType, dtype, tolerance, initOut, compile_args) = GetParam();
|
||||
std::tie(cmpF, type, filterSize, sz, borderType, dtype, initOut, compile_args) = GetParam();
|
||||
initMatsRandN(type, sz, dtype, initOut);
|
||||
|
||||
cv::Point anchor = {-1, -1};
|
||||
@ -90,37 +75,20 @@ TEST_P(BoxFilterTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
// TODO: Control this choice with test's especial parameter
|
||||
#if 1
|
||||
// Allow some rounding error
|
||||
if (CV_MAT_DEPTH(out_mat_gapi.type()) == CV_32F)
|
||||
{
|
||||
// 6 decimal digits is nearly best accuracy we can expect of FP32 arithmetic here
|
||||
EXPECT_EQ(0, cv::countNonZero(cv::abs(out_mat_gapi - out_mat_ocv) > 1e-6*cv::abs(out_mat_ocv)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// allow wrong rounding if result fractional part is nearly 0.5,
|
||||
// assume there would be not more than 0.01% of such cases
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi != out_mat_ocv), 1e-4*out_mat_ocv.total());
|
||||
}
|
||||
#else
|
||||
cv::Mat absDiff;
|
||||
cv::absdiff(out_mat_gapi, out_mat_ocv, absDiff);
|
||||
EXPECT_EQ(0, cv::countNonZero(absDiff > tolerance));
|
||||
#endif
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
|
||||
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(type, kernSize, sz, dtype, initOut, compile_args) = GetParam();
|
||||
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);
|
||||
@ -142,27 +110,20 @@ TEST_P(SepFilterTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
// TODO: Control this choice with test's especial parameter
|
||||
#if 1
|
||||
// Expect some rounding error
|
||||
EXPECT_LE(cv::countNonZero(cv::abs(out_mat_gapi - out_mat_ocv) > 1e-5 * cv::abs(out_mat_ocv)),
|
||||
0.01 * out_mat_ocv.total());
|
||||
#else
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
#endif
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(BlurTest, AccuracyTest)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
int filterSize = 0, borderType = 0;
|
||||
cv::Size sz;
|
||||
double tolerance = 0.0;
|
||||
bool initOut = false;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(type, filterSize, sz, borderType, tolerance, initOut, compile_args) = GetParam();
|
||||
std::tie(cmpF, type, filterSize, sz, borderType, initOut, compile_args) = GetParam();
|
||||
initMatsRandN(type, sz, type, initOut);
|
||||
|
||||
cv::Point anchor = {-1, -1};
|
||||
@ -179,21 +140,20 @@ TEST_P(BlurTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::Mat absDiff;
|
||||
cv::absdiff(out_mat_gapi, out_mat_ocv, absDiff);
|
||||
EXPECT_EQ(0, cv::countNonZero(absDiff > tolerance));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
|
||||
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(type, kernSize, sz, initOut, compile_args) = GetParam();
|
||||
std::tie(cmpF,type, kernSize, sz, initOut, compile_args) = GetParam();
|
||||
initMatsRandN(type, sz, type, initOut);
|
||||
|
||||
cv::Size kSize = cv::Size(kernSize, kernSize);
|
||||
@ -211,42 +171,20 @@ TEST_P(GaussianBlurTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
// TODO: Control this choice with test's especial parameter
|
||||
#if 1
|
||||
// Expect some rounding error
|
||||
if (CV_MAT_DEPTH(out_mat_gapi.type()) == CV_32F ||
|
||||
CV_MAT_DEPTH(out_mat_gapi.type()) == CV_64F)
|
||||
{
|
||||
// Note that 1e-6 is nearly best accuracy we can expect of FP32 arithetic
|
||||
EXPECT_EQ(0, cv::countNonZero(cv::abs(out_mat_gapi - out_mat_ocv) >
|
||||
1e-6*cv::abs(out_mat_ocv)));
|
||||
}
|
||||
else if (CV_MAT_DEPTH(out_mat_gapi.type()) == CV_8U)
|
||||
{
|
||||
// OpenCV uses 16-bits fixed-point for 8U data, so may produce wrong results
|
||||
EXPECT_LE(cv::countNonZero(cv::abs(out_mat_gapi - out_mat_ocv) > 1),
|
||||
0.05*out_mat_ocv.total());
|
||||
EXPECT_LE(cv::countNonZero(cv::abs(out_mat_gapi - out_mat_ocv) > 2), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
}
|
||||
#else
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
#endif
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
|
||||
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(type, kernSize, sz, initOut, compile_args) = GetParam();
|
||||
std::tie(cmpF, type, kernSize, sz, initOut, compile_args) = GetParam();
|
||||
initMatsRandN(type, sz, type, initOut);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
@ -261,19 +199,20 @@ TEST_P(MedianBlurTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
|
||||
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(type, kernSize, sz, kernType, initOut, compile_args) = GetParam();
|
||||
std::tie(cmpF, type, kernSize, sz, kernType, initOut, compile_args) = GetParam();
|
||||
initMatsRandN(type, sz, type, initOut);
|
||||
|
||||
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize));
|
||||
@ -290,19 +229,20 @@ TEST_P(ErodeTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
|
||||
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(type, sz, initOut, numIters, compile_args) = GetParam();
|
||||
std::tie(cmpF, type, sz, initOut, numIters, compile_args) = GetParam();
|
||||
initMatsRandN(type, sz, type, initOut);
|
||||
|
||||
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3,3));
|
||||
@ -319,19 +259,20 @@ TEST_P(Erode3x3Test, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
|
||||
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(type, kernSize, sz, kernType, initOut, compile_args) = GetParam();
|
||||
std::tie(cmpF, type, kernSize, sz, kernType, initOut, compile_args) = GetParam();
|
||||
initMatsRandN(type, sz, type, initOut);
|
||||
|
||||
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize));
|
||||
@ -348,19 +289,20 @@ TEST_P(DilateTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
|
||||
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(type, sz, initOut, numIters, compile_args) = GetParam();
|
||||
std::tie(cmpF, type, sz, initOut, numIters, compile_args) = GetParam();
|
||||
initMatsRandN(type, sz, type, initOut);
|
||||
|
||||
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3,3));
|
||||
@ -377,7 +319,7 @@ TEST_P(Dilate3x3Test, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
@ -385,12 +327,13 @@ 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(type, kernSize, sz, dtype, dx, dy, initOut, compile_args) = GetParam();
|
||||
std::tie(cmpF, type, kernSize, sz, dtype, dx, dy, initOut, compile_args) = GetParam();
|
||||
initMatsRandN(type, sz, dtype, initOut);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
@ -405,17 +348,18 @@ TEST_P(SobelTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(EqHistTest, AccuracyTest)
|
||||
{
|
||||
compare_f cmpF;
|
||||
cv::Size sz;
|
||||
bool initOut = false;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(sz, initOut, compile_args) = GetParam();
|
||||
std::tie(cmpF, sz, initOut, compile_args) = GetParam();
|
||||
initMatsRandN(CV_8UC1, sz, CV_8UC1, initOut);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
@ -430,20 +374,21 @@ TEST_P(EqHistTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<0>(GetParam()));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(GetParam()));
|
||||
}
|
||||
}
|
||||
|
||||
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(type, sz, thrLow, thrUp, apSize, l2gr, initOut, compile_args) = GetParam();
|
||||
std::tie(cmpF, type, sz, thrLow, thrUp, apSize, l2gr, initOut, compile_args) = GetParam();
|
||||
|
||||
initMatsRandN(type, sz, CV_8UC1, initOut);
|
||||
|
||||
@ -459,7 +404,7 @@ TEST_P(CannyTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
@ -467,8 +412,9 @@ TEST_P(CannyTest, AccuracyTest)
|
||||
TEST_P(RGB2GrayTest, AccuracyTest)
|
||||
{
|
||||
auto param = GetParam();
|
||||
auto compile_args = std::get<2>(param);
|
||||
initMatsRandN(CV_8UC3, std::get<0>(param), CV_8UC1, std::get<1>(param));
|
||||
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));
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
@ -482,26 +428,17 @@ TEST_P(RGB2GrayTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
// TODO: control this choice with especial parameter of this test
|
||||
#if 1
|
||||
// allow faithful rounding if result's fractional part is nearly 0.5
|
||||
// - assume not more than 0.1% of pixels may deviate this way
|
||||
// - deviation must not exceed 1 unit anyway
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 0), 0.001*out_mat_ocv.total());
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 1), 0);
|
||||
#else
|
||||
// insist of bit-exact results
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
#endif
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<0>(param));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(BGR2GrayTest, AccuracyTest)
|
||||
{
|
||||
auto param = GetParam();
|
||||
auto compile_args = std::get<2>(param);
|
||||
initMatsRandN(CV_8UC3, std::get<0>(param), CV_8UC1, std::get<1>(param));
|
||||
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));
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
@ -515,26 +452,17 @@ TEST_P(BGR2GrayTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
// TODO: control this choice with especial parameter of this test
|
||||
#if 1
|
||||
// allow faithful rounding if result's fractional part is nearly 0.5
|
||||
// - assume not more than 0.1% of pixels may deviate this way
|
||||
// - deviation must not exceed 1 unit anyway
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 0), 0.001*out_mat_ocv.total());
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 1), 0);
|
||||
#else
|
||||
// insist of bit-exact results
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
#endif
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<0>(param));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(RGB2YUVTest, AccuracyTest)
|
||||
{
|
||||
auto param = GetParam();
|
||||
auto compile_args = std::get<2>(param);
|
||||
initMatsRandN(CV_8UC3, std::get<0>(param), CV_8UC3, std::get<1>(param));
|
||||
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));
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
@ -548,26 +476,18 @@ TEST_P(RGB2YUVTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
// TODO: control this choice with especial parameter of this test
|
||||
#if 1
|
||||
// allow faithful rounding if result's fractional part is nearly 0.5
|
||||
// - assume not more than 15% of pixels may deviate this way
|
||||
// - deviation must not exceed 1 unit anyway
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 0), 0.15*3*out_mat_ocv.total());
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 1), 0);
|
||||
#else
|
||||
// insist of bit-exact results
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
#endif
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<0>(param));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(YUV2RGBTest, AccuracyTest)
|
||||
{
|
||||
auto param = GetParam();
|
||||
auto compile_args = std::get<2>(param);
|
||||
initMatsRandN(CV_8UC3, std::get<0>(param), CV_8UC3, std::get<1>(param));
|
||||
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));
|
||||
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
@ -581,26 +501,17 @@ TEST_P(YUV2RGBTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
// TODO: control this choice with especial parameter of this test
|
||||
#if 1
|
||||
// allow faithful rounding if result's fractional part is nearly 0.5
|
||||
// - assume not more than 1% of pixels may deviate this way
|
||||
// - deviation must not exceed 1 unit anyway
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 0), 0.01*3*out_mat_ocv.total());
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 1), 0);
|
||||
#else
|
||||
// insist of bit-exact results
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
#endif
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<0>(param));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(RGB2LabTest, AccuracyTest)
|
||||
{
|
||||
auto param = GetParam();
|
||||
auto compile_args = std::get<2>(param);
|
||||
initMatsRandN(CV_8UC3, std::get<0>(param), CV_8UC3, std::get<1>(param));
|
||||
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));
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
@ -614,28 +525,17 @@ TEST_P(RGB2LabTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
// TODO: control this choice with especial parameter of this test
|
||||
#if 1
|
||||
// allow faithful rounding, if result's fractional part is nearly 0.5
|
||||
// - assume not more than 25% of pixels may deviate this way
|
||||
// - not more than 1% of pixels may deviate by 1 unit
|
||||
// - deviation must not exceed 2 units anyway
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 0), 0.25*3*out_mat_ocv.total());
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 1), 0.01*3*out_mat_ocv.total());
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 2), 1e-5*3*out_mat_ocv.total());
|
||||
#else
|
||||
// insist on bit-exact results
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
#endif
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<0>(param));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(BGR2LUVTest, AccuracyTest)
|
||||
{
|
||||
auto param = GetParam();
|
||||
auto compile_args = std::get<2>(param);
|
||||
initMatsRandN(CV_8UC3, std::get<0>(param), CV_8UC3, std::get<1>(param));
|
||||
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));
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
@ -649,28 +549,17 @@ TEST_P(BGR2LUVTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
// TODO: control this choice with especial parameter of this test
|
||||
#if 1
|
||||
// allow faithful rounding, if result's fractional part is nearly 0.5
|
||||
// - assume not more than 25% of pixels may deviate this way
|
||||
// - not more than 1% of pixels may deviate by 2+ units
|
||||
// - not more than 0.01% pixels may deviate by 5+ units
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 0), 0.25 * 3 * out_mat_ocv.total());
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 1), 0.01 * 3 * out_mat_ocv.total());
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 5), 0.0001 * 3 * out_mat_ocv.total());
|
||||
#else
|
||||
// insist on bit-exact results
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
#endif
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<0>(param));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(LUV2BGRTest, AccuracyTest)
|
||||
{
|
||||
auto param = GetParam();
|
||||
auto compile_args = std::get<2>(param);
|
||||
initMatsRandN(CV_8UC3, std::get<0>(param), CV_8UC3, std::get<1>(param));
|
||||
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));
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
@ -684,16 +573,17 @@ TEST_P(LUV2BGRTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<0>(param));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(BGR2YUVTest, AccuracyTest)
|
||||
{
|
||||
auto param = GetParam();
|
||||
auto compile_args = std::get<2>(param);
|
||||
initMatsRandN(CV_8UC3, std::get<0>(param), CV_8UC3, std::get<1>(param));
|
||||
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));
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
@ -707,16 +597,17 @@ TEST_P(BGR2YUVTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<0>(param));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(YUV2BGRTest, AccuracyTest)
|
||||
{
|
||||
auto param = GetParam();
|
||||
auto compile_args = std::get<2>(param);
|
||||
initMatsRandN(CV_8UC3, std::get<0>(param), CV_8UC3, std::get<1>(param));
|
||||
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));
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
@ -730,20 +621,8 @@ TEST_P(YUV2BGRTest, AccuracyTest)
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
// TODO: control this choice with especial parameter of this test
|
||||
#if 1
|
||||
// allow faithful rounding, if result's fractional part is nearly 0.5
|
||||
// - assume not more than 25% of pixels may deviate this way
|
||||
// - not more than 1% of pixels may deviate by 1 unit
|
||||
// - deviation must not exceed 2 units anyway
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 0), 0.25*3*out_mat_ocv.total());
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 1), 0.01*3*out_mat_ocv.total());
|
||||
EXPECT_LE(cv::countNonZero(out_mat_gapi - out_mat_ocv > 2), 1e-5*3*out_mat_ocv.total());
|
||||
#else
|
||||
// insist on bit-exact results
|
||||
EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
|
||||
#endif
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<0>(param));
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
|
||||
}
|
||||
}
|
||||
} // opencv_test
|
||||
|
@ -31,13 +31,22 @@ public:
|
||||
|
||||
cv::Scalar sc;
|
||||
|
||||
cv::Scalar initScalarRandU(unsigned upper)
|
||||
{
|
||||
auto& rng = cv::theRNG();
|
||||
double s1 = rng(upper);
|
||||
double s2 = rng(upper);
|
||||
double s3 = rng(upper);
|
||||
double s4 = rng(upper);
|
||||
return cv::Scalar(s1, s2, s3, s4);
|
||||
}
|
||||
|
||||
void initMatsRandU(int type, cv::Size sz_in, int dtype, bool createOutputMatrices = true)
|
||||
{
|
||||
in_mat1 = cv::Mat(sz_in, type);
|
||||
in_mat2 = cv::Mat(sz_in, type);
|
||||
|
||||
auto& rng = cv::theRNG();
|
||||
sc = cv::Scalar(rng(100),rng(100),rng(100),rng(100));
|
||||
sc = initScalarRandU(100);
|
||||
cv::randu(in_mat1, cv::Scalar::all(0), cv::Scalar::all(255));
|
||||
cv::randu(in_mat2, cv::Scalar::all(0), cv::Scalar::all(255));
|
||||
|
||||
@ -52,8 +61,7 @@ public:
|
||||
{
|
||||
in_mat1 = cv::Mat(sz_in, type);
|
||||
|
||||
auto& rng = cv::theRNG();
|
||||
sc = cv::Scalar(rng(100),rng(100),rng(100),rng(100));
|
||||
sc = initScalarRandU(100);
|
||||
|
||||
cv::randu(in_mat1, cv::Scalar::all(0), cv::Scalar::all(255));
|
||||
|
||||
@ -105,4 +113,19 @@ class TestParams: public TestFunctional, public TestWithParam<T>{};
|
||||
template<class T>
|
||||
class TestPerfParams: public TestFunctional, public perf::TestBaseWithParam<T>{};
|
||||
|
||||
using compare_f = std::function<bool(const cv::Mat &a, const cv::Mat &b)>;
|
||||
|
||||
template<typename T>
|
||||
struct Wrappable
|
||||
{
|
||||
compare_f to_compare_f()
|
||||
{
|
||||
T t = *static_cast<T*const>(this);
|
||||
return [t](const cv::Mat &a, const cv::Mat &b)
|
||||
{
|
||||
return t(a, b);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -15,8 +15,30 @@
|
||||
namespace opencv_test
|
||||
{
|
||||
|
||||
class AbsExact : public Wrappable<AbsExact>
|
||||
{
|
||||
public:
|
||||
AbsExact() {}
|
||||
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const { return cv::countNonZero(in1 != in2)==0; }
|
||||
private:
|
||||
};
|
||||
|
||||
class AbsTolerance : public Wrappable<AbsTolerance>
|
||||
{
|
||||
public:
|
||||
AbsTolerance(double tol) : _tol(tol) {}
|
||||
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
|
||||
{
|
||||
cv::Mat absDiff; cv::absdiff(in1, in2, absDiff);
|
||||
return cv::countNonZero(absDiff > _tol) == 0;
|
||||
}
|
||||
private:
|
||||
double _tol;
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter2DTestCPU, Filter2DTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 4, 5, 7),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480),
|
||||
@ -27,18 +49,19 @@ INSTANTIATE_TEST_CASE_P(Filter2DTestCPU, Filter2DTest,
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BoxFilterTestCPU, BoxFilterTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Combine(Values(AbsTolerance(1e-6).to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3,5),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
Values(cv::BORDER_DEFAULT),
|
||||
Values(-1, CV_32F),
|
||||
Values(0.0),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SepFilterTestCPU_8U, SepFilterTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3),
|
||||
Values(3),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -47,7 +70,8 @@ INSTANTIATE_TEST_CASE_P(SepFilterTestCPU_8U, SepFilterTest,
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SepFilterTestCPU_other, SepFilterTest,
|
||||
Combine(Values(CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -56,17 +80,18 @@ INSTANTIATE_TEST_CASE_P(SepFilterTestCPU_other, SepFilterTest,
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BlurTestCPU, BlurTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Combine(Values(AbsTolerance(0.0).to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3,5),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
Values(cv::BORDER_DEFAULT),
|
||||
Values(0.0),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(gaussBlurTestCPU, GaussianBlurTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -74,7 +99,8 @@ INSTANTIATE_TEST_CASE_P(gaussBlurTestCPU, GaussianBlurTest,
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MedianBlurTestCPU, MedianBlurTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -82,7 +108,8 @@ INSTANTIATE_TEST_CASE_P(MedianBlurTestCPU, MedianBlurTest,
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ErodeTestCPU, ErodeTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -93,7 +120,8 @@ INSTANTIATE_TEST_CASE_P(ErodeTestCPU, ErodeTest,
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Erode3x3TestCPU, Erode3x3Test,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
@ -101,7 +129,8 @@ INSTANTIATE_TEST_CASE_P(Erode3x3TestCPU, Erode3x3Test,
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(DilateTestCPU, DilateTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -112,7 +141,8 @@ INSTANTIATE_TEST_CASE_P(DilateTestCPU, DilateTest,
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Dilate3x3TestCPU, Dilate3x3Test,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
@ -120,7 +150,8 @@ INSTANTIATE_TEST_CASE_P(Dilate3x3TestCPU, Dilate3x3Test,
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SobelTestCPU, SobelTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(3, 5),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -131,13 +162,15 @@ INSTANTIATE_TEST_CASE_P(SobelTestCPU, SobelTest,
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(EqHistTestCPU, EqHistTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(CannyTestCPU, CannyTest,
|
||||
Combine(Values(CV_8UC1, CV_8UC3),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
Values(3.0, 120.0),
|
||||
@ -148,55 +181,64 @@ INSTANTIATE_TEST_CASE_P(CannyTestCPU, CannyTest,
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RGB2GrayTestCPU, RGB2GrayTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BGR2GrayTestCPU, BGR2GrayTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RGB2YUVTestCPU, RGB2YUVTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(YUV2RGBTestCPU, YUV2RGBTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RGB2LabTestCPU, RGB2LabTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BGR2LUVTestCPU, BGR2LUVTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(LUV2BGRTestCPU, LUV2BGRTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BGR2YUVTestCPU, BGR2YUVTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(YUV2BGRTestCPU, YUV2BGRTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
/*init output matrices or not*/ testing::Bool(),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
@ -14,55 +14,163 @@
|
||||
namespace opencv_test
|
||||
{
|
||||
|
||||
class AbsExactFluid : public Wrappable<AbsExactFluid>
|
||||
{
|
||||
public:
|
||||
AbsExactFluid() {}
|
||||
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const { return cv::countNonZero(in1 != in2) == 0; }
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
class AbsToleranceFluid : public Wrappable<AbsToleranceFluid>
|
||||
{
|
||||
public:
|
||||
AbsToleranceFluid(double tol) : _tol(tol) {}
|
||||
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
|
||||
{
|
||||
cv::Mat absDiff; cv::absdiff(in1, in2, absDiff);
|
||||
return cv::countNonZero(absDiff > _tol) == 0;
|
||||
}
|
||||
private:
|
||||
double _tol;
|
||||
};
|
||||
|
||||
class AbsTolerance32FFluid : public Wrappable<AbsTolerance32FFluid>
|
||||
{
|
||||
public:
|
||||
AbsTolerance32FFluid(double tol) : _tol(tol) {}
|
||||
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
|
||||
{
|
||||
if (CV_MAT_DEPTH(in1.type()) == CV_32F)
|
||||
return ((cv::countNonZero(cv::abs(in1 - in2) > (_tol)*cv::abs(in2))) ? false : true);
|
||||
else
|
||||
return ((cv::countNonZero(in1 != in2) <= (_tol * 100) * in2.total()) ? true : false);
|
||||
}
|
||||
private:
|
||||
double _tol;
|
||||
};
|
||||
|
||||
class AbsToleranceSepFilterFluid : public Wrappable<AbsToleranceSepFilterFluid>
|
||||
{
|
||||
public:
|
||||
AbsToleranceSepFilterFluid(double tol) : _tol(tol) {}
|
||||
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
|
||||
{
|
||||
return ((cv::countNonZero(cv::abs(in1 - in2) > (_tol)* cv::abs(in2)) <= 0.01 * in2.total()) ? true : false);
|
||||
}
|
||||
private:
|
||||
double _tol;
|
||||
};
|
||||
|
||||
class AbsToleranceGaussianBlurFluid : public Wrappable<AbsToleranceGaussianBlurFluid>
|
||||
{
|
||||
public:
|
||||
AbsToleranceGaussianBlurFluid(double tol) : _tol(tol) {}
|
||||
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
|
||||
{
|
||||
if (CV_MAT_DEPTH(in1.type()) == CV_32F || CV_MAT_DEPTH(in1.type()) == CV_64F)
|
||||
{
|
||||
return ((cv::countNonZero(cv::abs(in1 - in2) > (_tol)*cv::abs(in2))) ? false : true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CV_MAT_DEPTH(in1.type()) == CV_8U)
|
||||
{
|
||||
bool a = (cv::countNonZero(cv::abs(in1 - in2) > 1) <= _tol * in2.total());
|
||||
return ((a == 1 ? 0 : 1) && ((cv::countNonZero(cv::abs(in1 - in2) > 2) <= 0) == 1 ? 0 : 1)) == 1 ? false : true;
|
||||
}
|
||||
else return cv::countNonZero(in1 != in2)==0;
|
||||
}
|
||||
}
|
||||
private:
|
||||
double _tol;
|
||||
};
|
||||
|
||||
class AbsToleranceRGBBGRFluid : public Wrappable<AbsToleranceRGBBGRFluid>
|
||||
{
|
||||
public:
|
||||
AbsToleranceRGBBGRFluid(double tol) : _tol(tol) {}
|
||||
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
|
||||
{
|
||||
bool a = (cv::countNonZero((in1 - in2) > 0) <= _tol * in2.total());
|
||||
return ((a == 1 ? 0 : 1) && ((cv::countNonZero((in1 - in2) > 1) <= 0) == 1 ? 0 : 1)) == 1 ? false : true;
|
||||
}
|
||||
private:
|
||||
double _tol;
|
||||
};
|
||||
|
||||
class ToleranceTripleFluid : public Wrappable<ToleranceTripleFluid>
|
||||
{
|
||||
public:
|
||||
ToleranceTripleFluid(double tol1, double tol2, double tol3) : _tol1(tol1), _tol2(tol2), _tol3(tol3) {}
|
||||
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
|
||||
{
|
||||
bool a = (cv::countNonZero((in1 - in2) > 0) <= _tol1 * in2.total());
|
||||
return (((a == 1 ? 0 : 1) &&
|
||||
((cv::countNonZero((in1 - in2) > 1) <= _tol2 * in2.total()) == 1 ? 0 : 1) &&
|
||||
((cv::countNonZero((in1 - in2) > 2) <= _tol3 * in2.total()) == 1 ? 0 : 1))) == 1 ? false : true;
|
||||
}
|
||||
private:
|
||||
double _tol1, _tol2, _tol3;
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RGB2GrayTestFluid, RGB2GrayTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsToleranceRGBBGRFluid(0.001).to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
Values(true, false),
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BGR2GrayTestFluid, BGR2GrayTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsToleranceRGBBGRFluid(0.001).to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
Values(true, false),
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RGB2YUVTestFluid, RGB2YUVTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(AbsToleranceRGBBGRFluid(0.15*3).to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
Values(true, false),
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(YUV2RGBTestFluid, YUV2RGBTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(ToleranceTripleFluid(0.25 * 3, 0.01 * 3, 1e-5 * 3).to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
Values(true, false),
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RGB2LabTestFluid, RGB2LabTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(ToleranceTripleFluid(0.25 * 3, 0.0, 1e-5 * 3).to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
Values(true, false),
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
// FIXME: Not supported by Fluid yet (no kernel implemented)
|
||||
INSTANTIATE_TEST_CASE_P(BGR2LUVTestFluid, BGR2LUVTest,
|
||||
Combine(Values(cv::Size(1280, 720),
|
||||
Combine(Values(ToleranceTripleFluid(0.25 * 3, 0.01 * 3, 0.0001 * 3).to_compare_f()),
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
Values(true, false),
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(blurTestFluid, BlurTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Combine(Values(AbsToleranceFluid(0.0).to_compare_f()),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(3), // add kernel size=5 when implementation is ready
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
Values(cv::BORDER_DEFAULT),
|
||||
Values(0.0),
|
||||
Values(true, false),
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(gaussBlurTestFluid, GaussianBlurTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Combine(Values(AbsToleranceGaussianBlurFluid(1e-6).to_compare_f()),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(3), // add kernel size=5 when implementation is ready
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -70,7 +178,8 @@ INSTANTIATE_TEST_CASE_P(gaussBlurTestFluid, GaussianBlurTest,
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(medianBlurTestFluid, MedianBlurTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Combine(Values(AbsExactFluid().to_compare_f()),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(3), // add kernel size=5 when implementation is ready
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -78,7 +187,8 @@ INSTANTIATE_TEST_CASE_P(medianBlurTestFluid, MedianBlurTest,
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(erodeTestFluid, ErodeTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Combine(Values(AbsExactFluid().to_compare_f()),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(3), // add kernel size=5 when implementation is ready
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -89,7 +199,8 @@ INSTANTIATE_TEST_CASE_P(erodeTestFluid, ErodeTest,
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(dilateTestFluid, DilateTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Combine(Values(AbsExactFluid().to_compare_f()),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(3), // add kernel size=5 when implementation is ready
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -100,7 +211,8 @@ INSTANTIATE_TEST_CASE_P(dilateTestFluid, DilateTest,
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SobelTestFluid, SobelTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Combine(Values(AbsExactFluid().to_compare_f()),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(3), // add kernel size=5 when implementation is ready
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -110,20 +222,20 @@ INSTANTIATE_TEST_CASE_P(SobelTestFluid, SobelTest,
|
||||
Values(true, false),
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(boxFilterTestFluid, BoxFilterTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
INSTANTIATE_TEST_CASE_P(boxFilterTestFluid32, BoxFilterTest,
|
||||
Combine(Values(AbsTolerance32FFluid(1e-6).to_compare_f()),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(3), // add kernel size=5 when implementation is ready
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
Values(cv::BORDER_DEFAULT),
|
||||
Values(-1, CV_32F),
|
||||
Values(0.0),
|
||||
Values(true, false),
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
// FIXME: Tests are failing on Fluid backend (accuracy issue?)
|
||||
INSTANTIATE_TEST_CASE_P(sepFilterTestFluid, SepFilterTest,
|
||||
Combine(Values(CV_32FC1),
|
||||
Combine(Values(AbsToleranceSepFilterFluid(1e-5f).to_compare_f()),
|
||||
Values(CV_32FC1),
|
||||
Values(3), // add kernel size=5 when implementation is ready
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480)),
|
||||
@ -132,7 +244,8 @@ INSTANTIATE_TEST_CASE_P(sepFilterTestFluid, SepFilterTest,
|
||||
Values(cv::compile_args(IMGPROC_FLUID))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(filter2DTestFluid, Filter2DTest,
|
||||
Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Combine(Values(AbsTolerance32FFluid(1e-6).to_compare_f()),
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1),
|
||||
Values(3), // add kernel size=4,5,7 when implementation ready
|
||||
Values(cv::Size(1280, 720),
|
||||
cv::Size(640, 480),
|
||||
|
Loading…
Reference in New Issue
Block a user