1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-20 12:55:15 +08:00
Files
opencv_contrib/modules/fastcv/perf/perf_edges.cpp
quic-xuezha 67815e94c8 Merge pull request #3844 from CodeLinaro:xuezha_2ndPost
FastCV Extension code for OpenCV 2ndpost-1 #3844

Depends on: [opencv/opencv#26617](https://github.com/opencv/opencv/pull/26617)
Requires binary from [opencv/opencv_3rdparty#90](https://github.com/opencv/opencv_3rdparty/pull/90)

### 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-20 18:13:09 +03:00

68 lines
2.1 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 perf::TestBaseWithParam<tuple<Size, int, int, int>> SobelPerfTest;
PERF_TEST_P(SobelPerfTest, run,
::testing::Combine(::testing::Values(perf::szVGA, perf::sz720p, perf::sz1080p), // image size
::testing::Values(3,5,7), // kernel size
::testing::Values(BORDER_CONSTANT, BORDER_REPLICATE), // border type
::testing::Values(0) // border value
)
)
{
Size srcSize = get<0>(GetParam());
int ksize = get<1>(GetParam());
int border = get<2>(GetParam());
int borderValue = get<3>(GetParam());
cv::Mat dx, dy, src(srcSize, CV_8U);
RNG& rng = cv::theRNG();
cvtest::randUni(rng, src, Scalar::all(0), Scalar::all(255));
while (next())
{
startTimer();
cv::fastcv::sobel(src,dx,dy,ksize,border,borderValue);
stopTimer();
}
SANITY_CHECK_NOTHING();
}
typedef perf::TestBaseWithParam<tuple<Size, int, int>> Sobel3x3u8PerfTest;
PERF_TEST_P(Sobel3x3u8PerfTest, run,
::testing::Combine(::testing::Values(perf::szVGA, perf::sz720p, perf::sz1080p), // image size
::testing::Values(CV_8S, CV_16S, CV_32F), // image depth
::testing::Values(0, 1) // normalization
)
)
{
Size srcSize = get<0>(GetParam());
int ddepth = get<1>(GetParam());
int normalization = get<2>(GetParam());
cv::Mat dx, dy, src(srcSize, CV_8U);
RNG& rng = cv::theRNG();
cvtest::randUni(rng, src, Scalar::all(0), Scalar::all(255));
if((normalization ==0) && (ddepth == CV_8S))
throw ::perf::TestBase::PerfSkipTestException();
while (next())
{
startTimer();
cv::fastcv::sobel3x3u8(src, dx, dy, ddepth, normalization);
stopTimer();
}
SANITY_CHECK_NOTHING();
}
} //namespace