1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge pull request #25075 from mshabunin:cleanup-imgproc-1

C-API cleanup: apps, imgproc_c and some constants #25075

Merge with https://github.com/opencv/opencv_contrib/pull/3642

* Removed obsolete apps - traincascade and createsamples (please use older OpenCV versions if you need them). These apps relied heavily on C-API
* removed all mentions of imgproc C-API headers (imgproc_c.h, types_c.h) - they were empty, included core C-API headers
* replaced usage of several C constants with C++ ones (error codes, norm modes, RNG modes, PCA modes, ...) - most part of this PR (split into two parts - all modules and calib+3d - for easier backporting)
* removed imgproc C-API headers (as separate commit, so that other changes could be backported to 4.x)

Most of these changes can be backported to 4.x.
This commit is contained in:
Maksim Shabunin
2024-03-05 12:18:31 +03:00
committed by GitHub
parent 1d1faaabef
commit 8cbdd0c833
152 changed files with 820 additions and 18160 deletions
+12 -11
View File
@@ -42,6 +42,7 @@
#include "test_precomp.hpp"
#include "opencv2/ts/ocl_test.hpp" // T-API like tests
#include "opencv2/core/core_c.h"
namespace opencv_test {
namespace {
@@ -773,14 +774,14 @@ bool CV_OperationsTest::TestTemplateMat()
mvf.push_back(Mat_<float>::zeros(4, 3));
merge(mvf, mf2);
split(mf2, mvf2);
CV_Assert( cvtest::norm(mvf2[0], mvf[0], CV_C) == 0 &&
cvtest::norm(mvf2[1], mvf[1], CV_C) == 0 );
CV_Assert( cvtest::norm(mvf2[0], mvf[0], NORM_INF) == 0 &&
cvtest::norm(mvf2[1], mvf[1], NORM_INF) == 0 );
{
Mat a(2,2,CV_32F,1.f);
Mat b(1,2,CV_32F,1.f);
Mat c = (a*b.t()).t();
CV_Assert( cvtest::norm(c, CV_L1) == 4. );
CV_Assert( cvtest::norm(c, NORM_L1) == 4. );
}
bool badarg_catched = false;
@@ -1130,13 +1131,13 @@ bool CV_OperationsTest::operations1()
Matx33f b(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f);
Mat c;
cv::add(Mat::zeros(3, 3, CV_32F), b, c);
CV_Assert( cvtest::norm(b, c, CV_C) == 0 );
CV_Assert( cvtest::norm(b, c, NORM_INF) == 0 );
cv::add(Mat::zeros(3, 3, CV_64F), b, c, noArray(), c.type());
CV_Assert( cvtest::norm(b, c, CV_C) == 0 );
CV_Assert( cvtest::norm(b, c, NORM_INF) == 0 );
cv::add(Mat::zeros(6, 1, CV_64F), 1, c, noArray(), c.type());
CV_Assert( cvtest::norm(Matx61f(1.f, 1.f, 1.f, 1.f, 1.f, 1.f), c, CV_C) == 0 );
CV_Assert( cvtest::norm(Matx61f(1.f, 1.f, 1.f, 1.f, 1.f, 1.f), c, NORM_INF) == 0 );
vector<Point2f> pt2d(3);
vector<Point3d> pt3d(2);
@@ -1182,11 +1183,11 @@ bool CV_OperationsTest::TestSVD()
Mat A = (Mat_<double>(3,4) << 1, 2, -1, 4, 2, 4, 3, 5, -1, -2, 6, 7);
Mat x;
SVD::solveZ(A,x);
if( cvtest::norm(A*x, CV_C) > FLT_EPSILON )
if( cvtest::norm(A*x, NORM_INF) > FLT_EPSILON )
throw test_excep();
SVD svd(A, SVD::FULL_UV);
if( cvtest::norm(A*svd.vt.row(3).t(), CV_C) > FLT_EPSILON )
if( cvtest::norm(A*svd.vt.row(3).t(), NORM_INF) > FLT_EPSILON )
throw test_excep();
Mat Dp(3,3,CV_32FC1);
@@ -1210,11 +1211,11 @@ bool CV_OperationsTest::TestSVD()
W=decomp.w;
Mat I = Mat::eye(3, 3, CV_32F);
if( cvtest::norm(U*U.t(), I, CV_C) > FLT_EPSILON ||
cvtest::norm(Vt*Vt.t(), I, CV_C) > FLT_EPSILON ||
if( cvtest::norm(U*U.t(), I, NORM_INF) > FLT_EPSILON ||
cvtest::norm(Vt*Vt.t(), I, NORM_INF) > FLT_EPSILON ||
W.at<float>(2) < 0 || W.at<float>(1) < W.at<float>(2) ||
W.at<float>(0) < W.at<float>(1) ||
cvtest::norm(U*Mat::diag(W)*Vt, Q, CV_C) > FLT_EPSILON )
cvtest::norm(U*Mat::diag(W)*Vt, Q, NORM_INF) > FLT_EPSILON )
throw test_excep();
}
catch(const test_excep&)