From 8f32902ce67eecc2bc3510c95512643ee8ab3d7d Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Mon, 15 Apr 2013 15:27:09 +0400 Subject: [PATCH] Minimize usages of legacy C API inside the library --- cmake/OpenCVDetectAndroidSDK.cmake | 2 +- .../core/adding_images/adding_images.rst | 3 +- .../basic_linear_transform.rst | 3 +- doc/tutorials/highgui/trackbar/trackbar.rst | 48 ++++---- .../linux_eclipse/linux_eclipse.rst | 26 ++--- .../load_save_image/load_save_image.rst | 9 +- include/opencv2/opencv.hpp | 3 +- modules/core/doc/drawing_functions.rst | 9 +- modules/core/doc/intro.rst | 6 +- modules/gpu/app/nv_perf_test/main.cpp | 1 - modules/gpu/perf/perf_core.cpp | 6 +- modules/gpu/perf/perf_imgproc.cpp | 4 +- modules/gpu/perf/perf_precomp.hpp | 1 - modules/gpu/perf/perf_video.cpp | 1 + modules/gpu/perf4au/main.cpp | 1 - modules/gpu/test/test_precomp.hpp | 1 - modules/imgproc/doc/feature_detection.rst | 15 ++- modules/imgproc/doc/histograms.rst | 6 +- .../include/opencv2/imgproc/imgproc_c.h | 1 - .../legacy/include/opencv2/legacy/compat.hpp | 8 -- modules/legacy/src/corrimages.cpp | 5 - modules/legacy/src/levmarprojbandle.cpp | 3 - modules/legacy/src/trifocal.cpp | 4 - modules/softcascade/src/octave.cpp | 1 + modules/softcascade/src/precomp.hpp | 1 - modules/softcascade/src/softcascade_init.cpp | 18 --- modules/ts/src/precomp.hpp | 3 - modules/ts/src/ts.cpp | 2 + modules/ts/src/ts_arrtest.cpp | 1 + modules/ts/src/ts_func.cpp | 50 ++++---- modules/video/src/optflowgf.cpp | 2 +- modules/video/src/precomp.hpp | 2 - ...es_HighDynamicRange_Retina_toneMapping.cpp | 8 +- ...hDynamicRange_Retina_toneMapping_video.cpp | 5 +- samples/cpp/bgfg_gmg.cpp | 3 +- .../cpp/detector_descriptor_evaluation.cpp | 14 +-- samples/cpp/em.cpp | 10 +- samples/cpp/fabmap_sample.cpp | 6 +- samples/cpp/freak_demo.cpp | 5 +- samples/cpp/hybridtrackingsample.cpp | 4 - samples/cpp/logpolar_bsm.cpp | 4 +- samples/cpp/morphology2.cpp | 2 - samples/cpp/retinaDemo.cpp | 3 +- .../tutorial_code/contrib/retina_tutorial.cpp | 3 +- samples/gpu/performance/tests.cpp | 109 +++++++++--------- 45 files changed, 184 insertions(+), 238 deletions(-) diff --git a/cmake/OpenCVDetectAndroidSDK.cmake b/cmake/OpenCVDetectAndroidSDK.cmake index 92d7ba3272..bab79805d0 100644 --- a/cmake/OpenCVDetectAndroidSDK.cmake +++ b/cmake/OpenCVDetectAndroidSDK.cmake @@ -275,7 +275,7 @@ macro(add_android_project target path) ocv_include_modules_recurse(${android_proj_NATIVE_DEPS}) ocv_include_directories("${path}/jni") - if (NATIVE_APP_GLUE) + if (NATIVE_APP_GLUE AND 0) include_directories(${ANDROID_NDK}/sources/android/native_app_glue) list(APPEND android_proj_jni_files ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) ocv_warnings_disable(CMAKE_C_FLAGS -Wstrict-prototypes -Wunused-parameter -Wmissing-prototypes) diff --git a/doc/tutorials/core/adding_images/adding_images.rst b/doc/tutorials/core/adding_images/adding_images.rst index e3135693de..3559132dc2 100644 --- a/doc/tutorials/core/adding_images/adding_images.rst +++ b/doc/tutorials/core/adding_images/adding_images.rst @@ -35,8 +35,7 @@ As usual, after the not-so-lengthy explanation, let's go to the code: .. code-block:: cpp - #include - #include + #include #include using namespace cv; diff --git a/doc/tutorials/core/basic_linear_transform/basic_linear_transform.rst b/doc/tutorials/core/basic_linear_transform/basic_linear_transform.rst index 4c2fb70358..75c2628683 100644 --- a/doc/tutorials/core/basic_linear_transform/basic_linear_transform.rst +++ b/doc/tutorials/core/basic_linear_transform/basic_linear_transform.rst @@ -72,8 +72,7 @@ Code .. code-block:: cpp - #include - #include + #include #include using namespace cv; diff --git a/doc/tutorials/highgui/trackbar/trackbar.rst b/doc/tutorials/highgui/trackbar/trackbar.rst index d6f7202ce1..dabfa5e8cf 100644 --- a/doc/tutorials/highgui/trackbar/trackbar.rst +++ b/doc/tutorials/highgui/trackbar/trackbar.rst @@ -28,9 +28,7 @@ Let's modify the program made in the tutorial :ref:`Adding_Images`. We will let .. code-block:: cpp - #include - #include - + #include using namespace cv; /// Global Variables @@ -50,41 +48,41 @@ Let's modify the program made in the tutorial :ref:`Adding_Images`. We will let */ void on_trackbar( int, void* ) { - alpha = (double) alpha_slider/alpha_slider_max ; - beta = ( 1.0 - alpha ); + alpha = (double) alpha_slider/alpha_slider_max ; + beta = ( 1.0 - alpha ); - addWeighted( src1, alpha, src2, beta, 0.0, dst); + addWeighted( src1, alpha, src2, beta, 0.0, dst); - imshow( "Linear Blend", dst ); + imshow( "Linear Blend", dst ); } int main( int argc, char** argv ) { - /// Read image ( same size, same type ) - src1 = imread("../../images/LinuxLogo.jpg"); - src2 = imread("../../images/WindowsLogo.jpg"); + /// Read image ( same size, same type ) + src1 = imread("../../images/LinuxLogo.jpg"); + src2 = imread("../../images/WindowsLogo.jpg"); - if( !src1.data ) { printf("Error loading src1 \n"); return -1; } - if( !src2.data ) { printf("Error loading src2 \n"); return -1; } + if( !src1.data ) { printf("Error loading src1 \n"); return -1; } + if( !src2.data ) { printf("Error loading src2 \n"); return -1; } - /// Initialize values - alpha_slider = 0; + /// Initialize values + alpha_slider = 0; - /// Create Windows - namedWindow("Linear Blend", 1); + /// Create Windows + namedWindow("Linear Blend", 1); - /// Create Trackbars - char TrackbarName[50]; - sprintf( TrackbarName, "Alpha x %d", alpha_slider_max ); + /// Create Trackbars + char TrackbarName[50]; + sprintf( TrackbarName, "Alpha x %d", alpha_slider_max ); - createTrackbar( TrackbarName, "Linear Blend", &alpha_slider, alpha_slider_max, on_trackbar ); + createTrackbar( TrackbarName, "Linear Blend", &alpha_slider, alpha_slider_max, on_trackbar ); - /// Show some stuff - on_trackbar( alpha_slider, 0 ); + /// Show some stuff + on_trackbar( alpha_slider, 0 ); - /// Wait until user press some key - waitKey(0); - return 0; + /// Wait until user press some key + waitKey(0); + return 0; } diff --git a/doc/tutorials/introduction/linux_eclipse/linux_eclipse.rst b/doc/tutorials/introduction/linux_eclipse/linux_eclipse.rst index dc684451e7..451a875c84 100644 --- a/doc/tutorials/introduction/linux_eclipse/linux_eclipse.rst +++ b/doc/tutorials/introduction/linux_eclipse/linux_eclipse.rst @@ -65,8 +65,7 @@ Making a project .. code-block:: cpp - #include - #include + #include using namespace cv; @@ -81,7 +80,7 @@ Making a project return -1; } - namedWindow( "Display Image", CV_WINDOW_AUTOSIZE ); + namedWindow( "Display Image", WINDOW_AUTOSIZE ); imshow( "Display Image", image ); waitKey(0); @@ -206,22 +205,15 @@ Say you have or create a new file, *helloworld.cpp* in a directory called *foo*: .. code-block:: cpp - #include - #include + #include + using namespace cv; + int main ( int argc, char **argv ) { - cvNamedWindow( "My Window", 1 ); - IplImage *img = cvCreateImage( cvSize( 640, 480 ), IPL_DEPTH_8U, 1 ); - CvFont font; - double hScale = 1.0; - double vScale = 1.0; - int lineWidth = 1; - cvInitFont( &font, CV_FONT_HERSHEY_SIMPLEX | CV_FONT_ITALIC, - hScale, vScale, 0, lineWidth ); - cvPutText( img, "Hello World!", cvPoint( 200, 400 ), &font, - cvScalar( 255, 255, 0 ) ); - cvShowImage( "My Window", img ); - cvWaitKey(); + Mat img(480, 640, CV_8U); + putText(img, "Hello World!", Point( 200, 400 ), FONT_HERSHEY_SIMPLEX | FONT_ITALIC, 1.0, Scalar( 255, 255, 0 )); + imshow("My Window", img); + waitKey(); return 0; } diff --git a/doc/tutorials/introduction/load_save_image/load_save_image.rst b/doc/tutorials/introduction/load_save_image/load_save_image.rst index 50fb9ea37f..ac0ee02e5d 100644 --- a/doc/tutorials/introduction/load_save_image/load_save_image.rst +++ b/doc/tutorials/introduction/load_save_image/load_save_image.rst @@ -26,8 +26,7 @@ Here it is: .. code-block:: cpp :linenos: - #include - #include + #include using namespace cv; @@ -45,12 +44,12 @@ Here it is: } Mat gray_image; - cvtColor( image, gray_image, CV_BGR2GRAY ); + cvtColor( image, gray_image, COLOR_BGR2GRAY ); imwrite( "../../images/Gray_Image.jpg", gray_image ); - namedWindow( imageName, CV_WINDOW_AUTOSIZE ); - namedWindow( "Gray image", CV_WINDOW_AUTOSIZE ); + namedWindow( imageName, WINDOW_AUTOSIZE ); + namedWindow( "Gray image", WINDOW_AUTOSIZE ); imshow( imageName, image ); imshow( "Gray image", gray_image ); diff --git a/include/opencv2/opencv.hpp b/include/opencv2/opencv.hpp index 403858cc75..020a45373a 100644 --- a/include/opencv2/opencv.hpp +++ b/include/opencv2/opencv.hpp @@ -44,15 +44,14 @@ #define __OPENCV_ALL_HPP__ #include "opencv2/core.hpp" -#include "opencv2/flann/miniflann.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/photo.hpp" #include "opencv2/video.hpp" #include "opencv2/features2d.hpp" #include "opencv2/objdetect.hpp" #include "opencv2/calib3d.hpp" -#include "opencv2/ml.hpp" #include "opencv2/highgui.hpp" #include "opencv2/contrib.hpp" +#include "opencv2/ml.hpp" #endif diff --git a/modules/core/doc/drawing_functions.rst b/modules/core/doc/drawing_functions.rst index 451470a7b6..705db4fcd9 100644 --- a/modules/core/doc/drawing_functions.rst +++ b/modules/core/doc/drawing_functions.rst @@ -507,10 +507,11 @@ The function draws contour outlines in the image if :math:`\texttt{thickness} \ge 0` or fills the area bounded by the contours if :math:`\texttt{thickness}<0` . The example below shows how to retrieve connected components from the binary image and label them: :: - #include "cv.h" - #include "highgui.h" + #include "opencv2/imgproc.hpp" + #include "opencv2/highgui.hpp" using namespace cv; + using namespace std; int main( int argc, char** argv ) { @@ -530,7 +531,7 @@ The function draws contour outlines in the image if vector hierarchy; findContours( src, contours, hierarchy, - CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE ); + RETR_CCOMP, CHAIN_APPROX_SIMPLE ); // iterate through all the top-level contours, // draw each connected component with its own random color @@ -538,7 +539,7 @@ The function draws contour outlines in the image if for( ; idx >= 0; idx = hierarchy[idx][0] ) { Scalar color( rand()&255, rand()&255, rand()&255 ); - drawContours( dst, contours, idx, color, CV_FILLED, 8, hierarchy ); + drawContours( dst, contours, idx, color, FILLED, 8, hierarchy ); } namedWindow( "Components", 1 ); diff --git a/modules/core/doc/intro.rst b/modules/core/doc/intro.rst index 5a170cb13f..2dd0db6bf6 100644 --- a/modules/core/doc/intro.rst +++ b/modules/core/doc/intro.rst @@ -104,8 +104,8 @@ OpenCV deallocates the memory automatically, as well as automatically allocates Example: :: - #include "cv.h" - #include "highgui.h" + #include "opencv2/imgproc.hpp" + #include "opencv2/highgui.hpp" using namespace cv; @@ -119,7 +119,7 @@ Example: :: for(;;) { cap >> frame; - cvtColor(frame, edges, CV_BGR2GRAY); + cvtColor(frame, edges, COLOR_BGR2GRAY); GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5); Canny(edges, edges, 0, 30, 3); imshow("edges", edges); diff --git a/modules/gpu/app/nv_perf_test/main.cpp b/modules/gpu/app/nv_perf_test/main.cpp index 4bdf387edf..a0363be124 100644 --- a/modules/gpu/app/nv_perf_test/main.cpp +++ b/modules/gpu/app/nv_perf_test/main.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include static void printOsInfo() diff --git a/modules/gpu/perf/perf_core.cpp b/modules/gpu/perf/perf_core.cpp index 3461880379..0b20214bd7 100644 --- a/modules/gpu/perf/perf_core.cpp +++ b/modules/gpu/perf/perf_core.cpp @@ -1305,7 +1305,9 @@ PERF_TEST_P(Sz_3Depth, Core_AddWeighted, // GEMM CV_FLAGS(GemmFlags, 0, cv::GEMM_1_T, cv::GEMM_2_T, cv::GEMM_3_T) -#define ALL_GEMM_FLAGS Values(0, CV_GEMM_A_T, CV_GEMM_B_T, CV_GEMM_C_T, CV_GEMM_A_T | CV_GEMM_B_T, CV_GEMM_A_T | CV_GEMM_C_T, CV_GEMM_A_T | CV_GEMM_B_T | CV_GEMM_C_T) +#define ALL_GEMM_FLAGS Values(0, (int)cv::GEMM_1_T, (int)cv::GEMM_2_T, (int)cv::GEMM_3_T, \ + (int)cv::GEMM_1_T | cv::GEMM_2_T, (int)cv::GEMM_1_T | cv::GEMM_3_T, \ + (int)cv::GEMM_1_T | cv::GEMM_2_T | cv::GEMM_3_T) DEF_PARAM_TEST(Sz_Type_Flags, cv::Size, MatType, GemmFlags); @@ -2071,7 +2073,7 @@ PERF_TEST_P(Sz_Depth, Core_CountNonZero, ////////////////////////////////////////////////////////////////////// // Reduce -CV_ENUM(ReduceCode, CV_REDUCE_SUM, CV_REDUCE_AVG, CV_REDUCE_MAX, CV_REDUCE_MIN) +CV_ENUM(ReduceCode, cv::REDUCE_SUM, cv::REDUCE_AVG, cv::REDUCE_MAX, cv::REDUCE_MIN) #define ALL_REDUCE_CODES ValuesIn(ReduceCode::all()) enum {Rows = 0, Cols = 1}; diff --git a/modules/gpu/perf/perf_imgproc.cpp b/modules/gpu/perf/perf_imgproc.cpp index 8a8e604771..ee109914bf 100644 --- a/modules/gpu/perf/perf_imgproc.cpp +++ b/modules/gpu/perf/perf_imgproc.cpp @@ -1794,7 +1794,7 @@ PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles, cv::gpu::GpuMat d_circles; cv::gpu::HoughCirclesBuf d_buf; - TEST_CYCLE() cv::gpu::HoughCircles(d_src, d_circles, d_buf, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); + TEST_CYCLE() cv::gpu::HoughCircles(d_src, d_circles, d_buf, cv::HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); cv::Mat gpu_circles(d_circles); cv::Vec3f* begin = gpu_circles.ptr(0); @@ -1806,7 +1806,7 @@ PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles, { std::vector cpu_circles; - TEST_CYCLE() cv::HoughCircles(src, cpu_circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); + TEST_CYCLE() cv::HoughCircles(src, cpu_circles, cv::HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); SANITY_CHECK(cpu_circles); } diff --git a/modules/gpu/perf/perf_precomp.hpp b/modules/gpu/perf/perf_precomp.hpp index 40930f7c08..f365a5aea8 100644 --- a/modules/gpu/perf/perf_precomp.hpp +++ b/modules/gpu/perf/perf_precomp.hpp @@ -63,7 +63,6 @@ #include "opencv2/calib3d.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/video.hpp" -#include "opencv2/legacy.hpp" #include "opencv2/photo.hpp" #include "opencv2/core/gpu_private.hpp" diff --git a/modules/gpu/perf/perf_video.cpp b/modules/gpu/perf/perf_video.cpp index a8e828efa3..c69b9606c8 100644 --- a/modules/gpu/perf/perf_video.cpp +++ b/modules/gpu/perf/perf_video.cpp @@ -41,6 +41,7 @@ //M*/ #include "perf_precomp.hpp" +#include "opencv2/legacy.hpp" using namespace std; using namespace testing; diff --git a/modules/gpu/perf4au/main.cpp b/modules/gpu/perf4au/main.cpp index 47a6c4e257..eb4f069f45 100644 --- a/modules/gpu/perf4au/main.cpp +++ b/modules/gpu/perf4au/main.cpp @@ -49,7 +49,6 @@ #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/test/test_precomp.hpp b/modules/gpu/test/test_precomp.hpp index c9716c1486..f6d1392c76 100644 --- a/modules/gpu/test/test_precomp.hpp +++ b/modules/gpu/test/test_precomp.hpp @@ -73,7 +73,6 @@ #include "opencv2/ts.hpp" #include "opencv2/ts/gpu_test.hpp" #include "opencv2/gpu.hpp" -#include "opencv2/legacy.hpp" #include "interpolation.hpp" #include "main_test_nvidia.h" diff --git a/modules/imgproc/doc/feature_detection.rst b/modules/imgproc/doc/feature_detection.rst index 090848724c..c88eaef650 100644 --- a/modules/imgproc/doc/feature_detection.rst +++ b/modules/imgproc/doc/feature_detection.rst @@ -306,8 +306,8 @@ The function finds circles in a grayscale image using a modification of the Houg Example: :: - #include - #include + #include + #include #include using namespace cv; @@ -317,11 +317,11 @@ Example: :: Mat img, gray; if( argc != 2 && !(img=imread(argv[1], 1)).data) return -1; - cvtColor(img, gray, CV_BGR2GRAY); + cvtColor(img, gray, COLOR_BGR2GRAY); // smooth it, otherwise a lot of false circles may be detected GaussianBlur( gray, gray, Size(9, 9), 2, 2 ); vector circles; - HoughCircles(gray, circles, CV_HOUGH_GRADIENT, + HoughCircles(gray, circles, HOUGH_GRADIENT, 2, gray->rows/4, 200, 100 ); for( size_t i = 0; i < circles.size(); i++ ) { @@ -426,9 +426,8 @@ The function implements the probabilistic Hough transform algorithm for line det /* This is a standalone program. Pass an image name as the first parameter of the program. Switch between standard and probabilistic Hough transform by changing "#if 1" to "#if 0" and back */ - #include - #include - #include + #include + #include using namespace cv; @@ -439,7 +438,7 @@ The function implements the probabilistic Hough transform algorithm for line det return -1; Canny( src, dst, 50, 200, 3 ); - cvtColor( dst, color_dst, CV_GRAY2BGR ); + cvtColor( dst, color_dst, COLOR_GRAY2BGR ); #if 0 vector lines; diff --git a/modules/imgproc/doc/histograms.rst b/modules/imgproc/doc/histograms.rst index b6c390402e..984bbc1365 100644 --- a/modules/imgproc/doc/histograms.rst +++ b/modules/imgproc/doc/histograms.rst @@ -42,8 +42,8 @@ arrays. The elements of a tuple used to increment a histogram bin are taken from the corresponding input arrays at the same location. The sample below shows how to compute a 2D Hue-Saturation histogram for a color image. :: - #include - #include + #include + #include using namespace cv; @@ -53,7 +53,7 @@ input arrays at the same location. The sample below shows how to compute a 2D Hu if( argc != 2 || !(src=imread(argv[1], 1)).data ) return -1; - cvtColor(src, hsv, CV_BGR2HSV); + cvtColor(src, hsv, COLOR_BGR2HSV); // Quantize the hue to 30 levels // and the saturation to 32 levels diff --git a/modules/imgproc/include/opencv2/imgproc/imgproc_c.h b/modules/imgproc/include/opencv2/imgproc/imgproc_c.h index c7b525c96d..4e2dc7142a 100644 --- a/modules/imgproc/include/opencv2/imgproc/imgproc_c.h +++ b/modules/imgproc/include/opencv2/imgproc/imgproc_c.h @@ -43,7 +43,6 @@ #ifndef __OPENCV_IMGPROC_IMGPROC_C_H__ #define __OPENCV_IMGPROC_IMGPROC_C_H__ -#include "opencv2/core/core_c.h" #include "opencv2/imgproc/types_c.h" #ifdef __cplusplus diff --git a/modules/legacy/include/opencv2/legacy/compat.hpp b/modules/legacy/include/opencv2/legacy/compat.hpp index 0af67d7537..5840d747a0 100644 --- a/modules/legacy/include/opencv2/legacy/compat.hpp +++ b/modules/legacy/include/opencv2/legacy/compat.hpp @@ -39,14 +39,6 @@ // //M*/ -/* - A few macros and definitions for backward compatibility - with the previous versions of OpenCV. They are obsolete and - are likely to be removed in future. To check whether your code - uses any of these, define CV_NO_BACKWARD_COMPATIBILITY before - including cv.h. -*/ - #ifndef __OPENCV_COMPAT_HPP__ #define __OPENCV_COMPAT_HPP__ diff --git a/modules/legacy/src/corrimages.cpp b/modules/legacy/src/corrimages.cpp index 027dc6e97c..019fb01f35 100644 --- a/modules/legacy/src/corrimages.cpp +++ b/modules/legacy/src/corrimages.cpp @@ -40,11 +40,6 @@ //M*/ #include "precomp.hpp" -//#include "cvtypes.h" -//#include -//#include -//#include "cv.h" -//#include "highgui.h" #if 0 #include diff --git a/modules/legacy/src/levmarprojbandle.cpp b/modules/legacy/src/levmarprojbandle.cpp index 84c2aee24d..545a96ef3e 100644 --- a/modules/legacy/src/levmarprojbandle.cpp +++ b/modules/legacy/src/levmarprojbandle.cpp @@ -41,11 +41,8 @@ #include "precomp.hpp" -//#include "cvtypes.h" #include #include -//#include "cv.h" - #include void icvReconstructPoints4DStatus(CvMat** projPoints, CvMat **projMatrs, CvMat** presPoints, CvMat *points4D,int numImages,CvMat **projError=0); diff --git a/modules/legacy/src/trifocal.cpp b/modules/legacy/src/trifocal.cpp index c8e7b0896a..b7200a510c 100644 --- a/modules/legacy/src/trifocal.cpp +++ b/modules/legacy/src/trifocal.cpp @@ -42,12 +42,8 @@ #include "precomp.hpp" #include "opencv2/calib3d/calib3d_c.h" -//#include "cvtypes.h" #include #include -//#include "cv.h" -//#include "windows.h" - #include /* Valery Mosyagin */ diff --git a/modules/softcascade/src/octave.cpp b/modules/softcascade/src/octave.cpp index 45b7671edd..935898d565 100644 --- a/modules/softcascade/src/octave.cpp +++ b/modules/softcascade/src/octave.cpp @@ -41,6 +41,7 @@ //M*/ #include "precomp.hpp" +#include "opencv2/ml.hpp" #include using cv::InputArray; diff --git a/modules/softcascade/src/precomp.hpp b/modules/softcascade/src/precomp.hpp index b4854f7927..194aec56dc 100644 --- a/modules/softcascade/src/precomp.hpp +++ b/modules/softcascade/src/precomp.hpp @@ -45,7 +45,6 @@ #include "opencv2/softcascade.hpp" #include "opencv2/imgproc.hpp" -#include "opencv2/ml.hpp" #include "opencv2/core/private.hpp" #include "opencv2/core/gpu_private.hpp" diff --git a/modules/softcascade/src/softcascade_init.cpp b/modules/softcascade/src/softcascade_init.cpp index a30f936e6b..b5bac41fae 100644 --- a/modules/softcascade/src/softcascade_init.cpp +++ b/modules/softcascade/src/softcascade_init.cpp @@ -63,22 +63,4 @@ bool initModule_softcascade(void) return (sc1->info() != 0) && (sc->info() != 0); } -namespace internal { -void error(const char *error_string, const char *file, const int line, const char *func) -{ - int code = CV_GpuApiCallError; - - if (std::uncaught_exception()) - { - const char* errorStr = cvErrorStr(code); - const char* function = func ? func : "unknown function"; - - std::cerr << "OpenCV Error: " << errorStr << "(" << error_string << ") in " << function << ", file " << file << ", line " << line; - std::cerr.flush(); - } - else - cv::error( cv::Exception(code, error_string, func, file, line) ); -} -} - } } \ No newline at end of file diff --git a/modules/ts/src/precomp.hpp b/modules/ts/src/precomp.hpp index 87435e350f..3fef1804a7 100644 --- a/modules/ts/src/precomp.hpp +++ b/modules/ts/src/precomp.hpp @@ -1,8 +1,5 @@ #include "opencv2/ts.hpp" - -#include "opencv2/core/core_c.h" #include "opencv2/core/utility.hpp" - #include "opencv2/core/private.hpp" #ifdef GTEST_LINKED_AS_SHARED_LIBRARY diff --git a/modules/ts/src/ts.cpp b/modules/ts/src/ts.cpp index 65a9727e70..90ea1f9819 100644 --- a/modules/ts/src/ts.cpp +++ b/modules/ts/src/ts.cpp @@ -40,6 +40,8 @@ //M*/ #include "precomp.hpp" +#include "opencv2/core/core_c.h" + #include #include #include diff --git a/modules/ts/src/ts_arrtest.cpp b/modules/ts/src/ts_arrtest.cpp index 03a511c4e4..a3a058c518 100644 --- a/modules/ts/src/ts_arrtest.cpp +++ b/modules/ts/src/ts_arrtest.cpp @@ -40,6 +40,7 @@ //M*/ #include "precomp.hpp" +#include "opencv2/core/core_c.h" namespace cvtest { diff --git a/modules/ts/src/ts_func.cpp b/modules/ts/src/ts_func.cpp index b797447691..4b48cd9ed1 100644 --- a/modules/ts/src/ts_func.cpp +++ b/modules/ts/src/ts_func.cpp @@ -645,7 +645,7 @@ void erode(const Mat& _src, Mat& dst, const Mat& _kernel, Point anchor, } if( anchor == Point(-1,-1) ) anchor = Point(kernel.cols/2, kernel.rows/2); - if( borderType == IPL_BORDER_CONSTANT ) + if( borderType == BORDER_CONSTANT ) borderValue = getMaxVal(src.depth()); copyMakeBorder(_src, src, anchor.y, kernel.rows - anchor.y - 1, anchor.x, kernel.cols - anchor.x - 1, @@ -702,7 +702,7 @@ void dilate(const Mat& _src, Mat& dst, const Mat& _kernel, Point anchor, } if( anchor == Point(-1,-1) ) anchor = Point(kernel.cols/2, kernel.rows/2); - if( borderType == IPL_BORDER_CONSTANT ) + if( borderType == BORDER_CONSTANT ) borderValue = getMinVal(src.depth()); copyMakeBorder(_src, src, anchor.y, kernel.rows - anchor.y - 1, anchor.x, kernel.cols - anchor.x - 1, @@ -778,7 +778,7 @@ void filter2D(const Mat& _src, Mat& dst, int ddepth, const Mat& kernel, CV_Assert( kernel.type() == CV_32F || kernel.type() == CV_64F ); if( anchor == Point(-1,-1) ) anchor = Point(kernel.cols/2, kernel.rows/2); - if( borderType == IPL_BORDER_CONSTANT ) + if( borderType == BORDER_CONSTANT ) borderValue = getMinVal(src.depth()); copyMakeBorder(_src, src, anchor.y, kernel.rows - anchor.y - 1, anchor.x, kernel.cols - anchor.x - 1, @@ -830,11 +830,11 @@ static int borderInterpolate( int p, int len, int borderType ) { if( (unsigned)p < (unsigned)len ) ; - else if( borderType == IPL_BORDER_REPLICATE ) + else if( borderType == BORDER_REPLICATE ) p = p < 0 ? 0 : len - 1; - else if( borderType == IPL_BORDER_REFLECT || borderType == IPL_BORDER_REFLECT_101 ) + else if( borderType == BORDER_REFLECT || borderType == BORDER_REFLECT_101 ) { - int delta = borderType == IPL_BORDER_REFLECT_101; + int delta = borderType == BORDER_REFLECT_101; if( len == 1 ) return 0; do @@ -846,17 +846,17 @@ static int borderInterpolate( int p, int len, int borderType ) } while( (unsigned)p >= (unsigned)len ); } - else if( borderType == IPL_BORDER_WRAP ) + else if( borderType == BORDER_WRAP ) { if( p < 0 ) p -= ((p-len+1)/len)*len; if( p >= len ) p %= len; } - else if( borderType == IPL_BORDER_CONSTANT ) + else if( borderType == BORDER_CONSTANT ) p = -1; else - CV_Error( CV_StsBadArg, "Unknown/unsupported border type" ); + CV_Error( Error::StsBadArg, "Unknown/unsupported border type" ); return p; } @@ -868,7 +868,7 @@ void copyMakeBorder(const Mat& src, Mat& dst, int top, int bottom, int left, int int i, j, k, esz = (int)src.elemSize(); int width = src.cols*esz, width1 = dst.cols*esz; - if( borderType == IPL_BORDER_CONSTANT ) + if( borderType == BORDER_CONSTANT ) { vector valvec((src.cols + left + right)*esz); uchar* val = &valvec[0]; @@ -1304,7 +1304,7 @@ double norm(const Mat& src, int normType, const Mat& mask) result = norm_((const double*)sptr, total, cn, normType, result, mptr); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); }; } if( normType0 == NORM_L2 ) @@ -1382,7 +1382,7 @@ double norm(const Mat& src1, const Mat& src2, int normType, const Mat& mask) result = norm_((const double*)sptr1, (const double*)sptr2, total, cn, normType, result, mptr); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); }; } if( normType0 == NORM_L2 ) @@ -1441,7 +1441,7 @@ double crossCorr(const Mat& src1, const Mat& src2) result += crossCorr_((const double*)sptr1, (const double*)sptr2, total); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); }; } return result; @@ -1574,7 +1574,7 @@ compare_(const _Tp* src1, const _Tp* src2, uchar* dst, size_t total, int cmpop) dst[i] = src1[i] > src2[i] ? 255 : 0; break; default: - CV_Error(CV_StsBadArg, "Unknown comparison operation"); + CV_Error(Error::StsBadArg, "Unknown comparison operation"); } } @@ -1610,7 +1610,7 @@ compareS_(const _Tp* src1, _WTp value, uchar* dst, size_t total, int cmpop) dst[i] = src1[i] > value ? 255 : 0; break; default: - CV_Error(CV_StsBadArg, "Unknown comparison operation"); + CV_Error(Error::StsBadArg, "Unknown comparison operation"); } } @@ -1657,7 +1657,7 @@ void compare(const Mat& src1, const Mat& src2, Mat& dst, int cmpop) compare_((const double*)sptr1, (const double*)sptr2, dptr, total, cmpop); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); } } } @@ -1704,7 +1704,7 @@ void compare(const Mat& src, double value, Mat& dst, int cmpop) compareS_((const double*)sptr, value, dptr, total, cmpop); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); } } } @@ -1836,7 +1836,7 @@ bool cmpUlps(const Mat& src1, const Mat& src2, int imaxDiff, double* _realmaxdif realmaxdiff = cmpUlpsFlt_((const int64*)sptr1, (const int64*)sptr2, total, imaxDiff, startidx, idx); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); } if(_realmaxdiff) @@ -1925,7 +1925,7 @@ int check( const Mat& a, double fmin, double fmax, vector* _idx ) checkFlt_((const double*)aptr, total, fmin, fmax, startidx, idx); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); } if( idx != 0 ) @@ -2344,7 +2344,7 @@ void transform( const Mat& src, Mat& dst, const Mat& transmat, const Mat& _shift transform_((const double*)sptr, (double*)dptr, total, scn, dcn, mat); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); } } } @@ -2401,7 +2401,7 @@ static void minmax(const Mat& src1, const Mat& src2, Mat& dst, char op) minmax_((const double*)sptr1, (const double*)sptr2, (double*)dptr, total, op); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); } } } @@ -2469,7 +2469,7 @@ static void minmax(const Mat& src1, double val, Mat& dst, char op) minmax_((const double*)sptr1, saturate_cast(val), (double*)dptr, total, op); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); } } } @@ -2541,7 +2541,7 @@ static void muldiv(const Mat& src1, const Mat& src2, Mat& dst, double scale, cha muldiv_((const double*)sptr1, (const double*)sptr2, (double*)dptr, total, scale, op); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); } } } @@ -2626,7 +2626,7 @@ Scalar mean(const Mat& src, const Mat& mask) mean_((const double*)sptr, mptr, total, cn, sum, nz); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); } } @@ -2863,7 +2863,7 @@ static void writeElems(std::ostream& out, const void* data, int nelems, int dept out.precision(pp); } else - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(Error::StsUnsupportedFormat, ""); } diff --git a/modules/video/src/optflowgf.cpp b/modules/video/src/optflowgf.cpp index df2559a3ec..18dd3544e4 100644 --- a/modules/video/src/optflowgf.cpp +++ b/modules/video/src/optflowgf.cpp @@ -56,7 +56,7 @@ FarnebackPolyExp( const Mat& src, Mat& dst, int n, double sigma ) { int k, x, y; - assert( src.type() == CV_32FC1 ); + CV_Assert( src.type() == CV_32FC1 ); int width = src.cols; int height = src.rows; AutoBuffer kbuf(n*6 + 3), _row((width + n*2)*3); diff --git a/modules/video/src/precomp.hpp b/modules/video/src/precomp.hpp index 5cd7ec3812..43ff772cc3 100644 --- a/modules/video/src/precomp.hpp +++ b/modules/video/src/precomp.hpp @@ -44,8 +44,6 @@ #define __OPENCV_PRECOMP_H__ #include "opencv2/video.hpp" -#include "opencv2/video/tracking_c.h" - #include "opencv2/core/utility.hpp" #include "opencv2/core/private.hpp" diff --git a/samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp b/samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp index 6a9bcb3832..8c1cc8e5a9 100644 --- a/samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp +++ b/samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp @@ -10,7 +10,8 @@ #include #include -#include "opencv2/opencv.hpp" +#include "opencv2/contrib.hpp" +#include "opencv2/highgui.hpp" static void help(std::string errorMessage) { @@ -28,7 +29,7 @@ static void drawPlot(const cv::Mat curve, const std::string figureTitle, const i cv::Mat displayedCurveImage = cv::Mat::ones(200, curve.size().height, CV_8U); cv::Mat windowNormalizedCurve; - normalize(curve, windowNormalizedCurve, 0, 200, CV_MINMAX, CV_32F); + normalize(curve, windowNormalizedCurve, 0, 200, cv::NORM_MINMAX, CV_32F); displayedCurveImage = cv::Scalar::all(255); // set a white background int binW = cvRound((double)displayedCurveImage.cols/curve.size().height); @@ -80,8 +81,7 @@ static void drawPlot(const cv::Mat curve, const std::string figureTitle, const i normalize(hist, normalizedHist, 1, 0, cv::NORM_L1, CV_32F); // normalize histogram so that its sum equals 1 double min_val, max_val; - CvMat histArr(normalizedHist); - cvMinMaxLoc(&histArr, &min_val, &max_val); + minMaxLoc(normalizedHist, &min_val, &max_val); //std::cout<<"Hist max,min = "< #include -#include "opencv2/opencv.hpp" +#include "opencv2/contrib.hpp" +#include "opencv2/highgui.hpp" static void help(std::string errorMessage) { @@ -38,7 +39,7 @@ static void drawPlot(const cv::Mat curve, const std::string figureTitle, const i cv::Mat displayedCurveImage = cv::Mat::ones(200, curve.size().height, CV_8U); cv::Mat windowNormalizedCurve; - normalize(curve, windowNormalizedCurve, 0, 200, CV_MINMAX, CV_32F); + normalize(curve, windowNormalizedCurve, 0, 200, cv::NORM_MINMAX, CV_32F); displayedCurveImage = cv::Scalar::all(255); // set a white background int binW = cvRound((double)displayedCurveImage.cols/curve.size().height); diff --git a/samples/cpp/bgfg_gmg.cpp b/samples/cpp/bgfg_gmg.cpp index 7403a83fb0..90d4fdde67 100644 --- a/samples/cpp/bgfg_gmg.cpp +++ b/samples/cpp/bgfg_gmg.cpp @@ -5,7 +5,8 @@ * Author: Andrew B. Godbehere */ -#include +#include "opencv2/video.hpp" +#include "opencv2/highgui.hpp" #include #include diff --git a/samples/cpp/detector_descriptor_evaluation.cpp b/samples/cpp/detector_descriptor_evaluation.cpp index 650db65d51..ece735a506 100644 --- a/samples/cpp/detector_descriptor_evaluation.cpp +++ b/samples/cpp/detector_descriptor_evaluation.cpp @@ -39,10 +39,10 @@ // //M*/ -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/features2d/features2d.hpp" -#include "opencv2/legacy/legacy.hpp" +#include "opencv2/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/features2d.hpp" +#include "opencv2/legacy.hpp" #include #include @@ -93,7 +93,7 @@ static void calcKeyPointProjections( const vector& src, const Mat_::const_iterator srcIt = src.begin(); vector::iterator dstIt = dst.begin(); @@ -109,7 +109,7 @@ static void calcKeyPointProjections( const vector& src, const Mat_ Aff; linearizeHomographyAt(H, srcIt->pt, Aff); Mat_ dstM; invert(Aff*invM*Aff.t(), dstM); Mat_ eval; eigen( dstM, eval ); - assert( eval(0,0) && eval(1,0) ); + CV_Assert( eval(0,0) && eval(1,0) ); float dstSize = (float)pow(1./(eval(0,0)*eval(1,0)), 0.25); // TODO: check angle projection @@ -526,7 +526,7 @@ inline void writeKeypoints( FileStorage& fs, const vector& keypoints, inline void readKeypoints( FileStorage& fs, vector& keypoints, int imgIdx ) { - assert( fs.isOpened() ); + CV_Assert( fs.isOpened() ); stringstream imgName; imgName << "img" << imgIdx; read( fs[imgName.str()], keypoints); } diff --git a/samples/cpp/em.cpp b/samples/cpp/em.cpp index 4c4664b8f8..3a070c8cf3 100644 --- a/samples/cpp/em.cpp +++ b/samples/cpp/em.cpp @@ -1,5 +1,5 @@ -#include "opencv2/legacy/legacy.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/legacy.hpp" using namespace cv; @@ -45,7 +45,7 @@ int main( int /*argc*/, char** /*argv*/ ) params.start_step = CvEM::START_AUTO_STEP; params.term_crit.max_iter = 300; params.term_crit.epsilon = 0.1; - params.term_crit.type = CV_TERMCRIT_ITER|CV_TERMCRIT_EPS; + params.term_crit.type = TermCriteria::COUNT|TermCriteria::EPS; // cluster the data em_model.train( samples, Mat(), params, &labels ); @@ -76,7 +76,7 @@ int main( int /*argc*/, char** /*argv*/ ) int response = cvRound(em_model.predict( sample )); Scalar c = colors[response]; - circle( img, Point(j, i), 1, c*0.75, CV_FILLED ); + circle( img, Point(j, i), 1, c*0.75, FILLED ); } } @@ -84,7 +84,7 @@ int main( int /*argc*/, char** /*argv*/ ) for( i = 0; i < nsamples; i++ ) { Point pt(cvRound(samples.at(i, 0)), cvRound(samples.at(i, 1))); - circle( img, pt, 1, colors[labels.at(i)], CV_FILLED ); + circle( img, pt, 1, colors[labels.at(i)], FILLED ); } imshow( "EM-clustering result", img ); diff --git a/samples/cpp/fabmap_sample.cpp b/samples/cpp/fabmap_sample.cpp index 8fa5b5dc09..75febb1340 100644 --- a/samples/cpp/fabmap_sample.cpp +++ b/samples/cpp/fabmap_sample.cpp @@ -49,9 +49,11 @@ // //M*/ +#include -#include "opencv2/opencv.hpp" -#include "opencv2/nonfree/nonfree.hpp" +#include "opencv2/contrib.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/nonfree.hpp" using namespace cv; using namespace std; diff --git a/samples/cpp/freak_demo.cpp b/samples/cpp/freak_demo.cpp index 82a435fcc4..41604865b2 100644 --- a/samples/cpp/freak_demo.cpp +++ b/samples/cpp/freak_demo.cpp @@ -43,7 +43,6 @@ #include #include #include -#include using namespace cv; @@ -95,9 +94,9 @@ int main( int argc, char** argv ) { // MATCHER // The standard Hamming distance can be used such as - // BruteForceMatcher matcher; + // BFMatcher matcher(NORM_HAMMING); // or the proposed cascade of hamming distance using SSSE3 - BruteForceMatcher matcher; + BFMatcher matcher(NORM_HAMMING); // detect double t = (double)getTickCount(); diff --git a/samples/cpp/hybridtrackingsample.cpp b/samples/cpp/hybridtrackingsample.cpp index 09ea76dc1b..b343dfed63 100644 --- a/samples/cpp/hybridtrackingsample.cpp +++ b/samples/cpp/hybridtrackingsample.cpp @@ -11,10 +11,6 @@ * */ -//#include -//#include -//#include -//#include #include #include #include diff --git a/samples/cpp/logpolar_bsm.cpp b/samples/cpp/logpolar_bsm.cpp index bfe99ce29e..fc4a4b34b7 100644 --- a/samples/cpp/logpolar_bsm.cpp +++ b/samples/cpp/logpolar_bsm.cpp @@ -6,7 +6,9 @@ * PSPC-lab - University of Genoa */ -#include "opencv2/opencv.hpp" +#include "opencv2/contrib.hpp" +#include "opencv2/highgui.hpp" + #include #include diff --git a/samples/cpp/morphology2.cpp b/samples/cpp/morphology2.cpp index 5b927cf023..f20b2c7815 100644 --- a/samples/cpp/morphology2.cpp +++ b/samples/cpp/morphology2.cpp @@ -1,5 +1,3 @@ -#define CV_NO_BACKWARD_COMPATIBILITY - #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" #include diff --git a/samples/cpp/retinaDemo.cpp b/samples/cpp/retinaDemo.cpp index 7b8d81a49c..7c40dd2223 100644 --- a/samples/cpp/retinaDemo.cpp +++ b/samples/cpp/retinaDemo.cpp @@ -9,7 +9,8 @@ #include #include -#include "opencv2/opencv.hpp" +#include "opencv2/contrib.hpp" +#include "opencv2/highgui.hpp" static void help(std::string errorMessage) { diff --git a/samples/cpp/tutorial_code/contrib/retina_tutorial.cpp b/samples/cpp/tutorial_code/contrib/retina_tutorial.cpp index 8ebcb7cba1..4d06eb5afe 100644 --- a/samples/cpp/tutorial_code/contrib/retina_tutorial.cpp +++ b/samples/cpp/tutorial_code/contrib/retina_tutorial.cpp @@ -9,7 +9,8 @@ #include #include -#include "opencv2/opencv.hpp" +#include "opencv2/contrib.hpp" +#include "opencv2/highgui.hpp" static void help(std::string errorMessage) { diff --git a/samples/gpu/performance/tests.cpp b/samples/gpu/performance/tests.cpp index 7c7969de91..97eb7a82aa 100644 --- a/samples/gpu/performance/tests.cpp +++ b/samples/gpu/performance/tests.cpp @@ -1,10 +1,11 @@ #include -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/calib3d/calib3d.hpp" -#include "opencv2/video/video.hpp" -#include "opencv2/gpu/gpu.hpp" -#include "opencv2/legacy/legacy.hpp" +#include "opencv2/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/calib3d.hpp" +#include "opencv2/video.hpp" +#include "opencv2/gpu.hpp" + +#include "opencv2/legacy.hpp" #include "performance.h" #include "opencv2/opencv_modules.hpp" @@ -21,7 +22,7 @@ static void InitMatchTemplate() Mat src; gen(src, 500, 500, CV_32F, 0, 1); Mat templ; gen(templ, 500, 500, CV_32F, 0, 1); gpu::GpuMat d_src(src), d_templ(templ), d_dst; - gpu::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR); + gpu::matchTemplate(d_src, d_templ, d_dst, TM_CCORR); } @@ -39,17 +40,17 @@ TEST(matchTemplate) SUBTEST << src.cols << 'x' << src.rows << ", 32FC1" << ", templ " << templ_size << 'x' << templ_size << ", CCORR"; gen(templ, templ_size, templ_size, CV_32F, 0, 1); - matchTemplate(src, templ, dst, CV_TM_CCORR); + matchTemplate(src, templ, dst, TM_CCORR); CPU_ON; - matchTemplate(src, templ, dst, CV_TM_CCORR); + matchTemplate(src, templ, dst, TM_CCORR); CPU_OFF; d_templ.upload(templ); - gpu::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR); + gpu::matchTemplate(d_src, d_templ, d_dst, TM_CCORR); GPU_ON; - gpu::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR); + gpu::matchTemplate(d_src, d_templ, d_dst, TM_CCORR); GPU_OFF; } } @@ -604,120 +605,120 @@ TEST(cvtColor) gen(src, 4000, 4000, CV_8UC1, 0, 255); d_src.upload(src); - SUBTEST << "4000x4000, 8UC1, CV_GRAY2BGRA"; + SUBTEST << "4000x4000, 8UC1, COLOR_GRAY2BGRA"; - cvtColor(src, dst, CV_GRAY2BGRA, 4); + cvtColor(src, dst, COLOR_GRAY2BGRA, 4); CPU_ON; - cvtColor(src, dst, CV_GRAY2BGRA, 4); + cvtColor(src, dst, COLOR_GRAY2BGRA, 4); CPU_OFF; - gpu::cvtColor(d_src, d_dst, CV_GRAY2BGRA, 4); + gpu::cvtColor(d_src, d_dst, COLOR_GRAY2BGRA, 4); GPU_ON; - gpu::cvtColor(d_src, d_dst, CV_GRAY2BGRA, 4); + gpu::cvtColor(d_src, d_dst, COLOR_GRAY2BGRA, 4); GPU_OFF; cv::swap(src, dst); d_src.swap(d_dst); - SUBTEST << "4000x4000, 8UC3 vs 8UC4, CV_BGR2YCrCb"; + SUBTEST << "4000x4000, 8UC3 vs 8UC4, COLOR_BGR2YCrCb"; - cvtColor(src, dst, CV_BGR2YCrCb); + cvtColor(src, dst, COLOR_BGR2YCrCb); CPU_ON; - cvtColor(src, dst, CV_BGR2YCrCb); + cvtColor(src, dst, COLOR_BGR2YCrCb); CPU_OFF; - gpu::cvtColor(d_src, d_dst, CV_BGR2YCrCb, 4); + gpu::cvtColor(d_src, d_dst, COLOR_BGR2YCrCb, 4); GPU_ON; - gpu::cvtColor(d_src, d_dst, CV_BGR2YCrCb, 4); + gpu::cvtColor(d_src, d_dst, COLOR_BGR2YCrCb, 4); GPU_OFF; cv::swap(src, dst); d_src.swap(d_dst); - SUBTEST << "4000x4000, 8UC4, CV_YCrCb2BGR"; + SUBTEST << "4000x4000, 8UC4, COLOR_YCrCb2BGR"; - cvtColor(src, dst, CV_YCrCb2BGR, 4); + cvtColor(src, dst, COLOR_YCrCb2BGR, 4); CPU_ON; - cvtColor(src, dst, CV_YCrCb2BGR, 4); + cvtColor(src, dst, COLOR_YCrCb2BGR, 4); CPU_OFF; - gpu::cvtColor(d_src, d_dst, CV_YCrCb2BGR, 4); + gpu::cvtColor(d_src, d_dst, COLOR_YCrCb2BGR, 4); GPU_ON; - gpu::cvtColor(d_src, d_dst, CV_YCrCb2BGR, 4); + gpu::cvtColor(d_src, d_dst, COLOR_YCrCb2BGR, 4); GPU_OFF; cv::swap(src, dst); d_src.swap(d_dst); - SUBTEST << "4000x4000, 8UC3 vs 8UC4, CV_BGR2XYZ"; + SUBTEST << "4000x4000, 8UC3 vs 8UC4, COLOR_BGR2XYZ"; - cvtColor(src, dst, CV_BGR2XYZ); + cvtColor(src, dst, COLOR_BGR2XYZ); CPU_ON; - cvtColor(src, dst, CV_BGR2XYZ); + cvtColor(src, dst, COLOR_BGR2XYZ); CPU_OFF; - gpu::cvtColor(d_src, d_dst, CV_BGR2XYZ, 4); + gpu::cvtColor(d_src, d_dst, COLOR_BGR2XYZ, 4); GPU_ON; - gpu::cvtColor(d_src, d_dst, CV_BGR2XYZ, 4); + gpu::cvtColor(d_src, d_dst, COLOR_BGR2XYZ, 4); GPU_OFF; cv::swap(src, dst); d_src.swap(d_dst); - SUBTEST << "4000x4000, 8UC4, CV_XYZ2BGR"; + SUBTEST << "4000x4000, 8UC4, COLOR_XYZ2BGR"; - cvtColor(src, dst, CV_XYZ2BGR, 4); + cvtColor(src, dst, COLOR_XYZ2BGR, 4); CPU_ON; - cvtColor(src, dst, CV_XYZ2BGR, 4); + cvtColor(src, dst, COLOR_XYZ2BGR, 4); CPU_OFF; - gpu::cvtColor(d_src, d_dst, CV_XYZ2BGR, 4); + gpu::cvtColor(d_src, d_dst, COLOR_XYZ2BGR, 4); GPU_ON; - gpu::cvtColor(d_src, d_dst, CV_XYZ2BGR, 4); + gpu::cvtColor(d_src, d_dst, COLOR_XYZ2BGR, 4); GPU_OFF; cv::swap(src, dst); d_src.swap(d_dst); - SUBTEST << "4000x4000, 8UC3 vs 8UC4, CV_BGR2HSV"; + SUBTEST << "4000x4000, 8UC3 vs 8UC4, COLOR_BGR2HSV"; - cvtColor(src, dst, CV_BGR2HSV); + cvtColor(src, dst, COLOR_BGR2HSV); CPU_ON; - cvtColor(src, dst, CV_BGR2HSV); + cvtColor(src, dst, COLOR_BGR2HSV); CPU_OFF; - gpu::cvtColor(d_src, d_dst, CV_BGR2HSV, 4); + gpu::cvtColor(d_src, d_dst, COLOR_BGR2HSV, 4); GPU_ON; - gpu::cvtColor(d_src, d_dst, CV_BGR2HSV, 4); + gpu::cvtColor(d_src, d_dst, COLOR_BGR2HSV, 4); GPU_OFF; cv::swap(src, dst); d_src.swap(d_dst); - SUBTEST << "4000x4000, 8UC4, CV_HSV2BGR"; + SUBTEST << "4000x4000, 8UC4, COLOR_HSV2BGR"; - cvtColor(src, dst, CV_HSV2BGR, 4); + cvtColor(src, dst, COLOR_HSV2BGR, 4); CPU_ON; - cvtColor(src, dst, CV_HSV2BGR, 4); + cvtColor(src, dst, COLOR_HSV2BGR, 4); CPU_OFF; - gpu::cvtColor(d_src, d_dst, CV_HSV2BGR, 4); + gpu::cvtColor(d_src, d_dst, COLOR_HSV2BGR, 4); GPU_ON; - gpu::cvtColor(d_src, d_dst, CV_HSV2BGR, 4); + gpu::cvtColor(d_src, d_dst, COLOR_HSV2BGR, 4); GPU_OFF; cv::swap(src, dst); @@ -1093,30 +1094,30 @@ TEST(reduce) SUBTEST << size << 'x' << size << ", dim = 0"; - reduce(src, dst0, 0, CV_REDUCE_MIN); + reduce(src, dst0, 0, REDUCE_MIN); CPU_ON; - reduce(src, dst0, 0, CV_REDUCE_MIN); + reduce(src, dst0, 0, REDUCE_MIN); CPU_OFF; - gpu::reduce(d_src, d_dst0, 0, CV_REDUCE_MIN); + gpu::reduce(d_src, d_dst0, 0, REDUCE_MIN); GPU_ON; - gpu::reduce(d_src, d_dst0, 0, CV_REDUCE_MIN); + gpu::reduce(d_src, d_dst0, 0, REDUCE_MIN); GPU_OFF; SUBTEST << size << 'x' << size << ", dim = 1"; - reduce(src, dst1, 1, CV_REDUCE_MIN); + reduce(src, dst1, 1, REDUCE_MIN); CPU_ON; - reduce(src, dst1, 1, CV_REDUCE_MIN); + reduce(src, dst1, 1, REDUCE_MIN); CPU_OFF; - gpu::reduce(d_src, d_dst1, 1, CV_REDUCE_MIN); + gpu::reduce(d_src, d_dst1, 1, REDUCE_MIN); GPU_ON; - gpu::reduce(d_src, d_dst1, 1, CV_REDUCE_MIN); + gpu::reduce(d_src, d_dst1, 1, REDUCE_MIN); GPU_OFF; } }