From 54e7c76d99c45d423407318aec17035ec9543257 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Wed, 17 Apr 2013 15:24:53 +0400 Subject: [PATCH] fixed compilation errors --- modules/gpu/perf4au/main.cpp | 1 + modules/gpu/src/arithm.cpp | 10 +-- modules/gpu/src/blend.cpp | 2 +- modules/gpu/src/cascadeclassifier.cpp | 5 +- modules/gpu/src/color.cpp | 14 +-- modules/gpu/src/denoising.cpp | 4 +- modules/gpu/src/element_operations.cpp | 76 ++++++++--------- modules/gpu/src/ffmpeg_video_source.cpp | 2 +- modules/gpu/src/fgd_bgfg.cpp | 1 + modules/gpu/src/filtering.cpp | 12 +-- modules/gpu/src/graphcuts.cpp | 2 +- modules/gpu/src/hog.cpp | 6 +- modules/gpu/src/hough.cpp | 4 +- modules/gpu/src/imgproc.cpp | 10 +-- modules/gpu/src/match_template.cpp | 18 ++-- modules/gpu/src/matrix_reductions.cpp | 20 ++--- modules/gpu/src/optical_flow.cpp | 2 +- modules/gpu/src/split_merge.cpp | 4 +- modules/gpu/src/video_reader.cpp | 4 +- modules/gpu/test/test_bgfg.cpp | 1 + modules/gpu/test/test_core.cpp | 89 ++++++++++---------- modules/gpu/test/test_denoising.cpp | 4 +- modules/gpu/test/test_features2d.cpp | 8 +- modules/gpu/test/test_filters.cpp | 2 +- modules/gpu/test/test_gpumat.cpp | 12 +-- modules/gpu/test/test_hough.cpp | 2 +- modules/gpu/test/test_imgproc.cpp | 16 ++-- modules/gpu/test/test_labeling.cpp | 4 +- modules/gpu/test/test_objdetect.cpp | 22 ++--- modules/gpu/test/test_optflow.cpp | 1 + modules/ocl/src/brute_force_matcher.cpp | 2 +- modules/softcascade/src/cuda/channels.cu | 28 ++---- modules/softcascade/src/cuda/icf-sc.cu | 19 +---- modules/softcascade/src/detector_cuda.cpp | 2 +- modules/softcascade/test/utility.cpp | 4 +- modules/superres/src/frame_source.cpp | 6 +- modules/superres/src/input_array_utility.cpp | 2 +- modules/superres/src/optical_flow.cpp | 8 +- modules/ts/src/ts_perf.cpp | 2 +- samples/cpp/Qt_sample/main.cpp | 1 + samples/gpu/cascadeclassifier_nvidia_api.cpp | 7 +- 41 files changed, 205 insertions(+), 234 deletions(-) diff --git a/modules/gpu/perf4au/main.cpp b/modules/gpu/perf4au/main.cpp index eb4f069f4..47a6c4e25 100644 --- a/modules/gpu/perf4au/main.cpp +++ b/modules/gpu/perf4au/main.cpp @@ -49,6 +49,7 @@ #include "opencv2/gpu.hpp" #include "opencv2/highgui.hpp" #include "opencv2/video.hpp" +#include "opencv2/legacy.hpp" #include "opencv2/ts.hpp" #include "opencv2/ts/gpu_perf.hpp" diff --git a/modules/gpu/src/arithm.cpp b/modules/gpu/src/arithm.cpp index f60c244c0..c40e7131e 100644 --- a/modules/gpu/src/arithm.cpp +++ b/modules/gpu/src/arithm.cpp @@ -77,7 +77,7 @@ void cv::gpu::gemm(const GpuMat& src1, const GpuMat& src2, double alpha, const G (void)dst; (void)flags; (void)stream; - CV_Error(CV_StsNotImplemented, "The library was build without CUBLAS"); + CV_Error(cv::Error::StsNotImplemented, "The library was build without CUBLAS"); #else // CUBLAS works with column-major matrices @@ -87,7 +87,7 @@ void cv::gpu::gemm(const GpuMat& src1, const GpuMat& src2, double alpha, const G if (src1.depth() == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } bool tr1 = (flags & GEMM_1_T) != 0; @@ -97,7 +97,7 @@ void cv::gpu::gemm(const GpuMat& src1, const GpuMat& src2, double alpha, const G if (src1.type() == CV_64FC2) { if (tr1 || tr2 || tr3) - CV_Error(CV_StsNotImplemented, "transpose operation doesn't implemented for CV_64FC2 type"); + CV_Error(cv::Error::StsNotImplemented, "transpose operation doesn't implemented for CV_64FC2 type"); } Size src1Size = tr1 ? Size(src1.rows, src1.cols) : src1.size(); @@ -233,7 +233,7 @@ void cv::gpu::transpose(const GpuMat& src, GpuMat& dst, Stream& s) else // if (src.elemSize() == 8) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); NppStStreamHandler h(stream); @@ -548,7 +548,7 @@ void cv::gpu::normalize(const GpuMat& src, GpuMat& dst, double a, double b, int } else { - CV_Error(CV_StsBadArg, "Unknown/unsupported norm type"); + CV_Error(cv::Error::StsBadArg, "Unknown/unsupported norm type"); } if (mask.empty()) diff --git a/modules/gpu/src/blend.cpp b/modules/gpu/src/blend.cpp index c667214ae..3fd650781 100644 --- a/modules/gpu/src/blend.cpp +++ b/modules/gpu/src/blend.cpp @@ -92,7 +92,7 @@ void cv::gpu::blendLinear(const GpuMat& img1, const GpuMat& img2, const GpuMat& blendLinearCaller(size.height, size.width, cn, img1, img2, weights1, weights2, result, StreamAccessor::getStream(stream)); break; default: - CV_Error(CV_StsUnsupportedFormat, "bad image depth in linear blending function"); + CV_Error(cv::Error::StsUnsupportedFormat, "bad image depth in linear blending function"); } } diff --git a/modules/gpu/src/cascadeclassifier.cpp b/modules/gpu/src/cascadeclassifier.cpp index 770627017..c7514bb21 100644 --- a/modules/gpu/src/cascadeclassifier.cpp +++ b/modules/gpu/src/cascadeclassifier.cpp @@ -43,6 +43,7 @@ #include "precomp.hpp" #include #include +#include "opencv2/objdetect/objdetect_c.h" using namespace cv; using namespace cv::gpu; @@ -169,7 +170,7 @@ public: cv::Size getClassifierCvSize() const { return cv::Size(haar.ClassifierSize.width, haar.ClassifierSize.height); } private: - static void NCVDebugOutputHandler(const String &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); } + static void NCVDebugOutputHandler(const String &msg) { CV_Error(cv::Error::GpuApiCallError, msg.c_str()); } NCVStatus load(const String& classifierFile) { @@ -425,7 +426,7 @@ public: GpuMat buff = integralBuffer; // generate integral for scale - gpu::resize(image, src, level.sFrame, 0, 0, CV_INTER_LINEAR); + gpu::resize(image, src, level.sFrame, 0, 0, cv::INTER_LINEAR); gpu::integralBuffered(src, sint, buff); // calculate job diff --git a/modules/gpu/src/color.cpp b/modules/gpu/src/color.cpp index 5b503814a..dc3582348 100644 --- a/modules/gpu/src/color.cpp +++ b/modules/gpu/src/color.cpp @@ -1854,7 +1854,7 @@ void cv::gpu::cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn, Stream func_t func = funcs[code]; if (func == 0) - CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); + CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" ); func(src, dst, dcn, stream); } @@ -1867,12 +1867,12 @@ void cv::gpu::demosaicing(const GpuMat& src, GpuMat& dst, int code, int dcn, Str switch (code) { - case CV_BayerBG2GRAY: case CV_BayerGB2GRAY: case CV_BayerRG2GRAY: case CV_BayerGR2GRAY: - bayer_to_gray(src, dst, code == CV_BayerBG2GRAY || code == CV_BayerGB2GRAY, code == CV_BayerGB2GRAY || code == CV_BayerGR2GRAY, stream); + case cv::COLOR_BayerBG2GRAY: case cv::COLOR_BayerGB2GRAY: case cv::COLOR_BayerRG2GRAY: case cv::COLOR_BayerGR2GRAY: + bayer_to_gray(src, dst, code == cv::COLOR_BayerBG2GRAY || code == cv::COLOR_BayerGB2GRAY, code == cv::COLOR_BayerGB2GRAY || code == cv::COLOR_BayerGR2GRAY, stream); break; - case CV_BayerBG2BGR: case CV_BayerGB2BGR: case CV_BayerRG2BGR: case CV_BayerGR2BGR: - bayer_to_bgr(src, dst, dcn, code == CV_BayerBG2BGR || code == CV_BayerGB2BGR, code == CV_BayerGB2BGR || code == CV_BayerGR2BGR, stream); + case cv::COLOR_BayerBG2BGR: case cv::COLOR_BayerGB2BGR: case cv::COLOR_BayerRG2BGR: case cv::COLOR_BayerGR2BGR: + bayer_to_bgr(src, dst, dcn, code == cv::COLOR_BayerBG2BGR || code == cv::COLOR_BayerGB2BGR, code == cv::COLOR_BayerGB2BGR || code == cv::COLOR_BayerGR2BGR, stream); break; case COLOR_BayerBG2BGR_MHT: case COLOR_BayerGB2BGR_MHT: case COLOR_BayerRG2BGR_MHT: case COLOR_BayerGR2BGR_MHT: @@ -1923,7 +1923,7 @@ void cv::gpu::demosaicing(const GpuMat& src, GpuMat& dst, int code, int dcn, Str } default: - CV_Error( CV_StsBadFlag, "Unknown / unsupported color conversion code" ); + CV_Error( cv::Error::StsBadFlag, "Unknown / unsupported color conversion code" ); } } @@ -1952,7 +1952,7 @@ void cv::gpu::gammaCorrection(const GpuMat& src, GpuMat& dst, bool forward, Stre (void)dst; (void)forward; (void)stream; - CV_Error( CV_StsNotImplemented, "This function works only with CUDA 5.0 or higher" ); + CV_Error( cv::Error::StsNotImplemented, "This function works only with CUDA 5.0 or higher" ); #else typedef NppStatus (*func_t)(const Npp8u* pSrc, int nSrcStep, Npp8u* pDst, int nDstStep, NppiSize oSizeROI); typedef NppStatus (*func_inplace_t)(Npp8u* pSrcDst, int nSrcDstStep, NppiSize oSizeROI); diff --git a/modules/gpu/src/denoising.cpp b/modules/gpu/src/denoising.cpp index 0f3b8205d..1687f8e3c 100644 --- a/modules/gpu/src/denoising.cpp +++ b/modules/gpu/src/denoising.cpp @@ -179,7 +179,7 @@ void cv::gpu::FastNonLocalMeansDenoising::labMethod( const GpuMat& src, GpuMat& CV_Assert(src.type() == CV_8UC3); lab.create(src.size(), src.type()); - cv::gpu::cvtColor(src, lab, CV_BGR2Lab, 0, s); + cv::gpu::cvtColor(src, lab, cv::COLOR_BGR2Lab, 0, s); l.create(src.size(), CV_8U); ab.create(src.size(), CV_8UC2); @@ -189,7 +189,7 @@ void cv::gpu::FastNonLocalMeansDenoising::labMethod( const GpuMat& src, GpuMat& simpleMethod(ab, ab, h_color, search_window, block_window, s); cudev::imgproc::fnlm_merge_channels(l, ab, lab, StreamAccessor::getStream(s)); - cv::gpu::cvtColor(lab, dst, CV_Lab2BGR, 0, s); + cv::gpu::cvtColor(lab, dst, cv::COLOR_Lab2BGR, 0, s); } diff --git a/modules/gpu/src/element_operations.cpp b/modules/gpu/src/element_operations.cpp index dada52175..91ebce5f9 100644 --- a/modules/gpu/src/element_operations.cpp +++ b/modules/gpu/src/element_operations.cpp @@ -356,7 +356,7 @@ void cv::gpu::add(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const Gpu if (sdepth == CV_64F || ddepth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src1.size(), CV_MAKE_TYPE(ddepth, cn)); @@ -405,7 +405,7 @@ void cv::gpu::add(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const Gpu const func_t func = funcs[sdepth][ddepth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src1_, src2_, dst_, mask, stream); } @@ -514,7 +514,7 @@ void cv::gpu::add(const GpuMat& src, const Scalar& sc, GpuMat& dst, const GpuMat if (sdepth == CV_64F || ddepth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), CV_MAKE_TYPE(ddepth, cn)); @@ -533,7 +533,7 @@ void cv::gpu::add(const GpuMat& src, const Scalar& sc, GpuMat& dst, const GpuMat const func_t func = funcs[sdepth][ddepth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src, sc.val[0], dst, mask, stream); } @@ -636,7 +636,7 @@ void cv::gpu::subtract(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, cons if (sdepth == CV_64F || ddepth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src1.size(), CV_MAKE_TYPE(ddepth, cn)); @@ -685,7 +685,7 @@ void cv::gpu::subtract(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, cons const func_t func = funcs[sdepth][ddepth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src1_, src2_, dst_, mask, stream); } @@ -794,7 +794,7 @@ void cv::gpu::subtract(const GpuMat& src, const Scalar& sc, GpuMat& dst, const G if (sdepth == CV_64F || ddepth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), CV_MAKE_TYPE(ddepth, cn)); @@ -813,7 +813,7 @@ void cv::gpu::subtract(const GpuMat& src, const Scalar& sc, GpuMat& dst, const G const func_t func = funcs[sdepth][ddepth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src, sc.val[0], dst, mask, stream); } @@ -936,7 +936,7 @@ void cv::gpu::multiply(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, doub if (sdepth == CV_64F || ddepth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src1.size(), CV_MAKE_TYPE(ddepth, cn)); @@ -948,7 +948,7 @@ void cv::gpu::multiply(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, doub const func_t func = funcs[sdepth][ddepth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src1_, src2_, dst_, scale, stream); } @@ -1057,7 +1057,7 @@ void cv::gpu::multiply(const GpuMat& src, const Scalar& sc, GpuMat& dst, double if (sdepth == CV_64F || ddepth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), CV_MAKE_TYPE(ddepth, cn)); @@ -1078,7 +1078,7 @@ void cv::gpu::multiply(const GpuMat& src, const Scalar& sc, GpuMat& dst, double const func_t func = funcs[sdepth][ddepth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src, nsc.val[0], dst, stream); } @@ -1201,7 +1201,7 @@ void cv::gpu::divide(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, double if (sdepth == CV_64F || ddepth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src1.size(), CV_MAKE_TYPE(ddepth, cn)); @@ -1213,7 +1213,7 @@ void cv::gpu::divide(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, double const func_t func = funcs[sdepth][ddepth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src1_, src2_, dst_, scale, stream); } @@ -1322,7 +1322,7 @@ void cv::gpu::divide(const GpuMat& src, const Scalar& sc, GpuMat& dst, double sc if (sdepth == CV_64F || ddepth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), CV_MAKE_TYPE(ddepth, cn)); @@ -1343,7 +1343,7 @@ void cv::gpu::divide(const GpuMat& src, const Scalar& sc, GpuMat& dst, double sc const func_t func = funcs[sdepth][ddepth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src, nsc.val[0], dst, stream); } @@ -1439,7 +1439,7 @@ void cv::gpu::divide(double scale, const GpuMat& src, GpuMat& dst, int dtype, St if (sdepth == CV_64F || ddepth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), CV_MAKE_TYPE(ddepth, cn)); @@ -1449,7 +1449,7 @@ void cv::gpu::divide(double scale, const GpuMat& src, GpuMat& dst, int dtype, St const func_t func = funcs[sdepth][ddepth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src, scale, dst, stream); } @@ -1491,7 +1491,7 @@ void cv::gpu::absdiff(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Strea if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src1.size(), src1.type()); @@ -1540,7 +1540,7 @@ void cv::gpu::absdiff(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Strea const func_t func = funcs[depth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src1_, src2_, dst_, stream); } @@ -1575,7 +1575,7 @@ void cv::gpu::absdiff(const GpuMat& src1, const Scalar& src2, GpuMat& dst, Strea if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src1.size(), src1.type()); @@ -1616,7 +1616,7 @@ void cv::gpu::abs(const GpuMat& src, GpuMat& dst, Stream& stream) if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), src.type()); @@ -1657,7 +1657,7 @@ void cv::gpu::sqr(const GpuMat& src, GpuMat& dst, Stream& stream) if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), src.type()); @@ -1698,7 +1698,7 @@ void cv::gpu::sqrt(const GpuMat& src, GpuMat& dst, Stream& stream) if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), src.type()); @@ -1739,7 +1739,7 @@ void cv::gpu::log(const GpuMat& src, GpuMat& dst, Stream& stream) if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), src.type()); @@ -1780,7 +1780,7 @@ void cv::gpu::exp(const GpuMat& src, GpuMat& dst, Stream& stream) if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), src.type()); @@ -1836,7 +1836,7 @@ void cv::gpu::compare(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, int c if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src1.size(), CV_MAKE_TYPE(CV_8U, cn)); @@ -1940,7 +1940,7 @@ void cv::gpu::compare(const GpuMat& src, Scalar sc, GpuMat& dst, int cmpop, Stre if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), CV_MAKE_TYPE(CV_8U, cn)); @@ -2453,7 +2453,7 @@ void cv::gpu::min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& s if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src1.size(), src1.type()); @@ -2502,7 +2502,7 @@ void cv::gpu::min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& s const func_t func = funcs[depth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src1_, src2_, dst_, stream); } @@ -2532,7 +2532,7 @@ void cv::gpu::max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& s if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src1.size(), src1.type()); @@ -2581,7 +2581,7 @@ void cv::gpu::max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& s const func_t func = funcs[depth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src1_, src2_, dst_, stream); } @@ -2624,7 +2624,7 @@ void cv::gpu::min(const GpuMat& src, double val, GpuMat& dst, Stream& stream) if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), src.type()); @@ -2662,7 +2662,7 @@ void cv::gpu::max(const GpuMat& src, double val, GpuMat& dst, Stream& stream) if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), src.type()); @@ -2689,7 +2689,7 @@ double cv::gpu::threshold(const GpuMat& src, GpuMat& dst, double thresh, double if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), src.type()); @@ -2766,7 +2766,7 @@ void cv::gpu::pow(const GpuMat& src, double power, GpuMat& dst, Stream& stream) if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src.size(), src.type()); @@ -3332,7 +3332,7 @@ void cv::gpu::addWeighted(const GpuMat& src1, double alpha, const GpuMat& src2, if (sdepth1 == CV_64F || sdepth2 == CV_64F || ddepth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } dst.create(src1.size(), CV_MAKE_TYPE(ddepth, cn)); @@ -3352,7 +3352,7 @@ void cv::gpu::addWeighted(const GpuMat& src1, double alpha, const GpuMat& src2, const func_t func = funcs[sdepth1][sdepth2][ddepth]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of source and destination types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of source and destination types"); func(src1_, alpha, src2_, beta, gamma, dst_, StreamAccessor::getStream(stream)); } diff --git a/modules/gpu/src/ffmpeg_video_source.cpp b/modules/gpu/src/ffmpeg_video_source.cpp index ff51a8f3d..16cd7b64e 100644 --- a/modules/gpu/src/ffmpeg_video_source.cpp +++ b/modules/gpu/src/ffmpeg_video_source.cpp @@ -108,7 +108,7 @@ cv::gpu::detail::FFmpegVideoSource::FFmpegVideoSource(const String& fname) : stream_ = create_InputMediaStream_FFMPEG_p(fname.c_str(), &codec, &chroma_format, &width, &height); if (!stream_) - CV_Error(CV_StsUnsupportedFormat, "Unsupported video source"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported video source"); format_.codec = static_cast(codec); format_.chromaFormat = static_cast(chroma_format); diff --git a/modules/gpu/src/fgd_bgfg.cpp b/modules/gpu/src/fgd_bgfg.cpp index 87550c493..c0bd76532 100644 --- a/modules/gpu/src/fgd_bgfg.cpp +++ b/modules/gpu/src/fgd_bgfg.cpp @@ -60,6 +60,7 @@ int cv::gpu::FGDStatModel::update(const cv::gpu::GpuMat&) { throw_no_cuda(); ret #else #include "fgd_bgfg_common.hpp" +#include "opencv2/imgproc/imgproc_c.h" namespace { diff --git a/modules/gpu/src/filtering.cpp b/modules/gpu/src/filtering.cpp index 7359d47e7..33d179b7e 100644 --- a/modules/gpu/src/filtering.cpp +++ b/modules/gpu/src/filtering.cpp @@ -634,27 +634,27 @@ void cv::gpu::morphologyEx(const GpuMat& src, GpuMat& dst, int op, const Mat& ke erode(src, buf2, kernel, buf1, anchor, iterations, stream); dilate(buf2, dst, kernel, buf1, anchor, iterations, stream); break; - case CV_MOP_CLOSE: + case MORPH_CLOSE: dilate(src, buf2, kernel, buf1, anchor, iterations, stream); erode(buf2, dst, kernel, buf1, anchor, iterations, stream); break; - case CV_MOP_GRADIENT: + case MORPH_GRADIENT: erode(src, buf2, kernel, buf1, anchor, iterations, stream); dilate(src, dst, kernel, buf1, anchor, iterations, stream); subtract(dst, buf2, dst, GpuMat(), -1, stream); break; - case CV_MOP_TOPHAT: + case MORPH_TOPHAT: erode(src, dst, kernel, buf1, anchor, iterations, stream); dilate(dst, buf2, kernel, buf1, anchor, iterations, stream); subtract(src, buf2, dst, GpuMat(), -1, stream); break; - case CV_MOP_BLACKHAT: + case MORPH_BLACKHAT: dilate(src, dst, kernel, buf1, anchor, iterations, stream); erode(dst, buf2, kernel, buf1, anchor, iterations, stream); subtract(buf2, src, dst, GpuMat(), -1, stream); break; default: - CV_Error(CV_StsBadArg, "unknown morphological operation"); + CV_Error(cv::Error::StsBadArg, "unknown morphological operation"); } } @@ -985,7 +985,7 @@ namespace DeviceInfo devInfo; int cc = devInfo.majorVersion() * 10 + devInfo.minorVersion(); if (ksize > 16 && cc < 20) - CV_Error(CV_StsNotImplemented, "column linear filter doesn't implemented for kernel size > 16 for device with compute capabilities less than 2.0"); + CV_Error(cv::Error::StsNotImplemented, "column linear filter doesn't implemented for kernel size > 16 for device with compute capabilities less than 2.0"); func(src, dst, kernel.ptr(), ksize, anchor, brd_type, cc, StreamAccessor::getStream(s)); } diff --git a/modules/gpu/src/graphcuts.cpp b/modules/gpu/src/graphcuts.cpp index 6f77eb29f..40ccd0471 100644 --- a/modules/gpu/src/graphcuts.cpp +++ b/modules/gpu/src/graphcuts.cpp @@ -107,7 +107,7 @@ void cv::gpu::labelComponents(const GpuMat& mask, GpuMat& components, int flags, CV_Assert(!mask.empty() && mask.type() == CV_8U); if (!deviceSupports(SHARED_ATOMICS)) - CV_Error(CV_StsNotImplemented, "The device doesn't support shared atomics and communicative synchronization!"); + CV_Error(cv::Error::StsNotImplemented, "The device doesn't support shared atomics and communicative synchronization!"); components.create(mask.size(), CV_32SC1); diff --git a/modules/gpu/src/hog.cpp b/modules/gpu/src/hog.cpp index 2b2ff0db9..a599fa8f1 100644 --- a/modules/gpu/src/hog.cpp +++ b/modules/gpu/src/hog.cpp @@ -260,7 +260,7 @@ void cv::gpu::HOGDescriptor::getDescriptors(const GpuMat& img, Size win_stride, win_stride.height, win_stride.width, img.rows, img.cols, block_hists.ptr(), descriptors); break; default: - CV_Error(CV_StsBadArg, "Unknown descriptor format"); + CV_Error(cv::Error::StsBadArg, "Unknown descriptor format"); } } @@ -351,7 +351,7 @@ void cv::gpu::HOGDescriptor::computeConfidenceMultiScale(const GpuMat& img, std: Size scaled_win_size(cvRound(win_size.width * scale), cvRound(win_size.height * scale)); for (size_t j = 0; j < locations.size(); j++) - all_candidates.push_back(Rect(Point2d((CvPoint)locations[j]) * scale, scaled_win_size)); + all_candidates.push_back(Rect(Point2d(locations[j]) * scale, scaled_win_size)); } found_locations.assign(all_candidates.begin(), all_candidates.end()); @@ -443,7 +443,7 @@ void cv::gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, std::vector::max()); CV_Assert(src.rows < std::numeric_limits::max()); - CV_Assert(method == CV_HOUGH_GRADIENT); + CV_Assert(method == cv::HOUGH_GRADIENT); CV_Assert(dp > 0); CV_Assert(minRadius > 0 && maxRadius > minRadius); CV_Assert(cannyThreshold > 0); @@ -1351,7 +1351,7 @@ Ptr cv::gpu::GeneralizedHough_GPU::create(int method) return new GHT_Guil_Full(); } - CV_Error(CV_StsBadArg, "Unsupported method"); + CV_Error(cv::Error::StsBadArg, "Unsupported method"); return Ptr(); } diff --git a/modules/gpu/src/imgproc.cpp b/modules/gpu/src/imgproc.cpp index 4f693e2e6..885445c1a 100644 --- a/modules/gpu/src/imgproc.cpp +++ b/modules/gpu/src/imgproc.cpp @@ -111,10 +111,10 @@ void cv::gpu::meanShiftFiltering(const GpuMat& src, GpuMat& dst, int sp, int sr, using namespace ::cv::gpu::cudev::imgproc; if( src.empty() ) - CV_Error( CV_StsBadArg, "The input image is empty" ); + CV_Error( cv::Error::StsBadArg, "The input image is empty" ); if( src.depth() != CV_8U || src.channels() != 4 ) - CV_Error( CV_StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" ); + CV_Error( cv::Error::StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" ); dst.create( src.size(), CV_8UC4 ); @@ -147,10 +147,10 @@ void cv::gpu::meanShiftProc(const GpuMat& src, GpuMat& dstr, GpuMat& dstsp, int using namespace ::cv::gpu::cudev::imgproc; if( src.empty() ) - CV_Error( CV_StsBadArg, "The input image is empty" ); + CV_Error( cv::Error::StsBadArg, "The input image is empty" ); if( src.depth() != CV_8U || src.channels() != 4 ) - CV_Error( CV_StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" ); + CV_Error( cv::Error::StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" ); dstr.create( src.size(), CV_8UC4 ); dstsp.create( src.size(), CV_16SC2 ); @@ -1488,7 +1488,7 @@ void cv::gpu::Canny(const GpuMat& src, CannyBuf& buf, GpuMat& dst, double low_th CV_Assert(src.type() == CV_8UC1); if (!deviceSupports(SHARED_ATOMICS)) - CV_Error(CV_StsNotImplemented, "The device doesn't support shared atomics"); + CV_Error(cv::Error::StsNotImplemented, "The device doesn't support shared atomics"); if( low_thresh > high_thresh ) std::swap( low_thresh, high_thresh); diff --git a/modules/gpu/src/match_template.cpp b/modules/gpu/src/match_template.cpp index 8fbad008d..d78828bf1 100644 --- a/modules/gpu/src/match_template.cpp +++ b/modules/gpu/src/match_template.cpp @@ -149,15 +149,15 @@ namespace { switch (method) { - case CV_TM_CCORR: + case cv::TM_CCORR: if (depth == CV_32F) return 250; if (depth == CV_8U) return 300; break; - case CV_TM_SQDIFF: + case cv::TM_SQDIFF: if (depth == CV_8U) return 300; break; } - CV_Error(CV_StsBadArg, "getTemplateThreshold: unsupported match template mode"); + CV_Error(cv::Error::StsBadArg, "getTemplateThreshold: unsupported match template mode"); return 0; } @@ -166,7 +166,7 @@ namespace const GpuMat& image, const GpuMat& templ, GpuMat& result, MatchTemplateBuf &buf, Stream& stream) { result.create(image.rows - templ.rows + 1, image.cols - templ.cols + 1, CV_32F); - if (templ.size().area() < getTemplateThreshold(CV_TM_CCORR, CV_32F)) + if (templ.size().area() < getTemplateThreshold(cv::TM_CCORR, CV_32F)) { matchTemplateNaive_CCORR_32F(image, templ, result, image.channels(), StreamAccessor::getStream(stream)); return; @@ -189,7 +189,7 @@ namespace void matchTemplate_CCORR_8U( const GpuMat& image, const GpuMat& templ, GpuMat& result, MatchTemplateBuf &buf, Stream& stream) { - if (templ.size().area() < getTemplateThreshold(CV_TM_CCORR, CV_8U)) + if (templ.size().area() < getTemplateThreshold(cv::TM_CCORR, CV_8U)) { result.create(image.rows - templ.rows + 1, image.cols - templ.cols + 1, CV_32F); matchTemplateNaive_CCORR_8U(image, templ, result, image.channels(), StreamAccessor::getStream(stream)); @@ -235,7 +235,7 @@ namespace void matchTemplate_SQDIFF_8U( const GpuMat& image, const GpuMat& templ, GpuMat& result, MatchTemplateBuf &buf, Stream& stream) { - if (templ.size().area() < getTemplateThreshold(CV_TM_SQDIFF, CV_8U)) + if (templ.size().area() < getTemplateThreshold(cv::TM_SQDIFF, CV_8U)) { result.create(image.rows - templ.rows + 1, image.cols - templ.cols + 1, CV_32F); matchTemplateNaive_SQDIFF_8U(image, templ, result, image.channels(), StreamAccessor::getStream(stream)); @@ -308,7 +308,7 @@ namespace (unsigned int)templ_sum[3], result, StreamAccessor::getStream(stream)); break; default: - CV_Error(CV_StsBadArg, "matchTemplate: unsupported number of channels"); + CV_Error(cv::Error::StsBadArg, "matchTemplate: unsupported number of channels"); } } } @@ -394,7 +394,7 @@ namespace result, StreamAccessor::getStream(stream)); break; default: - CV_Error(CV_StsBadArg, "matchTemplate: unsupported number of channels"); + CV_Error(cv::Error::StsBadArg, "matchTemplate: unsupported number of channels"); } } } @@ -428,7 +428,7 @@ void cv::gpu::matchTemplate( { case CV_8U: callers = callers8U; break; case CV_32F: callers = callers32F; break; - default: CV_Error(CV_StsBadArg, "matchTemplate: unsupported data type"); + default: CV_Error(cv::Error::StsBadArg, "matchTemplate: unsupported data type"); } Caller caller = callers[method]; diff --git a/modules/gpu/src/matrix_reductions.cpp b/modules/gpu/src/matrix_reductions.cpp index 0e08708dc..b56cb20fe 100644 --- a/modules/gpu/src/matrix_reductions.cpp +++ b/modules/gpu/src/matrix_reductions.cpp @@ -124,7 +124,7 @@ void cv::gpu::meanStdDev(const GpuMat& src, Scalar& mean, Scalar& stddev, GpuMat CV_Assert(src.type() == CV_8UC1); if (!deviceSupports(FEATURE_SET_COMPUTE_13)) - CV_Error(CV_StsNotImplemented, "Not sufficient compute capebility"); + CV_Error(cv::Error::StsNotImplemented, "Not sufficient compute capebility"); NppiSize sz; sz.width = src.cols; @@ -259,7 +259,7 @@ Scalar cv::gpu::sum(const GpuMat& src, const GpuMat& mask, GpuMat& buf) if (src.depth() == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } Size buf_size; @@ -305,7 +305,7 @@ Scalar cv::gpu::absSum(const GpuMat& src, const GpuMat& mask, GpuMat& buf) if (src.depth() == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } Size buf_size; @@ -351,7 +351,7 @@ Scalar cv::gpu::sqrSum(const GpuMat& src, const GpuMat& mask, GpuMat& buf) if (src.depth() == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } Size buf_size; @@ -404,7 +404,7 @@ void cv::gpu::minMax(const GpuMat& src, double* minVal, double* maxVal, const Gp if (src.depth() == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } Size buf_size; @@ -455,7 +455,7 @@ void cv::gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal, Point if (src.depth() == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } Size valbuf_size, locbuf_size; @@ -506,7 +506,7 @@ int cv::gpu::countNonZero(const GpuMat& src, GpuMat& buf) if (src.depth() == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } Size buf_size; @@ -534,7 +534,7 @@ void cv::gpu::reduce(const GpuMat& src, GpuMat& dst, int dim, int reduceOp, int { CV_Assert( src.channels() <= 4 ); CV_Assert( dim == 0 || dim == 1 ); - CV_Assert( reduceOp == CV_REDUCE_SUM || reduceOp == CV_REDUCE_AVG || reduceOp == CV_REDUCE_MAX || reduceOp == CV_REDUCE_MIN ); + CV_Assert( reduceOp == REDUCE_SUM || reduceOp == REDUCE_AVG || reduceOp == REDUCE_MAX || reduceOp == REDUCE_MIN ); if (dtype < 0) dtype = src.depth(); @@ -614,7 +614,7 @@ void cv::gpu::reduce(const GpuMat& src, GpuMat& dst, int dim, int reduceOp, int const func_t func = funcs[src.depth()][dst.depth()]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of input and output array formats"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of input and output array formats"); func(src.reshape(1), dst.data, reduceOp, StreamAccessor::getStream(stream)); } @@ -691,7 +691,7 @@ void cv::gpu::reduce(const GpuMat& src, GpuMat& dst, int dim, int reduceOp, int const func_t func = funcs[src.depth()][dst.depth()]; if (!func) - CV_Error(CV_StsUnsupportedFormat, "Unsupported combination of input and output array formats"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported combination of input and output array formats"); func(src, dst.data, src.channels(), reduceOp, StreamAccessor::getStream(stream)); } diff --git a/modules/gpu/src/optical_flow.cpp b/modules/gpu/src/optical_flow.cpp index 1da81bab2..a5b741410 100644 --- a/modules/gpu/src/optical_flow.cpp +++ b/modules/gpu/src/optical_flow.cpp @@ -68,7 +68,7 @@ namespace namespace { - static void outputHandler(const String &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); } + static void outputHandler(const String &msg) { CV_Error(cv::Error::GpuApiCallError, msg.c_str()); } } void cv::gpu::BroxOpticalFlow::operator ()(const GpuMat& frame0, const GpuMat& frame1, GpuMat& u, GpuMat& v, Stream& s) diff --git a/modules/gpu/src/split_merge.cpp b/modules/gpu/src/split_merge.cpp index 66d0c9928..c9ab7ed30 100644 --- a/modules/gpu/src/split_merge.cpp +++ b/modules/gpu/src/split_merge.cpp @@ -78,7 +78,7 @@ namespace if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } bool single_channel_only = true; @@ -122,7 +122,7 @@ namespace if (depth == CV_64F) { if (!deviceSupports(NATIVE_DOUBLE)) - CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double"); + CV_Error(cv::Error::StsUnsupportedFormat, "The device doesn't support double"); } if (num_channels == 1) diff --git a/modules/gpu/src/video_reader.cpp b/modules/gpu/src/video_reader.cpp index b29f828cc..7bc63dae3 100644 --- a/modules/gpu/src/video_reader.cpp +++ b/modules/gpu/src/video_reader.cpp @@ -217,7 +217,7 @@ namespace bool cv::gpu::VideoReader_GPU::Impl::grab(GpuMat& frame) { if (videoSource_->hasError() || videoParser_->hasError()) - CV_Error(CV_StsUnsupportedFormat, "Unsupported video source"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported video source"); if (!videoSource_->isStarted() || frameQueue_->isEndOfDecode()) return false; @@ -232,7 +232,7 @@ bool cv::gpu::VideoReader_GPU::Impl::grab(GpuMat& frame) break; if (videoSource_->hasError() || videoParser_->hasError()) - CV_Error(CV_StsUnsupportedFormat, "Unsupported video source"); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported video source"); if (frameQueue_->isEndOfDecode()) return false; diff --git a/modules/gpu/test/test_bgfg.cpp b/modules/gpu/test/test_bgfg.cpp index 0ffd8d112..d5151fc3d 100644 --- a/modules/gpu/test/test_bgfg.cpp +++ b/modules/gpu/test/test_bgfg.cpp @@ -41,6 +41,7 @@ //M*/ #include "test_precomp.hpp" +#include "opencv2/legacy.hpp" #ifdef HAVE_CUDA diff --git a/modules/gpu/test/test_core.cpp b/modules/gpu/test/test_core.cpp index 1bc952c7a..b2072c25f 100644 --- a/modules/gpu/test/test_core.cpp +++ b/modules/gpu/test/test_core.cpp @@ -89,7 +89,7 @@ GPU_TEST_P(Merge, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -151,7 +151,7 @@ GPU_TEST_P(Split, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -221,7 +221,7 @@ GPU_TEST_P(Add_Array, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -283,7 +283,7 @@ GPU_TEST_P(Add_Array_Mask, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -340,7 +340,7 @@ GPU_TEST_P(Add_Scalar, WithOutMask) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -371,7 +371,7 @@ GPU_TEST_P(Add_Scalar, WithMask) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -436,7 +436,7 @@ GPU_TEST_P(Subtract_Array, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -498,7 +498,7 @@ GPU_TEST_P(Subtract_Array_Mask, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -555,7 +555,7 @@ GPU_TEST_P(Subtract_Scalar, WithOutMask) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -586,7 +586,7 @@ GPU_TEST_P(Subtract_Scalar, WithMask) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -651,7 +651,7 @@ GPU_TEST_P(Multiply_Array, WithOutScale) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -681,7 +681,7 @@ GPU_TEST_P(Multiply_Array, WithScale) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -836,7 +836,7 @@ GPU_TEST_P(Multiply_Scalar, WithOutScale) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -867,7 +867,7 @@ GPU_TEST_P(Multiply_Scalar, WithScale) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -931,7 +931,7 @@ GPU_TEST_P(Divide_Array, WithOutScale) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -961,7 +961,7 @@ GPU_TEST_P(Divide_Array, WithScale) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -1116,7 +1116,7 @@ GPU_TEST_P(Divide_Scalar, WithOutScale) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -1146,7 +1146,7 @@ GPU_TEST_P(Divide_Scalar, WithScale) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -1202,7 +1202,7 @@ GPU_TEST_P(Divide_Scalar_Inv, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -1258,7 +1258,7 @@ GPU_TEST_P(AbsDiff, Array) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -1287,7 +1287,7 @@ GPU_TEST_P(AbsDiff, Scalar) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -1649,7 +1649,7 @@ GPU_TEST_P(Compare_Array, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -1759,7 +1759,7 @@ GPU_TEST_P(Compare_Scalar, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -2110,7 +2110,7 @@ GPU_TEST_P(Min, Array) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -2138,7 +2138,7 @@ GPU_TEST_P(Min, Scalar) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -2193,7 +2193,7 @@ GPU_TEST_P(Max, Array) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -2221,7 +2221,7 @@ GPU_TEST_P(Max, Scalar) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -2279,7 +2279,7 @@ GPU_TEST_P(Pow, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -2342,7 +2342,7 @@ GPU_TEST_P(AddWeighted, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -2410,7 +2410,7 @@ GPU_TEST_P(GEMM, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else if (type == CV_64FC2 && flags != 0) @@ -2422,7 +2422,7 @@ GPU_TEST_P(GEMM, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsNotImplemented, e.code); + ASSERT_EQ(cv::Error::StsNotImplemented, e.code); } } else @@ -2480,7 +2480,7 @@ GPU_TEST_P(Transpose, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -2871,7 +2871,7 @@ GPU_TEST_P(MeanStdDev, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsNotImplemented, e.code); + ASSERT_EQ(cv::Error::StsNotImplemented, e.code); } } else @@ -3153,7 +3153,7 @@ GPU_TEST_P(MinMax, WithoutMask) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -3183,7 +3183,7 @@ GPU_TEST_P(MinMax, WithMask) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -3213,7 +3213,7 @@ GPU_TEST_P(MinMax, NullPtr) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -3298,7 +3298,7 @@ GPU_TEST_P(MinMaxLoc, WithoutMask) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -3334,7 +3334,7 @@ GPU_TEST_P(MinMaxLoc, WithMask) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -3372,7 +3372,7 @@ GPU_TEST_P(MinMaxLoc, NullPtr) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -3438,7 +3438,7 @@ GPU_TEST_P(CountNonZero, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -3460,8 +3460,7 @@ INSTANTIATE_TEST_CASE_P(GPU_Core, CountNonZero, testing::Combine( ////////////////////////////////////////////////////////////////////////////// // Reduce -CV_ENUM(ReduceCode, CV_REDUCE_SUM, CV_REDUCE_AVG, CV_REDUCE_MAX, CV_REDUCE_MIN) -#define ALL_REDUCE_CODES testing::Values(ReduceCode(CV_REDUCE_SUM), ReduceCode(CV_REDUCE_AVG), ReduceCode(CV_REDUCE_MAX), ReduceCode(CV_REDUCE_MIN)) +CV_ENUM(ReduceCode, REDUCE_SUM, REDUCE_AVG, REDUCE_MAX, REDUCE_MIN) PARAM_TEST_CASE(Reduce, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels, ReduceCode, UseRoi) { @@ -3489,9 +3488,9 @@ PARAM_TEST_CASE(Reduce, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels, Reduc type = CV_MAKE_TYPE(depth, channels); - if (reduceOp == CV_REDUCE_MAX || reduceOp == CV_REDUCE_MIN) + if (reduceOp == cv::REDUCE_MAX || reduceOp == cv::REDUCE_MIN) dst_depth = depth; - else if (reduceOp == CV_REDUCE_SUM) + else if (reduceOp == cv::REDUCE_SUM) dst_depth = depth == CV_8U ? CV_32S : depth < CV_64F ? CV_32F : depth; else dst_depth = depth < CV_32F ? CV_32F : depth; @@ -3539,7 +3538,7 @@ INSTANTIATE_TEST_CASE_P(GPU_Core, Reduce, testing::Combine( MatDepth(CV_32F), MatDepth(CV_64F)), ALL_CHANNELS, - ALL_REDUCE_CODES, + ReduceCode::all(), WHOLE_SUBMAT)); ////////////////////////////////////////////////////////////////////////////// diff --git a/modules/gpu/test/test_denoising.cpp b/modules/gpu/test/test_denoising.cpp index e480cf468..2f1a93be1 100644 --- a/modules/gpu/test/test_denoising.cpp +++ b/modules/gpu/test/test_denoising.cpp @@ -116,7 +116,7 @@ GPU_TEST_P(BruteForceNonLocalMeans, Regression) ASSERT_FALSE(bgr.empty()); cv::Mat gray; - cv::cvtColor(bgr, gray, CV_BGR2GRAY); + cv::cvtColor(bgr, gray, cv::COLOR_BGR2GRAY); GpuMat dbgr, dgray; cv::gpu::nonLocalMeans(GpuMat(bgr), dbgr, 20); @@ -159,7 +159,7 @@ GPU_TEST_P(FastNonLocalMeans, Regression) ASSERT_FALSE(bgr.empty()); cv::Mat gray; - cv::cvtColor(bgr, gray, CV_BGR2GRAY); + cv::cvtColor(bgr, gray, cv::COLOR_BGR2GRAY); GpuMat dbgr, dgray; cv::gpu::FastNonLocalMeansDenoising fnlmd; diff --git a/modules/gpu/test/test_features2d.cpp b/modules/gpu/test/test_features2d.cpp index dfa3afa38..29dcc2040 100644 --- a/modules/gpu/test/test_features2d.cpp +++ b/modules/gpu/test/test_features2d.cpp @@ -88,7 +88,7 @@ GPU_TEST_P(FAST, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsNotImplemented, e.code); + ASSERT_EQ(cv::Error::StsNotImplemented, e.code); } } else @@ -176,7 +176,7 @@ GPU_TEST_P(ORB, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsNotImplemented, e.code); + ASSERT_EQ(cv::Error::StsNotImplemented, e.code); } } else @@ -581,7 +581,7 @@ GPU_TEST_P(BruteForceMatcher, RadiusMatch_Single) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsNotImplemented, e.code); + ASSERT_EQ(cv::Error::StsNotImplemented, e.code); } } else @@ -646,7 +646,7 @@ GPU_TEST_P(BruteForceMatcher, RadiusMatch_Collection) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsNotImplemented, e.code); + ASSERT_EQ(cv::Error::StsNotImplemented, e.code); } } else diff --git a/modules/gpu/test/test_filters.cpp b/modules/gpu/test/test_filters.cpp index cbb6db8a2..1c0679e48 100644 --- a/modules/gpu/test/test_filters.cpp +++ b/modules/gpu/test/test_filters.cpp @@ -286,7 +286,7 @@ GPU_TEST_P(GaussianBlur, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsNotImplemented, e.code); + ASSERT_EQ(cv::Error::StsNotImplemented, e.code); } } else diff --git a/modules/gpu/test/test_gpumat.cpp b/modules/gpu/test/test_gpumat.cpp index c7a0cabcb..6fd4d69b4 100644 --- a/modules/gpu/test/test_gpumat.cpp +++ b/modules/gpu/test/test_gpumat.cpp @@ -90,7 +90,7 @@ GPU_TEST_P(SetTo, SameVal) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -115,7 +115,7 @@ GPU_TEST_P(SetTo, DifferentVal) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -142,7 +142,7 @@ GPU_TEST_P(SetTo, Masked) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -210,7 +210,7 @@ GPU_TEST_P(CopyTo, Masked) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -269,7 +269,7 @@ GPU_TEST_P(ConvertTo, WithOutScaling) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else @@ -301,7 +301,7 @@ GPU_TEST_P(ConvertTo, WithScaling) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsUnsupportedFormat, e.code); + ASSERT_EQ(cv::Error::StsUnsupportedFormat, e.code); } } else diff --git a/modules/gpu/test/test_hough.cpp b/modules/gpu/test/test_hough.cpp index 89f17573b..a04490104 100644 --- a/modules/gpu/test/test_hough.cpp +++ b/modules/gpu/test/test_hough.cpp @@ -149,7 +149,7 @@ GPU_TEST_P(HoughCircles, Accuracy) drawCircles(src, circles_gold, true); cv::gpu::GpuMat d_circles; - cv::gpu::HoughCircles(loadMat(src, useRoi), d_circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); + cv::gpu::HoughCircles(loadMat(src, useRoi), d_circles, cv::HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); std::vector circles; cv::gpu::HoughCirclesDownload(d_circles, circles); diff --git a/modules/gpu/test/test_imgproc.cpp b/modules/gpu/test/test_imgproc.cpp index e424763bf..740a8d930 100644 --- a/modules/gpu/test/test_imgproc.cpp +++ b/modules/gpu/test/test_imgproc.cpp @@ -104,7 +104,7 @@ GPU_TEST_P(HistEven, Accuracy) ASSERT_FALSE(img.empty()); cv::Mat hsv; - cv::cvtColor(img, hsv, CV_BGR2HSV); + cv::cvtColor(img, hsv, cv::COLOR_BGR2HSV); int hbins = 30; float hranges[] = {0.0f, 180.0f}; @@ -353,7 +353,7 @@ GPU_TEST_P(Canny, Accuracy) } catch (const cv::Exception& e) { - ASSERT_EQ(CV_StsNotImplemented, e.code); + ASSERT_EQ(cv::Error::StsNotImplemented, e.code); } } else @@ -417,7 +417,7 @@ GPU_TEST_P(MeanShift, Filtering) cv::Mat dst(d_dst); cv::Mat result; - cv::cvtColor(dst, result, CV_BGRA2BGR); + cv::cvtColor(dst, result, cv::COLOR_BGRA2BGR); EXPECT_MAT_NEAR(img_template, result, 0.0); } @@ -490,7 +490,7 @@ GPU_TEST_P(MeanShiftSegmentation, Regression) cv::gpu::meanShiftSegmentation(loadMat(img), dst, 10, 10, minsize); cv::Mat dst_rgb; - cv::cvtColor(dst, dst_rgb, CV_BGRA2BGR); + cv::cvtColor(dst, dst_rgb, cv::COLOR_BGRA2BGR); EXPECT_MAT_SIMILAR(dst_gold, dst_rgb, 1e-3); } @@ -828,7 +828,7 @@ GPU_TEST_P(MatchTemplate_CCOEF_NORMED, Accuracy) ASSERT_FALSE(pattern.empty()); cv::gpu::GpuMat d_dst; - cv::gpu::matchTemplate(loadMat(image), loadMat(pattern), d_dst, CV_TM_CCOEFF_NORMED); + cv::gpu::matchTemplate(loadMat(image), loadMat(pattern), d_dst, cv::TM_CCOEFF_NORMED); cv::Mat dst(d_dst); @@ -837,7 +837,7 @@ GPU_TEST_P(MatchTemplate_CCOEF_NORMED, Accuracy) cv::minMaxLoc(dst, &minVal, &maxVal, &minLoc, &maxLoc); cv::Mat dstGold; - cv::matchTemplate(image, pattern, dstGold, CV_TM_CCOEFF_NORMED); + cv::matchTemplate(image, pattern, dstGold, cv::TM_CCOEFF_NORMED); double minValGold, maxValGold; cv::Point minLocGold, maxLocGold; @@ -877,7 +877,7 @@ GPU_TEST_P(MatchTemplate_CanFindBigTemplate, SQDIFF_NORMED) ASSERT_FALSE(templ.empty()); cv::gpu::GpuMat d_result; - cv::gpu::matchTemplate(loadMat(scene), loadMat(templ), d_result, CV_TM_SQDIFF_NORMED); + cv::gpu::matchTemplate(loadMat(scene), loadMat(templ), d_result, cv::TM_SQDIFF_NORMED); cv::Mat result(d_result); @@ -900,7 +900,7 @@ GPU_TEST_P(MatchTemplate_CanFindBigTemplate, SQDIFF) ASSERT_FALSE(templ.empty()); cv::gpu::GpuMat d_result; - cv::gpu::matchTemplate(loadMat(scene), loadMat(templ), d_result, CV_TM_SQDIFF); + cv::gpu::matchTemplate(loadMat(scene), loadMat(templ), d_result, cv::TM_SQDIFF); cv::Mat result(d_result); diff --git a/modules/gpu/test/test_labeling.cpp b/modules/gpu/test/test_labeling.cpp index 2e85cc3d0..4a1927c39 100644 --- a/modules/gpu/test/test_labeling.cpp +++ b/modules/gpu/test/test_labeling.cpp @@ -170,9 +170,9 @@ struct Labeling : testing::TestWithParam GPU_TEST_P(Labeling, DISABLED_ConnectedComponents) { cv::Mat image; - cvtColor(loat_image(), image, CV_BGR2GRAY); + cvtColor(loat_image(), image, cv::COLOR_BGR2GRAY); - cv::threshold(image, image, 150, 255, CV_THRESH_BINARY); + cv::threshold(image, image, 150, 255, cv::THRESH_BINARY); ASSERT_TRUE(image.type() == CV_8UC1); diff --git a/modules/gpu/test/test_objdetect.cpp b/modules/gpu/test/test_objdetect.cpp index aaeaa54e6..b91c5dcf4 100644 --- a/modules/gpu/test/test_objdetect.cpp +++ b/modules/gpu/test/test_objdetect.cpp @@ -192,11 +192,11 @@ GPU_TEST_P(HOG, Detect) // Test on color image cv::Mat img; - cv::cvtColor(img_rgb, img, CV_BGR2BGRA); + cv::cvtColor(img_rgb, img, cv::COLOR_BGR2BGRA); testDetect(img); // Test on gray image - cv::cvtColor(img_rgb, img, CV_BGR2GRAY); + cv::cvtColor(img_rgb, img, cv::COLOR_BGR2GRAY); testDetect(img); f.close(); @@ -210,7 +210,7 @@ GPU_TEST_P(HOG, GetDescriptors) // Convert to C4 cv::Mat img; - cv::cvtColor(img_rgb, img, CV_BGR2BGRA); + cv::cvtColor(img_rgb, img, cv::COLOR_BGR2BGRA); cv::gpu::GpuMat d_img(img); @@ -250,38 +250,38 @@ GPU_TEST_P(HOG, GetDescriptors) img_rgb = readImage("hog/positive1.png"); ASSERT_TRUE(!img_rgb.empty()); - cv::cvtColor(img_rgb, img, CV_BGR2BGRA); + cv::cvtColor(img_rgb, img, cv::COLOR_BGR2BGRA); computeBlockHistograms(cv::gpu::GpuMat(img)); // Everything is fine with interpolation for left top subimage ASSERT_EQ(0.0, cv::norm((cv::Mat)block_hists, (cv::Mat)descriptors.rowRange(0, 1))); img_rgb = readImage("hog/positive2.png"); ASSERT_TRUE(!img_rgb.empty()); - cv::cvtColor(img_rgb, img, CV_BGR2BGRA); + cv::cvtColor(img_rgb, img, cv::COLOR_BGR2BGRA); computeBlockHistograms(cv::gpu::GpuMat(img)); compare_inner_parts(cv::Mat(block_hists), cv::Mat(descriptors.rowRange(1, 2))); img_rgb = readImage("hog/negative1.png"); ASSERT_TRUE(!img_rgb.empty()); - cv::cvtColor(img_rgb, img, CV_BGR2BGRA); + cv::cvtColor(img_rgb, img, cv::COLOR_BGR2BGRA); computeBlockHistograms(cv::gpu::GpuMat(img)); compare_inner_parts(cv::Mat(block_hists), cv::Mat(descriptors.rowRange(2, 3))); img_rgb = readImage("hog/negative2.png"); ASSERT_TRUE(!img_rgb.empty()); - cv::cvtColor(img_rgb, img, CV_BGR2BGRA); + cv::cvtColor(img_rgb, img, cv::COLOR_BGR2BGRA); computeBlockHistograms(cv::gpu::GpuMat(img)); compare_inner_parts(cv::Mat(block_hists), cv::Mat(descriptors.rowRange(3, 4))); img_rgb = readImage("hog/positive3.png"); ASSERT_TRUE(!img_rgb.empty()); - cv::cvtColor(img_rgb, img, CV_BGR2BGRA); + cv::cvtColor(img_rgb, img, cv::COLOR_BGR2BGRA); computeBlockHistograms(cv::gpu::GpuMat(img)); compare_inner_parts(cv::Mat(block_hists), cv::Mat(descriptors.rowRange(4, 5))); img_rgb = readImage("hog/negative3.png"); ASSERT_TRUE(!img_rgb.empty()); - cv::cvtColor(img_rgb, img, CV_BGR2BGRA); + cv::cvtColor(img_rgb, img, cv::COLOR_BGR2BGRA); computeBlockHistograms(cv::gpu::GpuMat(img)); compare_inner_parts(cv::Mat(block_hists), cv::Mat(descriptors.rowRange(5, 6))); } @@ -385,7 +385,7 @@ GPU_TEST_P(LBP_classify, Accuracy) cv::Mat image = cv::imread(imagePath); image = image.colRange(0, image.cols/2); cv::Mat grey; - cvtColor(image, grey, CV_BGR2GRAY); + cvtColor(image, grey, cv::COLOR_BGR2GRAY); ASSERT_FALSE(image.empty()); std::vector rects; @@ -394,7 +394,7 @@ GPU_TEST_P(LBP_classify, Accuracy) std::vector::iterator it = rects.begin(); for (; it != rects.end(); ++it) - cv::rectangle(markedImage, *it, CV_RGB(0, 0, 255)); + cv::rectangle(markedImage, *it, cv::Scalar(255, 0, 0)); cv::gpu::CascadeClassifier_GPU gpuClassifier; ASSERT_TRUE(gpuClassifier.load(classifierXmlPath)); diff --git a/modules/gpu/test/test_optflow.cpp b/modules/gpu/test/test_optflow.cpp index 263b20e33..34a08f2cf 100644 --- a/modules/gpu/test/test_optflow.cpp +++ b/modules/gpu/test/test_optflow.cpp @@ -41,6 +41,7 @@ //M*/ #include "test_precomp.hpp" +#include "opencv2/legacy.hpp" #ifdef HAVE_CUDA diff --git a/modules/ocl/src/brute_force_matcher.cpp b/modules/ocl/src/brute_force_matcher.cpp index 7f8b545a6..1834e7bc1 100644 --- a/modules/ocl/src/brute_force_matcher.cpp +++ b/modules/ocl/src/brute_force_matcher.cpp @@ -615,7 +615,7 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchConvert(const Mat &trainIdx, cons void cv::ocl::BruteForceMatcher_OCL_base::match(const oclMat &query, const oclMat &train, std::vector &matches, const oclMat &mask) { - assert(mask.empty()); // mask is not supported at the moment + CV_Assert(mask.empty()); // mask is not supported at the moment oclMat trainIdx, distance; matchSingle(query, train, trainIdx, distance, mask); matchDownload(trainIdx, distance, matches); diff --git a/modules/softcascade/src/cuda/channels.cu b/modules/softcascade/src/cuda/channels.cu index 351c9cbde..ca9011340 100644 --- a/modules/softcascade/src/cuda/channels.cu +++ b/modules/softcascade/src/cuda/channels.cu @@ -41,25 +41,7 @@ //M*/ #include "opencv2/core/cuda_devptrs.hpp" - -namespace cv { namespace softcascade { namespace internal { -void error(const char *error_string, const char *file, const int line, const char *func); -}}} -#if defined(__GNUC__) - #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__, __func__) -#else /* defined(__CUDACC__) || defined(__MSVC__) */ - #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__) -#endif - -static inline void ___cudaSafeCall(cudaError_t err, const char *file, const int line, const char *func = "") -{ - if (cudaSuccess != err) cv::softcascade::internal::error(cudaGetErrorString(err), file, line, func); -} - -__host__ __device__ __forceinline__ int divUp(int total, int grain) -{ - return (total + grain - 1) / grain; -} +#include "opencv2/core/cuda/common.hpp" namespace cv { namespace softcascade { namespace cudev { @@ -393,7 +375,7 @@ namespace cv { namespace softcascade { namespace cudev { const dim3 block(32, 8); - const dim3 grid(divUp(integral.cols, block.x), 1); + const dim3 grid(cv::gpu::cudev::divUp(integral.cols, block.x), 1); shfl_integral_vertical<<>>(integral); cudaSafeCall( cudaGetLastError() ); @@ -478,7 +460,7 @@ namespace cv { namespace softcascade { namespace cudev { const dim3 block(32, 8); - const dim3 grid(divUp(integral.cols, block.x), 1); + const dim3 grid(cv::gpu::cudev::divUp(integral.cols, block.x), 1); shfl_integral_vertical<<>>((cv::gpu::PtrStepSz)buffer, integral); cudaSafeCall( cudaGetLastError() ); @@ -518,8 +500,8 @@ namespace cv { namespace softcascade { namespace cudev void transform(const cv::gpu::PtrStepSz& bgr, cv::gpu::PtrStepSzb gray) { const dim3 block(32, 8); - const dim3 grid(divUp(bgr.cols, block.x), divUp(bgr.rows, block.y)); + const dim3 grid(cv::gpu::cudev::divUp(bgr.cols, block.x), cv::gpu::cudev::divUp(bgr.rows, block.y)); device_transform<<>>(bgr, gray); cudaSafeCall(cudaDeviceSynchronize()); } -}}} \ No newline at end of file +}}} diff --git a/modules/softcascade/src/cuda/icf-sc.cu b/modules/softcascade/src/cuda/icf-sc.cu index 3db93db6e..3003e6ccb 100644 --- a/modules/softcascade/src/cuda/icf-sc.cu +++ b/modules/softcascade/src/cuda/icf-sc.cu @@ -43,24 +43,7 @@ #include #include #include - -namespace cv { namespace softcascade { namespace internal { -void error(const char *error_string, const char *file, const int line, const char *func); -}}} -#if defined(__GNUC__) - #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__, __func__) -#else /* defined(__CUDACC__) || defined(__MSVC__) */ - #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__) -#endif - -static inline void ___cudaSafeCall(cudaError_t err, const char *file, const int line, const char *func = "") -{ - if (cudaSuccess != err) cv::softcascade::internal::error(cudaGetErrorString(err), file, line, func); -} - -#ifndef CV_PI - #define CV_PI 3.1415926535897932384626433832795 -#endif +#include "opencv2/core/cuda/common.hpp" namespace cv { namespace softcascade { namespace cudev { diff --git a/modules/softcascade/src/detector_cuda.cpp b/modules/softcascade/src/detector_cuda.cpp index 0c1e372ec..5c7aba185 100644 --- a/modules/softcascade/src/detector_cuda.cpp +++ b/modules/softcascade/src/detector_cuda.cpp @@ -501,7 +501,7 @@ void integral(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& sum, cv::gpu::GpuMat& else res.copyTo(inner); } - else {CV_Error(CV_GpuNotSupported, ": CC 3.x required.");} + else {CV_Error(cv::Error::GpuNotSupported, ": CC 3.x required.");} } } diff --git a/modules/softcascade/test/utility.cpp b/modules/softcascade/test/utility.cpp index cb3b1fbf4..b308f416c 100644 --- a/modules/softcascade/test/utility.cpp +++ b/modules/softcascade/test/utility.cpp @@ -75,7 +75,7 @@ void DeviceManager::load(int i) if (i < 0 || i >= getCudaEnabledDeviceCount()) { msg << "Incorrect device number - " << i; - CV_Error(CV_StsBadArg, msg.str()); + CV_Error(cv::Error::StsBadArg, msg.str()); } DeviceInfo info(i); @@ -83,7 +83,7 @@ void DeviceManager::load(int i) if (!info.isCompatible()) { msg << "Device " << i << " [" << info.name() << "] is NOT compatible with current GPU module build"; - CV_Error(CV_StsBadArg, msg.str()); + CV_Error(cv::Error::StsBadArg, msg.str()); } devices_.push_back(info); diff --git a/modules/superres/src/frame_source.cpp b/modules/superres/src/frame_source.cpp index 7a753eab0..5e6ed0a2b 100644 --- a/modules/superres/src/frame_source.cpp +++ b/modules/superres/src/frame_source.cpp @@ -85,14 +85,14 @@ Ptr cv::superres::createFrameSource_Empty() Ptr cv::superres::createFrameSource_Video(const String& fileName) { (void) fileName; - CV_Error(CV_StsNotImplemented, "The called functionality is disabled for current build or platform"); + CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); return Ptr(); } Ptr cv::superres::createFrameSource_Camera(int deviceId) { (void) deviceId; - CV_Error(CV_StsNotImplemented, "The called functionality is disabled for current build or platform"); + CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); return Ptr(); } @@ -192,7 +192,7 @@ Ptr cv::superres::createFrameSource_Camera(int deviceId) Ptr cv::superres::createFrameSource_Video_GPU(const String& fileName) { (void) fileName; - CV_Error(CV_StsNotImplemented, "The called functionality is disabled for current build or platform"); + CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); return Ptr(); } diff --git a/modules/superres/src/input_array_utility.cpp b/modules/superres/src/input_array_utility.cpp index 9655d8d9d..327d2db5e 100644 --- a/modules/superres/src/input_array_utility.cpp +++ b/modules/superres/src/input_array_utility.cpp @@ -180,7 +180,7 @@ namespace #ifdef HAVE_OPENCV_GPU gpu::cvtColor(src.getGpuMat(), dst.getGpuMatRef(), code, cn); #else - CV_Error(CV_StsNotImplemented, "The called functionality is disabled for current build or platform"); + CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); #endif break; diff --git a/modules/superres/src/optical_flow.cpp b/modules/superres/src/optical_flow.cpp index def0d9d76..713ed0122 100644 --- a/modules/superres/src/optical_flow.cpp +++ b/modules/superres/src/optical_flow.cpp @@ -347,25 +347,25 @@ Ptr cv::superres::createOptFlow_DualTVL1() Ptr cv::superres::createOptFlow_Farneback_GPU() { - CV_Error(CV_StsNotImplemented, "The called functionality is disabled for current build or platform"); + CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); return Ptr(); } Ptr cv::superres::createOptFlow_DualTVL1_GPU() { - CV_Error(CV_StsNotImplemented, "The called functionality is disabled for current build or platform"); + CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); return Ptr(); } Ptr cv::superres::createOptFlow_Brox_GPU() { - CV_Error(CV_StsNotImplemented, "The called functionality is disabled for current build or platform"); + CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); return Ptr(); } Ptr cv::superres::createOptFlow_PyrLK_GPU() { - CV_Error(CV_StsNotImplemented, "The called functionality is disabled for current build or platform"); + CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); return Ptr(); } diff --git a/modules/ts/src/ts_perf.cpp b/modules/ts/src/ts_perf.cpp index 14e891144..33a9ec7e3 100644 --- a/modules/ts/src/ts_perf.cpp +++ b/modules/ts/src/ts_perf.cpp @@ -1153,7 +1153,7 @@ void TestBase::RunPerfTestBody() { metrics.terminationReason = performance_metrics::TERM_EXCEPTION; #ifdef HAVE_CUDA - if (e.code == CV_GpuApiCallError) + if (e.code == cv::Error::GpuApiCallError) cv::gpu::resetDevice(); #endif FAIL() << "Expected: PerfTestBody() doesn't throw an exception.\n Actual: it throws cv::Exception:\n " << e.what(); diff --git a/samples/cpp/Qt_sample/main.cpp b/samples/cpp/Qt_sample/main.cpp index c4a8c5fbf..16345d56a 100644 --- a/samples/cpp/Qt_sample/main.cpp +++ b/samples/cpp/Qt_sample/main.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include diff --git a/samples/gpu/cascadeclassifier_nvidia_api.cpp b/samples/gpu/cascadeclassifier_nvidia_api.cpp index 0c05499c8..694825424 100644 --- a/samples/gpu/cascadeclassifier_nvidia_api.cpp +++ b/samples/gpu/cascadeclassifier_nvidia_api.cpp @@ -8,6 +8,7 @@ #include #include "opencv2/gpu/gpu.hpp" #include "opencv2/highgui/highgui.hpp" +#include "opencv2/objdetect/objdetect_c.h" #ifdef HAVE_CUDA #include "NCVHaarObjectDetection.hpp" @@ -40,15 +41,15 @@ static void matPrint(Mat &img, int lineOffsY, Scalar fontColor, const string &ss Point org; org.x = 1; org.y = 3 * fontSize.height * (lineOffsY + 1) / 2; - putText(img, ss, org, fontFace, fontScale, CV_RGB(0,0,0), 5*fontThickness/2, 16); + putText(img, ss, org, fontFace, fontScale, Scalar(0,0,0), 5*fontThickness/2, 16); putText(img, ss, org, fontFace, fontScale, fontColor, fontThickness, 16); } static void displayState(Mat &canvas, bool bHelp, bool bGpu, bool bLargestFace, bool bFilter, double fps) { - Scalar fontColorRed = CV_RGB(255,0,0); - Scalar fontColorNV = CV_RGB(118,185,0); + Scalar fontColorRed(0,0,255); + Scalar fontColorNV(0,185,118); ostringstream ss; ss << "FPS = " << setprecision(1) << fixed << fps;