mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge pull request #25984 from fengyuentau:imgproc/warpaffine_opt
imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs #25984 Merge wtih https://github.com/opencv/opencv_extra/pull/1198. Merge with https://github.com/opencv/opencv_contrib/pull/3787. ### 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 - [x] 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. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -15,24 +15,6 @@ typedef TestBaseWithParam<MatInfo_SizePair_t> MatInfo_SizePair;
|
||||
CV_16UC1, CV_16UC2, CV_16UC3, CV_16UC4, \
|
||||
CV_32FC1, CV_32FC2, CV_32FC3, CV_32FC4
|
||||
|
||||
// For gradient-ish testing of the other matrix formats
|
||||
template<typename T>
|
||||
static void fillFPGradient(Mat& img)
|
||||
{
|
||||
const int ch = img.channels();
|
||||
|
||||
int r, c, i;
|
||||
for(r=0; r<img.rows; r++)
|
||||
{
|
||||
for(c=0; c<img.cols; c++)
|
||||
{
|
||||
T vals[] = {(T)r, (T)c, (T)(r*c), (T)(r*c/(r+c+1))};
|
||||
T *p = (T*)img.ptr(r, c);
|
||||
for(i=0; i<ch; i++) p[i] = (T)vals[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PERF_TEST_P(MatInfo_Size_Size, resizeUpLinear,
|
||||
testing::Values(
|
||||
MatInfo_Size_Size_t(CV_8UC1, szVGA, szqHD),
|
||||
@@ -51,7 +33,7 @@ PERF_TEST_P(MatInfo_Size_Size, resizeUpLinear,
|
||||
Size to = get<2>(GetParam());
|
||||
|
||||
cv::Mat src(from, matType), dst(to, matType);
|
||||
cvtest::fillGradient(src);
|
||||
cvtest::fillGradient<uint8_t>(src);
|
||||
declare.in(src).out(dst);
|
||||
|
||||
TEST_CYCLE_MULTIRUN(10) resize(src, dst, to, 0, 0, INTER_LINEAR_EXACT);
|
||||
@@ -79,9 +61,9 @@ PERF_TEST_P(MatInfo_SizePair, resizeUpLinearNonExact,
|
||||
cv::Mat src(from, matType), dst(to, matType);
|
||||
switch(src.depth())
|
||||
{
|
||||
case CV_8U: cvtest::fillGradient(src); break;
|
||||
case CV_16U: fillFPGradient<ushort>(src); break;
|
||||
case CV_32F: fillFPGradient<float>(src); break;
|
||||
case CV_8U: cvtest::fillGradient<uint8_t>(src); break;
|
||||
case CV_16U: cvtest::fillGradient<ushort>(src); break;
|
||||
case CV_32F: cvtest::fillGradient<float>(src); break;
|
||||
}
|
||||
declare.in(src).out(dst);
|
||||
|
||||
@@ -120,7 +102,7 @@ PERF_TEST_P(MatInfo_Size_Size, resizeDownLinear,
|
||||
Size to = get<2>(GetParam());
|
||||
|
||||
cv::Mat src(from, matType), dst(to, matType);
|
||||
cvtest::fillGradient(src);
|
||||
cvtest::fillGradient<uint8_t>(src);
|
||||
declare.in(src).out(dst);
|
||||
|
||||
TEST_CYCLE_MULTIRUN(10) resize(src, dst, to, 0, 0, INTER_LINEAR_EXACT);
|
||||
@@ -155,9 +137,9 @@ PERF_TEST_P(MatInfo_SizePair, resizeDownLinearNonExact,
|
||||
cv::Mat src(from, matType), dst(to, matType);
|
||||
switch(src.depth())
|
||||
{
|
||||
case CV_8U: cvtest::fillGradient(src); break;
|
||||
case CV_16U: fillFPGradient<ushort>(src); break;
|
||||
case CV_32F: fillFPGradient<float>(src); break;
|
||||
case CV_8U: cvtest::fillGradient<uint8_t>(src); break;
|
||||
case CV_16U: cvtest::fillGradient<ushort>(src); break;
|
||||
case CV_32F: cvtest::fillGradient<float>(src); break;
|
||||
}
|
||||
declare.in(src).out(dst);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user