1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-19 11:21:39 +08:00
Files
opencv_contrib/modules/fastcv/perf/perf_threshold_range.cpp
sssanjee-quic 2c7591c57f Merge pull request #3824 from CodeLinaro:FastcvHAL_1stPost
Depends on https://github.com/opencv/opencv/pull/26316

### 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
- [ ] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] 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
2024-12-02 10:53:50 +03:00

49 lines
1.5 KiB
C++

/*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#include "perf_precomp.hpp"
namespace opencv_test {
typedef std::tuple<cv::Size, int /*lowThresh*/, int /*highThresh*/, int /*trueValue*/, int /*falseValue*/> ThresholdRangePerfParams;
typedef perf::TestBaseWithParam<ThresholdRangePerfParams> ThresholdRangePerfTest;
PERF_TEST_P(ThresholdRangePerfTest, run,
::testing::Combine(::testing::Values(Size(8, 8), Size(640, 480), Size(800, 600)),
::testing::Values(0, 15, 128, 255), // lowThresh
::testing::Values(0, 15, 128, 255), // highThresh
::testing::Values(0, 15, 128, 255), // trueValue
::testing::Values(0, 15, 128, 255) // falseValue
)
)
{
auto p = GetParam();
cv::Size size = std::get<0>(p);
int loThresh = std::get<1>(p);
int hiThresh = std::get<2>(p);
int trueValue = std::get<3>(p);
int falseValue = std::get<4>(p);
int lowThresh = std::min(loThresh, hiThresh);
int highThresh = std::max(loThresh, hiThresh);
RNG& rng = cv::theRNG();
Mat src(size, CV_8UC1);
cvtest::randUni(rng, src, Scalar::all(0), Scalar::all(256));
Mat dst;
while(next())
{
startTimer();
cv::fastcv::thresholdRange(src, dst, lowThresh, highThresh, trueValue, falseValue);
stopTimer();
}
SANITY_CHECK_NOTHING();
}
} // namespace