mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 19:44:14 +08:00

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
46 lines
1.6 KiB
C++
46 lines
1.6 KiB
C++
/*
|
|
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include "test_precomp.hpp"
|
|
|
|
namespace opencv_test { namespace {
|
|
|
|
typedef std::tuple<float, float> BilateralTestParams;
|
|
class BilateralRecursiveTest : public ::testing::TestWithParam<BilateralTestParams> {};
|
|
|
|
TEST_P(BilateralRecursiveTest, accuracy)
|
|
{
|
|
auto p = GetParam();
|
|
float sigmaColor = std::get<0>(p);
|
|
float sigmaSpace = std::get<1>(p);
|
|
|
|
cv::Mat src = imread(cvtest::findDataFile("cv/shared/baboon.png"), cv::IMREAD_GRAYSCALE);
|
|
|
|
Mat dst;
|
|
cv::fastcv::bilateralRecursive(src, dst, sigmaColor, sigmaSpace);
|
|
|
|
// NOTE: test files should be manually loaded to folder on a device, for example like this:
|
|
// adb push fastcv/misc/bilateral_recursive/ /sdcard/testdata/fastcv/bilateral/
|
|
cv::Mat ref = imread(cvtest::findDataFile(cv::format("fastcv/bilateral/rec_%2f_%2f.png", sigmaColor, sigmaSpace)),
|
|
IMREAD_GRAYSCALE);
|
|
|
|
if (cvtest::debugLevel > 0)
|
|
{
|
|
cv::imwrite(cv::format("rec_%2f_%2f.png", sigmaColor, sigmaSpace), dst);
|
|
}
|
|
|
|
double normInf = cvtest::norm(dst, ref, cv::NORM_INF);
|
|
double normL2 = cvtest::norm(dst, ref, cv::NORM_L2);
|
|
|
|
ASSERT_LT(normInf, 1);
|
|
ASSERT_LT(normL2, 1.f / src.size().area());
|
|
}
|
|
|
|
INSTANTIATE_TEST_CASE_P(FastCV_Extension, BilateralRecursiveTest,
|
|
::testing::Combine(::testing::Values(0.01f, 0.03f, 0.1f, 1.f, 5.f),
|
|
::testing::Values(0.01f, 0.05f, 0.1f, 1.f, 5.f)));
|
|
|
|
}} // namespaces opencv_test, ::
|