mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge pull request #26590 from Kumataro:fix26589
Support C++20 standard #26590 Close https://github.com/opencv/opencv/issues/26589 Related https://github.com/opencv/opencv_contrib/pull/3842 Related: https://github.com/opencv/opencv/issues/20269 - do not arithmetic enums and ( different enums or floating numeric) - remove unused variable ### 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:
@@ -1865,107 +1865,65 @@ TEST(Imgproc_PreCornerDetect, accuracy) { CV_PreCornerDetectTest test; test.safe
|
||||
TEST(Imgproc_Integral, accuracy) { CV_IntegralTest test; test.safe_run(); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
typedef std::pair<perf::MatDepth, perf::MatDepth> Imgproc_DepthAndDepth;
|
||||
typedef testing::TestWithParam< Imgproc_DepthAndDepth> Imgproc_FilterSupportedFormats;
|
||||
|
||||
class CV_FilterSupportedFormatsTest : public cvtest::BaseTest
|
||||
TEST_P(Imgproc_FilterSupportedFormats, normal)
|
||||
{
|
||||
public:
|
||||
CV_FilterSupportedFormatsTest() {}
|
||||
~CV_FilterSupportedFormatsTest() {}
|
||||
protected:
|
||||
void run(int)
|
||||
{
|
||||
const int depths[][2] =
|
||||
{
|
||||
{CV_8U, CV_8U},
|
||||
{CV_8U, CV_16U},
|
||||
{CV_8U, CV_16S},
|
||||
{CV_8U, CV_32F},
|
||||
{CV_8U, CV_64F},
|
||||
{CV_16U, CV_16U},
|
||||
{CV_16U, CV_32F},
|
||||
{CV_16U, CV_64F},
|
||||
{CV_16S, CV_16S},
|
||||
{CV_16S, CV_32F},
|
||||
{CV_16S, CV_64F},
|
||||
{CV_32F, CV_32F},
|
||||
{CV_64F, CV_64F},
|
||||
{-1, -1}
|
||||
};
|
||||
// use some "odd" size to do yet another smoke
|
||||
// testing of the non-SIMD loop tails
|
||||
Size sz(163, 117);
|
||||
Mat small_kernel(5, 5, CV_32F), big_kernel(21, 21, CV_32F);
|
||||
Mat kernelX(11, 1, CV_32F), kernelY(7, 1, CV_32F);
|
||||
Mat symkernelX(11, 1, CV_32F), symkernelY(7, 1, CV_32F);
|
||||
randu(small_kernel, -10, 10);
|
||||
randu(big_kernel, -1, 1);
|
||||
randu(kernelX, -1, 1);
|
||||
randu(kernelY, -1, 1);
|
||||
flip(kernelX, symkernelX, 0);
|
||||
symkernelX += kernelX;
|
||||
flip(kernelY, symkernelY, 0);
|
||||
symkernelY += kernelY;
|
||||
|
||||
int i = 0;
|
||||
volatile int fidx = -1;
|
||||
try
|
||||
{
|
||||
// use some "odd" size to do yet another smoke
|
||||
// testing of the non-SIMD loop tails
|
||||
Size sz(163, 117);
|
||||
Mat small_kernel(5, 5, CV_32F), big_kernel(21, 21, CV_32F);
|
||||
Mat kernelX(11, 1, CV_32F), kernelY(7, 1, CV_32F);
|
||||
Mat symkernelX(11, 1, CV_32F), symkernelY(7, 1, CV_32F);
|
||||
randu(small_kernel, -10, 10);
|
||||
randu(big_kernel, -1, 1);
|
||||
randu(kernelX, -1, 1);
|
||||
randu(kernelY, -1, 1);
|
||||
flip(kernelX, symkernelX, 0);
|
||||
symkernelX += kernelX;
|
||||
flip(kernelY, symkernelY, 0);
|
||||
symkernelY += kernelY;
|
||||
Mat elem_ellipse = getStructuringElement(MORPH_ELLIPSE, Size(7, 7));
|
||||
Mat elem_rect = getStructuringElement(MORPH_RECT, Size(7, 7));
|
||||
|
||||
Mat elem_ellipse = getStructuringElement(MORPH_ELLIPSE, Size(7, 7));
|
||||
Mat elem_rect = getStructuringElement(MORPH_RECT, Size(7, 7));
|
||||
int sdepth = std::get<0>(GetParam());
|
||||
int ddepth = std::get<1>(GetParam());
|
||||
Mat src(sz, CV_MAKETYPE(sdepth, 5)), dst;
|
||||
randu(src, 0, 100);
|
||||
// non-separable filtering with a small kernel
|
||||
EXPECT_NO_THROW(cv::filter2D(src, dst, ddepth, small_kernel));
|
||||
EXPECT_NO_THROW(cv::filter2D(src, dst, ddepth, big_kernel));
|
||||
EXPECT_NO_THROW(cv::sepFilter2D(src, dst, ddepth, kernelX, kernelY));
|
||||
EXPECT_NO_THROW(cv::sepFilter2D(src, dst, ddepth, symkernelX, symkernelY));
|
||||
EXPECT_NO_THROW(cv::Sobel(src, dst, ddepth, 2, 0, 5));
|
||||
EXPECT_NO_THROW(cv::Scharr(src, dst, ddepth, 0, 1));
|
||||
if( sdepth != ddepth )
|
||||
return;
|
||||
EXPECT_NO_THROW(cv::GaussianBlur(src, dst, Size(5, 5), 1.2, 1.2));
|
||||
EXPECT_NO_THROW(cv::blur(src, dst, Size(11, 11)));
|
||||
EXPECT_NO_THROW(cv::morphologyEx(src, dst, MORPH_GRADIENT, elem_ellipse));
|
||||
EXPECT_NO_THROW(cv::morphologyEx(src, dst, MORPH_GRADIENT, elem_rect));
|
||||
}
|
||||
|
||||
for( i = 0; depths[i][0] >= 0; i++ )
|
||||
{
|
||||
int sdepth = depths[i][0];
|
||||
int ddepth = depths[i][1];
|
||||
Mat src(sz, CV_MAKETYPE(sdepth, 5)), dst;
|
||||
randu(src, 0, 100);
|
||||
// non-separable filtering with a small kernel
|
||||
fidx = 0;
|
||||
cv::filter2D(src, dst, ddepth, small_kernel);
|
||||
fidx++;
|
||||
cv::filter2D(src, dst, ddepth, big_kernel);
|
||||
fidx++;
|
||||
cv::sepFilter2D(src, dst, ddepth, kernelX, kernelY);
|
||||
fidx++;
|
||||
cv::sepFilter2D(src, dst, ddepth, symkernelX, symkernelY);
|
||||
fidx++;
|
||||
cv::Sobel(src, dst, ddepth, 2, 0, 5);
|
||||
fidx++;
|
||||
cv::Scharr(src, dst, ddepth, 0, 1);
|
||||
if( sdepth != ddepth )
|
||||
continue;
|
||||
fidx++;
|
||||
cv::GaussianBlur(src, dst, Size(5, 5), 1.2, 1.2);
|
||||
fidx++;
|
||||
cv::blur(src, dst, Size(11, 11));
|
||||
fidx++;
|
||||
cv::morphologyEx(src, dst, MORPH_GRADIENT, elem_ellipse);
|
||||
fidx++;
|
||||
cv::morphologyEx(src, dst, MORPH_GRADIENT, elem_rect);
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
ts->printf(cvtest::TS::LOG, "Combination of depths %d => %d in %s is not supported (yet it should be)",
|
||||
depths[i][0], depths[i][1],
|
||||
fidx == 0 ? "filter2D (small kernel)" :
|
||||
fidx == 1 ? "filter2D (large kernel)" :
|
||||
fidx == 2 ? "sepFilter2D" :
|
||||
fidx == 3 ? "sepFilter2D (symmetrical/asymmetrical kernel)" :
|
||||
fidx == 4 ? "Sobel" :
|
||||
fidx == 5 ? "Scharr" :
|
||||
fidx == 6 ? "GaussianBlur" :
|
||||
fidx == 7 ? "blur" :
|
||||
fidx == 8 || fidx == 9 ? "morphologyEx" :
|
||||
"unknown???");
|
||||
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST(Imgproc_Filtering, supportedFormats) { CV_FilterSupportedFormatsTest test; test.safe_run(); }
|
||||
INSTANTIATE_TEST_CASE_P(/**/, Imgproc_FilterSupportedFormats,
|
||||
testing::Values(
|
||||
make_pair( CV_8U, CV_8U ),
|
||||
make_pair( CV_8U, CV_16U ),
|
||||
make_pair( CV_8U, CV_16S ),
|
||||
make_pair( CV_8U, CV_32F),
|
||||
make_pair( CV_8U, CV_64F),
|
||||
make_pair( CV_16U, CV_16U),
|
||||
make_pair( CV_16U, CV_32F),
|
||||
make_pair( CV_16U, CV_64F),
|
||||
make_pair( CV_16S, CV_16S),
|
||||
make_pair( CV_16S, CV_32F),
|
||||
make_pair( CV_16S, CV_64F),
|
||||
make_pair( CV_32F, CV_32F),
|
||||
make_pair( CV_64F, CV_64F)
|
||||
)
|
||||
);
|
||||
|
||||
TEST(Imgproc_Blur, borderTypes)
|
||||
{
|
||||
|
||||
@@ -282,7 +282,7 @@ void CV_ResizeTest::prepare_to_validation( int /*test_case_idx*/ )
|
||||
int elem_size = CV_ELEM_SIZE(src->type);
|
||||
int drows = dst->rows, dcols = dst->cols;
|
||||
|
||||
if( interpolation == CV_INTER_NN )
|
||||
if( interpolation == cv::INTER_NEAREST )
|
||||
{
|
||||
for( j = 0; j < dcols; j++ )
|
||||
{
|
||||
@@ -373,7 +373,7 @@ void CV_ResizeExactTest::get_test_array_types_and_sizes(int test_case_idx, vecto
|
||||
/////////////////////////
|
||||
|
||||
static void test_remap( const Mat& src, Mat& dst, const Mat& mapx, const Mat& mapy,
|
||||
Mat* mask=0, int interpolation=CV_INTER_LINEAR )
|
||||
Mat* mask=0, int interpolation=cv::INTER_LINEAR )
|
||||
{
|
||||
int x, y, k;
|
||||
int drows = dst.rows, dcols = dst.cols;
|
||||
@@ -384,7 +384,7 @@ static void test_remap( const Mat& src, Mat& dst, const Mat& mapx, const Mat& ma
|
||||
int step = (int)(src.step / CV_ELEM_SIZE(depth));
|
||||
int delta;
|
||||
|
||||
if( interpolation != CV_INTER_CUBIC )
|
||||
if( interpolation != cv::INTER_CUBIC )
|
||||
{
|
||||
delta = 0;
|
||||
scols -= 1; srows -= 1;
|
||||
@@ -762,7 +762,7 @@ void CV_RemapTest::get_test_array_types_and_sizes( int test_case_idx, vector<vec
|
||||
{
|
||||
CV_ImgWarpBaseTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
|
||||
types[INPUT][1] = types[INPUT][2] = CV_32FC1;
|
||||
interpolation = CV_INTER_LINEAR;
|
||||
interpolation = cv::INTER_LINEAR;
|
||||
}
|
||||
|
||||
|
||||
@@ -917,7 +917,7 @@ void CV_GetRectSubPixTest::get_test_array_types_and_sizes( int test_case_idx, ve
|
||||
|
||||
center.x = (float)(cvtest::randReal(rng)*src_size.width);
|
||||
center.y = (float)(cvtest::randReal(rng)*src_size.height);
|
||||
interpolation = CV_INTER_LINEAR;
|
||||
interpolation = cv::INTER_LINEAR;
|
||||
|
||||
test_cpp = (cvtest::randInt(rng) & 256) == 0;
|
||||
}
|
||||
@@ -1595,7 +1595,7 @@ TEST(Imgproc_Remap, DISABLED_memleak)
|
||||
putchar('.');
|
||||
fflush(stdout);
|
||||
}
|
||||
remap(src, dst, map_x, map_y, CV_INTER_LINEAR);
|
||||
remap(src, dst, map_x, map_y, cv::INTER_LINEAR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1617,11 +1617,11 @@ TEST(Imgproc_linearPolar, identity)
|
||||
{
|
||||
linearPolar(src, dst,
|
||||
Point2f((N-1) * 0.5f, (N-1) * 0.5f), N * 0.5f,
|
||||
cv::WARP_FILL_OUTLIERS | CV_INTER_LINEAR | cv::WARP_INVERSE_MAP);
|
||||
cv::WARP_FILL_OUTLIERS | cv::INTER_LINEAR | cv::WARP_INVERSE_MAP);
|
||||
|
||||
linearPolar(dst, src,
|
||||
Point2f((N-1) * 0.5f, (N-1) * 0.5f), N * 0.5f,
|
||||
cv::WARP_FILL_OUTLIERS | CV_INTER_LINEAR);
|
||||
cv::WARP_FILL_OUTLIERS | cv::INTER_LINEAR);
|
||||
|
||||
double psnr = cvtest::PSNR(in(roi), src(roi));
|
||||
EXPECT_LE(25, psnr) << "iteration=" << i;
|
||||
@@ -1658,11 +1658,11 @@ TEST(Imgproc_logPolar, identity)
|
||||
{
|
||||
logPolar(src, dst,
|
||||
Point2f((N-1) * 0.5f, (N-1) * 0.5f), M,
|
||||
cv::WARP_FILL_OUTLIERS | CV_INTER_LINEAR | cv::WARP_INVERSE_MAP);
|
||||
cv::WARP_FILL_OUTLIERS | cv::INTER_LINEAR | cv::WARP_INVERSE_MAP);
|
||||
|
||||
logPolar(dst, src,
|
||||
Point2f((N-1) * 0.5f, (N-1) * 0.5f), M,
|
||||
cv::WARP_FILL_OUTLIERS | CV_INTER_LINEAR);
|
||||
cv::WARP_FILL_OUTLIERS | cv::INTER_LINEAR);
|
||||
|
||||
double psnr = cvtest::PSNR(in(roi), src(roi));
|
||||
EXPECT_LE(25, psnr) << "iteration=" << i;
|
||||
@@ -1694,7 +1694,7 @@ TEST(Imgproc_warpPolar, identity)
|
||||
Rect roi = Rect(0, 0, in.cols - ((N + 19) / 20), in.rows);
|
||||
Point2f center = Point2f((N - 1) * 0.5f, (N - 1) * 0.5f);
|
||||
double radius = N * 0.5;
|
||||
int flags = cv::WARP_FILL_OUTLIERS | CV_INTER_LINEAR;
|
||||
int flags = cv::WARP_FILL_OUTLIERS | cv::INTER_LINEAR;
|
||||
// test linearPolar
|
||||
for (int ki = 1; ki <= 5; ki++)
|
||||
{
|
||||
|
||||
@@ -1269,7 +1269,7 @@ void CV_WarpPerspective_Test::warpPerspective(const Mat& _src, Mat& _dst)
|
||||
continue;
|
||||
}
|
||||
|
||||
den *= INTER_TAB_SIZE;
|
||||
den *= static_cast<double>(INTER_TAB_SIZE);
|
||||
int v0 = saturate_cast<int>((tM[0] * dx + tM[1] * dy + tM[2]) * den);
|
||||
int v1 = saturate_cast<int>((tM[3] * dx + tM[4] * dy + tM[5]) * den);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user