feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试 2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程 3.重整权利声明文件,重整代码工程,确保最小化侵权风险 Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
This commit is contained in:
9
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_core_perf_tests.cpp
vendored
Normal file
9
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_core_perf_tests.cpp
vendored
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"
|
91
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_core_perf_tests.hpp
vendored
Normal file
91
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_core_perf_tests.hpp
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
// 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-2021 Intel Corporation
|
||||
|
||||
|
||||
#ifndef OPENCV_GAPI_CORE_PERF_TESTS_HPP
|
||||
#define OPENCV_GAPI_CORE_PERF_TESTS_HPP
|
||||
|
||||
|
||||
#include "../../test/common/gapi_tests_common.hpp"
|
||||
#include "../../test/common/gapi_parsers_tests_common.hpp"
|
||||
#include <opencv2/gapi/core.hpp>
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
|
||||
enum bitwiseOp
|
||||
{
|
||||
AND = 0,
|
||||
OR = 1,
|
||||
XOR = 2,
|
||||
NOT = 3
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class AddPerfTest : public TestPerfParams<tuple<cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class AddCPerfTest : public TestPerfParams<tuple<cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class SubPerfTest : public TestPerfParams<tuple<cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class SubCPerfTest : public TestPerfParams<tuple<cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class SubRCPerfTest : public TestPerfParams<tuple<cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class MulPerfTest : public TestPerfParams<tuple<cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class MulDoublePerfTest : public TestPerfParams<tuple<cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class MulCPerfTest : public TestPerfParams<tuple<cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class DivPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class DivCPerfTest : public TestPerfParams<tuple<cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class DivRCPerfTest : public TestPerfParams<tuple<compare_f,cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class MaskPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class MeanPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class Polar2CartPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
class Cart2PolarPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
class CmpPerfTest : public TestPerfParams<tuple<CmpTypes, cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class CmpWithScalarPerfTest : public TestPerfParams<tuple<compare_f, CmpTypes, cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class BitwisePerfTest : public TestPerfParams<tuple<bitwiseOp, bool, cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class BitwiseNotPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class SelectPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class MinPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class MaxPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class AbsDiffPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class AbsDiffCPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class SumPerfTest : public TestPerfParams<tuple<compare_scalar_f, cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class CountNonZeroPerfTest : public TestPerfParams<tuple<compare_scalar_f, cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class AddWeightedPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class NormPerfTest : public TestPerfParams<tuple<compare_scalar_f, NormTypes, cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class IntegralPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class ThresholdPerfTest : public TestPerfParams<tuple<cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class ThresholdOTPerfTest : public TestPerfParams<tuple<cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class InRangePerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class Split3PerfTest : public TestPerfParams<tuple<cv::Size, cv::GCompileArgs>> {};
|
||||
class Split4PerfTest : public TestPerfParams<tuple<cv::Size, cv::GCompileArgs>> {};
|
||||
class Merge3PerfTest : public TestPerfParams<tuple<cv::Size, cv::GCompileArgs>> {};
|
||||
class Merge4PerfTest : public TestPerfParams<tuple<cv::Size, cv::GCompileArgs>> {};
|
||||
class RemapPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class FlipPerfTest : public TestPerfParams<tuple<cv::Size, MatType, int, cv::GCompileArgs>> {};
|
||||
class CropPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::Rect, cv::GCompileArgs>> {};
|
||||
class CopyPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class ConcatHorPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class ConcatHorVecPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class ConcatVertPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class ConcatVertVecPerfTest : public TestPerfParams<tuple<cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class LUTPerfTest : public TestPerfParams<tuple<MatType, MatType, cv::Size, cv::GCompileArgs>> {};
|
||||
class ConvertToPerfTest : public TestPerfParams<tuple<compare_f, MatType, int, cv::Size, double, double, cv::GCompileArgs>> {};
|
||||
class KMeansNDPerfTest : public TestPerfParams<tuple<cv::Size, CompareMats, int,
|
||||
cv::KmeansFlags, cv::GCompileArgs>> {};
|
||||
class KMeans2DPerfTest : public TestPerfParams<tuple<int, int, cv::KmeansFlags,
|
||||
cv::GCompileArgs>> {};
|
||||
class KMeans3DPerfTest : public TestPerfParams<tuple<int, int, cv::KmeansFlags,
|
||||
cv::GCompileArgs>> {};
|
||||
class TransposePerfTest : public TestPerfParams<tuple<compare_f, cv::Size, MatType, cv::GCompileArgs>> {};
|
||||
class ResizePerfTest : public TestPerfParams<tuple<compare_f, MatType, int, cv::Size, cv::Size, cv::GCompileArgs>> {};
|
||||
class ResizeFxFyPerfTest : public TestPerfParams<tuple<compare_f, MatType, int, cv::Size, double, double, cv::GCompileArgs>> {};
|
||||
class ParseSSDBLPerfTest : public TestPerfParams<tuple<cv::Size, float, int, cv::GCompileArgs>>, public ParserSSDTest {};
|
||||
class ParseSSDPerfTest : public TestPerfParams<tuple<cv::Size, float, bool, bool, cv::GCompileArgs>>, public ParserSSDTest {};
|
||||
class ParseYoloPerfTest : public TestPerfParams<tuple<cv::Size, float, float, int, cv::GCompileArgs>>, public ParserYoloTest {};
|
||||
class SizePerfTest : public TestPerfParams<tuple<MatType, cv::Size, cv::GCompileArgs>> {};
|
||||
class SizeRPerfTest : public TestPerfParams<tuple<cv::Size, cv::GCompileArgs>> {};
|
||||
}
|
||||
#endif // OPENCV_GAPI_CORE_PERF_TESTS_HPP
|
2348
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp
vendored
Normal file
2348
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_core_perf_tests_inl.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_imgproc_perf_tests.cpp
vendored
Normal file
9
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_imgproc_perf_tests.cpp
vendored
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"
|
104
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_imgproc_perf_tests.hpp
vendored
Normal file
104
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_imgproc_perf_tests.hpp
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
// 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-2020 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>
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
|
||||
using namespace perf;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
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 MorphologyExPerfTest : public TestPerfParams<tuple<compare_f,MatType,cv::Size,
|
||||
cv::MorphTypes,cv::GCompileArgs>> {};
|
||||
class SobelPerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int,int,int, cv::GCompileArgs>> {};
|
||||
class SobelXYPerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int,int, cv::GCompileArgs>> {};
|
||||
class LaplacianPerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int,
|
||||
cv::GCompileArgs>> {};
|
||||
class BilateralFilterPerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int, double,double,
|
||||
cv::GCompileArgs>> {};
|
||||
class CannyPerfTest : public TestPerfParams<tuple<compare_f, MatType,cv::Size,double,double,int,bool,
|
||||
cv::GCompileArgs>> {};
|
||||
class GoodFeaturesPerfTest : public TestPerfParams<tuple<compare_vector_f<cv::Point2f>, std::string,
|
||||
int,int,double,double,int,bool,
|
||||
cv::GCompileArgs>> {};
|
||||
class FindContoursPerfTest : public TestPerfParams<tuple<CompareMats, MatType,cv::Size,
|
||||
cv::RetrievalModes,
|
||||
cv::ContourApproximationModes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FindContoursHPerfTest : public TestPerfParams<tuple<CompareMats, MatType,cv::Size,
|
||||
cv::RetrievalModes,
|
||||
cv::ContourApproximationModes,
|
||||
cv::GCompileArgs>> {};
|
||||
class BoundingRectMatPerfTest :
|
||||
public TestPerfParams<tuple<CompareRects, MatType,cv::Size,bool, cv::GCompileArgs>> {};
|
||||
class BoundingRectVector32SPerfTest :
|
||||
public TestPerfParams<tuple<CompareRects, cv::Size, cv::GCompileArgs>> {};
|
||||
class BoundingRectVector32FPerfTest :
|
||||
public TestPerfParams<tuple<CompareRects, cv::Size, cv::GCompileArgs>> {};
|
||||
class FitLine2DMatVectorPerfTest : public TestPerfParams<tuple<CompareVecs<float, 4>,
|
||||
MatType,cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine2DVector32SPerfTest : public TestPerfParams<tuple<CompareVecs<float, 4>,
|
||||
cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine2DVector32FPerfTest : public TestPerfParams<tuple<CompareVecs<float, 4>,
|
||||
cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine2DVector64FPerfTest : public TestPerfParams<tuple<CompareVecs<float, 4>,
|
||||
cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine3DMatVectorPerfTest : public TestPerfParams<tuple<CompareVecs<float, 6>,
|
||||
MatType,cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine3DVector32SPerfTest : public TestPerfParams<tuple<CompareVecs<float, 6>,
|
||||
cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine3DVector32FPerfTest : public TestPerfParams<tuple<CompareVecs<float, 6>,
|
||||
cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine3DVector64FPerfTest : public TestPerfParams<tuple<CompareVecs<float, 6>,
|
||||
cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class EqHistPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
class BGR2RGBPerfTest : 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 BGR2I420PerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
class RGB2I420PerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
class I4202BGRPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
class I4202RGBPerfTest : 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>> {};
|
||||
class RGB2HSVPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
class BayerGR2RGBPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
class RGB2YUV422PerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
|
||||
} // opencv_test
|
||||
|
||||
#endif //OPENCV_GAPI_IMGPROC_PERF_TESTS_HPP
|
1765
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_imgproc_perf_tests_inl.hpp
vendored
Normal file
1765
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_imgproc_perf_tests_inl.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_render_perf_tests.cpp
vendored
Normal file
9
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_render_perf_tests.cpp
vendored
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) 2020 Intel Corporation
|
||||
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "gapi_render_perf_tests_inl.hpp"
|
43
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_render_perf_tests.hpp
vendored
Normal file
43
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_render_perf_tests.hpp
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
// 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) 2020 Intel Corporation
|
||||
|
||||
|
||||
#ifndef OPENCV_GAPI_RENDER_PERF_TESTS_HPP
|
||||
#define OPENCV_GAPI_RENDER_PERF_TESTS_HPP
|
||||
|
||||
|
||||
#include "../../test/common/gapi_tests_common.hpp"
|
||||
#include <opencv2/gapi/render/render.hpp>
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
|
||||
using namespace perf;
|
||||
|
||||
class RenderTestFTexts : public TestPerfParams<tuple<std::wstring, cv::Size, cv::Point,
|
||||
int, cv::Scalar, cv::GCompileArgs>> {};
|
||||
class RenderTestTexts : public TestPerfParams<tuple<std::string, cv::Size, cv::Point,
|
||||
int, cv::Scalar, int, int,
|
||||
bool, cv::GCompileArgs>> {};
|
||||
class RenderTestRects : public TestPerfParams<tuple<cv::Size, cv::Rect, cv::Scalar,
|
||||
int, int, int, cv::GCompileArgs>> {};
|
||||
class RenderTestCircles : public TestPerfParams<tuple<cv::Size, cv::Point, int,
|
||||
cv::Scalar, int, int, int,
|
||||
cv::GCompileArgs>> {};
|
||||
class RenderTestLines : public TestPerfParams<tuple<cv::Size, cv::Point, cv::Point,
|
||||
cv::Scalar, int, int, int,
|
||||
cv::GCompileArgs>> {};
|
||||
class RenderTestMosaics : public TestPerfParams<tuple<cv::Size, cv::Rect, int, int,
|
||||
cv::GCompileArgs>> {};
|
||||
class RenderTestImages : public TestPerfParams<tuple<cv::Size, cv::Rect, cv::Scalar, double,
|
||||
cv::GCompileArgs>> {};
|
||||
class RenderTestPolylines : public TestPerfParams<tuple<cv::Size, std::vector<cv::Point>,
|
||||
cv::Scalar, int, int, int,
|
||||
cv::GCompileArgs>> {};
|
||||
class RenderTestPolyItems : public TestPerfParams<tuple<cv::Size, int, int, int, cv::GCompileArgs>> {};
|
||||
|
||||
}
|
||||
#endif //OPENCV_GAPI_RENDER_PERF_TESTS_HPP
|
827
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_render_perf_tests_inl.hpp
vendored
Normal file
827
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_render_perf_tests_inl.hpp
vendored
Normal file
@ -0,0 +1,827 @@
|
||||
// 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) 2020 Intel Corporation
|
||||
|
||||
|
||||
#include "gapi_render_perf_tests.hpp"
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
|
||||
namespace {
|
||||
void create_rand_mats(const cv::Size &size, MatType type, cv::Mat &ref_mat, cv::Mat &gapi_mat)
|
||||
{
|
||||
ref_mat.create(size, type);
|
||||
cv::randu(ref_mat, cv::Scalar::all(0), cv::Scalar::all(255));
|
||||
ref_mat.copyTo(gapi_mat);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
PERF_TEST_P_(RenderTestFTexts, RenderFTextsPerformanceBGROCVTest)
|
||||
{
|
||||
std::wstring text;
|
||||
cv::Size sz;
|
||||
cv::Point org;
|
||||
int fh = 0;
|
||||
cv::Scalar color;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(text ,sz ,org ,fh ,color, comp_args) = GetParam();
|
||||
|
||||
MatType type = CV_8UC3;
|
||||
cv::Mat gapi_mat, ref_mat;
|
||||
create_rand_mats(sz, type, ref_mat, gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::FText{text, org, fh, color});
|
||||
|
||||
cv::GMat in;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
|
||||
cv::GComputation comp(cv::GIn(in, arr),
|
||||
cv::GOut(cv::gapi::wip::draw::render3ch(in, arr)));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestFTexts, RenderFTextsPerformanceNV12OCVTest)
|
||||
{
|
||||
std::wstring text;
|
||||
cv::Size sz;
|
||||
cv::Point org;
|
||||
int fh = 0;
|
||||
cv::Scalar color;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(text ,sz ,org ,fh ,color, comp_args) = GetParam();
|
||||
|
||||
cv::Mat y_ref_mat, uv_ref_mat;
|
||||
|
||||
cv::Mat y_in_gapi_mat, uv_in_gapi_mat,
|
||||
y_out_gapi_mat, uv_out_gapi_mat;
|
||||
|
||||
create_rand_mats(sz, CV_8UC1, y_ref_mat, y_in_gapi_mat);
|
||||
create_rand_mats(sz / 2, CV_8UC2, uv_ref_mat, uv_in_gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::FText{text, org, fh, color});
|
||||
|
||||
cv::GMat y_in, uv_in, y_out, uv_out;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
std::tie(y_out, uv_out) = cv::gapi::wip::draw::renderNV12(y_in, uv_in, arr);
|
||||
|
||||
cv::GComputation comp(cv::GIn(y_in, uv_in, arr), cv::GOut(y_out, uv_out));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestTexts, RenderTextsPerformanceBGROCVTest)
|
||||
{
|
||||
cv::Point org;
|
||||
int ff = 0;
|
||||
int thick = 0;
|
||||
int lt = 0;
|
||||
double fs = 2.0;
|
||||
cv::Scalar color;
|
||||
bool blo = false;
|
||||
std::string text;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(text, sz, org, ff, color, thick, lt, blo, comp_args) = GetParam();
|
||||
|
||||
MatType type = CV_8UC3;
|
||||
cv::Mat gapi_mat, ref_mat;
|
||||
create_rand_mats(sz, type, ref_mat, gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Text{text, org, ff, fs, color, thick, lt, blo});
|
||||
|
||||
cv::GMat in;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
|
||||
cv::GComputation comp(cv::GIn(in, arr),
|
||||
cv::GOut(cv::gapi::wip::draw::render3ch(in, arr)));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestTexts, RenderTextsPerformanceNV12OCVTest)
|
||||
{
|
||||
cv::Point org;
|
||||
int ff = 0;
|
||||
int thick = 0;
|
||||
int lt = 0;
|
||||
double fs = 2.0;
|
||||
cv::Scalar color;
|
||||
bool blo = false;
|
||||
std::string text;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(text, sz, org, ff, color, thick, lt, blo, comp_args) = GetParam();
|
||||
|
||||
cv::Mat y_ref_mat, uv_ref_mat;
|
||||
|
||||
cv::Mat y_in_gapi_mat, uv_in_gapi_mat,
|
||||
y_out_gapi_mat, uv_out_gapi_mat;
|
||||
|
||||
create_rand_mats(sz, CV_8UC1, y_ref_mat, y_in_gapi_mat);
|
||||
create_rand_mats(sz / 2, CV_8UC2, uv_ref_mat, uv_in_gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Text{text, org, ff, fs, color, thick, lt, blo});
|
||||
|
||||
cv::GMat y_in, uv_in, y_out, uv_out;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
std::tie(y_out, uv_out) = cv::gapi::wip::draw::renderNV12(y_in, uv_in, arr);
|
||||
|
||||
cv::GComputation comp(cv::GIn(y_in, uv_in, arr), cv::GOut(y_out, uv_out));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestRects, RenderRectsPerformanceBGROCVTest)
|
||||
{
|
||||
cv::Rect rect;
|
||||
cv::Scalar color;
|
||||
int thick = 0;
|
||||
int lt = 0;
|
||||
int shift = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, rect, color, thick, lt, shift, comp_args) = GetParam();
|
||||
|
||||
MatType type = CV_8UC3;
|
||||
cv::Mat gapi_mat, ref_mat;
|
||||
create_rand_mats(sz, type, ref_mat, gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Rect{rect, color, thick, lt, shift});
|
||||
|
||||
cv::GMat in;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
|
||||
cv::GComputation comp(cv::GIn(in, arr),
|
||||
cv::GOut(cv::gapi::wip::draw::render3ch(in, arr)));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestRects, RenderRectsPerformanceNV12OCVTest)
|
||||
{
|
||||
cv::Rect rect;
|
||||
cv::Scalar color;
|
||||
int thick = 0;
|
||||
int lt = 0;
|
||||
int shift = 0;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, rect, color, thick, lt, shift, comp_args) = GetParam();
|
||||
|
||||
cv::Mat y_ref_mat, uv_ref_mat;
|
||||
|
||||
cv::Mat y_in_gapi_mat, uv_in_gapi_mat,
|
||||
y_out_gapi_mat, uv_out_gapi_mat;
|
||||
|
||||
create_rand_mats(sz, CV_8UC1, y_ref_mat, y_in_gapi_mat);
|
||||
create_rand_mats(sz / 2, CV_8UC2, uv_ref_mat, uv_in_gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Rect{rect, color, thick, lt, shift});
|
||||
|
||||
cv::GMat y_in, uv_in, y_out, uv_out;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
std::tie(y_out, uv_out) = cv::gapi::wip::draw::renderNV12(y_in, uv_in, arr);
|
||||
|
||||
cv::GComputation comp(cv::GIn(y_in, uv_in, arr), cv::GOut(y_out, uv_out));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestCircles, RenderCirclesPerformanceBGROCVTest)
|
||||
{
|
||||
cv::Point center;
|
||||
int radius;
|
||||
cv::Scalar color;
|
||||
int thick = 0;
|
||||
int lt = 0;
|
||||
int shift = 0;
|
||||
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, center, radius, color, thick, lt, shift, comp_args) = GetParam();
|
||||
|
||||
MatType type = CV_8UC3;
|
||||
cv::Mat gapi_mat, ref_mat;
|
||||
create_rand_mats(sz, type, ref_mat, gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Circle{center, radius, color, thick, lt, shift});
|
||||
|
||||
cv::GMat in;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
|
||||
cv::GComputation comp(cv::GIn(in, arr),
|
||||
cv::GOut(cv::gapi::wip::draw::render3ch(in, arr)));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestCircles, RenderCirclesPerformanceNV12OCVTest)
|
||||
{
|
||||
cv::Point center;
|
||||
int radius;
|
||||
cv::Scalar color;
|
||||
int thick = 0;
|
||||
int lt = 0;
|
||||
int shift = 0;
|
||||
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, center, radius, color, thick, lt, shift, comp_args) = GetParam();
|
||||
|
||||
cv::Mat y_ref_mat, uv_ref_mat;
|
||||
|
||||
cv::Mat y_in_gapi_mat, uv_in_gapi_mat,
|
||||
y_out_gapi_mat, uv_out_gapi_mat;
|
||||
|
||||
create_rand_mats(sz, CV_8UC1, y_ref_mat, y_in_gapi_mat);
|
||||
create_rand_mats(sz / 2, CV_8UC2, uv_ref_mat, uv_in_gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Circle{center, radius, color, thick, lt, shift});
|
||||
|
||||
cv::GMat y_in, uv_in, y_out, uv_out;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
std::tie(y_out, uv_out) = cv::gapi::wip::draw::renderNV12(y_in, uv_in, arr);
|
||||
|
||||
cv::GComputation comp(cv::GIn(y_in, uv_in, arr), cv::GOut(y_out, uv_out));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestLines, RenderLinesPerformanceBGROCVTest)
|
||||
{
|
||||
cv::Point pt1;
|
||||
cv::Point pt2;
|
||||
cv::Scalar color;
|
||||
int thick = 0;
|
||||
int lt = 0;
|
||||
int shift = 0;
|
||||
|
||||
compare_f cmpF;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, pt1, pt2, color, thick, lt, shift, comp_args) = GetParam();
|
||||
|
||||
MatType type = CV_8UC3;
|
||||
cv::Mat gapi_mat, ref_mat;
|
||||
create_rand_mats(sz, type, ref_mat, gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Line{pt1, pt2, color, thick, lt, shift});
|
||||
|
||||
cv::GMat in;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
|
||||
cv::GComputation comp(cv::GIn(in, arr),
|
||||
cv::GOut(cv::gapi::wip::draw::render3ch(in, arr)));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestLines, RenderLinesPerformanceNV12OCVTest)
|
||||
{
|
||||
cv::Point pt1;
|
||||
cv::Point pt2;
|
||||
cv::Scalar color;
|
||||
int thick = 0;
|
||||
int lt = 0;
|
||||
int shift = 0;
|
||||
|
||||
compare_f cmpF;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, pt1, pt2, color, thick, lt, shift, comp_args) = GetParam();
|
||||
|
||||
cv::Mat y_ref_mat, uv_ref_mat;
|
||||
|
||||
cv::Mat y_in_gapi_mat, uv_in_gapi_mat,
|
||||
y_out_gapi_mat, uv_out_gapi_mat;
|
||||
|
||||
create_rand_mats(sz, CV_8UC1, y_ref_mat, y_in_gapi_mat);
|
||||
create_rand_mats(sz / 2, CV_8UC2, uv_ref_mat, uv_in_gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Line{pt1, pt2, color, thick, lt, shift});
|
||||
|
||||
cv::GMat y_in, uv_in, y_out, uv_out;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
std::tie(y_out, uv_out) = cv::gapi::wip::draw::renderNV12(y_in, uv_in, arr);
|
||||
|
||||
cv::GComputation comp(cv::GIn(y_in, uv_in, arr), cv::GOut(y_out, uv_out));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestMosaics, RenderMosaicsPerformanceBGROCVTest)
|
||||
{
|
||||
cv::Rect mos;
|
||||
int cellsz = 0;
|
||||
int decim = 0;
|
||||
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, mos, cellsz, decim, comp_args) = GetParam();
|
||||
|
||||
MatType type = CV_8UC3;
|
||||
cv::Mat gapi_mat, ref_mat;
|
||||
create_rand_mats(sz, type, ref_mat, gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Mosaic{mos, cellsz, decim});
|
||||
|
||||
cv::GMat in;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
|
||||
cv::GComputation comp(cv::GIn(in, arr),
|
||||
cv::GOut(cv::gapi::wip::draw::render3ch(in, arr)));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
|
||||
PERF_TEST_P_(RenderTestMosaics, RenderMosaicsPerformanceNV12OCVTest)
|
||||
{
|
||||
cv::Rect mos;
|
||||
int cellsz = 0;
|
||||
int decim = 0;
|
||||
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, mos, cellsz, decim, comp_args) = GetParam();
|
||||
|
||||
cv::Mat y_ref_mat, uv_ref_mat;
|
||||
|
||||
cv::Mat y_in_gapi_mat, uv_in_gapi_mat,
|
||||
y_out_gapi_mat, uv_out_gapi_mat;
|
||||
|
||||
create_rand_mats(sz, CV_8UC1, y_ref_mat, y_in_gapi_mat);
|
||||
create_rand_mats(sz / 2, CV_8UC2, uv_ref_mat, uv_in_gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Mosaic{mos, cellsz, decim});
|
||||
|
||||
cv::GMat y_in, uv_in, y_out, uv_out;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
std::tie(y_out, uv_out) = cv::gapi::wip::draw::renderNV12(y_in, uv_in, arr);
|
||||
|
||||
cv::GComputation comp(cv::GIn(y_in, uv_in, arr), cv::GOut(y_out, uv_out));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestImages, RenderImagesPerformanceBGROCVTest)
|
||||
{
|
||||
cv::Rect rect;
|
||||
cv::Scalar color;
|
||||
double transparency = 0.0;
|
||||
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, rect, color, transparency, comp_args) = GetParam();
|
||||
|
||||
MatType type = CV_8UC3;
|
||||
cv::Mat gapi_mat, ref_mat;
|
||||
create_rand_mats(sz, type, ref_mat, gapi_mat);
|
||||
|
||||
cv::Mat img(rect.size(), CV_8UC3, color);
|
||||
cv::Mat alpha(rect.size(), CV_32FC1, transparency);
|
||||
auto tl = rect.tl();
|
||||
cv::Point org = {tl.x, tl.y + rect.size().height};
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Image{org, img, alpha});
|
||||
cv::gapi::wip::draw::render(gapi_mat, prims);
|
||||
|
||||
cv::GMat in;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
|
||||
cv::GComputation comp(cv::GIn(in, arr),
|
||||
cv::GOut(cv::gapi::wip::draw::render3ch(in, arr)));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestImages, RenderImagesPerformanceNV12OCVTest)
|
||||
{
|
||||
cv::Rect rect;
|
||||
cv::Scalar color;
|
||||
double transparency = 0.0;
|
||||
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, rect, color, transparency, comp_args) = GetParam();
|
||||
|
||||
cv::Mat y_ref_mat, uv_ref_mat;
|
||||
|
||||
cv::Mat y_in_gapi_mat, uv_in_gapi_mat,
|
||||
y_out_gapi_mat, uv_out_gapi_mat;
|
||||
|
||||
create_rand_mats(sz, CV_8UC1, y_ref_mat, y_in_gapi_mat);
|
||||
create_rand_mats(sz / 2, CV_8UC2, uv_ref_mat, uv_in_gapi_mat);
|
||||
|
||||
cv::Mat img(rect.size(), CV_8UC3, color);
|
||||
cv::Mat alpha(rect.size(), CV_32FC1, transparency);
|
||||
auto tl = rect.tl();
|
||||
cv::Point org = {tl.x, tl.y + rect.size().height};
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Image{org, img, alpha});
|
||||
|
||||
cv::GMat y_in, uv_in, y_out, uv_out;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
std::tie(y_out, uv_out) = cv::gapi::wip::draw::renderNV12(y_in, uv_in, arr);
|
||||
|
||||
cv::GComputation comp(cv::GIn(y_in, uv_in, arr), cv::GOut(y_out, uv_out));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestPolylines, RenderPolylinesPerformanceBGROCVTest)
|
||||
{
|
||||
std::vector<cv::Point> points;
|
||||
cv::Scalar color;
|
||||
int thick = 0;
|
||||
int lt = 0;
|
||||
int shift = 0;
|
||||
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, points, color, thick, lt, shift, comp_args) = GetParam();
|
||||
|
||||
MatType type = CV_8UC3;
|
||||
cv::Mat gapi_mat, ref_mat;
|
||||
create_rand_mats(sz, type, ref_mat, gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Poly{points, color, thick, lt, shift});
|
||||
|
||||
cv::GMat in;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
|
||||
cv::GComputation comp(cv::GIn(in, arr),
|
||||
cv::GOut(cv::gapi::wip::draw::render3ch(in, arr)));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestPolylines, RenderPolylinesPerformanceNV12OCVTest)
|
||||
{
|
||||
std::vector<cv::Point> points;
|
||||
cv::Scalar color;
|
||||
int thick = 0;
|
||||
int lt = 0;
|
||||
int shift = 0;
|
||||
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, points, color, thick, lt, shift, comp_args) = GetParam();
|
||||
|
||||
cv::Mat y_ref_mat, uv_ref_mat;
|
||||
|
||||
cv::Mat y_in_gapi_mat, uv_in_gapi_mat,
|
||||
y_out_gapi_mat, uv_out_gapi_mat;
|
||||
|
||||
create_rand_mats(sz, CV_8UC1, y_ref_mat, y_in_gapi_mat);
|
||||
create_rand_mats(sz / 2, CV_8UC2, uv_ref_mat, uv_in_gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
prims.emplace_back(cv::gapi::wip::draw::Poly{points, color, thick, lt, shift});
|
||||
|
||||
cv::GMat y_in, uv_in, y_out, uv_out;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
std::tie(y_out, uv_out) = cv::gapi::wip::draw::renderNV12(y_in, uv_in, arr);
|
||||
|
||||
cv::GComputation comp(cv::GIn(y_in, uv_in, arr), cv::GOut(y_out, uv_out));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestPolyItems, RenderPolyItemsPerformanceBGROCVTest)
|
||||
{
|
||||
cv::Size sz;
|
||||
int rects_num = 0;
|
||||
int text_num = 0;
|
||||
int image_num = 0;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, rects_num, text_num, image_num, comp_args) = GetParam();
|
||||
|
||||
int thick = 2;
|
||||
int lt = LINE_8;
|
||||
cv::Scalar color(100, 50, 150);
|
||||
|
||||
MatType type = CV_8UC3;
|
||||
cv::Mat gapi_mat, ref_mat;
|
||||
create_rand_mats(sz, type, ref_mat, gapi_mat);
|
||||
cv::Mat gapi_out_mat(sz, type);
|
||||
gapi_mat.copyTo(gapi_out_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
|
||||
// Rects
|
||||
int shift = 0;
|
||||
for (int i = 0; i < rects_num; ++i) {
|
||||
cv::Rect rect(200 + i, 200 + i, 200, 200);
|
||||
prims.emplace_back(cv::gapi::wip::draw::Rect(rect, color, thick, lt, shift));
|
||||
}
|
||||
|
||||
// Mosaic
|
||||
int cellsz = 25;
|
||||
int decim = 0;
|
||||
for (int i = 0; i < rects_num; ++i) {
|
||||
cv::Rect mos(200 + i, 200 + i, 200, 200);
|
||||
prims.emplace_back(cv::gapi::wip::draw::Mosaic(mos, cellsz, decim));
|
||||
}
|
||||
|
||||
// Text
|
||||
std::string text = "Some text";
|
||||
int ff = FONT_HERSHEY_SIMPLEX;
|
||||
double fs = 2.0;
|
||||
bool blo = false;
|
||||
for (int i = 0; i < text_num; ++i) {
|
||||
cv::Point org(200 + i, 200 + i);
|
||||
prims.emplace_back(cv::gapi::wip::draw::Text(text, org, ff, fs, color, thick, lt, blo));
|
||||
}
|
||||
|
||||
// Image
|
||||
double transparency = 1.0;
|
||||
cv::Rect rect_img(0 ,0 , 50, 50);
|
||||
cv::Mat img(rect_img.size(), CV_8UC3, color);
|
||||
cv::Mat alpha(rect_img.size(), CV_32FC1, transparency);
|
||||
auto tl = rect_img.tl();
|
||||
for (int i = 0; i < image_num; ++i) {
|
||||
cv::Point org_img = {tl.x + i, tl.y + rect_img.size().height + i};
|
||||
|
||||
prims.emplace_back(cv::gapi::wip::draw::Image({org_img, img, alpha}));
|
||||
}
|
||||
|
||||
cv::GMat in;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
|
||||
cv::GComputation comp(cv::GIn(in, arr),
|
||||
cv::GOut(cv::gapi::wip::draw::render3ch(in, arr)));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_out_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(gin(gapi_mat, prims), gout(gapi_out_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(RenderTestPolyItems, RenderPolyItemsPerformanceNV12OCVTest)
|
||||
{
|
||||
cv::Size sz;
|
||||
int rects_num = 0;
|
||||
int text_num = 0;
|
||||
int image_num = 0;
|
||||
cv::GCompileArgs comp_args;
|
||||
std::tie(sz, rects_num, text_num, image_num, comp_args) = GetParam();
|
||||
|
||||
int thick = 2;
|
||||
int lt = LINE_8;
|
||||
cv::Scalar color(100, 50, 150);
|
||||
|
||||
cv::Mat y_ref_mat, uv_ref_mat;
|
||||
|
||||
cv::Mat y_in_gapi_mat, uv_in_gapi_mat,
|
||||
y_out_gapi_mat, uv_out_gapi_mat;
|
||||
|
||||
create_rand_mats(sz, CV_8UC1, y_ref_mat, y_in_gapi_mat);
|
||||
create_rand_mats(sz / 2, CV_8UC2, uv_ref_mat, uv_in_gapi_mat);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::gapi::wip::draw::Prims prims;
|
||||
|
||||
// Rects
|
||||
int shift = 0;
|
||||
for (int i = 0; i < rects_num; ++i) {
|
||||
cv::Rect rect(200 + i, 200 + i, 200, 200);
|
||||
prims.emplace_back(cv::gapi::wip::draw::Rect(rect, color, thick, lt, shift));
|
||||
}
|
||||
|
||||
// Mosaic
|
||||
int cellsz = 25;
|
||||
int decim = 0;
|
||||
for (int i = 0; i < rects_num; ++i) {
|
||||
cv::Rect mos(200 + i, 200 + i, 200, 200);
|
||||
prims.emplace_back(cv::gapi::wip::draw::Mosaic(mos, cellsz, decim));
|
||||
}
|
||||
|
||||
// Text
|
||||
std::string text = "Some text";
|
||||
int ff = FONT_HERSHEY_SIMPLEX;
|
||||
double fs = 2.0;
|
||||
bool blo = false;
|
||||
for (int i = 0; i < text_num; ++i) {
|
||||
cv::Point org(200 + i, 200 + i);
|
||||
prims.emplace_back(cv::gapi::wip::draw::Text(text, org, ff, fs, color, thick, lt, blo));
|
||||
}
|
||||
|
||||
// Image
|
||||
double transparency = 1.0;
|
||||
cv::Rect rect_img(0 ,0 , 50, 50);
|
||||
cv::Mat img(rect_img.size(), CV_8UC3, color);
|
||||
cv::Mat alpha(rect_img.size(), CV_32FC1, transparency);
|
||||
auto tl = rect_img.tl();
|
||||
for (int i = 0; i < image_num; ++i) {
|
||||
cv::Point org_img = {tl.x + i, tl.y + rect_img.size().height + i};
|
||||
|
||||
prims.emplace_back(cv::gapi::wip::draw::Image({org_img, img, alpha}));
|
||||
}
|
||||
|
||||
cv::GMat y_in, uv_in, y_out, uv_out;
|
||||
cv::GArray<cv::gapi::wip::draw::Prim> arr;
|
||||
std::tie(y_out, uv_out) = cv::gapi::wip::draw::renderNV12(y_in, uv_in, arr);
|
||||
|
||||
cv::GComputation comp(cv::GIn(y_in, uv_in, arr), cv::GOut(y_out, uv_out));
|
||||
|
||||
// Warm-up graph engine:
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat), std::move(comp_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
comp.apply(cv::gin(y_in_gapi_mat, uv_in_gapi_mat, prims),
|
||||
cv::gout(y_out_gapi_mat, uv_out_gapi_mat));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} // namespace opencv_test
|
9
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_video_perf_tests.cpp
vendored
Normal file
9
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_video_perf_tests.cpp
vendored
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) 2020 Intel Corporation
|
||||
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "gapi_video_perf_tests_inl.hpp"
|
40
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_video_perf_tests.hpp
vendored
Normal file
40
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_video_perf_tests.hpp
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
// 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) 2020 Intel Corporation
|
||||
|
||||
#ifndef OPENCV_GAPI_VIDEO_PERF_TESTS_HPP
|
||||
#define OPENCV_GAPI_VIDEO_PERF_TESTS_HPP
|
||||
|
||||
#include "../../test/common/gapi_video_tests_common.hpp"
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
|
||||
using namespace perf;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class BuildOptFlowPyramidPerfTest : public TestPerfParams<tuple<std::string,int,int,bool,int,int,
|
||||
bool,GCompileArgs>> {};
|
||||
class OptFlowLKPerfTest : public TestPerfParams<tuple<std::string,int,tuple<int,int>,int,
|
||||
cv::TermCriteria,cv::GCompileArgs>> {};
|
||||
class OptFlowLKForPyrPerfTest : public TestPerfParams<tuple<std::string,int,tuple<int,int>,int,
|
||||
cv::TermCriteria,bool,
|
||||
cv::GCompileArgs>> {};
|
||||
class BuildPyr_CalcOptFlow_PipelinePerfTest : public TestPerfParams<tuple<std::string,int,int,bool,
|
||||
cv::GCompileArgs>> {};
|
||||
|
||||
class BackgroundSubtractorPerfTest:
|
||||
public TestPerfParams<tuple<cv::gapi::video::BackgroundSubtractorType, std::string,
|
||||
bool, double, std::size_t, cv::GCompileArgs, CompareMats>> {};
|
||||
|
||||
class KalmanFilterControlPerfTest :
|
||||
public TestPerfParams<tuple<MatType2, int, int, size_t, bool, cv::GCompileArgs>> {};
|
||||
class KalmanFilterNoControlPerfTest :
|
||||
public TestPerfParams<tuple<MatType2, int, int, size_t, bool, cv::GCompileArgs>> {};
|
||||
|
||||
} // opencv_test
|
||||
|
||||
#endif // OPENCV_GAPI_VIDEO_PERF_TESTS_HPP
|
398
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_video_perf_tests_inl.hpp
vendored
Normal file
398
3rdparty/opencv-4.5.4/modules/gapi/perf/common/gapi_video_perf_tests_inl.hpp
vendored
Normal file
@ -0,0 +1,398 @@
|
||||
// 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) 2020 Intel Corporation
|
||||
|
||||
#ifndef OPENCV_GAPI_VIDEO_PERF_TESTS_INL_HPP
|
||||
#define OPENCV_GAPI_VIDEO_PERF_TESTS_INL_HPP
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "gapi_video_perf_tests.hpp"
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
|
||||
using namespace perf;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(BuildOptFlowPyramidPerfTest, TestPerformance)
|
||||
{
|
||||
std::vector<Mat> outPyrOCV, outPyrGAPI;
|
||||
int outMaxLevelOCV = 0, outMaxLevelGAPI = 0;
|
||||
Scalar outMaxLevelSc;
|
||||
|
||||
BuildOpticalFlowPyramidTestParams params;
|
||||
std::tie(params.fileName, params.winSize,
|
||||
params.maxLevel, params.withDerivatives,
|
||||
params.pyrBorder, params.derivBorder,
|
||||
params.tryReuseInputImage, params.compileArgs) = GetParam();
|
||||
|
||||
BuildOpticalFlowPyramidTestOutput outOCV { outPyrOCV, outMaxLevelOCV };
|
||||
BuildOpticalFlowPyramidTestOutput outGAPI { outPyrGAPI, outMaxLevelGAPI };
|
||||
|
||||
GComputation c = runOCVnGAPIBuildOptFlowPyramid(*this, params, outOCV, outGAPI);
|
||||
|
||||
declare.in(in_mat1).out(outPyrGAPI);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(in_mat1), cv::gout(outPyrGAPI, outMaxLevelSc));
|
||||
}
|
||||
outMaxLevelGAPI = static_cast<int>(outMaxLevelSc[0]);
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
compareOutputPyramids(outGAPI, outOCV);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(OptFlowLKPerfTest, TestPerformance)
|
||||
{
|
||||
std::vector<cv::Point2f> outPtsOCV, outPtsGAPI, inPts;
|
||||
std::vector<uchar> outStatusOCV, outStatusGAPI;
|
||||
std::vector<float> outErrOCV, outErrGAPI;
|
||||
|
||||
OptFlowLKTestParams params;
|
||||
std::tie(params.fileNamePattern, params.channels,
|
||||
params.pointsNum, params.winSize, params.criteria,
|
||||
params.compileArgs) = GetParam();
|
||||
|
||||
OptFlowLKTestOutput outOCV { outPtsOCV, outStatusOCV, outErrOCV };
|
||||
OptFlowLKTestOutput outGAPI { outPtsGAPI, outStatusGAPI, outErrGAPI };
|
||||
|
||||
cv::GComputation c = runOCVnGAPIOptFlowLK(*this, inPts, params, outOCV, outGAPI);
|
||||
|
||||
declare.in(in_mat1, in_mat2, inPts).out(outPtsGAPI, outStatusGAPI, outErrGAPI);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(in_mat1, in_mat2, inPts, std::vector<cv::Point2f>{ }),
|
||||
cv::gout(outPtsGAPI, outStatusGAPI, outErrGAPI));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
compareOutputsOptFlow(outGAPI, outOCV);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(OptFlowLKForPyrPerfTest, TestPerformance)
|
||||
{
|
||||
std::vector<cv::Mat> inPyr1, inPyr2;
|
||||
std::vector<cv::Point2f> outPtsOCV, outPtsGAPI, inPts;
|
||||
std::vector<uchar> outStatusOCV, outStatusGAPI;
|
||||
std::vector<float> outErrOCV, outErrGAPI;
|
||||
|
||||
bool withDeriv = false;
|
||||
OptFlowLKTestParams params;
|
||||
std::tie(params.fileNamePattern, params.channels,
|
||||
params.pointsNum, params.winSize, params.criteria,
|
||||
withDeriv, params.compileArgs) = GetParam();
|
||||
|
||||
OptFlowLKTestInput<std::vector<cv::Mat>> in { inPyr1, inPyr2, inPts };
|
||||
OptFlowLKTestOutput outOCV { outPtsOCV, outStatusOCV, outErrOCV };
|
||||
OptFlowLKTestOutput outGAPI { outPtsGAPI, outStatusGAPI, outErrGAPI };
|
||||
|
||||
cv::GComputation c = runOCVnGAPIOptFlowLKForPyr(*this, in, params, withDeriv, outOCV, outGAPI);
|
||||
|
||||
declare.in(inPyr1, inPyr2, inPts).out(outPtsGAPI, outStatusGAPI, outErrGAPI);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(inPyr1, inPyr2, inPts, std::vector<cv::Point2f>{ }),
|
||||
cv::gout(outPtsGAPI, outStatusGAPI, outErrGAPI));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
compareOutputsOptFlow(outGAPI, outOCV);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(BuildPyr_CalcOptFlow_PipelinePerfTest, TestPerformance)
|
||||
{
|
||||
std::vector<Point2f> outPtsOCV, outPtsGAPI, inPts;
|
||||
std::vector<uchar> outStatusOCV, outStatusGAPI;
|
||||
std::vector<float> outErrOCV, outErrGAPI;
|
||||
|
||||
BuildOpticalFlowPyramidTestParams params;
|
||||
params.pyrBorder = BORDER_DEFAULT;
|
||||
params.derivBorder = BORDER_DEFAULT;
|
||||
params.tryReuseInputImage = true;
|
||||
std::tie(params.fileName, params.winSize,
|
||||
params.maxLevel, params.withDerivatives,
|
||||
params.compileArgs) = GetParam();
|
||||
|
||||
auto customKernel = gapi::kernels<GCPUMinScalar>();
|
||||
auto kernels = gapi::combine(customKernel,
|
||||
params.compileArgs[0].get<gapi::GKernelPackage>());
|
||||
params.compileArgs = compile_args(kernels);
|
||||
|
||||
OptFlowLKTestOutput outOCV { outPtsOCV, outStatusOCV, outErrOCV };
|
||||
OptFlowLKTestOutput outGAPI { outPtsGAPI, outStatusGAPI, outErrGAPI };
|
||||
|
||||
cv::GComputation c = runOCVnGAPIOptFlowPipeline(*this, params, outOCV, outGAPI, inPts);
|
||||
|
||||
declare.in(in_mat1, in_mat2, inPts).out(outPtsGAPI, outStatusGAPI, outErrGAPI);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(in_mat1, in_mat2, inPts, std::vector<cv::Point2f>{ }),
|
||||
cv::gout(outPtsGAPI, outStatusGAPI, outErrGAPI));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
compareOutputsOptFlow(outGAPI, outOCV);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef HAVE_OPENCV_VIDEO
|
||||
|
||||
PERF_TEST_P_(BackgroundSubtractorPerfTest, TestPerformance)
|
||||
{
|
||||
namespace gvideo = cv::gapi::video;
|
||||
initTestDataPath();
|
||||
|
||||
gvideo::BackgroundSubtractorType opType;
|
||||
std::string filePath = "";
|
||||
bool detectShadows = false;
|
||||
double learningRate = -1.;
|
||||
std::size_t testNumFrames = 0;
|
||||
cv::GCompileArgs compileArgs;
|
||||
CompareMats cmpF;
|
||||
|
||||
std::tie(opType, filePath, detectShadows, learningRate, testNumFrames,
|
||||
compileArgs, cmpF) = GetParam();
|
||||
|
||||
const int histLength = 500;
|
||||
double thr = -1;
|
||||
switch (opType)
|
||||
{
|
||||
case gvideo::TYPE_BS_MOG2:
|
||||
{
|
||||
thr = 16.;
|
||||
break;
|
||||
}
|
||||
case gvideo::TYPE_BS_KNN:
|
||||
{
|
||||
thr = 400.;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
FAIL() << "unsupported type of BackgroundSubtractor";
|
||||
}
|
||||
const gvideo::BackgroundSubtractorParams bsp(opType, histLength, thr, detectShadows,
|
||||
learningRate);
|
||||
|
||||
// Retrieving frames
|
||||
std::vector<cv::Mat> frames;
|
||||
frames.reserve(testNumFrames);
|
||||
{
|
||||
cv::Mat frame;
|
||||
cv::VideoCapture cap;
|
||||
if (!cap.open(findDataFile(filePath)))
|
||||
throw SkipTestException("Video file can not be opened");
|
||||
for (std::size_t i = 0; i < testNumFrames && cap.read(frame); i++)
|
||||
{
|
||||
frames.push_back(frame);
|
||||
}
|
||||
}
|
||||
GAPI_Assert(testNumFrames == frames.size() && "Can't read required number of frames");
|
||||
|
||||
// G-API graph declaration
|
||||
cv::GMat in;
|
||||
cv::GMat out = cv::gapi::BackgroundSubtractor(in, bsp);
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
auto cc = c.compile(cv::descr_of(frames[0]), std::move(compileArgs));
|
||||
|
||||
cv::Mat gapiForeground;
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cc.prepareForNewStream();
|
||||
for (size_t i = 0; i < testNumFrames; i++)
|
||||
{
|
||||
cc(cv::gin(frames[i]), cv::gout(gapiForeground));
|
||||
}
|
||||
}
|
||||
|
||||
// OpenCV Background Subtractor declaration
|
||||
cv::Ptr<cv::BackgroundSubtractor> pOCVBackSub;
|
||||
if (opType == gvideo::TYPE_BS_MOG2)
|
||||
pOCVBackSub = cv::createBackgroundSubtractorMOG2(histLength, thr, detectShadows);
|
||||
else if (opType == gvideo::TYPE_BS_KNN)
|
||||
pOCVBackSub = cv::createBackgroundSubtractorKNN(histLength, thr, detectShadows);
|
||||
cv::Mat ocvForeground;
|
||||
for (size_t i = 0; i < testNumFrames; i++)
|
||||
{
|
||||
pOCVBackSub->apply(frames[i], ocvForeground, learningRate);
|
||||
}
|
||||
// Validation
|
||||
EXPECT_TRUE(cmpF(gapiForeground, ocvForeground));
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
inline void generateInputKalman(const int mDim, const MatType2& type,
|
||||
const size_t testNumMeasurements, const bool receiveRandMeas,
|
||||
std::vector<bool>& haveMeasurements,
|
||||
std::vector<cv::Mat>& measurements)
|
||||
{
|
||||
cv::RNG& rng = cv::theRNG();
|
||||
measurements.clear();
|
||||
haveMeasurements = std::vector<bool>(testNumMeasurements, true);
|
||||
for (size_t i = 0; i < testNumMeasurements; i++)
|
||||
{
|
||||
if (receiveRandMeas)
|
||||
{
|
||||
haveMeasurements[i] = rng(2u) == 1; // returns 0 or 1 - whether we have measurement
|
||||
// at this iteration or not
|
||||
} // if not - testing the slowest case in which we have measurements at every iteration
|
||||
|
||||
cv::Mat measurement = cv::Mat::zeros(mDim, 1, type);
|
||||
if (haveMeasurements[i])
|
||||
{
|
||||
cv::randu(measurement, cv::Scalar::all(-1), cv::Scalar::all(1));
|
||||
}
|
||||
measurements.push_back(measurement.clone());
|
||||
}
|
||||
}
|
||||
|
||||
inline void generateInputKalman(const int mDim, const int cDim, const MatType2& type,
|
||||
const size_t testNumMeasurements, const bool receiveRandMeas,
|
||||
std::vector<bool>& haveMeasurements,
|
||||
std::vector<cv::Mat>& measurements,
|
||||
std::vector<cv::Mat>& ctrls)
|
||||
{
|
||||
generateInputKalman(mDim, type, testNumMeasurements, receiveRandMeas,
|
||||
haveMeasurements, measurements);
|
||||
ctrls.clear();
|
||||
cv::Mat ctrl(cDim, 1, type);
|
||||
for (size_t i = 0; i < testNumMeasurements; i++)
|
||||
{
|
||||
cv::randu(ctrl, cv::Scalar::all(-1), cv::Scalar::all(1));
|
||||
ctrls.push_back(ctrl.clone());
|
||||
}
|
||||
}
|
||||
|
||||
PERF_TEST_P_(KalmanFilterControlPerfTest, TestPerformance)
|
||||
{
|
||||
MatType2 type = -1;
|
||||
int dDim = -1, mDim = -1;
|
||||
size_t testNumMeasurements = 0;
|
||||
bool receiveRandMeas = true;
|
||||
cv::GCompileArgs compileArgs;
|
||||
std::tie(type, dDim, mDim, testNumMeasurements, receiveRandMeas, compileArgs) = GetParam();
|
||||
|
||||
const int cDim = 2;
|
||||
cv::gapi::KalmanParams kp;
|
||||
initKalmanParams(type, dDim, mDim, cDim, kp);
|
||||
|
||||
// Generating input
|
||||
std::vector<bool> haveMeasurements;
|
||||
std::vector<cv::Mat> measurements, ctrls;
|
||||
generateInputKalman(mDim, cDim, type, testNumMeasurements, receiveRandMeas,
|
||||
haveMeasurements, measurements, ctrls);
|
||||
|
||||
// G-API graph declaration
|
||||
cv::GMat m, ctrl;
|
||||
cv::GOpaque<bool> have_m;
|
||||
cv::GMat out = cv::gapi::KalmanFilter(m, have_m, ctrl, kp);
|
||||
cv::GComputation c(cv::GIn(m, have_m, ctrl), cv::GOut(out));
|
||||
auto cc = c.compile(
|
||||
cv::descr_of(cv::gin(cv::Mat(mDim, 1, type), true, cv::Mat(cDim, 1, type))),
|
||||
std::move(compileArgs));
|
||||
|
||||
cv::Mat gapiKState(dDim, 1, type);
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cc.prepareForNewStream();
|
||||
for (size_t i = 0; i < testNumMeasurements; i++)
|
||||
{
|
||||
bool hvMeas = haveMeasurements[i];
|
||||
cc(cv::gin(measurements[i], hvMeas, ctrls[i]), cv::gout(gapiKState));
|
||||
}
|
||||
}
|
||||
|
||||
// OpenCV reference KalmanFilter initialization
|
||||
cv::KalmanFilter ocvKalman(dDim, mDim, cDim, type);
|
||||
initKalmanFilter(kp, true, ocvKalman);
|
||||
|
||||
cv::Mat ocvKState(dDim, 1, type);
|
||||
for (size_t i = 0; i < testNumMeasurements; i++)
|
||||
{
|
||||
ocvKState = ocvKalman.predict(ctrls[i]);
|
||||
if (haveMeasurements[i])
|
||||
ocvKState = ocvKalman.correct(measurements[i]);
|
||||
}
|
||||
// Validation
|
||||
EXPECT_TRUE(AbsExact().to_compare_f()(gapiKState, ocvKState));
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(KalmanFilterNoControlPerfTest, TestPerformance)
|
||||
{
|
||||
MatType2 type = -1;
|
||||
int dDim = -1, mDim = -1;
|
||||
size_t testNumMeasurements = 0;
|
||||
bool receiveRandMeas = true;
|
||||
cv::GCompileArgs compileArgs;
|
||||
std::tie(type, dDim, mDim, testNumMeasurements, receiveRandMeas, compileArgs) = GetParam();
|
||||
|
||||
const int cDim = 0;
|
||||
cv::gapi::KalmanParams kp;
|
||||
initKalmanParams(type, dDim, mDim, cDim, kp);
|
||||
|
||||
// Generating input
|
||||
std::vector<bool> haveMeasurements;
|
||||
std::vector<cv::Mat> measurements;
|
||||
generateInputKalman(mDim, type, testNumMeasurements, receiveRandMeas,
|
||||
haveMeasurements, measurements);
|
||||
|
||||
// G-API graph declaration
|
||||
cv::GMat m;
|
||||
cv::GOpaque<bool> have_m;
|
||||
cv::GMat out = cv::gapi::KalmanFilter(m, have_m, kp);
|
||||
cv::GComputation c(cv::GIn(m, have_m), cv::GOut(out));
|
||||
auto cc = c.compile(cv::descr_of(cv::gin(cv::Mat(mDim, 1, type), true)),
|
||||
std::move(compileArgs));
|
||||
|
||||
cv::Mat gapiKState(dDim, 1, type);
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cc.prepareForNewStream();
|
||||
for (size_t i = 0; i < testNumMeasurements; i++)
|
||||
{
|
||||
bool hvMeas = haveMeasurements[i];
|
||||
cc(cv::gin(measurements[i], hvMeas), cv::gout(gapiKState));
|
||||
}
|
||||
}
|
||||
|
||||
// OpenCV reference KalmanFilter declaration
|
||||
cv::KalmanFilter ocvKalman(dDim, mDim, cDim, type);
|
||||
initKalmanFilter(kp, false, ocvKalman);
|
||||
|
||||
cv::Mat ocvKState(dDim, 1, type);
|
||||
for (size_t i = 0; i < testNumMeasurements; i++)
|
||||
{
|
||||
ocvKState = ocvKalman.predict();
|
||||
if (haveMeasurements[i])
|
||||
ocvKState = ocvKalman.correct(measurements[i]);
|
||||
}
|
||||
// Validation
|
||||
EXPECT_TRUE(AbsExact().to_compare_f()(gapiKState, ocvKState));
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
#endif // HAVE_OPENCV_VIDEO
|
||||
|
||||
} // opencv_test
|
||||
|
||||
#endif // OPENCV_GAPI_VIDEO_PERF_TESTS_INL_HPP
|
Reference in New Issue
Block a user