From 85589dd12e95d9a3ce9222d4bafb574857de9ede Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Wed, 27 Mar 2024 12:31:04 +0300 Subject: [PATCH] Added performance test for cv::thining. --- modules/ximgproc/perf/perf_thining.cpp | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 modules/ximgproc/perf/perf_thining.cpp diff --git a/modules/ximgproc/perf/perf_thining.cpp b/modules/ximgproc/perf/perf_thining.cpp new file mode 100644 index 00000000000..6703a01da80 --- /dev/null +++ b/modules/ximgproc/perf/perf_thining.cpp @@ -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 ThinningPerfParam; +typedef TestBaseWithParam 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