1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-20 21:40:49 +08:00

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
This commit is contained in:
sssanjee-quic
2024-12-02 13:23:50 +05:30
committed by GitHub
parent 5409e01d01
commit 2c7591c57f
60 changed files with 3629 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
/*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#include "perf_precomp.hpp"
namespace opencv_test {
// we use such nested structure to combine test values
typedef std::tuple< std::tuple<bool /* useBboxes */, bool /* useContourData */>,
int /* numNeighbors */, std::string /*file path*/> MSERPerfParams;
typedef perf::TestBaseWithParam<MSERPerfParams> MSERPerfTest;
PERF_TEST_P(MSERPerfTest, run,
::testing::Combine(::testing::Values(std::tuple<bool, bool> { true, false},
std::tuple<bool, bool> {false, false},
std::tuple<bool, bool> { true, true}
), // useBboxes, useContourData
::testing::Values(4, 8), // numNeighbors
::testing::Values("cv/shared/baboon.png", "cv/mser/puzzle.png")
)
)
{
auto p = GetParam();
bool useBboxes = std::get<0>(std::get<0>(p));
bool useContourData = std::get<1>(std::get<0>(p));
int numNeighbors = std::get<1>(p); // 4 or 8
std::string imgPath = std::get<2>(p);
cv::Mat src = imread(cvtest::findDataFile(imgPath), cv::IMREAD_GRAYSCALE);
unsigned int delta = 2;
unsigned int minArea = 256;
unsigned int maxArea = (int)src.total()/4;
float maxVariation = 0.15f;
float minDiversity = 0.2f;
while(next())
{
std::vector<std::vector<Point>> contours;
std::vector<cv::Rect> bboxes;
std::vector<cv::fastcv::ContourData> contourData;
startTimer();
if (useBboxes)
{
if (useContourData)
{
cv::fastcv::MSER(src, contours, bboxes, contourData, numNeighbors,
delta, minArea, maxArea, maxVariation, minDiversity);
}
else
{
cv::fastcv::MSER(src, contours, bboxes, numNeighbors,
delta, minArea, maxArea, maxVariation, minDiversity);
}
}
else
{
cv::fastcv::MSER(src, contours, numNeighbors,
delta, minArea, maxArea, maxVariation, minDiversity);
}
stopTimer();
}
SANITY_CHECK_NOTHING();
}
} // namespace