From b5e9eb742c521870632e634a12dd385c4ef54777 Mon Sep 17 00:00:00 2001 From: Christine Poerschke Date: Mon, 29 May 2023 09:02:59 +0100 Subject: [PATCH] Merge pull request #23698 from cpoerschke:4.x-pr-21959-perf imgproc: add basic IntelligentScissorsMB performance test #23698 Adding basic performance test that can be used before and after the #21959 changes etc. as per @asmorkalov's https://github.com/opencv/opencv/pull/21959#issuecomment-1565240926 comment. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [X] I agree to contribute to the project under Apache 2 License. - [X] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [X] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [X] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake --- .../perf/perf_intelligent_scissors.cpp | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 modules/imgproc/perf/perf_intelligent_scissors.cpp diff --git a/modules/imgproc/perf/perf_intelligent_scissors.cpp b/modules/imgproc/perf/perf_intelligent_scissors.cpp new file mode 100644 index 0000000000..703ef9cfd2 --- /dev/null +++ b/modules/imgproc/perf/perf_intelligent_scissors.cpp @@ -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 perf::TestBaseWithParam TestIntelligentScissorsMB; + +PERF_TEST_P(TestIntelligentScissorsMB, buildMap, testing::Values( IMREAD_GRAYSCALE, IMREAD_COLOR )) +{ + const int flags = GetParam(); + + const Mat image = imread(findDataFile("cv/shared/lena.png"), flags); + ASSERT_TRUE(!image.empty()); + + const Point source_point(275, 63); + + segmentation::IntelligentScissorsMB tool; + tool.applyImage(image); + + PERF_SAMPLE_BEGIN() + for (size_t idx = 1; idx <= 100; ++idx) + { + tool.buildMap(source_point); + } + PERF_SAMPLE_END() + + SANITY_CHECK_NOTHING(); +} + + +}} // namespace