Skip to content

Commit

Permalink
Merge pull request #3808 from mshabunin:cpp-cleanup
Browse files Browse the repository at this point in the history
C-API cleanup: removed legacy API usage
  • Loading branch information
asmorkalov authored Oct 17, 2024
2 parents 31be64e + 974247c commit 3cc5923
Show file tree
Hide file tree
Showing 15 changed files with 11 additions and 705 deletions.
3 changes: 1 addition & 2 deletions modules/ccalib/src/ccalib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include "opencv2/ccalib.hpp"

#include <opencv2/core.hpp>
#include <opencv2/core/types_c.h> // CV_TERM
#include <opencv2/imgproc.hpp>
#include <opencv2/3d.hpp>
#include <opencv2/calib.hpp>
Expand Down Expand Up @@ -222,7 +221,7 @@ void CustomPattern::refinePointsPos(const Mat& img, vector<Point2f>& p)
Mat gray;
cvtColor(img, gray, COLOR_RGB2GRAY);
cornerSubPix(gray, p, Size(10, 10), Size(-1, -1),
TermCriteria(CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 30, 0.1));
TermCriteria(cv::TermCriteria::MAX_ITER + cv::TermCriteria::EPS, 30, 0.1));

}

Expand Down
1 change: 0 additions & 1 deletion modules/cudalegacy/src/cuda/NCVHaarObjectDetection.cu
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@

#ifdef HAVE_OPENCV_XOBJDETECT
# include "opencv2/xobjdetect.hpp"
//# include "opencv2/objdetect/objdetect_c.h"
#endif

#include "opencv2/cudalegacy/NCV.hpp"
Expand Down
5 changes: 2 additions & 3 deletions modules/cvv/samples/cvv_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <opencv2/imgproc.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/videoio/videoio_c.h>

#define CVVISUAL_DEBUGMODE
#include <opencv2/cvv/debug_mode.hpp>
Expand Down Expand Up @@ -55,8 +54,8 @@ main(int argc, char** argv)

if (res_w>0 && res_h>0) {
printf("Setting resolution to %dx%d\n", res_w, res_h);
capture.set(CV_CAP_PROP_FRAME_WIDTH, res_w);
capture.set(CV_CAP_PROP_FRAME_HEIGHT, res_h);
capture.set(cv::CAP_PROP_FRAME_WIDTH, res_w);
capture.set(cv::CAP_PROP_FRAME_HEIGHT, res_h);
}


Expand Down
1 change: 0 additions & 1 deletion modules/dpm/src/dpm_feature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#define __DPM_FEATURE__

#include "opencv2/core.hpp"
#include "opencv2/core/core_c.h"
#include "opencv2/imgproc.hpp"

#include <string>
Expand Down
6 changes: 3 additions & 3 deletions modules/ml/src/ann_mlp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,8 +865,8 @@ class ANN_MLPImpl CV_FINAL : public ANN_MLP

TermCriteria termcrit;
termcrit.type = TermCriteria::COUNT + TermCriteria::EPS;
termcrit.maxCount = std::max((params.termCrit.type & CV_TERMCRIT_ITER ? params.termCrit.maxCount : MAX_ITER), 1);
termcrit.epsilon = std::max((params.termCrit.type & CV_TERMCRIT_EPS ? params.termCrit.epsilon : DEFAULT_EPSILON), DBL_EPSILON);
termcrit.maxCount = std::max((params.termCrit.type & TermCriteria::COUNT ? params.termCrit.maxCount : MAX_ITER), 1);
termcrit.epsilon = std::max((params.termCrit.type & TermCriteria::EPS ? params.termCrit.epsilon : DEFAULT_EPSILON), DBL_EPSILON);

int iter = 0;
switch(params.trainMethod){
Expand Down Expand Up @@ -902,7 +902,7 @@ class ANN_MLPImpl CV_FINAL : public ANN_MLP
int count = inputs.rows;

int iter = -1, max_iter = termCrit.maxCount*count;
double epsilon = (termCrit.type & CV_TERMCRIT_EPS) ? termCrit.epsilon*count : 0;
double epsilon = (termCrit.type & cv::TermCriteria::EPS) ? termCrit.epsilon*count : 0;

int l_count = layer_count();
int ivcount = layer_sizes[0];
Expand Down
2 changes: 1 addition & 1 deletion modules/ml/src/em.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class CV_EXPORTS EMImpl CV_FINAL : public EM
CV_Assert(!clusterSamples.empty());

calcCovarMatrix(clusterSamples, covs[clusterIndex], means.row(clusterIndex),
CV_COVAR_NORMAL + CV_COVAR_ROWS + CV_COVAR_USE_AVG + CV_COVAR_SCALE, CV_64FC1);
cv::COVAR_NORMAL + cv::COVAR_ROWS + cv::COVAR_USE_AVG + cv::COVAR_SCALE, CV_64FC1);
weights.at<double>(clusterIndex) = static_cast<double>(clusterSamples.rows)/static_cast<double>(nsamples);
}

Expand Down
1 change: 0 additions & 1 deletion modules/ml/src/precomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

#include "opencv2/core.hpp"
#include "opencv2/ml.hpp"
#include "opencv2/core/core_c.h"
#include "opencv2/core/utility.hpp"

#include "opencv2/core/private.hpp"
Expand Down
2 changes: 1 addition & 1 deletion modules/ml/src/svm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ struct SvmParams
C = 1;
nu = 0;
p = 0;
termCrit = TermCriteria( CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 1000, FLT_EPSILON );
termCrit = TermCriteria( cv::TermCriteria::MAX_ITER + cv::TermCriteria::EPS, 1000, FLT_EPSILON );
}

SvmParams( int _svmType, int _kernelType,
Expand Down
1 change: 0 additions & 1 deletion modules/reg/samples/map_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#ifdef COMPARE_FEATURES
#include <opencv2/xfeatures2d.hpp>
#include <opencv2/3d.hpp>
#include <opencv2/calib3d/calib3d_c.h>
using namespace cv::xfeatures2d;
#endif

Expand Down
Loading

0 comments on commit 3cc5923

Please sign in to comment.