vendor: OpenCV 5.0.0 snapshot at 755e50675d97db9b7d449d8bd6b09888646f6c6e

This commit is contained in:
Gitea Mirror Bot
2026-08-22 00:11:13 +08:00
commit 12022378a3
3872 changed files with 2513409 additions and 0 deletions
@@ -0,0 +1,49 @@
// 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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
typedef tuple<bool, Size, int, int, MatType> AMPerfTestParam;
typedef TestBaseWithParam<AMPerfTestParam> AdaptiveManifoldPerfTest;
PERF_TEST_P( AdaptiveManifoldPerfTest, perf,
Combine(
Values(true, false), //adjust_outliers flag
Values(sz1080p, sz720p), //size
Values(1, 3, 8), //joint channels num
Values(1, 3), //source channels num
Values(CV_8U, CV_32F) //source and joint depth
)
)
{
AMPerfTestParam params = GetParam();
bool adjustOutliers = get<0>(params);
Size sz = get<1>(params);
int jointCnNum = get<2>(params);
int srcCnNum = get<3>(params);
int depth = get<4>(params);
Mat joint(sz, CV_MAKE_TYPE(depth, jointCnNum));
Mat src(sz, CV_MAKE_TYPE(depth, srcCnNum));
Mat dst(sz, CV_MAKE_TYPE(depth, srcCnNum));
declare.in(joint, src, WARMUP_RNG).out(dst);
double sigma_s = 16;
double sigma_r = 0.5;
TEST_CYCLE_N(3)
{
Mat res;
amFilter(joint, src, res, sigma_s, sigma_r, adjustOutliers);
//at 5th cycle sigma_s will be five times more and tree depth will be 5
sigma_s *= 1.38;
sigma_r /= 1.38;
}
SANITY_CHECK_NOTHING();
}
}} // namespace
@@ -0,0 +1,42 @@
// 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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
typedef tuple<int, double, double, Size, MatType, int> BTFTestParam;
typedef TestBaseWithParam<BTFTestParam> BilateralTextureFilterTest;
PERF_TEST_P(BilateralTextureFilterTest, perf,
Combine(
Values(2),
Values(0.5),
Values(0.5),
SZ_TYPICAL,
Values(CV_8U, CV_32F),
Values(1, 3))
)
{
BTFTestParam params = GetParam();
int fr = get<0>(params);
double sigmaAlpha = get<1>(params);
double sigmaAvg = get<2>(params);
Size sz = get<3>(params);
int depth = get<4>(params);
int srcCn = get<5>(params);
Mat src(sz, CV_MAKE_TYPE(depth,srcCn));
Mat dst(sz, src.type());
declare.in(src, WARMUP_RNG).out(dst);
TEST_CYCLE_N(1)
{
bilateralTextureFilter(src, dst, fr, 1, sigmaAlpha, sigmaAvg);
}
SANITY_CHECK_NOTHING();
}
}} // namespace
@@ -0,0 +1,128 @@
// 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.
#include "perf_precomp.hpp"
#include "opencv2/ximgproc/disparity_filter.hpp"
namespace opencv_test { namespace {
void MakeArtificialExample(RNG rng, Mat& dst_left_view, Mat& dst_left_disparity_map, Mat& dst_right_disparity_map, Rect& dst_ROI);
CV_ENUM(GuideTypes, CV_8UC3);
CV_ENUM(SrcTypes, CV_16S);
typedef tuple<GuideTypes, SrcTypes, Size, bool, bool> DisparityWLSParams;
typedef TestBaseWithParam<DisparityWLSParams> DisparityWLSFilterPerfTest;
PERF_TEST_P( DisparityWLSFilterPerfTest, perf, Combine(GuideTypes::all(), SrcTypes::all(), Values(sz720p), Values(true,false), Values(true,false)) )
{
RNG rng(0);
DisparityWLSParams params = GetParam();
int guideType = get<0>(params);
int srcType = get<1>(params);
Size sz = get<2>(params);
bool use_conf = get<3>(params);
bool use_downscale = get<4>(params);
Mat guide(sz, guideType);
Mat disp_left(sz, srcType);
Mat disp_right(sz, srcType);
Mat dst(sz, srcType);
Rect ROI;
MakeArtificialExample(rng,guide,disp_left,disp_right,ROI);
if(use_downscale)
{
resize(disp_left,disp_left,Size(),0.5,0.5, INTER_LINEAR_EXACT);
disp_left/=2;
resize(disp_right,disp_right,Size(),0.5,0.5, INTER_LINEAR_EXACT);
disp_right/=2;
ROI = Rect(ROI.x/2,ROI.y/2,ROI.width/2,ROI.height/2);
}
TEST_CYCLE_N(10)
{
Ptr<DisparityWLSFilter> wls_filter = createDisparityWLSFilterGeneric(use_conf);
wls_filter->filter(disp_left,guide,dst,disp_right,ROI);
}
SANITY_CHECK_NOTHING();
}
void MakeArtificialExample(RNG rng, Mat& dst_left_view, Mat& dst_left_disparity_map, Mat& dst_right_disparity_map, Rect& dst_ROI)
{
int w = dst_left_view.cols;
int h = dst_left_view.rows;
//params:
unsigned char bg_level = (unsigned char)rng.uniform(0.0,255.0);
unsigned char fg_level = (unsigned char)rng.uniform(0.0,255.0);
int rect_width = (int)rng.uniform(w/16,w/2);
int rect_height = (int)rng.uniform(h/16,h/2);
int rect_disparity = (int)(0.15*w); //typical maximum disparity value
double sigma = 6.0;
int rect_x_offset = (w-rect_width) /2;
int rect_y_offset = (h-rect_height)/2;
if(dst_left_view.channels()==3)
dst_left_view = Scalar(Vec3b(bg_level,bg_level,bg_level));
else
dst_left_view = Scalar(bg_level);
dst_left_disparity_map = Scalar(0);
dst_right_disparity_map = Scalar(0);
Mat dst_left_view_rect = Mat(dst_left_view, Rect(rect_x_offset,rect_y_offset,rect_width,rect_height));
Mat dst_left_disparity_map_rect = Mat(dst_left_disparity_map,Rect(rect_x_offset,rect_y_offset,rect_width,rect_height));
if(dst_left_view.channels()==3)
dst_left_view_rect = Scalar(Vec3b(fg_level,fg_level,fg_level));
else
dst_left_view_rect = Scalar(fg_level);
dst_left_disparity_map_rect = Scalar(16*rect_disparity);
rect_x_offset-=rect_disparity;
Mat dst_right_disparity_map_rect = Mat(dst_right_disparity_map,Rect(rect_x_offset,rect_y_offset,rect_width,rect_height));
dst_right_disparity_map_rect = Scalar(-16*rect_disparity);
//add some gaussian noise:
unsigned char *l;
short *ldisp, *rdisp;
for(int i=0;i<h;i++)
{
l = dst_left_view.ptr(i);
ldisp = (short*)dst_left_disparity_map.ptr(i);
rdisp = (short*)dst_right_disparity_map.ptr(i);
if(dst_left_view.channels()==3)
{
for(int j=0;j<w;j++)
{
l[0] = saturate_cast<unsigned char>(l[0] + rng.gaussian(sigma));
l[1] = saturate_cast<unsigned char>(l[1] + rng.gaussian(sigma));
l[2] = saturate_cast<unsigned char>(l[2] + rng.gaussian(sigma));
l+=3;
ldisp[0] = saturate_cast<short>(ldisp[0] + rng.gaussian(sigma));
ldisp++;
rdisp[0] = saturate_cast<short>(rdisp[0] + rng.gaussian(sigma));
rdisp++;
}
}
else
{
for(int j=0;j<w;j++)
{
l[0] = saturate_cast<unsigned char>(l[0] + rng.gaussian(sigma));
l++;
ldisp[0] = saturate_cast<short>(ldisp[0] + rng.gaussian(sigma));
ldisp++;
rdisp[0] = saturate_cast<short>(rdisp[0] + rng.gaussian(sigma));
rdisp++;
}
}
}
dst_ROI = Rect(rect_disparity,0,w-rect_disparity,h);
}
}} // namespace
@@ -0,0 +1,46 @@
// 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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
CV_ENUM(GuideMatType, CV_8UC1, CV_8UC3, CV_32FC1, CV_32FC3) //reduced set
CV_ENUM(SourceMatType, CV_8UC1, CV_8UC3, CV_8UC4, CV_32FC1, CV_32FC3) //reduced set
CV_ENUM(DTFMode, DTF_NC, DTF_IC, DTF_RF)
typedef tuple<GuideMatType, SourceMatType, Size, double, double, DTFMode> DTTestParams;
typedef TestBaseWithParam<DTTestParams> DomainTransformTest;
PERF_TEST_P( DomainTransformTest, perf,
Combine(
GuideMatType::all(),
SourceMatType::all(),
Values(szVGA, sz720p),
Values(10.0, 80.0),
Values(30.0, 50.0),
DTFMode::all()
)
)
{
int guideType = get<0>(GetParam());
int srcType = get<1>(GetParam());
Size size = get<2>(GetParam());
double sigmaSpatial = get<3>(GetParam());
double sigmaColor = get<4>(GetParam());
int dtfType = get<5>(GetParam());
Mat guide(size, guideType);
Mat src(size, srcType);
Mat dst(size, srcType);
declare.in(guide, src, WARMUP_RNG).out(dst);
TEST_CYCLE_N(5)
{
dtFilter(guide, src, dst, sigmaSpatial, sigmaColor, dtfType);
}
SANITY_CHECK_NOTHING();
}
}} // namespace
@@ -0,0 +1,45 @@
// 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.
//
// Created by Simon Reich
//
#include "perf_precomp.hpp"
namespace opencv_test
{
namespace
{
/* 1. Define parameter type and test fixture */
typedef tuple<int, double> RGFTestParam;
typedef TestBaseWithParam<RGFTestParam> EdgepreservingFilterTest;
/* 2. Declare the testsuite */
PERF_TEST_P(EdgepreservingFilterTest, perf,
Combine(Values(-20, 0, 10), Values(-100, 0, 20)))
{
/* 3. Get actual test parameters */
RGFTestParam params = GetParam();
int kernelSize = get<0>(params);
double threshold = get<1>(params);
/* 4. Allocate and initialize arguments for tested function */
std::string filename = getDataPath("perf/320x260.png");
Mat src = imread(filename, 1);
Mat dst(src.size(), src.type());
/* 5. Manifest your expectations about this test */
declare.in(src).out(dst);
/* 6. Collect the samples! */
PERF_SAMPLE_BEGIN();
ximgproc::edgePreservingFilter(src, dst, kernelSize, threshold);
PERF_SAMPLE_END();
/* 7. Do not check anything */
SANITY_CHECK_NOTHING();
}
} // namespace
} // namespace opencv_test
@@ -0,0 +1,81 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2015, Smart Engines Ltd, all rights reserved.
// Copyright (C) 2015, Institute for Information Transmission Problems of the Russian Academy of Sciences (Kharkevich Institute), all rights reserved.
// Copyright (C) 2015, Dmitry Nikolaev, Simon Karpenko, Michail Aliev, Elena Kuznetsova, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
typedef tuple<Size, MatType, MatDepth> srcSize_srcType_dstDepth_t;
typedef perf::TestBaseWithParam<srcSize_srcType_dstDepth_t>
srcSize_srcType_dstDepth;
#define ALL_MAT_DEPHTS CV_8U, CV_8S, CV_16U, CV_32S, CV_32F, CV_64F
PERF_TEST_P(srcSize_srcType_dstDepth, FastHoughTransform,
testing::Combine(
testing::Values(TYPICAL_MAT_SIZES),
testing::Values(TYPICAL_MAT_TYPES),
testing::Values(ALL_MAT_DEPHTS)
)
)
{
Size srcSize = get<0>(GetParam());
int srcType = get<1>(GetParam());
int dstDepth = get<2>(GetParam());
Mat src(srcSize, srcType);
Mat fht;
declare.in(src, WARMUP_RNG);
TEST_CYCLE_N(3)
{
FastHoughTransform(src, fht, dstDepth);
}
SANITY_CHECK_NOTHING();
}
#undef ALL_MAT_DEPHTS
}} // namespace
+39
View File
@@ -0,0 +1,39 @@
// 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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
CV_ENUM(GuideTypes, CV_8UC1, CV_8UC3);
CV_ENUM(SrcTypes, CV_8UC1, CV_8UC3, CV_16SC1, CV_16SC3, CV_32FC1, CV_32FC3);
typedef tuple<GuideTypes, SrcTypes, Size> FGSParams;
typedef TestBaseWithParam<FGSParams> FGSFilterPerfTest;
PERF_TEST_P( FGSFilterPerfTest, perf, Combine(GuideTypes::all(), SrcTypes::all(), Values(sz720p)) )
{
RNG rng(0);
FGSParams params = GetParam();
int guideType = get<0>(params);
int srcType = get<1>(params);
Size sz = get<2>(params);
Mat guide(sz, guideType);
Mat src(sz, srcType);
Mat dst(sz, srcType);
declare.in(guide, src, WARMUP_RNG).out(dst);
TEST_CYCLE_N(10)
{
double lambda = rng.uniform(500.0, 10000.0);
double sigma = rng.uniform(1.0, 100.0);
fastGlobalSmootherFilter(guide,src,dst,lambda,sigma);
}
SANITY_CHECK_NOTHING();
}
}} // namespace
@@ -0,0 +1,27 @@
// 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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
typedef tuple<Size, MatType, int> FindEllipsesTestParam;
typedef TestBaseWithParam<FindEllipsesTestParam> FindEllipsesTest;
PERF_TEST_P(FindEllipsesTest, perf, Combine(SZ_TYPICAL, Values(CV_8U), Values(1, 3)))
{
FindEllipsesTestParam params = GetParam();
Size sz = get<0>(params);
int matType = get<1>(params);
int srcCn = get<2>(params);
Mat src(sz, CV_MAKE_TYPE(matType, srcCn));
Mat dst(sz, CV_32FC(6));
declare.in(src, WARMUP_RNG).out(dst);
TEST_CYCLE() findEllipses(src, dst, 0.7f, 0.5f, 0.05f);
SANITY_CHECK_NOTHING();
}
}} // namespace
@@ -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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
CV_ENUM(GuideTypes, CV_8UC1, CV_8UC3, CV_32FC1, CV_32FC3);
CV_ENUM(SrcTypes, CV_8UC1, CV_8UC3, CV_32FC1, CV_32FC3);
typedef tuple<GuideTypes, SrcTypes, Size, double> GFParams;
typedef TestBaseWithParam<GFParams> GuidedFilterPerfTest;
PERF_TEST_P( GuidedFilterPerfTest, perf, Combine(GuideTypes::all(), SrcTypes::all(), Values(sz1080p, sz2K), Values(1./1, 1./2, 1./3, 1./4)) )
{
RNG rng(0);
GFParams params = GetParam();
int guideType = get<0>(params);
int srcType = get<1>(params);
Size sz = get<2>(params);
double scale = get<3>(params);
Mat guide(sz, guideType);
Mat src(sz, srcType);
Mat dst(sz, srcType);
declare.in(guide, src, WARMUP_RNG).out(dst);
TEST_CYCLE_N(3)
{
int radius = rng.uniform(5, 30);
double eps = rng.uniform(0.1, 1e5);
guidedFilter(guide, src, dst, radius, eps, -1, scale);
}
SANITY_CHECK_NOTHING();
}
}} // namespace
@@ -0,0 +1,45 @@
// 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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
typedef tuple<double, Size, MatType, int, int> JBFTestParam;
typedef TestBaseWithParam<JBFTestParam> JointBilateralFilterTest;
PERF_TEST_P(JointBilateralFilterTest, perf,
Combine(
Values(4.0, 10.0),
SZ_TYPICAL,
Values(CV_8U, CV_32F),
Values(1, 3),
Values(1, 3))
)
{
JBFTestParam params = GetParam();
double sigmaS = get<0>(params);
Size sz = get<1>(params);
int depth = get<2>(params);
int jCn = get<3>(params);
int srcCn = get<4>(params);
Mat joint(sz, CV_MAKE_TYPE(depth, jCn));
Mat src(sz, CV_MAKE_TYPE(depth, srcCn));
Mat dst(sz, src.type());
declare.in(joint, src, WARMUP_RNG).out(dst);
RNG rnd(cvRound(10*sigmaS) + sz.height + depth + jCn + srcCn);
double sigmaC = rnd.uniform(1.0, 255.0);
TEST_CYCLE_N(1)
{
jointBilateralFilter(joint, src, dst, 0, sigmaC, sigmaS);
}
SANITY_CHECK_NOTHING();
}
}} // namespace
+41
View File
@@ -0,0 +1,41 @@
// 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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
typedef tuple<Size, MatType, int> L0SmoothTestParam;
typedef TestBaseWithParam<L0SmoothTestParam> L0SmoothTest;
PERF_TEST_P(L0SmoothTest, perf,
Combine(
SZ_TYPICAL,
Values(CV_8U, CV_16U, CV_32F, CV_64F),
Values(1, 3))
)
{
L0SmoothTestParam params = GetParam();
Size sz = get<0>(params);
int depth = get<1>(params);
int srcCn = get<2>(params);
Mat src(sz, CV_MAKE_TYPE(depth, srcCn));
Mat dst(sz, src.type());
declare.in(src, WARMUP_RNG).out(dst);
RNG rnd(sz.height + depth + srcCn);
double lambda = rnd.uniform(0.01, 0.05);
double kappa = rnd.uniform(1.0, 3.0);
TEST_CYCLE_N(1)
{
l0Smooth(src, dst, lambda, kappa);
}
SANITY_CHECK_NOTHING();
}
}} // namespace
+6
View File
@@ -0,0 +1,6 @@
// 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.
#include "perf_precomp.hpp"
CV_PERF_TEST_MAIN(edgefilter)
+15
View File
@@ -0,0 +1,15 @@
// 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.
#ifndef __OPENCV_PERF_PRECOMP_HPP__
#define __OPENCV_PERF_PRECOMP_HPP__
#include <opencv2/ts.hpp>
#include <opencv2/ximgproc.hpp>
namespace opencv_test {
using namespace perf;
using namespace cv::ximgproc;
}
#endif
@@ -0,0 +1,35 @@
// 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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
typedef tuple<Size, MatType> RadonTransformPerfTestParam;
typedef perf::TestBaseWithParam<RadonTransformPerfTestParam> RadonTransformPerfTest;
PERF_TEST_P(RadonTransformPerfTest, perf,
testing::Combine(
testing::Values(TYPICAL_MAT_SIZES),
testing::Values(CV_8UC1, CV_32FC1, CV_64FC1)
)
)
{
Size srcSize = get<0>(GetParam());
int srcType = get<1>(GetParam());
Mat src(srcSize, srcType);
Mat radon;
declare.in(src, WARMUP_RNG);
TEST_CYCLE()
{
RadonTransform(src, radon);
}
SANITY_CHECK_NOTHING();
}
} }
@@ -0,0 +1,34 @@
// 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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
typedef tuple<MatDepth, int, Size> RDFParams;
typedef TestBaseWithParam<RDFParams> RidgeDetectionFilterPerfTest;
PERF_TEST_P(RidgeDetectionFilterPerfTest, perf, Combine(
Values((MatDepth)CV_32F),
Values(3),
SZ_TYPICAL
))
{
RDFParams params = GetParam();
int ddepth = get<0>(params);
int ksize = get<1>(params);
Size sz = get<2>(params);
Mat src(sz, ddepth);
Mat out(sz, src.type());
declare.in(src).out(out);
Ptr<RidgeDetectionFilter> rdf = RidgeDetectionFilter::create(ddepth,1, 1, ksize);
TEST_CYCLE() rdf->getRidgeFilteredImage(src, out);
SANITY_CHECK_NOTHING();
}
}} // namespace
@@ -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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
typedef tuple<double, Size, MatType, int> RGFTestParam;
typedef TestBaseWithParam<RGFTestParam> RollingGuidanceFilterTest;
PERF_TEST_P(RollingGuidanceFilterTest, perf,
Combine(
Values(2.0, 4.0, 6.0, 10.0),
SZ_TYPICAL,
Values(CV_8U, CV_32F),
Values(1, 3))
)
{
RGFTestParam params = GetParam();
double sigmaS = get<0>(params);
Size sz = get<1>(params);
int depth = get<2>(params);
int srcCn = get<3>(params);
Mat src(sz, CV_MAKE_TYPE(depth, srcCn));
Mat dst(sz, src.type());
declare.in(src, WARMUP_RNG).out(dst);
RNG rnd(cvRound(10*sigmaS) + sz.height + depth + srcCn);
double sigmaC = rnd.uniform(1.0, 255.0);
int iterNum = int(rnd.uniform(1.0, 5.0));
TEST_CYCLE_N(1)
{
rollingGuidanceFilter(src, dst, -1, sigmaC, sigmaS, iterNum);
}
SANITY_CHECK_NOTHING();
}
}} // namespace
@@ -0,0 +1,37 @@
// 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.
#include "perf_precomp.hpp"
namespace opencv_test {
namespace {
typedef tuple<int, Size, int> RLParams;
typedef TestBaseWithParam<RLParams> RLMorphologyPerfTest;
PERF_TEST_P(RLMorphologyPerfTest, perf, Combine(Values(1,7, 21), Values(sz720p, sz2160p),
Values(MORPH_ERODE, MORPH_DILATE, MORPH_OPEN, MORPH_CLOSE, MORPH_GRADIENT,MORPH_TOPHAT, MORPH_BLACKHAT)))
{
RLParams params = GetParam();
int seSize = get<0>(params);
Size sz = get<1>(params);
int op = get<2>(params);
Mat src(sz, CV_8U);
Mat thresholded, dstRLE;
Mat se = rl::getStructuringElement(MORPH_ELLIPSE, cv::Size(2 * seSize + 1, 2 * seSize + 1));
declare.in(src, WARMUP_RNG);
TEST_CYCLE_N(4)
{
rl::threshold(src, thresholded, 100.0, THRESH_BINARY);
rl::morphologyEx(thresholded, dstRLE, op, se);
}
SANITY_CHECK_NOTHING();
}
}
} // namespace
+36
View File
@@ -0,0 +1,36 @@
// 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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
typedef tuple<Size, int> ThinningPerfParam;
typedef TestBaseWithParam<ThinningPerfParam> ThinningPerfTest;
PERF_TEST_P(ThinningPerfTest, perf,
Combine(
Values(sz1080p, sz720p, szVGA),
Values(THINNING_ZHANGSUEN, THINNING_GUOHALL)
)
)
{
ThinningPerfParam params = GetParam();
Size size = get<0>(params);
int type = get<1>(params);
Mat src = Mat::zeros(size, CV_8UC1);
for (int x = 50; x < src.cols - 50; x += 50)
cv::circle(src, Point(x, x/2), 30 + x/2, Scalar(255), 5);
Mat dst;
TEST_CYCLE()
{
thinning(src, dst, type);
}
SANITY_CHECK_NOTHING();
}
}} // namespace
@@ -0,0 +1,48 @@
// 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.
#include "perf_precomp.hpp"
namespace opencv_test { namespace {
typedef tuple<Size, MatType, int, int, int, WMFWeightType> WMFTestParam;
typedef TestBaseWithParam<WMFTestParam> WeightedMedianFilterTest;
PERF_TEST_P(WeightedMedianFilterTest, perf,
Combine(
Values(szODD, szQVGA),
Values(CV_8U, CV_32F),
Values(1, 3),
Values(1, 3),
Values(3, 5),
Values(WMF_EXP, WMF_COS))
)
{
RNG rnd(1);
WMFTestParam params = GetParam();
double sigma = rnd.uniform(20.0, 30.0);
Size sz = get<0>(params);
int srcDepth = get<1>(params);
int jCn = get<2>(params);
int srcCn = get<3>(params);
int r = get<4>(params);
WMFWeightType weightType = get<5>(params);
Mat joint(sz, CV_MAKE_TYPE(CV_8U, jCn));
Mat src(sz, CV_MAKE_TYPE(srcDepth, srcCn));
Mat dst(sz, src.type());
declare.in(joint, src, WARMUP_RNG).out(dst);
TEST_CYCLE_N(1)
{
weightedMedianFilter(joint, src, dst, r, sigma, weightType);
}
SANITY_CHECK_NOTHING();
}
}} // namespace