From fc98b31c3ec83acf778c30c0cd34d178c9d0a54b Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Thu, 29 Feb 2024 12:24:01 +0300 Subject: [PATCH] Partially backport C API removal in imgproc module to reduce conflicts with 5.x --- modules/highgui/src/window_wayland.cpp | 22 +++++++++++----------- modules/imgproc/src/approx.cpp | 20 ++++++++++---------- modules/imgproc/src/contours.cpp | 2 +- modules/imgproc/src/distransform.cpp | 24 ++++++++++++------------ modules/imgproc/src/drawing.cpp | 4 ++-- modules/imgproc/src/emd.cpp | 6 +++--- modules/imgproc/src/histogram.cpp | 2 +- modules/imgproc/src/imgwarp.cpp | 24 ++++++++++++------------ modules/imgproc/src/thresh.cpp | 12 ++++++------ modules/imgproc/test/test_convhull.cpp | 4 ++-- modules/imgproc/test/test_drawing.cpp | 4 ++-- modules/imgproc/test/test_imgwarp.cpp | 14 +++++++------- modules/imgproc/test/test_thresh.cpp | 18 +++++++++--------- 13 files changed, 78 insertions(+), 78 deletions(-) diff --git a/modules/highgui/src/window_wayland.cpp b/modules/highgui/src/window_wayland.cpp index 0d7c9788a1..be5eb243b7 100644 --- a/modules/highgui/src/window_wayland.cpp +++ b/modules/highgui/src/window_wayland.cpp @@ -1442,18 +1442,18 @@ cv::Rect cv_wl_titlebar::draw(void *data, cv::Size const &size, bool force) { cv::putText( buf_, window_->get_title(), origin, title_.face, title_.scale, - CV_RGB(0xff, 0xff, 0xff), title_.thickness, CV_AA + CV_RGB(0xff, 0xff, 0xff), title_.thickness, cv::LINE_AA ); } buf_(cv::Rect(btn_min_.tl(), cv::Size(titlebar_min_width, size.height))) = bg_color_; - cv::line(buf_, btn_cls.tl(), btn_cls.br(), line_color_, 1, CV_AA); + cv::line(buf_, btn_cls.tl(), btn_cls.br(), line_color_, 1, cv::LINE_AA); cv::line(buf_, btn_cls.tl() + cv::Point(btn_cls.width, 0), btn_cls.br() - cv::Point(btn_cls.width, 0), - line_color_, 1, CV_AA); - cv::rectangle(buf_, btn_max.tl(), btn_max.br(), line_color_, 1, CV_AA); + line_color_, 1, cv::LINE_AA); + cv::rectangle(buf_, btn_max.tl(), btn_max.br(), line_color_, 1, cv::LINE_AA); cv::line(buf_, cv::Point(btn_min_.x + 8, btn_min_.height / 2), - cv::Point(btn_min_.x + btn_min_.width - 8, btn_min_.height / 2), line_color_, 1, CV_AA); - cv::line(buf_, cv::Point(0, 0), cv::Point(buf_.size().width, 0), border_color_, 1, CV_AA); + cv::Point(btn_min_.x + btn_min_.width - 8, btn_min_.height / 2), line_color_, 1, cv::LINE_AA); + cv::line(buf_, cv::Point(0, 0), cv::Point(buf_.size().width, 0), border_color_, 1, cv::LINE_AA); write_mat_to_xrgb8888(buf_, data); last_size_ = size; @@ -1657,12 +1657,12 @@ cv::Rect cv_wl_trackbar::draw(void *data, cv::Size const &size, bool force) { data_, (name_ + ": " + std::to_string(slider_.value)), bar_.text_orig, bar_.fontface, bar_.fontscale, - CV_RGB(0x00, 0x00, 0x00), bar_.font_thickness, CV_AA); + CV_RGB(0x00, 0x00, 0x00), bar_.font_thickness, cv::LINE_AA); - cv::line(data_, bar_.left, bar_.right, color_.bg, bar_.thickness + 3, CV_AA); - cv::line(data_, bar_.left, bar_.right, color_.fg, bar_.thickness, CV_AA); - cv::circle(data_, slider_.pos, slider_.radius, color_.fg, -1, CV_AA); - cv::circle(data_, slider_.pos, slider_.radius, color_.bg, 1, CV_AA); + cv::line(data_, bar_.left, bar_.right, color_.bg, bar_.thickness + 3, cv::LINE_AA); + cv::line(data_, bar_.left, bar_.right, color_.fg, bar_.thickness, cv::LINE_AA); + cv::circle(data_, slider_.pos, slider_.radius, color_.fg, -1, cv::LINE_AA); + cv::circle(data_, slider_.pos, slider_.radius, color_.bg, 1, cv::LINE_AA); write_mat_to_xrgb8888(data_, data); damage = cv::Rect(cv::Point(0, 0), size); diff --git a/modules/imgproc/src/approx.cpp b/modules/imgproc/src/approx.cpp index efbc6d33a5..df1570c38d 100644 --- a/modules/imgproc/src/approx.cpp +++ b/modules/imgproc/src/approx.cpp @@ -103,9 +103,9 @@ CvSeq* icvApproximateChainTC89( CvChain* chain, int header_size, /* calc 1-curvature */ s = abs_diff[reader.code - prev_code + 7]; - if( method <= CV_CHAIN_APPROX_SIMPLE ) + if( method <= cv::CHAIN_APPROX_SIMPLE ) { - if( method == CV_CHAIN_APPROX_NONE || s != 0 ) + if( method == cv::CHAIN_APPROX_NONE || s != 0 ) { CV_WRITE_SEQ_ELEM( pt, writer ); } @@ -121,7 +121,7 @@ CvSeq* icvApproximateChainTC89( CvChain* chain, int header_size, //CV_Assert( pt.x == chain->origin.x && pt.y == chain->origin.y ); - if( method <= CV_CHAIN_APPROX_SIMPLE ) + if( method <= cv::CHAIN_APPROX_SIMPLE ) return cvEndWriteSeq( &writer ); current->next = 0; @@ -176,7 +176,7 @@ CvSeq* icvApproximateChainTC89( CvChain* chain, int header_size, current->k = --k; /* determine cosine curvature if it should be used */ - if( method == CV_CHAIN_APPROX_TC89_KCOS ) + if( method == cv::CHAIN_APPROX_TC89_KCOS ) { /* calc k-cosine curvature */ for( j = k, s = 0; j > 0; j-- ) @@ -288,7 +288,7 @@ CvSeq* icvApproximateChainTC89( CvChain* chain, int header_size, } while( current != 0 ); - if( method == CV_CHAIN_APPROX_TC89_KCOS ) + if( method == cv::CHAIN_APPROX_TC89_KCOS ) goto copy_vect; /* Pass 4. @@ -390,7 +390,7 @@ cvApproxChains( CvSeq* src_seq, if( !src_seq || !storage ) CV_Error( CV_StsNullPtr, "" ); - if( method > CV_CHAIN_APPROX_TC89_KCOS || method <= 0 || minimal_perimeter < 0 ) + if( method > cv::CHAIN_APPROX_TC89_KCOS || method <= 0 || minimal_perimeter < 0 ) CV_Error( CV_StsOutOfRange, "" ); while( src_seq != 0 ) @@ -403,10 +403,10 @@ cvApproxChains( CvSeq* src_seq, switch( method ) { - case CV_CHAIN_APPROX_NONE: - case CV_CHAIN_APPROX_SIMPLE: - case CV_CHAIN_APPROX_TC89_L1: - case CV_CHAIN_APPROX_TC89_KCOS: + case cv::CHAIN_APPROX_NONE: + case cv::CHAIN_APPROX_SIMPLE: + case cv::CHAIN_APPROX_TC89_L1: + case cv::CHAIN_APPROX_TC89_KCOS: contour = icvApproximateChainTC89( (CvChain *) src_seq, sizeof( CvContour ), storage, method ); break; default: diff --git a/modules/imgproc/src/contours.cpp b/modules/imgproc/src/contours.cpp index e06e014e17..2e0d14e4c7 100644 --- a/modules/imgproc/src/contours.cpp +++ b/modules/imgproc/src/contours.cpp @@ -301,7 +301,7 @@ cvStartFindContours_Impl( void* _img, CvMemStorage* storage, /* converts all pixels to 0 or 1 */ if( CV_MAT_TYPE(mat->type) != CV_32S ) - cvThreshold( mat, mat, 0, 1, CV_THRESH_BINARY ); + cvThreshold( mat, mat, 0, 1, cv::THRESH_BINARY ); return scanner; } diff --git a/modules/imgproc/src/distransform.cpp b/modules/imgproc/src/distransform.cpp index 52167b2264..c2bdb62948 100644 --- a/modules/imgproc/src/distransform.cpp +++ b/modules/imgproc/src/distransform.cpp @@ -760,18 +760,18 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe _labels.create(src.size(), CV_32S); labels = _labels.getMat(); - maskSize = CV_DIST_MASK_5; + maskSize = cv::DIST_MASK_5; } float _mask[5] = {0}; - if( maskSize != CV_DIST_MASK_3 && maskSize != CV_DIST_MASK_5 && maskSize != CV_DIST_MASK_PRECISE ) + if( maskSize != cv::DIST_MASK_3 && maskSize != cv::DIST_MASK_5 && maskSize != cv::DIST_MASK_PRECISE ) CV_Error( CV_StsBadSize, "Mask size should be 3 or 5 or 0 (precise)" ); - if ((distType == CV_DIST_C || distType == CV_DIST_L1) && !need_labels) - maskSize = CV_DIST_MASK_3; + if ((distType == cv::DIST_C || distType == cv::DIST_L1) && !need_labels) + maskSize = cv::DIST_MASK_3; - if( maskSize == CV_DIST_MASK_PRECISE ) + if( maskSize == cv::DIST_MASK_PRECISE ) { #ifdef HAVE_IPP @@ -809,19 +809,19 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe return; } - CV_Assert( distType == CV_DIST_C || distType == CV_DIST_L1 || distType == CV_DIST_L2 ); + CV_Assert( distType == cv::DIST_C || distType == cv::DIST_L1 || distType == cv::DIST_L2 ); - getDistanceTransformMask( (distType == CV_DIST_C ? 0 : - distType == CV_DIST_L1 ? 1 : 2) + maskSize*10, _mask ); + getDistanceTransformMask( (distType == cv::DIST_C ? 0 : + distType == cv::DIST_L1 ? 1 : 2) + maskSize*10, _mask ); Size size = src.size(); - int border = maskSize == CV_DIST_MASK_3 ? 1 : 2; + int border = maskSize == cv::DIST_MASK_3 ? 1 : 2; Mat temp; if( !need_labels ) { - if( maskSize == CV_DIST_MASK_3 ) + if( maskSize == cv::DIST_MASK_3 ) { #if defined (HAVE_IPP) && (IPP_VERSION_X100 >= 700) bool has_int_overflow = (int64)src.cols * src.rows >= INT_MAX; @@ -864,7 +864,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe { labels.setTo(Scalar::all(0)); - if( labelType == CV_DIST_LABEL_CCOMP ) + if( labelType == cv::DIST_LABEL_CCOMP ) { Mat zpix = src == 0; connectedComponents(zpix, labels, 8, CV_32S, CCL_WU); @@ -893,7 +893,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, { CV_INSTRUMENT_REGION(); - if (distanceType == CV_DIST_L1 && dstType==CV_8U) + if (distanceType == cv::DIST_L1 && dstType==CV_8U) distanceTransform_L1_8U(_src, _dst); else distanceTransform(_src, _dst, noArray(), distanceType, maskSize, DIST_LABEL_PIXEL); diff --git a/modules/imgproc/src/drawing.cpp b/modules/imgproc/src/drawing.cpp index d69007a320..019c6e537e 100644 --- a/modules/imgproc/src/drawing.cpp +++ b/modules/imgproc/src/drawing.cpp @@ -1359,7 +1359,7 @@ FillEdgeCollection( Mat& img, std::vector& edges, const void* color, i int pix_size = (int)img.elemSize(); int delta; - if (line_type < CV_AA) + if (line_type < cv::LINE_AA) delta = 0; else delta = XY_ONE - 1; @@ -2310,7 +2310,7 @@ void putText( InputOutputArray _img, const String& text, Point org, int base_line = -(ascii[0] & 15); int hscale = cvRound(fontScale*XY_ONE), vscale = hscale; - if( line_type == CV_AA && img.depth() != CV_8U ) + if( line_type == cv::LINE_AA && img.depth() != CV_8U ) line_type = 8; if( bottomLeftOrigin ) diff --git a/modules/imgproc/src/emd.cpp b/modules/imgproc/src/emd.cpp index 3e065b0404..eb86460535 100644 --- a/modules/imgproc/src/emd.cpp +++ b/modules/imgproc/src/emd.cpp @@ -232,13 +232,13 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1, user_param = (void *) (size_t)dims; switch (dist_type) { - case CV_DIST_L1: + case cv::DIST_L1: dist_func = icvDistL1; break; - case CV_DIST_L2: + case cv::DIST_L2: dist_func = icvDistL2; break; - case CV_DIST_C: + case cv::DIST_C: dist_func = icvDistC; break; default: diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index 7a52d0f3fe..499dd6e983 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -2471,7 +2471,7 @@ cvThreshHist( CvHistogram* hist, double thresh ) { CvMat mat; cvGetMat( hist->bins, &mat, 0, 1 ); - cvThreshold( &mat, &mat, thresh, 0, CV_THRESH_TOZERO ); + cvThreshold( &mat, &mat, thresh, 0, cv::THRESH_TOZERO ); } else { diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index 567f890906..7a9ed3033e 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -1449,7 +1449,7 @@ static bool ocl_linearPolar(InputArray _src, OutputArray _dst, size_t h = dsize.height; String buildOptions; unsigned mem_size = 32; - if (flags & CV_WARP_INVERSE_MAP) + if (flags & cv::WARP_INVERSE_MAP) { buildOptions = "-D InverseMap"; } @@ -1464,7 +1464,7 @@ static bool ocl_linearPolar(InputArray _src, OutputArray _dst, ocl::KernelArg ocl_cp_sp = ocl::KernelArg::PtrReadWrite(cp_sp); ocl::KernelArg ocl_r = ocl::KernelArg::PtrReadWrite(r); - if (!(flags & CV_WARP_INVERSE_MAP)) + if (!(flags & cv::WARP_INVERSE_MAP)) { @@ -1495,7 +1495,7 @@ static bool ocl_linearPolar(InputArray _src, OutputArray _dst, size_t globalThreads[2] = { (size_t)dsize.width , (size_t)dsize.height }; size_t localThreads[2] = { mem_size , mem_size }; k.run(2, globalThreads, localThreads, false); - remap(src, _dst, mapx, mapy, flags & cv::INTER_MAX, (flags & CV_WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT); + remap(src, _dst, mapx, mapy, flags & cv::INTER_MAX, (flags & cv::WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT); return true; } static bool ocl_logPolar(InputArray _src, OutputArray _dst, @@ -1518,7 +1518,7 @@ static bool ocl_logPolar(InputArray _src, OutputArray _dst, size_t h = dsize.height; String buildOptions; unsigned mem_size = 32; - if (flags & CV_WARP_INVERSE_MAP) + if (flags & cv::WARP_INVERSE_MAP) { buildOptions = "-D InverseMap"; } @@ -1535,7 +1535,7 @@ static bool ocl_logPolar(InputArray _src, OutputArray _dst, ocl::KernelArg ocl_cp_sp = ocl::KernelArg::PtrReadWrite(cp_sp); ocl::KernelArg ocl_r = ocl::KernelArg::PtrReadWrite(r); - if (!(flags & CV_WARP_INVERSE_MAP)) + if (!(flags & cv::WARP_INVERSE_MAP)) { @@ -1566,7 +1566,7 @@ static bool ocl_logPolar(InputArray _src, OutputArray _dst, size_t globalThreads[2] = { (size_t)dsize.width , (size_t)dsize.height }; size_t localThreads[2] = { mem_size , mem_size }; k.run(2, globalThreads, localThreads, false); - remap(src, _dst, mapx, mapy, flags & cv::INTER_MAX, (flags & CV_WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT); + remap(src, _dst, mapx, mapy, flags & cv::INTER_MAX, (flags & cv::WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT); return true; } #endif @@ -3635,7 +3635,7 @@ cvWarpAffine( const CvArr* srcarr, CvArr* dstarr, const CvMat* marr, cv::Mat matrix = cv::cvarrToMat(marr); CV_Assert( src.type() == dst.type() ); cv::warpAffine( src, dst, matrix, dst.size(), flags, - (flags & CV_WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT, + (flags & cv::WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT, fillval ); } @@ -3647,7 +3647,7 @@ cvWarpPerspective( const CvArr* srcarr, CvArr* dstarr, const CvMat* marr, cv::Mat matrix = cv::cvarrToMat(marr); CV_Assert( src.type() == dst.type() ); cv::warpPerspective( src, dst, matrix, dst.size(), flags, - (flags & CV_WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT, + (flags & cv::WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT, fillval ); } @@ -3660,7 +3660,7 @@ cvRemap( const CvArr* srcarr, CvArr* dstarr, cv::Mat mapx = cv::cvarrToMat(_mapx), mapy = cv::cvarrToMat(_mapy); CV_Assert( src.type() == dst.type() && dst.size() == mapx.size() ); cv::remap( src, dst, mapx, mapy, flags & cv::INTER_MAX, - (flags & CV_WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT, + (flags & cv::WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT, fillval ); CV_Assert( dst0.data == dst.data ); } @@ -3744,7 +3744,7 @@ void cv::warpPolar(InputArray _src, OutputArray _dst, Size dsize, mapy.create(dsize, CV_32F); bool semiLog = (flags & WARP_POLAR_LOG) != 0; - if (!(flags & CV_WARP_INVERSE_MAP)) + if (!(flags & cv::WARP_INVERSE_MAP)) { CV_Assert(!dsize.empty()); double Kangle = CV_2PI / dsize.height; @@ -3784,7 +3784,7 @@ void cv::warpPolar(InputArray _src, OutputArray _dst, Size dsize, my[rho] = (float)y; } } - remap(_src, _dst, mapx, mapy, flags & cv::INTER_MAX, (flags & CV_WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT); + remap(_src, _dst, mapx, mapy, flags & cv::INTER_MAX, (flags & cv::WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT); } else { @@ -3837,7 +3837,7 @@ void cv::warpPolar(InputArray _src, OutputArray _dst, Size dsize, } } remap(src, _dst, mapx, mapy, flags & cv::INTER_MAX, - (flags & CV_WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT); + (flags & cv::WARP_FILL_OUTLIERS) ? cv::BORDER_CONSTANT : cv::BORDER_TRANSPARENT); } } diff --git a/modules/imgproc/src/thresh.cpp b/modules/imgproc/src/thresh.cpp index 4622691e68..8259902ed7 100644 --- a/modules/imgproc/src/thresh.cpp +++ b/modules/imgproc/src/thresh.cpp @@ -1545,18 +1545,18 @@ double cv::threshold( InputArray _src, OutputArray _dst, double thresh, double m ocl_threshold(_src, _dst, thresh, maxval, type), thresh) Mat src = _src.getMat(); - int automatic_thresh = (type & ~CV_THRESH_MASK); + int automatic_thresh = (type & ~cv::THRESH_MASK); type &= THRESH_MASK; - CV_Assert( automatic_thresh != (CV_THRESH_OTSU | CV_THRESH_TRIANGLE) ); - if( automatic_thresh == CV_THRESH_OTSU ) + CV_Assert( automatic_thresh != (cv::THRESH_OTSU | cv::THRESH_TRIANGLE) ); + if( automatic_thresh == cv::THRESH_OTSU ) { int src_type = src.type(); CV_CheckType(src_type, src_type == CV_8UC1 || src_type == CV_16UC1, "THRESH_OTSU mode"); thresh = src.type() == CV_8UC1 ? getThreshVal_Otsu_8u( src ) : getThreshVal_Otsu_16u( src ); } - else if( automatic_thresh == CV_THRESH_TRIANGLE ) + else if( automatic_thresh == cv::THRESH_TRIANGLE ) { CV_Assert( src.type() == CV_8UC1 ); thresh = getThreshVal_Triangle_8u( src ); @@ -1711,10 +1711,10 @@ void cv::adaptiveThreshold( InputArray _src, OutputArray _dst, double maxValue, int idelta = type == THRESH_BINARY ? cvCeil(delta) : cvFloor(delta); uchar tab[768]; - if( type == CV_THRESH_BINARY ) + if( type == cv::THRESH_BINARY ) for( i = 0; i < 768; i++ ) tab[i] = (uchar)(i - 255 > -idelta ? imaxval : 0); - else if( type == CV_THRESH_BINARY_INV ) + else if( type == cv::THRESH_BINARY_INV ) for( i = 0; i < 768; i++ ) tab[i] = (uchar)(i - 255 <= -idelta ? imaxval : 0); else diff --git a/modules/imgproc/test/test_convhull.cpp b/modules/imgproc/test/test_convhull.cpp index 70251e3a25..2501a38075 100644 --- a/modules/imgproc/test/test_convhull.cpp +++ b/modules/imgproc/test/test_convhull.cpp @@ -747,7 +747,7 @@ int CV_MinAreaRectTest::validate_test_results( int test_case_idx ) cvCircle(img,cvPoint(cvRound(p[i].x*a+b),cvRound(p[i].y*c+d)), 3, CV_RGB(0,255,0), -1 ); for( i = 0; i < n; i++ ) bp[i] = cvPoint(cvRound(box_pt[i].x*a+b),cvRound(box_pt[i].y*c+d)); - cvPolyLine( img, &bpp, &n, 1, 1, CV_RGB(255,255,0), 1, CV_AA, 0 ); + cvPolyLine( img, &bpp, &n, 1, 1, CV_RGB(255,255,0), 1, cv::LINE_AA, 0 ); cvShowImage( "test", img ); cvWaitKey(); cvReleaseImage(&img); @@ -857,7 +857,7 @@ int CV_MinTriangleTest::validate_test_results( int test_case_idx ) cvCircle(img,cvPoint(cvRound(p[i].x*a+b),cvRound(p[i].y*c+d)), 3, CV_RGB(0,255,0), -1 ); for( i = 0; i < n; i++ ) bp[i] = cvPoint(cvRound(triangle[i].x*a+b),cvRound(triangle[i].y*c+d)); - cvPolyLine( img, &bpp, &n, 1, 1, CV_RGB(255,255,0), 1, CV_AA, 0 ); + cvPolyLine( img, &bpp, &n, 1, 1, CV_RGB(255,255,0), 1, cv::LINE_AA, 0 ); cvShowImage( "test", img ); cvWaitKey(); cvReleaseImage(&img); diff --git a/modules/imgproc/test/test_drawing.cpp b/modules/imgproc/test/test_drawing.cpp index 02095cd6b7..cdd2a01b4b 100644 --- a/modules/imgproc/test/test_drawing.cpp +++ b/modules/imgproc/test/test_drawing.cpp @@ -742,7 +742,7 @@ TEST(Drawing, fillpoly_fully) t1.x = (t1.x + offset.x) << (xy_shift - shift); t1.y = (t1.y + delta) >> shift; - if (lineType < CV_AA) + if (lineType < cv::LINE_AA) { t0.x = (t0.x + (xy_one >> 1)) >> xy_shift; t1.x = (t1.x + (xy_one >> 1)) >> xy_shift; @@ -831,7 +831,7 @@ PARAM_TEST_CASE(FillPolyFully, unsigned, unsigned, int, int, Point, cv::LineType t1.x = (t1.x + offset.x) << (xy_shift - shift); t1.y = (t1.y + delta) >> shift; - if (lineType < CV_AA) + if (lineType < cv::LINE_AA) { t0.x = (t0.x + (xy_one >> 1)) >> xy_shift; t1.x = (t1.x + (xy_one >> 1)) >> xy_shift; diff --git a/modules/imgproc/test/test_imgwarp.cpp b/modules/imgproc/test/test_imgwarp.cpp index 737128aa55..e8840d231b 100644 --- a/modules/imgproc/test/test_imgwarp.cpp +++ b/modules/imgproc/test/test_imgwarp.cpp @@ -1615,11 +1615,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; @@ -1656,11 +1656,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; @@ -1692,11 +1692,11 @@ 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++) { - warpPolar(src, dst, src.size(), center, radius, flags + WARP_POLAR_LINEAR + CV_WARP_INVERSE_MAP); + warpPolar(src, dst, src.size(), center, radius, flags + WARP_POLAR_LINEAR + cv::WARP_INVERSE_MAP); warpPolar(dst, src, src.size(), center, radius, flags + WARP_POLAR_LINEAR); double psnr = cv::PSNR(in(roi), src(roi)); @@ -1706,7 +1706,7 @@ TEST(Imgproc_warpPolar, identity) src = in.clone(); for (int ki = 1; ki <= 5; ki++) { - warpPolar(src, dst, src.size(),center, radius, flags + WARP_POLAR_LOG + CV_WARP_INVERSE_MAP ); + warpPolar(src, dst, src.size(),center, radius, flags + WARP_POLAR_LOG + cv::WARP_INVERSE_MAP ); warpPolar(dst, src, src.size(),center, radius, flags + WARP_POLAR_LOG); double psnr = cv::PSNR(in(roi), src(roi)); diff --git a/modules/imgproc/test/test_thresh.cpp b/modules/imgproc/test/test_thresh.cpp index 510560fd05..3eb096a655 100644 --- a/modules/imgproc/test/test_thresh.cpp +++ b/modules/imgproc/test/test_thresh.cpp @@ -63,7 +63,7 @@ protected: CV_ThreshTest::CV_ThreshTest(int test_type) { - CV_Assert( (test_type & CV_THRESH_MASK) == 0 ); + CV_Assert( (test_type & cv::THRESH_MASK) == 0 ); test_array[INPUT].push_back(NULL); test_array[OUTPUT].push_back(NULL); test_array[REF_OUTPUT].push_back(NULL); @@ -84,7 +84,7 @@ void CV_ThreshTest::get_test_array_types_and_sizes( int test_case_idx, cvtest::ArrayTest::get_test_array_types_and_sizes( test_case_idx, sizes, types ); depth = depth == 0 ? CV_8U : depth == 1 ? CV_16S : depth == 2 ? CV_16U : depth == 3 ? CV_32F : CV_64F; - if ( extra_type == CV_THRESH_OTSU ) + if ( extra_type == cv::THRESH_OTSU ) { depth = cvtest::randInt(rng) % 2 == 0 ? CV_8U : CV_16U; cn = 1; @@ -197,7 +197,7 @@ static void test_threshold( const Mat& _src, Mat& _dst, int width_n = _src.cols*cn, height = _src.rows; int ithresh = cvFloor(thresh); int imaxval, ithresh2; - if (extra_type == CV_THRESH_OTSU) + if (extra_type == cv::THRESH_OTSU) { thresh = compute_otsu_thresh(_src); ithresh = cvFloor(thresh); @@ -228,7 +228,7 @@ static void test_threshold( const Mat& _src, Mat& _dst, switch( thresh_type ) { - case CV_THRESH_BINARY: + case cv::THRESH_BINARY: for( i = 0; i < height; i++ ) { if( depth == CV_8U ) @@ -268,7 +268,7 @@ static void test_threshold( const Mat& _src, Mat& _dst, } } break; - case CV_THRESH_BINARY_INV: + case cv::THRESH_BINARY_INV: for( i = 0; i < height; i++ ) { if( depth == CV_8U ) @@ -308,7 +308,7 @@ static void test_threshold( const Mat& _src, Mat& _dst, } } break; - case CV_THRESH_TRUNC: + case cv::THRESH_TRUNC: for( i = 0; i < height; i++ ) { if( depth == CV_8U ) @@ -363,7 +363,7 @@ static void test_threshold( const Mat& _src, Mat& _dst, } } break; - case CV_THRESH_TOZERO: + case cv::THRESH_TOZERO: for( i = 0; i < height; i++ ) { if( depth == CV_8U ) @@ -418,7 +418,7 @@ static void test_threshold( const Mat& _src, Mat& _dst, } } break; - case CV_THRESH_TOZERO_INV: + case cv::THRESH_TOZERO_INV: for( i = 0; i < height; i++ ) { if( depth == CV_8U ) @@ -486,7 +486,7 @@ void CV_ThreshTest::prepare_to_validation( int /*test_case_idx*/ ) } TEST(Imgproc_Threshold, accuracy) { CV_ThreshTest test; test.safe_run(); } -TEST(Imgproc_Threshold, accuracyOtsu) { CV_ThreshTest test(CV_THRESH_OTSU); test.safe_run(); } +TEST(Imgproc_Threshold, accuracyOtsu) { CV_ThreshTest test(cv::THRESH_OTSU); test.safe_run(); } BIGDATA_TEST(Imgproc_Threshold, huge) {