From edfdf12c31ffc304363ca2f07fb2733493028773 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 2 Feb 2018 14:19:58 +0300 Subject: [PATCH] tests: refactor test files --- modules/aruco/test/test_arucodetection.cpp | 12 +- modules/aruco/test/test_boarddetection.cpp | 10 +- modules/aruco/test/test_charucodetection.cpp | 18 +-- modules/aruco/test/test_main.cpp | 3 + modules/aruco/test/test_misc.cpp | 5 +- modules/aruco/test/test_precomp.hpp | 13 +- .../test/test_backgroundsubtractor_gbh.cpp | 17 +-- .../test/test_backgroundsubtractor_lsbp.cpp | 9 +- modules/bgsegm/test/test_main.cpp | 3 + modules/bgsegm/test/test_precomp.hpp | 18 +-- .../perf/opencl/perf_retina.ocl.cpp | 12 +- modules/bioinspired/perf/perf_precomp.hpp | 13 +- modules/bioinspired/test/test_main.cpp | 3 + modules/bioinspired/test/test_precomp.hpp | 12 +- modules/bioinspired/test/test_retina_ocl.cpp | 5 +- .../test/test_cnn_3dobj_feature_extract.cpp | 14 +- modules/cnn_3dobj/test/test_main.cpp | 3 + modules/cnn_3dobj/test/test_precomp.hpp | 11 +- modules/cvv/test/test_debug_flag.cpp | 7 + modules/cvv/test/test_is_any_of.cpp | 7 + modules/cvv/test/test_location.cpp | 7 + modules/cvv/test/test_main.cpp | 3 + modules/cvv/test/test_observer_ptr.cpp | 7 + modules/cvv/test/test_precomp.hpp | 11 +- modules/cvv/test/test_reference.cpp | 4 + modules/face/test/test_bif.cpp | 4 + modules/face/test/test_face_align.cpp | 12 +- modules/face/test/test_facemark.cpp | 11 +- modules/face/test/test_facemark_aam.cpp | 11 +- modules/face/test/test_facemark_lbf.cpp | 11 +- modules/face/test/test_loadsave.cpp | 4 + modules/face/test/test_precomp.hpp | 55 +------ modules/fuzzy/test/test_f0.cpp | 9 +- modules/fuzzy/test/test_f1.cpp | 7 +- modules/fuzzy/test/test_image.cpp | 9 +- modules/fuzzy/test/test_main.cpp | 3 + modules/fuzzy/test/test_precomp.hpp | 11 +- modules/hdf/test/test_hdf5.cpp | 20 ++- modules/hdf/test/test_precomp.hpp | 9 -- modules/img_hash/test/test_average_hash.cpp | 4 +- .../img_hash/test/test_block_mean_hash.cpp | 4 +- .../img_hash/test/test_marr_hildreth_hash.cpp | 4 +- modules/img_hash/test/test_phash.cpp | 4 +- modules/img_hash/test/test_precomp.hpp | 16 +- .../test/test_radial_variance_hash.cpp | 8 +- .../line_descriptor/perf/perf_descriptors.cpp | 9 +- .../line_descriptor/perf/perf_detection.cpp | 9 +- .../line_descriptor/perf/perf_matching.cpp | 9 +- modules/line_descriptor/perf/perf_precomp.hpp | 16 +- .../test/test_descriptors_regression.cpp | 5 +- .../test/test_detector_regression.cpp | 9 +- modules/line_descriptor/test/test_main.cpp | 3 + .../test/test_matcher_regression.cpp | 5 +- modules/line_descriptor/test/test_precomp.hpp | 20 +-- .../optflow/perf/opencl/perf_dis_optflow.cpp | 53 +------ modules/optflow/perf/perf_deepflow.cpp | 48 +----- modules/optflow/perf/perf_disflow.cpp | 48 +----- modules/optflow/perf/perf_main.cpp | 3 + modules/optflow/perf/perf_precomp.hpp | 18 +-- .../perf/perf_variational_refinement.cpp | 48 +----- modules/optflow/test/ocl/test_dis.cpp | 10 +- modules/optflow/test/ocl/test_motempl.cpp | 7 +- modules/optflow/test/test_OF_accuracy.cpp | 9 +- .../optflow/test/test_OF_reproducibility.cpp | 11 +- modules/optflow/test/test_main.cpp | 3 + modules/optflow/test/test_motiontemplates.cpp | 5 +- modules/optflow/test/test_precomp.hpp | 19 +-- modules/phase_unwrapping/test/test_main.cpp | 3 + .../phase_unwrapping/test/test_precomp.hpp | 12 +- .../phase_unwrapping/test/test_unwrapping.cpp | 51 +------ modules/reg/perf/perf_precomp.hpp | 26 ++-- modules/reg/perf/perf_reg.cpp | 23 +-- modules/reg/test/test_precomp.hpp | 26 ++-- modules/reg/test/test_reg.cpp | 36 ++--- modules/rgbd/test/test_main.cpp | 3 + modules/rgbd/test/test_normal.cpp | 87 +++-------- modules/rgbd/test/test_odometry.cpp | 30 ++-- modules/rgbd/test/test_precomp.hpp | 9 +- modules/rgbd/test/test_registration.cpp | 15 +- modules/rgbd/test/test_utils.cpp | 19 ++- modules/sfm/test/test_common.cpp | 21 +-- modules/sfm/test/test_conditioning.cpp | 6 +- modules/sfm/test/test_fundamental.cpp | 17 +-- modules/sfm/test/test_main.cpp | 3 + modules/sfm/test/test_numeric.cpp | 8 +- modules/sfm/test/test_precomp.hpp | 14 +- modules/sfm/test/test_projection.cpp | 8 +- modules/sfm/test/test_reconstruct.cpp | 6 +- modules/sfm/test/test_robust.cpp | 14 +- modules/sfm/test/test_simple_pipeline.cpp | 6 +- modules/sfm/test/test_triangulation.cpp | 11 +- modules/stereo/perf/perf_bm.cpp | 22 +-- modules/stereo/perf/perf_descriptor.cpp | 34 ++--- modules/stereo/perf/perf_precomp.hpp | 28 +--- modules/stereo/test/test_block_matching.cpp | 8 +- modules/stereo/test/test_descriptors.cpp | 12 +- modules/stereo/test/test_precomp.hpp | 24 +-- modules/structured_light/test/test_faps.cpp | 8 +- .../test/test_getProjPixel.cpp | 5 +- modules/structured_light/test/test_main.cpp | 3 + modules/structured_light/test/test_plane.cpp | 13 +- .../structured_light/test/test_precomp.hpp | 12 +- modules/text/test/test_detection.cpp | 10 +- modules/text/test/test_main.cpp | 3 + modules/text/test/test_precomp.hpp | 7 + modules/tracking/perf/perf_Tracker.cpp | 13 +- modules/tracking/perf/perf_main.cpp | 3 + modules/tracking/perf/perf_precomp.hpp | 20 +-- modules/tracking/test/test_aukf.cpp | 12 +- modules/tracking/test/test_main.cpp | 3 + modules/tracking/test/test_precomp.hpp | 15 +- .../test/test_trackerParametersIO.cpp | 5 +- modules/tracking/test/test_trackers.cpp | 13 +- modules/tracking/test/test_ukf.cpp | 12 +- modules/xfeatures2d/perf/perf_daisy.cpp | 12 +- modules/xfeatures2d/perf/perf_latch.cpp | 12 +- modules/xfeatures2d/perf/perf_main.cpp | 3 + modules/xfeatures2d/perf/perf_msd.cpp | 12 +- modules/xfeatures2d/perf/perf_precomp.hpp | 21 +-- modules/xfeatures2d/perf/perf_surf.cpp | 12 +- modules/xfeatures2d/perf/perf_surf.cuda.cpp | 5 +- modules/xfeatures2d/perf/perf_surf.ocl.cpp | 5 +- modules/xfeatures2d/perf/perf_vgg.cpp | 12 +- modules/xfeatures2d/test/test_detectors.cpp | 26 ++-- modules/xfeatures2d/test/test_features2d.cpp | 38 ++--- modules/xfeatures2d/test/test_gms_matcher.cpp | 8 +- modules/xfeatures2d/test/test_keypoints.cpp | 6 +- modules/xfeatures2d/test/test_main.cpp | 3 + modules/xfeatures2d/test/test_precomp.hpp | 22 +-- .../test_rotation_and_scale_invariance.cpp | 9 +- modules/xfeatures2d/test/test_surf.cuda.cpp | 3 +- modules/xfeatures2d/test/test_surf.ocl.cpp | 7 +- .../ximgproc/perf/perf_adaptive_manifold.cpp | 52 +------ .../perf/perf_bilateral_texture_filter.cpp | 52 +------ .../perf/perf_disparity_wls_filter.cpp | 52 +------ .../ximgproc/perf/perf_domain_transform.cpp | 51 +------ .../perf/perf_fast_hough_transform.cpp | 15 +- modules/ximgproc/perf/perf_fgs_filter.cpp | 51 +------ modules/ximgproc/perf/perf_guided_filter.cpp | 51 +------ modules/ximgproc/perf/perf_l0_smooth.cpp | 53 +------ modules/ximgproc/perf/perf_main.cpp | 3 + modules/ximgproc/perf/perf_precomp.hpp | 18 +-- .../perf/perf_ridge_detection_filter.cpp | 9 +- .../perf/perf_rolling_guidance_filter.cpp | 53 +------ .../perf/perf_weighted_median_filter.cpp | 137 +++++++----------- .../perf/pref_joint_bilateral_filter.cpp | 51 +------ .../ximgproc/test/test_adaptive_manifold.cpp | 55 +------ .../test/test_adaptive_manifold_ref_impl.cpp | 70 ++------- modules/ximgproc/test/test_anisodiff.cpp | 8 +- .../test/test_bilateral_texture_filter.cpp | 56 +------ .../test/test_disparity_wls_filter.cpp | 53 +------ .../ximgproc/test/test_domain_transform.cpp | 51 +------ .../test/test_fast_hough_transform.cpp | 14 +- modules/ximgproc/test/test_fgs_filter.cpp | 52 +------ modules/ximgproc/test/test_fld.cpp | 12 +- modules/ximgproc/test/test_guided_filter.cpp | 53 +------ .../test/test_joint_bilateral_filter.cpp | 55 +------ modules/ximgproc/test/test_l0_smooth.cpp | 52 +------ modules/ximgproc/test/test_main.cpp | 3 + modules/ximgproc/test/test_precomp.hpp | 22 ++- .../test/test_ridge_detection_filter.cpp | 7 +- .../test/test_rolling_guidance_filter.cpp | 53 +------ .../test/test_sparse_match_interpolator.cpp | 58 ++------ .../test/test_structured_edge_detection.cpp | 8 +- modules/ximgproc/test/test_thinning.cpp | 8 +- .../test/test_weighted_median_filter.cpp | 52 +------ modules/xphoto/perf/perf_grayworld.cpp | 15 +- .../perf_learning_based_color_balance.cpp | 52 +------ modules/xphoto/perf/perf_main.cpp | 3 + modules/xphoto/perf/perf_precomp.hpp | 15 +- modules/xphoto/test/dct_image_denoising.cpp | 11 +- modules/xphoto/test/simple_color_balance.cpp | 11 +- modules/xphoto/test/test_denoise_bm3d.cpp | 9 +- modules/xphoto/test/test_grayworld.cpp | 10 +- .../test_learning_based_color_balance.cpp | 15 +- modules/xphoto/test/test_main.cpp | 3 + modules/xphoto/test/test_precomp.hpp | 18 +-- 177 files changed, 996 insertions(+), 2321 deletions(-) diff --git a/modules/aruco/test/test_arucodetection.cpp b/modules/aruco/test/test_arucodetection.cpp index 9d923883d..10194f4d0 100644 --- a/modules/aruco/test/test_arucodetection.cpp +++ b/modules/aruco/test/test_arucodetection.cpp @@ -38,12 +38,8 @@ the use of this software, even if advised of the possibility of such damage. #include "test_precomp.hpp" -#include -#include - -using namespace std; -using namespace cv; +namespace opencv_test { namespace { /** * @brief Draw 2D synthetic markers and detect them @@ -118,7 +114,7 @@ void CV_ArucoDetectionSimple::run(int) { } for(int c = 0; c < 4; c++) { - double dist = norm(groundTruthCorners[m][c] - corners[idx][c]); + double dist = cv::norm(groundTruthCorners[m][c] - corners[idx][c]); // TODO cvtest if(dist > 0.001) { ts->printf(cvtest::TS::LOG, "Incorrect marker corners position"); ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY); @@ -290,7 +286,7 @@ void CV_ArucoDetectionPerspective::run(int) { return; } for(int c = 0; c < 4; c++) { - double dist = norm(groundTruthCorners[c] - corners[0][c]); + double dist = cv::norm(groundTruthCorners[c] - corners[0][c]); // TODO cvtest if(dist > 5) { ts->printf(cvtest::TS::LOG, "Incorrect marker corners position"); ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY); @@ -507,3 +503,5 @@ TEST(CV_ArucoBitCorrection, algorithmic) { CV_ArucoBitCorrection test; test.safe_run(); } + +}} // namespace diff --git a/modules/aruco/test/test_boarddetection.cpp b/modules/aruco/test/test_boarddetection.cpp index c57b2dd6e..474bc372f 100644 --- a/modules/aruco/test/test_boarddetection.cpp +++ b/modules/aruco/test/test_boarddetection.cpp @@ -38,12 +38,8 @@ the use of this software, even if advised of the possibility of such damage. #include "test_precomp.hpp" -#include -#include - -using namespace std; -using namespace cv; +namespace opencv_test { namespace { static double deg2rad(double deg) { return deg * CV_PI / 180.; } @@ -237,7 +233,7 @@ void CV_ArucoBoardPose::run(int) { projectedCorners); for(int c = 0; c < 4; c++) { - double repError = norm(projectedCorners[c] - corners[i][c]); + double repError = cv::norm(projectedCorners[c] - corners[i][c]); // TODO cvtest if(repError > 5.) { ts->printf(cvtest::TS::LOG, "Corner reprojection error too high"); ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH); @@ -407,3 +403,5 @@ TEST(CV_ArucoBoardPose, CheckNegativeZ) out = cv::Point3d(tvec) + rotm*Point3d(board.objPoints[0][0]); ASSERT_GT(out.z, 0); } + +}} // namespace diff --git a/modules/aruco/test/test_charucodetection.cpp b/modules/aruco/test/test_charucodetection.cpp index 1f506ba2f..5cb47d8fd 100644 --- a/modules/aruco/test/test_charucodetection.cpp +++ b/modules/aruco/test/test_charucodetection.cpp @@ -38,12 +38,8 @@ the use of this software, even if advised of the possibility of such damage. #include "test_precomp.hpp" -#include -#include - -using namespace std; -using namespace cv; +namespace opencv_test { namespace { static double deg2rad(double deg) { return deg * CV_PI / 180.; } @@ -289,7 +285,7 @@ void CV_CharucoDetection::run(int) { return; } - double repError = norm(charucoCorners[i] - projectedCharucoCorners[currentId]); + double repError = cv::norm(charucoCorners[i] - projectedCharucoCorners[currentId]); // TODO cvtest if(repError > 5.) { @@ -394,7 +390,7 @@ void CV_CharucoPoseEstimation::run(int) { return; } - double repError = norm(charucoCorners[i] - projectedCharucoCorners[currentId]); + double repError = cv::norm(charucoCorners[i] - projectedCharucoCorners[currentId]); // TODO cvtest if(repError > 5.) { @@ -504,8 +500,7 @@ void CV_CharucoDiamondDetection::run(int) { for(unsigned int i = 0; i < 4; i++) { - double repError = - norm(diamondCorners[0][i] - projectedDiamondCornersReorder[i]); + double repError = cv::norm(diamondCorners[0][i] - projectedDiamondCornersReorder[i]); // TODO cvtest if(repError > 5.) { ts->printf(cvtest::TS::LOG, "Diamond corner reprojection error too high"); @@ -530,8 +525,7 @@ void CV_CharucoDiamondDetection::run(int) { distCoeffs, projectedDiamondCornersPose); for(unsigned int i = 0; i < 4; i++) { - double repError = - norm(projectedDiamondCornersReorder[i] - projectedDiamondCornersPose[i]); + double repError = cv::norm(projectedDiamondCornersReorder[i] - projectedDiamondCornersPose[i]); // TODO cvtest if(repError > 5.) { ts->printf(cvtest::TS::LOG, "Charuco pose error too high"); @@ -562,3 +556,5 @@ TEST(CV_CharucoDiamondDetection, accuracy) { CV_CharucoDiamondDetection test; test.safe_run(); } + +}} // namespace diff --git a/modules/aruco/test/test_main.cpp b/modules/aruco/test/test_main.cpp index 6b2499344..0e51ddfd0 100644 --- a/modules/aruco/test/test_main.cpp +++ b/modules/aruco/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("cv") diff --git a/modules/aruco/test/test_misc.cpp b/modules/aruco/test/test_misc.cpp index db9e83a48..2224fc574 100644 --- a/modules/aruco/test/test_misc.cpp +++ b/modules/aruco/test/test_misc.cpp @@ -3,7 +3,8 @@ // of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -#include + +namespace opencv_test { namespace { TEST(CV_ArucoDrawMarker, regression_1226) { @@ -22,3 +23,5 @@ TEST(CV_ArucoDrawMarker, regression_1226) board->draw(sz, mat, 0, 1); }); } + +}} // namespace diff --git a/modules/aruco/test/test_precomp.hpp b/modules/aruco/test/test_precomp.hpp index 9881ff8ed..d8c903f4c 100644 --- a/modules/aruco/test/test_precomp.hpp +++ b/modules/aruco/test/test_precomp.hpp @@ -1,18 +1,13 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ -#include #include "opencv2/ts.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/calib3d.hpp" #include "opencv2/aruco.hpp" +#include #endif diff --git a/modules/bgsegm/test/test_backgroundsubtractor_gbh.cpp b/modules/bgsegm/test/test_backgroundsubtractor_gbh.cpp index 507c58c36..f42f008e1 100644 --- a/modules/bgsegm/test/test_backgroundsubtractor_gbh.cpp +++ b/modules/bgsegm/test/test_backgroundsubtractor_gbh.cpp @@ -1,14 +1,11 @@ -/* - * BackgroundSubtractorGBH_test.cpp - * - * Created on: Jun 14, 2012 - * Author: andrewgodbehere - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. +// +// Author: andrewgodbehere #include "test_precomp.hpp" -using namespace cv; -using namespace cv::bgsegm; +namespace opencv_test { namespace { class CV_BackgroundSubtractorTest : public cvtest::BaseTest { @@ -136,3 +133,5 @@ void CV_BackgroundSubtractorTest::run(int) } TEST(VIDEO_BGSUBGMG, accuracy) { CV_BackgroundSubtractorTest test; test.safe_run(); } + +}} // namespace diff --git a/modules/bgsegm/test/test_backgroundsubtractor_lsbp.cpp b/modules/bgsegm/test/test_backgroundsubtractor_lsbp.cpp index 964cc5a50..890070e4a 100644 --- a/modules/bgsegm/test/test_backgroundsubtractor_lsbp.cpp +++ b/modules/bgsegm/test/test_backgroundsubtractor_lsbp.cpp @@ -1,9 +1,10 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" #include -using namespace std; -using namespace cv; -using namespace cvtest; +namespace opencv_test { namespace { static string getDataDir() { return TS::ptr()->get_data_path(); } @@ -135,3 +136,5 @@ TEST(BackgroundSubtractor_LSBP, Accuracy) EXPECT_GE(evaluateBGSAlgorithm(bgsegm::createBackgroundSubtractorGSOC()), 0.9); EXPECT_GE(evaluateBGSAlgorithm(bgsegm::createBackgroundSubtractorLSBP()), 0.25); } + +}} // namespace diff --git a/modules/bgsegm/test/test_main.cpp b/modules/bgsegm/test/test_main.cpp index 6b2499344..0e51ddfd0 100644 --- a/modules/bgsegm/test/test_main.cpp +++ b/modules/bgsegm/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("cv") diff --git a/modules/bgsegm/test/test_precomp.hpp b/modules/bgsegm/test/test_precomp.hpp index 27839c07c..854d832fb 100644 --- a/modules/bgsegm/test/test_precomp.hpp +++ b/modules/bgsegm/test/test_precomp.hpp @@ -1,18 +1,16 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ -#include #include "opencv2/ts.hpp" #include "opencv2/imgproc.hpp" -#include "opencv2/bgsegm.hpp" #include "opencv2/imgcodecs.hpp" +#include "opencv2/bgsegm.hpp" + +namespace opencv_test { +using namespace cv::bgsegm; +} #endif diff --git a/modules/bioinspired/perf/opencl/perf_retina.ocl.cpp b/modules/bioinspired/perf/opencl/perf_retina.ocl.cpp index 881041cee..14326516c 100644 --- a/modules/bioinspired/perf/opencl/perf_retina.ocl.cpp +++ b/modules/bioinspired/perf/opencl/perf_retina.ocl.cpp @@ -1,12 +1,10 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "../perf_precomp.hpp" #include "opencv2/ts/ocl_perf.hpp" -using namespace std::tr1; -using namespace cv; -using namespace perf; - -namespace cvtest { -namespace ocl { +namespace opencv_test { namespace { ///////////////////////// Retina //////////////////////// @@ -44,4 +42,4 @@ OCL_PERF_TEST_P(RetinaFixture, Retina, SANITY_CHECK_NOTHING(); } -} } // namespace cvtest::ocl +}} // namespace diff --git a/modules/bioinspired/perf/perf_precomp.hpp b/modules/bioinspired/perf/perf_precomp.hpp index b2de4201d..1567521dc 100644 --- a/modules/bioinspired/perf/perf_precomp.hpp +++ b/modules/bioinspired/perf/perf_precomp.hpp @@ -1,11 +1,6 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ @@ -14,4 +9,6 @@ #include "opencv2/ts/ts_perf.hpp" #include "opencv2/bioinspired.hpp" +using namespace perf; + #endif diff --git a/modules/bioinspired/test/test_main.cpp b/modules/bioinspired/test/test_main.cpp index 6b2499344..0e51ddfd0 100644 --- a/modules/bioinspired/test/test_main.cpp +++ b/modules/bioinspired/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("cv") diff --git a/modules/bioinspired/test/test_precomp.hpp b/modules/bioinspired/test/test_precomp.hpp index b1672149a..b9d205b84 100644 --- a/modules/bioinspired/test/test_precomp.hpp +++ b/modules/bioinspired/test/test_precomp.hpp @@ -1,16 +1,10 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ #include "opencv2/ts.hpp" #include "opencv2/bioinspired.hpp" -#include #endif diff --git a/modules/bioinspired/test/test_retina_ocl.cpp b/modules/bioinspired/test/test_retina_ocl.cpp index f38896e7d..bcfc6cc19 100644 --- a/modules/bioinspired/test/test_retina_ocl.cpp +++ b/modules/bioinspired/test/test_retina_ocl.cpp @@ -48,8 +48,7 @@ #define RETINA_ITERATIONS 5 -namespace cvtest { -namespace ocl { +namespace opencv_test { namespace { PARAM_TEST_CASE(Retina_OCL, bool, int, bool, double, double) { @@ -113,4 +112,4 @@ OCL_INSTANTIATE_TEST_CASE_P(Contrib, Retina_OCL, testing::Combine( testing::Values(1.0, 0.5), testing::Values(10.0, 5.0))); -} } // namespace cvtest::ocl +}} // namespace diff --git a/modules/cnn_3dobj/test/test_cnn_3dobj_feature_extract.cpp b/modules/cnn_3dobj/test/test_cnn_3dobj_feature_extract.cpp index b43f6f26e..10ade647c 100755 --- a/modules/cnn_3dobj/test/test_cnn_3dobj_feature_extract.cpp +++ b/modules/cnn_3dobj/test/test_cnn_3dobj_feature_extract.cpp @@ -1,11 +1,11 @@ -/* - * Created on: Aug 14, 2015 - * Author: Yida Wang - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. +// +// Author: Yida Wang #include "test_precomp.hpp" -using namespace cv; +namespace opencv_test { namespace { using namespace cv::cnn_3dobj; class CV_CNN_Feature_Test : public cvtest::BaseTest @@ -62,3 +62,5 @@ void CV_CNN_Feature_Test::run(int) } TEST(CNN_FEATURE, accuracy) { CV_CNN_Feature_Test test; test.safe_run(); } + +}} // namespace diff --git a/modules/cnn_3dobj/test/test_main.cpp b/modules/cnn_3dobj/test/test_main.cpp index 6b2499344..0e51ddfd0 100755 --- a/modules/cnn_3dobj/test/test_main.cpp +++ b/modules/cnn_3dobj/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("cv") diff --git a/modules/cnn_3dobj/test/test_precomp.hpp b/modules/cnn_3dobj/test/test_precomp.hpp index ebb7d40da..4da726251 100755 --- a/modules/cnn_3dobj/test/test_precomp.hpp +++ b/modules/cnn_3dobj/test/test_precomp.hpp @@ -1,11 +1,6 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ diff --git a/modules/cvv/test/test_debug_flag.cpp b/modules/cvv/test/test_debug_flag.cpp index 5d6bb25aa..ffd9fa74d 100644 --- a/modules/cvv/test/test_debug_flag.cpp +++ b/modules/cvv/test/test_debug_flag.cpp @@ -1,5 +1,10 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" +namespace opencv_test { namespace { + /** * Tests whether cvv::debugMode() and cvv::setDebugFlag(bool)` * (from /include/opencv2/debug_mode.hpp) behave correctly. @@ -13,3 +18,5 @@ TEST(DebugFlagTest, SetAndUnsetDebugMode) cvv::setDebugFlag(true); EXPECT_EQ(cvv::debugMode(), true); } + +}} // namespace diff --git a/modules/cvv/test/test_is_any_of.cpp b/modules/cvv/test/test_is_any_of.cpp index f5fc1d65c..1a5718cf3 100644 --- a/modules/cvv/test/test_is_any_of.cpp +++ b/modules/cvv/test/test_is_any_of.cpp @@ -1,7 +1,12 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" #include "../src/util/util.hpp" +namespace opencv_test { namespace { + /** * Tests whether the `cvv::util::isAnyOf()` function (from /src/util/util.hpp) correctly recognises * the first parameter as element or not element of the data structure in the second parameter @@ -37,3 +42,5 @@ TEST(IsAnyOfTest, VectorLongInt) EXPECT_EQ(isAnyOf(3, std::vector{ 1, 2, 3, 4 }), true); EXPECT_EQ(isAnyOf(3, std::vector{ 1, 2, 4 }), false); } + +}} // namespace diff --git a/modules/cvv/test/test_location.cpp b/modules/cvv/test/test_location.cpp index db9f86503..d2a261d28 100644 --- a/modules/cvv/test/test_location.cpp +++ b/modules/cvv/test/test_location.cpp @@ -1,5 +1,10 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" +namespace opencv_test { namespace { + /** * Tests whether the `CVVISUAL_LOCATION` macro (from /include/opencv2/call_meta_data.hpp) * works as expected, i.e. the instance of `cvv::impl::CallMetaData` as which it gets defined has the correct data. @@ -24,3 +29,5 @@ TEST(LocationTest, EmptyLocation) cvv::impl::CallMetaData loc{}; EXPECT_EQ(loc.isKnown, false); } + +}} // namespace diff --git a/modules/cvv/test/test_main.cpp b/modules/cvv/test/test_main.cpp index 6118d1768..c772a97c5 100644 --- a/modules/cvv/test/test_main.cpp +++ b/modules/cvv/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN(".", /*Empty VA_ARGS for C++11*/) diff --git a/modules/cvv/test/test_observer_ptr.cpp b/modules/cvv/test/test_observer_ptr.cpp index 7284cef82..030d7139a 100644 --- a/modules/cvv/test/test_observer_ptr.cpp +++ b/modules/cvv/test/test_observer_ptr.cpp @@ -1,7 +1,12 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" #include "../src/util/observer_ptr.hpp" +namespace opencv_test { namespace { + /** * Verifies that assigning `nullptr` and a nonzero value to a `cvv::util::ObserverPtr` * (from /src/util/observer_ptr.hpp) work and that `isNull()` and `getPtr()` return the correct result. @@ -18,3 +23,5 @@ TEST(ObserverPtrTest, ConstructionAssignment) EXPECT_FALSE(ptr.isNull()); EXPECT_EQ(&x, ptr.getPtr()); } + +}} // namespace \ No newline at end of file diff --git a/modules/cvv/test/test_precomp.hpp b/modules/cvv/test/test_precomp.hpp index ec8333687..1ff0ce99b 100644 --- a/modules/cvv/test/test_precomp.hpp +++ b/modules/cvv/test/test_precomp.hpp @@ -1,11 +1,6 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ diff --git a/modules/cvv/test/test_reference.cpp b/modules/cvv/test/test_reference.cpp index 264c051db..94666c166 100644 --- a/modules/cvv/test/test_reference.cpp +++ b/modules/cvv/test/test_reference.cpp @@ -2,6 +2,8 @@ #include "../src/util/util.hpp" +namespace opencv_test { namespace { + /** * Makes sure that * - creating, reassigning and comparing `cvv::util::Reference`s (from /src/util/util.hpp) works, @@ -103,3 +105,5 @@ TEST(ReferenceTest, castTo) // should result in a compiler-error: // EXPECT_THROW(baseRef.castTo>(), std::bad_cast); } + +}} // namespace diff --git a/modules/face/test/test_bif.cpp b/modules/face/test/test_bif.cpp index 6228b550f..f337502d8 100644 --- a/modules/face/test/test_bif.cpp +++ b/modules/face/test/test_bif.cpp @@ -38,6 +38,8 @@ the use of this software, even if advised of the possibility of such damage. #include "test_precomp.hpp" +namespace opencv_test { namespace { + TEST(CV_Face_BIF, can_create_default) { cv::Ptr bif; EXPECT_NO_THROW(bif = cv::face::BIF::create()); @@ -65,3 +67,5 @@ TEST(CV_Face_BIF, can_compute) { EXPECT_NO_THROW(bif->compute(image, fea)); EXPECT_EQ(cv::Size(1, 13188), fea.size()); } + +}} // namespace diff --git a/modules/face/test/test_face_align.cpp b/modules/face/test/test_face_align.cpp index cf46be41a..85419e344 100644 --- a/modules/face/test/test_face_align.cpp +++ b/modules/face/test/test_face_align.cpp @@ -1,15 +1,9 @@ // This file is part of OpenCV project. // It is subject to the license terms in the LICENSE file found in the top-level directory // of this distribution and at http://opencv.org/license.html. - #include "test_precomp.hpp" -#include "opencv2/imgcodecs.hpp" -#include "opencv2/face.hpp" -#include "opencv2/objdetect.hpp" -#include -#include -using namespace std; -using namespace cv; + +namespace opencv_test { namespace { using namespace cv::face; static bool myDetector( InputArray image, OutputArray ROIs, CascadeClassifier* face_cascade) @@ -95,3 +89,5 @@ TEST(CV_Face_FacemarkKazemi, can_detect_landmarks) { EXPECT_NO_THROW(facemark->fit(img,faces,shapes)); shapes.clear(); } + +}} // namespace diff --git a/modules/face/test/test_facemark.cpp b/modules/face/test/test_facemark.cpp index d91470663..b32050955 100644 --- a/modules/face/test/test_facemark.cpp +++ b/modules/face/test/test_facemark.cpp @@ -35,13 +35,8 @@ Mentor: Delia Passalacqua */ #include "test_precomp.hpp" -#include "opencv2/imgcodecs.hpp" -#include "opencv2/face.hpp" -#include -#include -using namespace std; -using namespace cv; -using namespace cv::face; + +namespace opencv_test { namespace { TEST(CV_Face_Facemark, test_utilities) { string image_file = cvtest::findDataFile("face/david1.jpg", true); @@ -59,3 +54,5 @@ TEST(CV_Face_Facemark, test_utilities) { std::vector faces; EXPECT_TRUE(getFaces(img, faces, ¶ms)); } + +}} // namespace diff --git a/modules/face/test/test_facemark_aam.cpp b/modules/face/test/test_facemark_aam.cpp index 08851c44e..79cb399d7 100644 --- a/modules/face/test/test_facemark_aam.cpp +++ b/modules/face/test/test_facemark_aam.cpp @@ -42,13 +42,8 @@ Mentor: Delia Passalacqua */ #include "test_precomp.hpp" -#include "opencv2/imgcodecs.hpp" -#include "opencv2/face.hpp" -#include -#include -using namespace std; -using namespace cv; -using namespace cv::face; + +namespace opencv_test { namespace { static bool customDetector( InputArray image, OutputArray ROIs, CascadeClassifier *face_detector){ Mat gray; @@ -142,3 +137,5 @@ TEST(CV_Face_FacemarkAAM, test_workflow) { EXPECT_TRUE(facemark->getData(&data)); EXPECT_TRUE(data.s0.size()>0); } + +}} // namespace diff --git a/modules/face/test/test_facemark_lbf.cpp b/modules/face/test/test_facemark_lbf.cpp index 9009ee6d6..fde5a52ea 100644 --- a/modules/face/test/test_facemark_lbf.cpp +++ b/modules/face/test/test_facemark_lbf.cpp @@ -42,13 +42,8 @@ Mentor: Delia Passalacqua */ #include "test_precomp.hpp" -#include "opencv2/imgcodecs.hpp" -#include "opencv2/face.hpp" -#include -#include -using namespace std; -using namespace cv; -using namespace cv::face; + +namespace opencv_test { namespace { CascadeClassifier cascade_detector; static bool myCustomDetector( InputArray image, OutputArray ROIs, void * config = 0 ){ @@ -141,3 +136,5 @@ TEST(CV_Face_FacemarkLBF, test_workflow) { EXPECT_TRUE(facemark->fit(image, rects, facial_points)); EXPECT_TRUE(facial_points[0].size()>0); } + +}} // namespace diff --git a/modules/face/test/test_loadsave.cpp b/modules/face/test/test_loadsave.cpp index 3ec0d2873..031a538c6 100644 --- a/modules/face/test/test_loadsave.cpp +++ b/modules/face/test/test_loadsave.cpp @@ -38,6 +38,8 @@ the use of this software, even if advised of the possibility of such damage. #include "test_precomp.hpp" +namespace opencv_test { namespace { + // regression for #1267 // let's make sure, that both Algorithm::save(String) and // FaceRecognizer::write(String) lead to the same result @@ -78,3 +80,5 @@ TEST(CV_Face_SAVELOAD, use_write) { EXPECT_EQ(model2->empty(), false); EXPECT_EQ(p1, model2->predict(images[2])); } + +}} // namespace diff --git a/modules/face/test/test_precomp.hpp b/modules/face/test/test_precomp.hpp index 7fba99d7a..0efa7c445 100644 --- a/modules/face/test/test_precomp.hpp +++ b/modules/face/test/test_precomp.hpp @@ -1,56 +1,17 @@ -/* -By downloading, copying, installing or using the software you agree to this -license. If you do not agree to this license, do not download, install, -copy or use the software. - - License Agreement - For Open Source Computer Vision Library - (3-clause BSD License) - -Copyright (C) 2013, OpenCV Foundation, all rights reserved. -Third party copyrights are property of their respective owners. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the names of the copyright holders nor the names of the contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -This software is provided by the copyright holders and contributors "as is" and -any express or implied warranties, including, but not limited to, the implied -warranties of merchantability and fitness for a particular purpose are -disclaimed. In no event shall copyright holders or contributors be liable for -any direct, indirect, incidental, special, exemplary, or consequential damages -(including, but not limited to, procurement of substitute goods or services; -loss of use, data, or profits; or business interruption) however caused -and on any theory of liability, whether in contract, strict liability, -or tort (including negligence or otherwise) arising in any way out of -the use of this software, even if advised of the possibility of such damage. -*/ - -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ -#include #include "opencv2/ts.hpp" #include "opencv2/imgproc.hpp" +#include "opencv2/objdetect.hpp" #include "opencv2/face.hpp" #include "opencv2/face/bif.hpp" +namespace opencv_test { +using namespace cv::face; +} + #endif diff --git a/modules/fuzzy/test/test_f0.cpp b/modules/fuzzy/test/test_f0.cpp index c4ab36bbc..3949aab2b 100644 --- a/modules/fuzzy/test/test_f0.cpp +++ b/modules/fuzzy/test/test_f0.cpp @@ -41,10 +41,7 @@ #include "test_precomp.hpp" -#include - -using namespace std; -using namespace cv; +namespace opencv_test { namespace { TEST(fuzzy_f0, components) { @@ -231,4 +228,6 @@ TEST(fuzzy_f0, FL_process_float) double n1 = cvtest::norm(exp6, res6, NORM_INF); EXPECT_LE(n1, 1); -} \ No newline at end of file +} + +}} // namespace diff --git a/modules/fuzzy/test/test_f1.cpp b/modules/fuzzy/test/test_f1.cpp index cc85dab92..3d1b64613 100644 --- a/modules/fuzzy/test/test_f1.cpp +++ b/modules/fuzzy/test/test_f1.cpp @@ -41,10 +41,7 @@ #include "test_precomp.hpp" -#include - -using namespace std; -using namespace cv; +namespace opencv_test { namespace { TEST(fuzzy_f1, elements) { @@ -397,3 +394,5 @@ TEST(fuzzy_f1, inversion) EXPECT_DOUBLE_EQ(n1, 0); } + +}} // namespace diff --git a/modules/fuzzy/test/test_image.cpp b/modules/fuzzy/test/test_image.cpp index cf393e83a..67b0f749a 100644 --- a/modules/fuzzy/test/test_image.cpp +++ b/modules/fuzzy/test/test_image.cpp @@ -41,10 +41,7 @@ #include "test_precomp.hpp" -#include - -using namespace std; -using namespace cv; +namespace opencv_test { namespace { TEST(fuzzy_image, inpainting) { @@ -111,4 +108,6 @@ TEST(fuzzy_image, kernel) double diff = cvtest::norm(kernel1, kernel2, NORM_INF); EXPECT_DOUBLE_EQ(diff, 0); -} \ No newline at end of file +} + +}} // namespace diff --git a/modules/fuzzy/test/test_main.cpp b/modules/fuzzy/test/test_main.cpp index 6b2499344..0e51ddfd0 100644 --- a/modules/fuzzy/test/test_main.cpp +++ b/modules/fuzzy/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("cv") diff --git a/modules/fuzzy/test/test_precomp.hpp b/modules/fuzzy/test/test_precomp.hpp index 8300b9792..0adccdd4a 100644 --- a/modules/fuzzy/test/test_precomp.hpp +++ b/modules/fuzzy/test/test_precomp.hpp @@ -1,11 +1,6 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ diff --git a/modules/hdf/test/test_hdf5.cpp b/modules/hdf/test/test_hdf5.cpp index cfb0bd661..a7610f72c 100644 --- a/modules/hdf/test/test_hdf5.cpp +++ b/modules/hdf/test/test_hdf5.cpp @@ -6,14 +6,10 @@ * @file test_hdf5.cpp * @author Fangjun Kuang * @date December 2017 - * */ -#include // for remove() - #include "test_precomp.hpp" -#include -using namespace cv; +namespace opencv_test { namespace { struct HDF5_Test : public testing::Test { @@ -150,14 +146,14 @@ TEST_F(HDF5_Test, write_read_dataset_1) m_hdf_io->dsread(single, dataset_single_channel); EXPECT_EQ(single.type(), m_single_channel.type()); EXPECT_EQ(single.size(), m_single_channel.size()); - EXPECT_NEAR(norm(single-m_single_channel), 0, 1e-10); + EXPECT_LE(cvtest::norm(single, m_single_channel, NORM_L2), 1e-10); // read dual channel matrix Mat dual; m_hdf_io->dsread(dual, dataset_two_channels); EXPECT_EQ(dual.type(), m_two_channels.type()); EXPECT_EQ(dual.size(), m_two_channels.size()); - EXPECT_NEAR(norm(dual-m_two_channels), 0, 1e-10); + EXPECT_LE(cvtest::norm(dual, m_two_channels, NORM_L2), 1e-10); m_hdf_io->close(); } @@ -202,14 +198,14 @@ TEST_F(HDF5_Test, write_read_dataset_2) m_hdf_io->dsread(single, dataset_single_channel); EXPECT_EQ(single.type(), m_single_channel.type()); EXPECT_EQ(single.size(), m_single_channel.size()); - EXPECT_NEAR(norm(single-m_single_channel), 0, 1e-10); + EXPECT_LE(cvtest::norm(single, m_single_channel, NORM_L2), 1e-10); // read dual channel matrix Mat dual; m_hdf_io->dsread(dual, dataset_two_channels); EXPECT_EQ(dual.type(), m_two_channels.type()); EXPECT_EQ(dual.size(), m_two_channels.size()); - EXPECT_NEAR(norm(dual-m_two_channels), 0, 1e-10); + EXPECT_LE(cvtest::norm(dual, m_two_channels, NORM_L2), 1e-10); m_hdf_io->close(); } @@ -347,8 +343,8 @@ TEST_F(HDF5_Test, test_attribute_InutArray_OutputArray_2d) m_hdf_io->atwrite(attr_value, attr_name); m_hdf_io->atread(expected_attr_value, attr_name); - double diff = norm(attr_value - expected_attr_value); - EXPECT_NEAR(diff, 0, 1e-6); + double diff = cvtest::norm(attr_value, expected_attr_value, NORM_L2); + EXPECT_LE(diff, 1e-6); EXPECT_EQ(attr_value.size, expected_attr_value.size); EXPECT_EQ(attr_value.type(), expected_attr_value.type()); @@ -356,3 +352,5 @@ TEST_F(HDF5_Test, test_attribute_InutArray_OutputArray_2d) m_hdf_io->close(); } + +}} // namespace diff --git a/modules/hdf/test/test_precomp.hpp b/modules/hdf/test/test_precomp.hpp index fd337f200..c1f6d49b5 100644 --- a/modules/hdf/test/test_precomp.hpp +++ b/modules/hdf/test/test_precomp.hpp @@ -1,15 +1,6 @@ // This file is part of OpenCV project. // It is subject to the license terms in the LICENSE file found in the top-level directory // of this distribution and at http://opencv.org/license.html. - -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ diff --git a/modules/img_hash/test/test_average_hash.cpp b/modules/img_hash/test/test_average_hash.cpp index 146dfb9fd..8c86f9514 100644 --- a/modules/img_hash/test/test_average_hash.cpp +++ b/modules/img_hash/test/test_average_hash.cpp @@ -6,7 +6,7 @@ #include -using namespace cv; +namespace opencv_test { namespace { class CV_AverageHashTest : public cvtest::BaseTest { @@ -56,3 +56,5 @@ void CV_AverageHashTest::run(int ) } TEST(average_hash_test, accuracy) { CV_AverageHashTest test; test.safe_run(); } + +}} // namespace diff --git a/modules/img_hash/test/test_block_mean_hash.cpp b/modules/img_hash/test/test_block_mean_hash.cpp index c23872a82..43009ccef 100644 --- a/modules/img_hash/test/test_block_mean_hash.cpp +++ b/modules/img_hash/test/test_block_mean_hash.cpp @@ -6,7 +6,7 @@ #include -using namespace cv; +namespace opencv_test { namespace { using namespace cv::img_hash; /** @@ -210,3 +210,5 @@ void CV_BlockMeanHashTest::run(int) } TEST(block_mean_hash_test, accuracy) { CV_BlockMeanHashTest test; test.safe_run(); } + +}} // namespace diff --git a/modules/img_hash/test/test_marr_hildreth_hash.cpp b/modules/img_hash/test/test_marr_hildreth_hash.cpp index f20e795d7..74f29d1fa 100644 --- a/modules/img_hash/test/test_marr_hildreth_hash.cpp +++ b/modules/img_hash/test/test_marr_hildreth_hash.cpp @@ -4,7 +4,7 @@ #include "test_precomp.hpp" -using namespace cv; +namespace opencv_test { namespace { class CV_MarrHildrethTest : public cvtest::BaseTest { @@ -58,3 +58,5 @@ void CV_MarrHildrethTest::run(int ) } TEST(marr_hildreth_test, accuracy) { CV_MarrHildrethTest test; test.safe_run(); } + +}} // namespace diff --git a/modules/img_hash/test/test_phash.cpp b/modules/img_hash/test/test_phash.cpp index 43ed96228..bbb72ea74 100644 --- a/modules/img_hash/test/test_phash.cpp +++ b/modules/img_hash/test/test_phash.cpp @@ -6,7 +6,7 @@ #include -using namespace cv; +namespace opencv_test { namespace { class CV_PHashTest : public cvtest::BaseTest { @@ -56,3 +56,5 @@ void CV_PHashTest::run(int ) } TEST(average_phash_test, accuracy) { CV_PHashTest test; test.safe_run(); } + +}} // namespace diff --git a/modules/img_hash/test/test_precomp.hpp b/modules/img_hash/test/test_precomp.hpp index c4ea21785..acf519ce2 100644 --- a/modules/img_hash/test/test_precomp.hpp +++ b/modules/img_hash/test/test_precomp.hpp @@ -1,20 +1,10 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ -#include #include "opencv2/ts.hpp" #include "opencv2/img_hash.hpp" -#include "opencv2/imgproc.hpp" -#include "opencv2/core/cvdef.h" -#include "opencv2/core.hpp" -#include "opencv2/highgui.hpp" #endif diff --git a/modules/img_hash/test/test_radial_variance_hash.cpp b/modules/img_hash/test/test_radial_variance_hash.cpp index d4b5d7b1e..082322d3d 100644 --- a/modules/img_hash/test/test_radial_variance_hash.cpp +++ b/modules/img_hash/test/test_radial_variance_hash.cpp @@ -4,7 +4,7 @@ #include "test_precomp.hpp" -using namespace cv; +namespace opencv_test { namespace { using namespace cv::img_hash; @@ -24,7 +24,7 @@ protected: //the function "ph_feature_vector" to avoid NaN value void testComputeHash(); void testFeatures(); - void testHash(); + //void testHash(); // TODO unused void testPixPerLine(); void testProjection(); @@ -76,6 +76,7 @@ void CV_RadialVarianceHashTest::testFeatures() } } +#if 0 // unused void CV_RadialVarianceHashTest::testHash() { cv::Mat const hash = rvh->getHash(); @@ -95,6 +96,7 @@ void CV_RadialVarianceHashTest::testHash() EXPECT_EQ(hash.at(0, i), expectResult[i]); } } +#endif void CV_RadialVarianceHashTest::testPixPerLine() { @@ -148,3 +150,5 @@ void CV_RadialVarianceHashTest::run(int) } TEST(radial_variance_hash_test, accuracy) { CV_RadialVarianceHashTest test; test.safe_run(); } + +}} // namespace diff --git a/modules/line_descriptor/perf/perf_descriptors.cpp b/modules/line_descriptor/perf/perf_descriptors.cpp index 0b50e84a9..3b911d37a 100644 --- a/modules/line_descriptor/perf/perf_descriptors.cpp +++ b/modules/line_descriptor/perf/perf_descriptors.cpp @@ -41,12 +41,7 @@ #include "perf_precomp.hpp" -using namespace cv; -using namespace cv::line_descriptor; -using namespace std; -using namespace perf; -using std::tr1::make_tuple; -using std::tr1::get; +namespace opencv_test { namespace { typedef perf::TestBaseWithParam file_str; @@ -75,3 +70,5 @@ PERF_TEST_P(file_str, descriptors, testing::Values(IMAGES)) SANITY_CHECK_NOTHING(); } + +}} // namespace diff --git a/modules/line_descriptor/perf/perf_detection.cpp b/modules/line_descriptor/perf/perf_detection.cpp index b3e005305..6221cf32f 100644 --- a/modules/line_descriptor/perf/perf_detection.cpp +++ b/modules/line_descriptor/perf/perf_detection.cpp @@ -41,12 +41,7 @@ #include "perf_precomp.hpp" -using namespace cv; -using namespace cv::line_descriptor; -using namespace std; -using namespace perf; -using std::tr1::make_tuple; -using std::tr1::get; +namespace opencv_test { namespace { typedef perf::TestBaseWithParam file_str; @@ -136,3 +131,5 @@ PERF_TEST_P(file_str, detect_lsd, testing::Values(IMAGES)) SANITY_CHECK_NOTHING(); } + +}} // namespace diff --git a/modules/line_descriptor/perf/perf_matching.cpp b/modules/line_descriptor/perf/perf_matching.cpp index 1f5a7c0bc..dd88b1ef1 100644 --- a/modules/line_descriptor/perf/perf_matching.cpp +++ b/modules/line_descriptor/perf/perf_matching.cpp @@ -41,12 +41,7 @@ #include "perf_precomp.hpp" -using namespace cv; -using namespace cv::line_descriptor; -using namespace std; -using namespace perf; -using std::tr1::make_tuple; -using std::tr1::get; +namespace opencv_test { namespace { #define QUERY_DES_COUNT 300 #define DIM 32 @@ -185,3 +180,5 @@ PERF_TEST(radius_match, radius_match_distances_test) } + +}} // namespace diff --git a/modules/line_descriptor/perf/perf_precomp.hpp b/modules/line_descriptor/perf/perf_precomp.hpp index 445b70b58..f15f5fd23 100644 --- a/modules/line_descriptor/perf/perf_precomp.hpp +++ b/modules/line_descriptor/perf/perf_precomp.hpp @@ -38,16 +38,6 @@ // the use of this software, even if advised of the possibility of such damage. // //M*/ - - -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - #ifndef __OPENCV_PERF_PRECOMP_HPP__ #define __OPENCV_PERF_PRECOMP_HPP__ @@ -55,8 +45,8 @@ #include "opencv2/highgui.hpp" #include "opencv2/line_descriptor.hpp" -#ifdef GTEST_CREATE_SHARED_LIBRARY -#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined -#endif +namespace opencv_test { +using namespace cv::line_descriptor; +} #endif diff --git a/modules/line_descriptor/test/test_descriptors_regression.cpp b/modules/line_descriptor/test/test_descriptors_regression.cpp index 1fd378762..2e5ef4d82 100644 --- a/modules/line_descriptor/test/test_descriptors_regression.cpp +++ b/modules/line_descriptor/test/test_descriptors_regression.cpp @@ -41,8 +41,7 @@ #include "test_precomp.hpp" -using namespace cv; -using namespace cv::line_descriptor; +namespace opencv_test { namespace { /****************************************************************************************\ * Regression tests for line detector comparing keylines. * @@ -387,3 +386,5 @@ TEST( BinaryDescriptor, no_lines_found ) binDescriptor->detect(Image, keyLines); ASSERT_EQ(keyLines.size(), 0u); } + +}} // namespace diff --git a/modules/line_descriptor/test/test_detector_regression.cpp b/modules/line_descriptor/test/test_detector_regression.cpp index 3a98dd8ce..4ebda9a6e 100644 --- a/modules/line_descriptor/test/test_detector_regression.cpp +++ b/modules/line_descriptor/test/test_detector_regression.cpp @@ -41,8 +41,7 @@ #include "test_precomp.hpp" -using namespace cv; -using namespace cv::line_descriptor; +namespace opencv_test { namespace { /****************************************************************************************\ * Regression tests for line detector comparing keylines. * @@ -195,7 +194,7 @@ bool CV_BinaryDescriptorDetectorTest::isSimilarKeylines( const KeyLine& k1, cons const float maxAngleDif = 2.f; const float maxResponseDif = 0.1f; - float dist = (float) norm( k1.pt - k2.pt ); + float dist = (float)cv::norm(k1.pt - k2.pt); return ( dist < maxPtDif && fabs( k1.size - k2.size ) < maxSizeDif && abs( k1.angle - k2.angle ) < maxAngleDif && abs( k1.response - k2.response ) < maxResponseDif && k1.octave == k2.octave && k1.class_id == k2.class_id ); } @@ -225,7 +224,7 @@ void CV_BinaryDescriptorDetectorTest::compareKeylineSets( const std::vector - -#include -#include +namespace opencv_test { +using namespace cv::line_descriptor; +} #endif diff --git a/modules/optflow/perf/opencl/perf_dis_optflow.cpp b/modules/optflow/perf/opencl/perf_dis_optflow.cpp index 703e5b6c6..f299d4c49 100644 --- a/modules/optflow/perf/opencl/perf_dis_optflow.cpp +++ b/modules/optflow/perf/opencl/perf_dis_optflow.cpp @@ -1,54 +1,13 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "../perf_precomp.hpp" #include "opencv2/ts/ocl_perf.hpp" -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::optflow; +namespace opencv_test { namespace { #ifdef HAVE_OPENCL -namespace cvtest { -namespace ocl { - void MakeArtificialExample(UMat &dst_frame1, UMat &dst_frame2); typedef tuple DISParams; @@ -108,6 +67,6 @@ void MakeArtificialExample(UMat &dst_frame1, UMat &dst_frame2) remap(dst_frame2, dst_frame2, displacement_field, Mat(), INTER_LINEAR, BORDER_REPLICATE); } -} } // namespace cvtest::ocl - #endif // HAVE_OPENCL + +}} // namespace diff --git a/modules/optflow/perf/perf_deepflow.cpp b/modules/optflow/perf/perf_deepflow.cpp index e52dcd731..763eeae9a 100644 --- a/modules/optflow/perf/perf_deepflow.cpp +++ b/modules/optflow/perf/perf_deepflow.cpp @@ -1,47 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::optflow; +namespace opencv_test { namespace { typedef tuple DFParams; typedef TestBaseWithParam DenseOpticalFlow_DeepFlow; @@ -67,3 +29,5 @@ PERF_TEST_P(DenseOpticalFlow_DeepFlow, perf, Values(szVGA, sz720p)) SANITY_CHECK_NOTHING(); } + +}} // namespace diff --git a/modules/optflow/perf/perf_disflow.cpp b/modules/optflow/perf/perf_disflow.cpp index a04990896..dbc5c4f95 100644 --- a/modules/optflow/perf/perf_disflow.cpp +++ b/modules/optflow/perf/perf_disflow.cpp @@ -1,47 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::optflow; +namespace opencv_test { namespace { void MakeArtificialExample(Mat &dst_frame1, Mat &dst_frame2); @@ -101,3 +63,5 @@ void MakeArtificialExample(Mat &dst_frame1, Mat &dst_frame2) remap(dst_frame2, dst_frame2, displacement_field, Mat(), INTER_LINEAR, BORDER_REPLICATE); } + +}} // namespace diff --git a/modules/optflow/perf/perf_main.cpp b/modules/optflow/perf/perf_main.cpp index 0fbf990c3..10b917e73 100644 --- a/modules/optflow/perf/perf_main.cpp +++ b/modules/optflow/perf/perf_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" CV_PERF_TEST_MAIN(optflow) diff --git a/modules/optflow/perf/perf_precomp.hpp b/modules/optflow/perf/perf_precomp.hpp index 79e2f05f5..6230a691a 100644 --- a/modules/optflow/perf/perf_precomp.hpp +++ b/modules/optflow/perf/perf_precomp.hpp @@ -1,17 +1,15 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_PERF_PRECOMP_HPP__ #define __OPENCV_PERF_PRECOMP_HPP__ #include "opencv2/ts.hpp" -#include "opencv2/imgproc.hpp" #include "opencv2/optflow.hpp" -#include "opencv2/highgui.hpp" + +namespace opencv_test { +using namespace perf; +using namespace cv::optflow; +} #endif diff --git a/modules/optflow/perf/perf_variational_refinement.cpp b/modules/optflow/perf/perf_variational_refinement.cpp index 613d698ec..2a30374bc 100644 --- a/modules/optflow/perf/perf_variational_refinement.cpp +++ b/modules/optflow/perf/perf_variational_refinement.cpp @@ -1,47 +1,9 @@ -/* -* By downloading, copying, installing or using the software you agree to this license. -* If you do not agree to this license, do not download, install, -* copy or use the software. -* -* -* License Agreement -* For Open Source Computer Vision Library -* (3 - clause BSD License) -* -* Redistribution and use in source and binary forms, with or without modification, -* are permitted provided that the following conditions are met : -* -* * Redistributions of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* * Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and / or other materials provided with the distribution. -* -* * Neither the names of the copyright holders nor the names of the contributors -* may be used to endorse or promote products derived from this software -* without specific prior written permission. -* -* This software is provided by the copyright holders and contributors "as is" and -* any express or implied warranties, including, but not limited to, the implied -* warranties of merchantability and fitness for a particular purpose are disclaimed. -* In no event shall copyright holders or contributors be liable for any direct, -* indirect, incidental, special, exemplary, or consequential damages -* (including, but not limited to, procurement of substitute goods or services; -* loss of use, data, or profits; or business interruption) however caused -* and on any theory of liability, whether in contract, strict liability, -* or tort(including negligence or otherwise) arising in any way out of -* the use of this software, even if advised of the possibility of such damage. -*/ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::optflow; +namespace opencv_test { namespace { typedef tuple VarRefParams; typedef TestBaseWithParam DenseOpticalFlow_VariationalRefinement; @@ -75,3 +37,5 @@ PERF_TEST_P(DenseOpticalFlow_VariationalRefinement, perf, Combine(Values(szQVGA, SANITY_CHECK_NOTHING(); } + +}} // namespace diff --git a/modules/optflow/test/ocl/test_dis.cpp b/modules/optflow/test/ocl/test_dis.cpp index 5c847cd11..57f2969e1 100644 --- a/modules/optflow/test/ocl/test_dis.cpp +++ b/modules/optflow/test/ocl/test_dis.cpp @@ -44,11 +44,7 @@ #ifdef HAVE_OPENCL -using namespace cv; -using namespace optflow; - -namespace cvtest { -namespace ocl { +namespace opencv_test { namespace { PARAM_TEST_CASE(OCL_DenseOpticalFlow_DIS, int) { @@ -75,7 +71,7 @@ OCL_TEST_P(OCL_DenseOpticalFlow_DIS, Mat) Ptr algo; // iterate over presets: - for (int i = 0; i < test_loop_times; i++) + for (int i = 0; i < cvtest::ocl::test_loop_times; i++) { Mat flow; UMat ocl_flow; @@ -95,6 +91,6 @@ OCL_INSTANTIATE_TEST_CASE_P(Contrib, OCL_DenseOpticalFlow_DIS, DISOpticalFlow::PRESET_FAST, DISOpticalFlow::PRESET_MEDIUM)); -} } // namespace cvtest::ocl +}} // namespace #endif // HAVE_OPENCL diff --git a/modules/optflow/test/ocl/test_motempl.cpp b/modules/optflow/test/ocl/test_motempl.cpp index 0c744fde6..a0c1a27b5 100644 --- a/modules/optflow/test/ocl/test_motempl.cpp +++ b/modules/optflow/test/ocl/test_motempl.cpp @@ -10,8 +10,7 @@ #ifdef HAVE_OPENCL -namespace cvtest { -namespace ocl { +namespace opencv_test { namespace { PARAM_TEST_CASE(UpdateMotionHistory, bool) { @@ -47,7 +46,7 @@ PARAM_TEST_CASE(UpdateMotionHistory, bool) OCL_TEST_P(UpdateMotionHistory, Mat) { - for (int j = 0; j < test_loop_times; j++) + for (int j = 0; j < cvtest::ocl::test_loop_times; j++) { generateTestData(); @@ -62,6 +61,6 @@ OCL_TEST_P(UpdateMotionHistory, Mat) OCL_INSTANTIATE_TEST_CASE_P(Video, UpdateMotionHistory, Values(false, true)); -} } // namespace cvtest::ocl +}} // namespace #endif // HAVE_OPENCL diff --git a/modules/optflow/test/test_OF_accuracy.cpp b/modules/optflow/test/test_OF_accuracy.cpp index c47ff90fc..bf83e5052 100644 --- a/modules/optflow/test/test_OF_accuracy.cpp +++ b/modules/optflow/test/test_OF_accuracy.cpp @@ -40,12 +40,8 @@ //M*/ #include "test_precomp.hpp" -#include -using namespace std; -using namespace cv; -using namespace cvtest; -using namespace optflow; +namespace opencv_test { namespace { static string getDataDir() { return TS::ptr()->get_data_path(); } @@ -283,3 +279,6 @@ TEST(DenseOpticalFlow_GlobalPatchColliderWHT, ReferenceAccuracy) ASSERT_LE(7000U, corr.size()); ASSERT_LE(calcAvgEPE(corr, GT), 0.5f); } + + +}} // namespace diff --git a/modules/optflow/test/test_OF_reproducibility.cpp b/modules/optflow/test/test_OF_reproducibility.cpp index 7b9905576..be4d92de5 100644 --- a/modules/optflow/test/test_OF_reproducibility.cpp +++ b/modules/optflow/test/test_OF_reproducibility.cpp @@ -40,15 +40,8 @@ //M*/ #include "test_precomp.hpp" -#include -using namespace std; -using namespace std::tr1; -using namespace cv; -using namespace cvtest; -using namespace perf; -using namespace testing; -using namespace optflow; +namespace opencv_test { namespace { typedef tuple OFParams; typedef TestWithParam DenseOpticalFlow_DIS; @@ -157,3 +150,5 @@ TEST_P(DenseOpticalFlow_VariationalRefinement, MultithreadReproducibility) } INSTANTIATE_TEST_CASE_P(FullSet, DenseOpticalFlow_VariationalRefinement, Values(szODD, szQVGA)); + +}} // namespace diff --git a/modules/optflow/test/test_main.cpp b/modules/optflow/test/test_main.cpp index 6b2499344..0e51ddfd0 100644 --- a/modules/optflow/test/test_main.cpp +++ b/modules/optflow/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("cv") diff --git a/modules/optflow/test/test_motiontemplates.cpp b/modules/optflow/test/test_motiontemplates.cpp index 739bc02e1..b31abbbd7 100644 --- a/modules/optflow/test/test_motiontemplates.cpp +++ b/modules/optflow/test/test_motiontemplates.cpp @@ -41,8 +41,7 @@ #include "test_precomp.hpp" -using namespace cv; -using namespace std; +namespace opencv_test { namespace { ///////////////////// base MHI class /////////////////////// class CV_MHIBaseTest : public cvtest::ArrayTest @@ -498,3 +497,5 @@ int CV_MHIGlobalOrientTest::validate_test_results( int test_case_idx ) TEST(Video_MHIUpdate, accuracy) { CV_UpdateMHITest test; test.safe_run(); } TEST(Video_MHIGradient, accuracy) { CV_MHIGradientTest test; test.safe_run(); } TEST(Video_MHIGlobalOrient, accuracy) { CV_MHIGlobalOrientTest test; test.safe_run(); } + +}} // namespace diff --git a/modules/optflow/test/test_precomp.hpp b/modules/optflow/test/test_precomp.hpp index b89ce8b82..49eafefd8 100644 --- a/modules/optflow/test/test_precomp.hpp +++ b/modules/optflow/test/test_precomp.hpp @@ -1,18 +1,15 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ -#include #include "opencv2/ts.hpp" -#include "opencv2/imgproc.hpp" #include "opencv2/optflow.hpp" -#include "opencv2/imgcodecs.hpp" + +namespace opencv_test { +using namespace cv::optflow; +using namespace perf; +} #endif diff --git a/modules/phase_unwrapping/test/test_main.cpp b/modules/phase_unwrapping/test/test_main.cpp index 74b896b3d..0a9cce2e4 100644 --- a/modules/phase_unwrapping/test/test_main.cpp +++ b/modules/phase_unwrapping/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("cv") \ No newline at end of file diff --git a/modules/phase_unwrapping/test/test_precomp.hpp b/modules/phase_unwrapping/test/test_precomp.hpp index 16f5ce1b7..4bffd94cb 100644 --- a/modules/phase_unwrapping/test/test_precomp.hpp +++ b/modules/phase_unwrapping/test/test_precomp.hpp @@ -1,16 +1,10 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ #include "opencv2/ts.hpp" #include "opencv2/phase_unwrapping.hpp" -#include #endif diff --git a/modules/phase_unwrapping/test/test_unwrapping.cpp b/modules/phase_unwrapping/test/test_unwrapping.cpp index a18a26fc3..82513bb9d 100644 --- a/modules/phase_unwrapping/test/test_unwrapping.cpp +++ b/modules/phase_unwrapping/test/test_unwrapping.cpp @@ -1,48 +1,9 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// - // - // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. - // - // By downloading, copying, installing or using the software you agree to this license. - // If you do not agree to this license, do not download, install, - // copy or use the software. - // - // - // License Agreement - // For Open Source Computer Vision Library - // - // Copyright (C) 2015, OpenCV Foundation, all rights reserved. - // Third party copyrights are property of their respective owners. - // - // Redistribution and use in source and binary forms, with or without modification, - // are permitted provided that the following conditions are met: - // - // * Redistribution's of source code must retain the above copyright notice, - // this list of conditions and the following disclaimer. - // - // * Redistribution's in binary form must reproduce the above copyright notice, - // this list of conditions and the following disclaimer in the documentation - // and/or other materials provided with the distribution. - // - // * The name of the copyright holders may not be used to endorse or promote products - // derived from this software without specific prior written permission. - // - // This software is provided by the copyright holders and contributors "as is" and - // any express or implied warranties, including, but not limited to, the implied - // warranties of merchantability and fitness for a particular purpose are disclaimed. - // In no event shall the Intel Corporation or contributors be liable for any direct, - // indirect, incidental, special, exemplary, or consequential damages - // (including, but not limited to, procurement of substitute goods or services; - // loss of use, data, or profits; or business interruption) however caused - // and on any theory of liability, whether in contract, strict liability, - // or tort (including negligence or otherwise) arising in any way out of - // the use of this software, even if advised of the possibility of such damage. - // - //M*/ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -using namespace std; -using namespace cv; +namespace opencv_test { namespace { class CV_Unwrapping : public cvtest::BaseTest { @@ -100,4 +61,6 @@ TEST( HistogramPhaseUnwrapping, unwrapPhaseMap ) { CV_Unwrapping test; test.safe_run(); -} \ No newline at end of file +} + +}} // namespace diff --git a/modules/reg/perf/perf_precomp.hpp b/modules/reg/perf/perf_precomp.hpp index 316702027..5f947ecc6 100644 --- a/modules/reg/perf/perf_precomp.hpp +++ b/modules/reg/perf/perf_precomp.hpp @@ -40,23 +40,23 @@ // the use of this software, even if advised of the possibility of such damage. // //M*/ - -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - #ifndef __OPENCV_PERF_PRECOMP_HPP__ #define __OPENCV_PERF_PRECOMP_HPP__ -#include "opencv2/core.hpp" #include "opencv2/ts.hpp" -#ifdef GTEST_CREATE_SHARED_LIBRARY -#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined -#endif +#include "opencv2/reg/mapaffine.hpp" +#include "opencv2/reg/mapshift.hpp" +#include "opencv2/reg/mapprojec.hpp" +#include "opencv2/reg/mappergradshift.hpp" +#include "opencv2/reg/mappergradeuclid.hpp" +#include "opencv2/reg/mappergradsimilar.hpp" +#include "opencv2/reg/mappergradaffine.hpp" +#include "opencv2/reg/mappergradproj.hpp" +#include "opencv2/reg/mapperpyramid.hpp" + +namespace opencv_test { +using namespace cv::reg; +} #endif diff --git a/modules/reg/perf/perf_reg.cpp b/modules/reg/perf/perf_reg.cpp index c0e2ce934..1ab29fea5 100644 --- a/modules/reg/perf/perf_reg.cpp +++ b/modules/reg/perf/perf_reg.cpp @@ -42,25 +42,10 @@ //M*/ #include "perf_precomp.hpp" -#include "opencv2/ts.hpp" - -#include "opencv2/reg/mapaffine.hpp" -#include "opencv2/reg/mapshift.hpp" -#include "opencv2/reg/mapprojec.hpp" -#include "opencv2/reg/mappergradshift.hpp" -#include "opencv2/reg/mappergradeuclid.hpp" -#include "opencv2/reg/mappergradsimilar.hpp" -#include "opencv2/reg/mappergradaffine.hpp" -#include "opencv2/reg/mappergradproj.hpp" -#include "opencv2/reg/mapperpyramid.hpp" - -using namespace std; -using namespace std::tr1; -using namespace testing; -using namespace perf; -using namespace cv; -using namespace cv::reg; +namespace opencv_test { namespace { + +using namespace perf; Vec perfShift(const Mat& img1) { @@ -274,3 +259,5 @@ PERF_TEST_P(Size_MatType, Registration_Projective, SANITY_CHECK_NOTHING(); } + +}} // namespace diff --git a/modules/reg/test/test_precomp.hpp b/modules/reg/test/test_precomp.hpp index fb96866bf..fddfb8c91 100644 --- a/modules/reg/test/test_precomp.hpp +++ b/modules/reg/test/test_precomp.hpp @@ -40,21 +40,23 @@ // the use of this software, even if advised of the possibility of such damage. // //M*/ - -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ -#include "opencv2/opencv_modules.hpp" -#include "opencv2/core.hpp" -#include "opencv2/imgproc.hpp" #include "opencv2/ts.hpp" +#include "opencv2/reg/mapaffine.hpp" +#include "opencv2/reg/mapshift.hpp" +#include "opencv2/reg/mapprojec.hpp" +#include "opencv2/reg/mappergradshift.hpp" +#include "opencv2/reg/mappergradeuclid.hpp" +#include "opencv2/reg/mappergradsimilar.hpp" +#include "opencv2/reg/mappergradaffine.hpp" +#include "opencv2/reg/mappergradproj.hpp" +#include "opencv2/reg/mapperpyramid.hpp" + +namespace opencv_test { +using namespace cv::reg; +} + #endif diff --git a/modules/reg/test/test_reg.cpp b/modules/reg/test/test_reg.cpp index cae7e7f23..6965ff908 100644 --- a/modules/reg/test/test_reg.cpp +++ b/modules/reg/test/test_reg.cpp @@ -42,22 +42,8 @@ //M*/ #include "test_precomp.hpp" -#include -#include - -#include "opencv2/reg/mapaffine.hpp" -#include "opencv2/reg/mapshift.hpp" -#include "opencv2/reg/mapprojec.hpp" -#include "opencv2/reg/mappergradshift.hpp" -#include "opencv2/reg/mappergradeuclid.hpp" -#include "opencv2/reg/mappergradsimilar.hpp" -#include "opencv2/reg/mappergradaffine.hpp" -#include "opencv2/reg/mappergradproj.hpp" -#include "opencv2/reg/mapperpyramid.hpp" - -using namespace std; -using namespace cv; -using namespace cv::reg; + +namespace opencv_test { namespace { #define REG_DEBUG_OUTPUT 0 @@ -100,7 +86,7 @@ void RegTest::testShift() // Check accuracy Ptr mapInv(mapShift->inverseMap()); mapTest.compose(mapInv); - double shNorm = norm(mapTest.getShift()); + double shNorm = cv::norm(mapTest.getShift()); EXPECT_LE(shNorm, 0.1); } @@ -134,9 +120,9 @@ void RegTest::testEuclidean() // Check accuracy Ptr mapInv(mapAff->inverseMap()); mapTest.compose(mapInv); - double shNorm = norm(mapTest.getShift()); + double shNorm = cv::norm(mapTest.getShift()); EXPECT_LE(shNorm, 0.1); - double linTrNorm = norm(mapTest.getLinTr()); + double linTrNorm = cv::norm(mapTest.getLinTr()); EXPECT_LE(linTrNorm, sqrt(2.) + 0.01); EXPECT_GE(linTrNorm, sqrt(2.) - 0.01); } @@ -173,9 +159,9 @@ void RegTest::testSimilarity() // Check accuracy Ptr mapInv(mapAff->inverseMap()); mapTest.compose(mapInv); - double shNorm = norm(mapTest.getShift()); + double shNorm = cv::norm(mapTest.getShift()); EXPECT_LE(shNorm, 0.1); - double linTrNorm = norm(mapTest.getLinTr()); + double linTrNorm = cv::norm(mapTest.getLinTr()); EXPECT_LE(linTrNorm, sqrt(2.) + 0.01); EXPECT_GE(linTrNorm, sqrt(2.) - 0.01); } @@ -208,9 +194,9 @@ void RegTest::testAffine() // Check accuracy Ptr mapInv(mapAff->inverseMap()); mapTest.compose(mapInv); - double shNorm = norm(mapTest.getShift()); + double shNorm = cv::norm(mapTest.getShift()); EXPECT_LE(shNorm, 0.1); - double linTrNorm = norm(mapTest.getLinTr()); + double linTrNorm = cv::norm(mapTest.getLinTr()); EXPECT_LE(linTrNorm, sqrt(2.) + 0.01); EXPECT_GE(linTrNorm, sqrt(2.) - 0.01); } @@ -242,7 +228,7 @@ void RegTest::testProjective() // Check accuracy Ptr mapInv(mapProj->inverseMap()); mapTest.compose(mapInv); - double projNorm = norm(mapTest.getProjTr()); + double projNorm = cv::norm(mapTest.getProjTr()); EXPECT_LE(projNorm, sqrt(3.) + 0.01); EXPECT_GE(projNorm, sqrt(3.) - 0.01); } @@ -298,3 +284,5 @@ TEST_F(RegTest, projective_dt64fc1) loadImage(CV_64FC1); testProjective(); } + +}} // namespace diff --git a/modules/rgbd/test/test_main.cpp b/modules/rgbd/test/test_main.cpp index 6b2499344..0e51ddfd0 100644 --- a/modules/rgbd/test/test_main.cpp +++ b/modules/rgbd/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("cv") diff --git a/modules/rgbd/test/test_normal.cpp b/modules/rgbd/test/test_normal.cpp index dd32be127..f2233553a 100644 --- a/modules/rgbd/test/test_normal.cpp +++ b/modules/rgbd/test/test_normal.cpp @@ -37,65 +37,25 @@ #include #include -namespace cv -{ -namespace rgbd -{ - -class TickMeter -{ -public: - TickMeter(); - void start(); - void stop(); - - int64 getTimeTicks() const; - double getTimeMicro() const; - double getTimeMilli() const; - double getTimeSec() const; - int64 getCounter() const; - - void reset(); -private: - int64 counter; - int64 sumTime; - int64 startTime; -}; +namespace opencv_test { namespace { -TickMeter::TickMeter() { reset(); } -int64 TickMeter::getTimeTicks() const { return sumTime; } -double TickMeter::getTimeSec() const { return (double)getTimeTicks()/getTickFrequency(); } -double TickMeter::getTimeMilli() const { return getTimeSec()*1e3; } -double TickMeter::getTimeMicro() const { return getTimeMilli()*1e3; } -int64 TickMeter::getCounter() const { return counter; } -void TickMeter::reset() {startTime = 0; sumTime = 0; counter = 0; } - -void TickMeter::start(){ startTime = getTickCount(); } -void TickMeter::stop() +#if 0 +Point3f +rayPlaneIntersection(Point2f uv, const Mat& centroid, const Mat& normal, const Mat_& Kinv) { - int64 time = getTickCount(); - if ( startTime == 0 ) - return; - - ++counter; - - sumTime += ( time - startTime ); - startTime = 0; + Matx33d dKinv(Kinv); + Vec3d dNormal(normal); + return rayPlaneIntersection(Vec3d(uv.x, uv.y, 1), centroid.dot(normal), dNormal, dKinv); } - -Point3f -rayPlaneIntersection(Point2f uv, const Mat& centroid, const Mat& normal, const Mat_& Kinv); +#endif -Vec3f -rayPlaneIntersection(const Vec3d& uv1, double centroid_dot_normal, const Vec3d& normal, - const Matx33d& Kinv); Vec3f rayPlaneIntersection(const Vec3d& uv1, double centroid_dot_normal, const Vec3d& normal, const Matx33d& Kinv) { Matx31d L = Kinv * uv1; //a ray passing through camera optical center //and uv. - L = L * (1.0 / norm(L)); + L = L * (1.0 / cv::norm(L)); double LdotNormal = L.dot(normal); double d; if (std::fabs(LdotNormal) > 1e-9) @@ -111,18 +71,9 @@ rayPlaneIntersection(const Vec3d& uv1, double centroid_dot_normal, const Vec3d& Vec3f xyz((float)(d * L(0)), (float)(d * L(1)), (float)(d * L(2))); return xyz; } - -Point3f -rayPlaneIntersection(Point2f uv, const Mat& centroid, const Mat& normal, const Mat_& Kinv) -{ - Matx33d dKinv(Kinv); - Vec3d dNormal(normal); - return rayPlaneIntersection(Vec3d(uv.x, uv.y, 1), centroid.dot(normal), dNormal, dKinv); -} - const int W = 640; const int H = 480; -int window_size = 5; +//int window_size = 5; float focal_length = 525; float cx = W / 2.f + 0.5f; float cy = H / 2.f + 0.5f; @@ -170,7 +121,7 @@ struct Plane n[0] = rng.uniform(-0.5, 0.5); n[1] = rng.uniform(-0.5, 0.5); n[2] = -0.3; //rng.uniform(-1.f, 0.5f); - n = n / norm(n); + n = n / cv::norm(n); set_d((float)rng.uniform(-2.0, 0.6)); } @@ -188,9 +139,6 @@ struct Plane } }; -void -gen_points_3d(std::vector& planes_out, Mat_ &plane_mask, Mat& points3d, Mat& normals, - int n_planes); void gen_points_3d(std::vector& planes_out, Mat_ &plane_mask, Mat& points3d, Mat& normals, int n_planes) @@ -391,8 +339,8 @@ protected: for (int x = 0; x < normals.cols; ++x) { Vec3f vec1 = normals(y, x), vec2 = ground_normals(y, x); - vec1 = vec1 / norm(vec1); - vec2 = vec2 / norm(vec2); + vec1 = vec1 / cv::norm(vec1); + vec2 = vec2 / cv::norm(vec2); float dot = vec1.dot(vec2); // Just for rounding errors @@ -508,19 +456,18 @@ protected: } }; -} -} - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TEST(Rgbd_Normals, compute) { - cv::rgbd::CV_RgbdNormalsTest test; + CV_RgbdNormalsTest test; test.safe_run(); } TEST(Rgbd_Plane, compute) { - cv::rgbd::CV_RgbdPlaneTest test; + CV_RgbdPlaneTest test; test.safe_run(); } + +}} // namespace diff --git a/modules/rgbd/test/test_odometry.cpp b/modules/rgbd/test/test_odometry.cpp index 8e110bc3b..62b654a1e 100644 --- a/modules/rgbd/test/test_odometry.cpp +++ b/modules/rgbd/test/test_odometry.cpp @@ -35,14 +35,7 @@ #include "test_precomp.hpp" -#include -#include -#include - -namespace cv -{ -namespace rgbd -{ +namespace opencv_test { namespace { #define SHOW_DEBUG_LOG 0 #define SHOW_DEBUG_IMAGES 0 @@ -254,7 +247,7 @@ void CV_OdometryTest::run(int) ts->printf(cvtest::TS::LOG, "Can not find Rt between the same frame"); ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT); } - double diff = norm(calcRt, Mat::eye(4,4,CV_64FC1)); + double diff = cv::norm(calcRt, Mat::eye(4,4,CV_64FC1)); if(diff > DBL_EPSILON) { ts->printf(cvtest::TS::LOG, "Incorrect transformation between the same frame (not the identity matrix), diff = %f", diff); @@ -298,10 +291,10 @@ void CV_OdometryTest::run(int) // compare rotation - double rdiffnorm = norm(rvec - calcRvec), - rnorm = norm(rvec); - double tdiffnorm = norm(tvec - calcTvec), - tnorm = norm(tvec); + double rdiffnorm = cv::norm(rvec - calcRvec), + rnorm = cv::norm(rvec); + double tdiffnorm = cv::norm(tvec - calcTvec), + tnorm = cv::norm(tvec); if(rdiffnorm < rnorm && tdiffnorm < tnorm) better_1time_count++; if(5. * rdiffnorm < rnorm && 5 * tdiffnorm < tnorm) @@ -333,23 +326,24 @@ void CV_OdometryTest::run(int) /****************************************************************************************\ * Tests registrations * \****************************************************************************************/ -} -} TEST(RGBD_Odometry_Rgbd, algorithmic) { - cv::rgbd::CV_OdometryTest test(cv::rgbd::Odometry::create("RgbdOdometry"), 0.99, 0.94); + CV_OdometryTest test(cv::rgbd::Odometry::create("RgbdOdometry"), 0.99, 0.94); test.safe_run(); } TEST(DISABLED_RGBD_Odometry_ICP, algorithmic) { - cv::rgbd::CV_OdometryTest test(cv::rgbd::Odometry::create("ICPOdometry"), 0.99, 0.99); + CV_OdometryTest test(cv::rgbd::Odometry::create("ICPOdometry"), 0.99, 0.99); test.safe_run(); } TEST(DISABLED_RGBD_Odometry_RgbdICP, algorithmic) { - cv::rgbd::CV_OdometryTest test(cv::rgbd::Odometry::create("RgbdICPOdometry"), 0.99, 0.99); + CV_OdometryTest test(cv::rgbd::Odometry::create("RgbdICPOdometry"), 0.99, 0.99); test.safe_run(); } + + +}} // namespace diff --git a/modules/rgbd/test/test_precomp.hpp b/modules/rgbd/test/test_precomp.hpp index ccf662065..1a6ea9015 100644 --- a/modules/rgbd/test/test_precomp.hpp +++ b/modules/rgbd/test/test_precomp.hpp @@ -1,8 +1,15 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ #include #include -#include +#include + +namespace opencv_test { +using namespace cv::rgbd; +} #endif diff --git a/modules/rgbd/test/test_registration.cpp b/modules/rgbd/test/test_registration.cpp index 6c12b79a4..f88998367 100644 --- a/modules/rgbd/test/test_registration.cpp +++ b/modules/rgbd/test/test_registration.cpp @@ -44,11 +44,7 @@ #include "test_precomp.hpp" - -namespace cv -{ -namespace rgbd -{ +namespace opencv_test { namespace { class CV_RgbdDepthRegistrationTest: public cvtest::BaseTest { @@ -149,12 +145,11 @@ private: }; - -} -} - TEST(Rgbd_DepthRegistration, compute) { - cv::rgbd::CV_RgbdDepthRegistrationTest test; + CV_RgbdDepthRegistrationTest test; test.safe_run(); } + + +}} // namespace diff --git a/modules/rgbd/test/test_utils.cpp b/modules/rgbd/test/test_utils.cpp index aaa7e61e3..19190e627 100644 --- a/modules/rgbd/test/test_utils.cpp +++ b/modules/rgbd/test/test_utils.cpp @@ -1,11 +1,9 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -#include - -namespace cv -{ -namespace rgbd -{ +namespace opencv_test { namespace { class CV_RgbdDepthTo3dTest: public cvtest::BaseTest { @@ -47,7 +45,7 @@ protected: float avg_diff = 0; for (int y = 0; y < rows; ++y) for (int x = 0; x < cols; ++x) - avg_diff += (float)norm(image_points.at(y,x) - Vec2f((float)x,(float)y)); + avg_diff += (float)cv::norm(image_points.at(y,x) - Vec2f((float)x,(float)y)); // Verify the function works ASSERT_LE(avg_diff/rows/cols, 1e-4) << "Average error for ground truth is: " << (avg_diff / rows / cols); @@ -59,11 +57,12 @@ protected: } }; -} -} TEST(Rgbd_DepthTo3d, compute) { - cv::rgbd::CV_RgbdDepthTo3dTest test; + CV_RgbdDepthTo3dTest test; test.safe_run(); } + + +}} // namespace \ No newline at end of file diff --git a/modules/sfm/test/test_common.cpp b/modules/sfm/test/test_common.cpp index 31742f126..250d6ce32 100644 --- a/modules/sfm/test/test_common.cpp +++ b/modules/sfm/test/test_common.cpp @@ -1,16 +1,11 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -#include -#include +namespace opencv_test { -using namespace cv; -using namespace cv::sfm; -using namespace std; - -namespace cvtest -{ - -void generateTwoViewRandomScene( cvtest::TwoViewDataSet &data ) +void generateTwoViewRandomScene( TwoViewDataSet &data ) { vector > points2d; vector Rs; @@ -83,7 +78,7 @@ expectFundamentalProperties( const cv::Matx33d &F, void parser_2D_tracks(const string &_filename, std::vector &points2d ) { - ifstream myfile(_filename.c_str()); + std::ifstream myfile(_filename.c_str()); if (!myfile.is_open()) CV_Error(cv::Error::StsError, string("Unable to read file: ") + _filename + "\n"); @@ -96,7 +91,7 @@ parser_2D_tracks(const string &_filename, std::vector &points2d ) while ( getline(myfile, line_str) ) { - istringstream line(line_str); + std::istringstream line(line_str); if ( track > n_tracks ) { @@ -126,4 +121,4 @@ parser_2D_tracks(const string &_filename, std::vector &points2d ) } -} // namespace cvtest +} // namespace diff --git a/modules/sfm/test/test_conditioning.cpp b/modules/sfm/test/test_conditioning.cpp index 5e5194dc9..0da498f80 100644 --- a/modules/sfm/test/test_conditioning.cpp +++ b/modules/sfm/test/test_conditioning.cpp @@ -35,9 +35,7 @@ #include "test_precomp.hpp" -using namespace cv; -using namespace cv::sfm; -using namespace std; +namespace opencv_test { namespace { TEST(Sfm_conditioning, normalizePoints) { @@ -62,3 +60,5 @@ TEST(Sfm_conditioning, normalizeIsotropicPoints) { //TODO: implement me } + +}} // namespace diff --git a/modules/sfm/test/test_fundamental.cpp b/modules/sfm/test/test_fundamental.cpp index 02f28981e..1bc7a4def 100644 --- a/modules/sfm/test/test_fundamental.cpp +++ b/modules/sfm/test/test_fundamental.cpp @@ -35,10 +35,7 @@ #include "test_precomp.hpp" -using namespace cv; -using namespace cv::sfm; -using namespace cvtest; -using namespace std; +namespace opencv_test { namespace { TEST(Sfm_fundamental, fundamentalFromProjections) { @@ -88,7 +85,7 @@ TEST(Sfm_fundamental, motionFromEssential) { double tolerance = 1e-8; - cvtest::TwoViewDataSet d; + TwoViewDataSet d; generateTwoViewRandomScene(d); Matx33d E; @@ -105,7 +102,7 @@ TEST(Sfm_fundamental, motionFromEssential) bool one_solution_is_correct = false; for ( int i = 0; i < Rs.size(); ++i ) { - if ( (norm(Rs[i], R) < tolerance) && (norm(ts[i], t) < tolerance) ) + if ( (cvtest::norm(Rs[i], R, NORM_L2) < tolerance) && (cvtest::norm(ts[i], t, NORM_L2) < tolerance) ) { one_solution_is_correct = true; break; @@ -171,6 +168,8 @@ TEST(Sfm_fundamental, motionFromEssentialChooseSolution) EXPECT_LE(0, solution); EXPECT_LE(solution, 3); - EXPECT_LE(norm(Rs[solution]-Mat(R)), 1e-8); - EXPECT_LE(norm(ts[solution]-Mat(t)), 1e-8); -} \ No newline at end of file + EXPECT_LE(cvtest::norm(Rs[solution], Mat(R), NORM_L2), 1e-8); + EXPECT_LE(cvtest::norm(ts[solution], Mat(t), NORM_L2), 1e-8); +} + +}} // namespace diff --git a/modules/sfm/test/test_main.cpp b/modules/sfm/test/test_main.cpp index 74b896b3d..0a9cce2e4 100644 --- a/modules/sfm/test/test_main.cpp +++ b/modules/sfm/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("cv") \ No newline at end of file diff --git a/modules/sfm/test/test_numeric.cpp b/modules/sfm/test/test_numeric.cpp index dc28e6d65..c104ceb62 100644 --- a/modules/sfm/test/test_numeric.cpp +++ b/modules/sfm/test/test_numeric.cpp @@ -35,10 +35,7 @@ #include "test_precomp.hpp" -using namespace cv; -using namespace cv::sfm; -using namespace std; - +namespace opencv_test { namespace { template static void @@ -89,3 +86,6 @@ TEST(Sfm_numeric, skewMat) EXPECT_DOUBLE_EQ( bx(0,2), -bx(2,0) ); EXPECT_DOUBLE_EQ( bx(1,2), -bx(2,1) ); } + + +}} // namespace diff --git a/modules/sfm/test/test_precomp.hpp b/modules/sfm/test/test_precomp.hpp index 6002f30ab..bdd9d2549 100644 --- a/modules/sfm/test/test_precomp.hpp +++ b/modules/sfm/test/test_precomp.hpp @@ -1,7 +1,6 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ @@ -20,8 +19,9 @@ return;\ } -namespace cvtest +namespace opencv_test { + using namespace cv::sfm; template inline void @@ -64,7 +64,7 @@ namespace cvtest cosinusBetweenMatrices(const T &a, const T &b) { double s = cv::sum( a.mul(b) )[0]; - return ( s / norm(a) / norm(b) ); + return ( s / cv::norm(a) / cv::norm(b) ); } // Check that sin(angle(a, b)) < tolerance @@ -135,6 +135,6 @@ namespace cvtest void parser_2D_tracks(const std::string &_filename, std::vector &points2d ); -} // namespace cvtest +} // namespace #endif diff --git a/modules/sfm/test/test_projection.cpp b/modules/sfm/test/test_projection.cpp index 3cf0954b6..42b7d11d9 100644 --- a/modules/sfm/test/test_projection.cpp +++ b/modules/sfm/test/test_projection.cpp @@ -36,10 +36,7 @@ #include "test_precomp.hpp" #include -using namespace cv; -using namespace cv::sfm; -using namespace cvtest; -using namespace std; +namespace opencv_test { namespace { TEST(Sfm_projection, homogeneousToEuclidean) { @@ -117,3 +114,6 @@ TEST(Sfm_projection, P_From_KRt) // TODO: Change the code to ensure det(R) == 1, which is not currently // the case. Also add a test for that here. } + + +}} // namespace diff --git a/modules/sfm/test/test_reconstruct.cpp b/modules/sfm/test/test_reconstruct.cpp index 1122001bf..99d9446fd 100644 --- a/modules/sfm/test/test_reconstruct.cpp +++ b/modules/sfm/test/test_reconstruct.cpp @@ -35,9 +35,7 @@ #include "test_precomp.hpp" -using namespace cv; -using namespace cv::sfm; -using namespace std; +namespace opencv_test { namespace { /* Check projection errors */ static void @@ -94,3 +92,5 @@ TEST(Sfm_reconstruct, twoViewProjectiveOutliers) } #endif /* CERES_FOUND */ + +}} // namespace diff --git a/modules/sfm/test/test_robust.cpp b/modules/sfm/test/test_robust.cpp index 929d3ef6a..32e0cbffb 100644 --- a/modules/sfm/test/test_robust.cpp +++ b/modules/sfm/test/test_robust.cpp @@ -36,11 +36,7 @@ #include "test_precomp.hpp" #include "opencv2/sfm/robust.hpp" -using namespace cv; -using namespace cv::sfm; -using namespace cvtest; -using namespace std; - +namespace opencv_test { namespace { TEST(Sfm_robust, fundamentalFromCorrespondences8PointRobust) { @@ -81,7 +77,7 @@ TEST(Sfm_robust, fundamentalFromCorrespondences8PointRobust) TEST(Sfm_robust, fundamentalFromCorrespondences8PointRealisticNoOutliers) { double tolerance = 1e-8; - cvtest::TwoViewDataSet d; + TwoViewDataSet d; generateTwoViewRandomScene(d); Matx33d F_estimated; @@ -140,7 +136,7 @@ TEST(Sfm_robust, fundamentalFromCorrespondences7PointRobust) TEST(Sfm_robust, fundamentalFromCorrespondences7PointRealisticNoOutliers) { double tolerance = 1e-8; - cvtest::TwoViewDataSet d; + TwoViewDataSet d; generateTwoViewRandomScene(d); Matx33d F_estimated; @@ -157,4 +153,6 @@ TEST(Sfm_robust, fundamentalFromCorrespondences7PointRealisticNoOutliers) // Check fundamental properties. expectFundamentalProperties( F_estimated, d.x1, d.x2, tolerance); -} \ No newline at end of file +} + +}} // namespace diff --git a/modules/sfm/test/test_simple_pipeline.cpp b/modules/sfm/test/test_simple_pipeline.cpp index db269c147..7195bbf81 100644 --- a/modules/sfm/test/test_simple_pipeline.cpp +++ b/modules/sfm/test/test_simple_pipeline.cpp @@ -39,10 +39,7 @@ #include -using namespace cv; -using namespace cv::sfm; -using namespace cvtest; -using namespace std; +namespace opencv_test { namespace { const string SFM_DIR = "sfm"; const string TRACK_FILENAME = "backyard_tracks.txt"; @@ -86,4 +83,5 @@ TEST(Sfm_simple_pipeline, backyard) // UPDATE: 1.38894 } +}} // namespace #endif /* CERES_FOUND */ diff --git a/modules/sfm/test/test_triangulation.cpp b/modules/sfm/test/test_triangulation.cpp index d1bf6d825..a9715e55e 100644 --- a/modules/sfm/test/test_triangulation.cpp +++ b/modules/sfm/test/test_triangulation.cpp @@ -35,9 +35,7 @@ #include "test_precomp.hpp" -using namespace cv; -using namespace cv::sfm; -using namespace std; +namespace opencv_test { namespace { static void checkTriangulation(int nviews, int npoints, bool is_projective, float err_max2d, float err_max3d) @@ -66,12 +64,12 @@ checkTriangulation(int nviews, int npoints, bool is_projective, float err_max2d, homogeneousToEuclidean( cv::Mat(Ps[k])*X_homogeneous.col(i), x_reprojected ); // Check reprojection error. Should be nearly zero. - double error = norm( x_reprojected - points2d[k].col(i) ); + double error = cvtest::norm(x_reprojected, points2d[k].col(i), NORM_L2); EXPECT_LE(error*error, err_max2d); } // Check 3d error. Should be nearly zero. - double error = norm( X.col(i) - points3d.col(i) ); + double error = cvtest::norm(X.col(i), points3d.col(i), NORM_L2); EXPECT_LE(error*error, err_max3d); } } @@ -94,3 +92,6 @@ TEST(Sfm_triangulate, NViewTriangulate_FiveViews) checkTriangulation(nviews, npoints, is_projective, 1e-7, 1e-9); } + + +}} // namespace diff --git a/modules/stereo/perf/perf_bm.cpp b/modules/stereo/perf/perf_bm.cpp index 84148098d..388fc12dc 100644 --- a/modules/stereo/perf/perf_bm.cpp +++ b/modules/stereo/perf/perf_bm.cpp @@ -42,12 +42,9 @@ #include "perf_precomp.hpp" -using namespace std; -using namespace cv; -using namespace cv::stereo; -using namespace perf; +namespace opencv_test { namespace { -typedef std::tr1::tuple s_bm_test_t; +typedef tuple s_bm_test_t; typedef perf::TestBaseWithParam s_bm; PERF_TEST_P( s_bm, sgm_perf, @@ -58,9 +55,9 @@ PERF_TEST_P( s_bm, sgm_perf, ) ) { - Size sz = std::tr1::get<0>(GetParam()); - int matType = std::tr1::get<1>(GetParam()); - int sdepth = std::tr1::get<2>(GetParam()); + Size sz = get<0>(GetParam()); + int matType = get<1>(GetParam()); + int sdepth = get<2>(GetParam()); Mat left(sz, matType); Mat right(sz, matType); @@ -85,9 +82,9 @@ PERF_TEST_P( s_bm, bm_perf, ) ) { - Size sz = std::tr1::get<0>(GetParam()); - int matType = std::tr1::get<1>(GetParam()); - int sdepth = std::tr1::get<2>(GetParam()); + Size sz = get<0>(GetParam()); + int matType = get<1>(GetParam()); + int sdepth = get<2>(GetParam()); Mat left(sz, matType); Mat right(sz, matType); @@ -116,3 +113,6 @@ PERF_TEST_P( s_bm, bm_perf, } SANITY_CHECK(out1); } + + +}} // namespace diff --git a/modules/stereo/perf/perf_descriptor.cpp b/modules/stereo/perf/perf_descriptor.cpp index 753517627..5858f9b3a 100644 --- a/modules/stereo/perf/perf_descriptor.cpp +++ b/modules/stereo/perf/perf_descriptor.cpp @@ -41,12 +41,9 @@ //M*/ #include "perf_precomp.hpp" -using namespace std; -using namespace cv; -using namespace cv::stereo; -using namespace perf; +namespace opencv_test { namespace { -typedef std::tr1::tuple descript_params_t; +typedef tuple descript_params_t; typedef perf::TestBaseWithParam descript_params; PERF_TEST_P( descript_params, census_sparse_descriptor, @@ -57,9 +54,9 @@ PERF_TEST_P( descript_params, census_sparse_descriptor, ) ) { - Size sz = std::tr1::get<0>(GetParam()); - int matType = std::tr1::get<1>(GetParam()); - int sdepth = std::tr1::get<2>(GetParam()); + Size sz = get<0>(GetParam()); + int matType = get<1>(GetParam()); + int sdepth = get<2>(GetParam()); Mat left(sz, matType); Mat out1(sz, sdepth); declare.in(left, WARMUP_RNG) @@ -79,9 +76,9 @@ PERF_TEST_P( descript_params, star_census_transform, ) ) { - Size sz = std::tr1::get<0>(GetParam()); - int matType = std::tr1::get<1>(GetParam()); - int sdepth = std::tr1::get<2>(GetParam()); + Size sz = get<0>(GetParam()); + int matType = get<1>(GetParam()); + int sdepth = get<2>(GetParam()); Mat left(sz, matType); Mat out1(sz, sdepth); declare.in(left, WARMUP_RNG) @@ -101,9 +98,9 @@ PERF_TEST_P( descript_params, modified_census_transform, ) ) { - Size sz = std::tr1::get<0>(GetParam()); - int matType = std::tr1::get<1>(GetParam()); - int sdepth = std::tr1::get<2>(GetParam()); + Size sz = get<0>(GetParam()); + int matType = get<1>(GetParam()); + int sdepth = get<2>(GetParam()); Mat left(sz, matType); Mat out1(sz, sdepth); @@ -125,9 +122,9 @@ PERF_TEST_P( descript_params, center_symetric_census, ) ) { - Size sz = std::tr1::get<0>(GetParam()); - int matType = std::tr1::get<1>(GetParam()); - int sdepth = std::tr1::get<2>(GetParam()); + Size sz = get<0>(GetParam()); + int matType = get<1>(GetParam()); + int sdepth = get<2>(GetParam()); Mat left(sz, matType); Mat out1(sz, sdepth); @@ -141,3 +138,6 @@ PERF_TEST_P( descript_params, center_symetric_census, } SANITY_CHECK(out1); } + + +}} // namespace diff --git a/modules/stereo/perf/perf_precomp.hpp b/modules/stereo/perf/perf_precomp.hpp index 23ed07281..37d170e2e 100644 --- a/modules/stereo/perf/perf_precomp.hpp +++ b/modules/stereo/perf/perf_precomp.hpp @@ -1,32 +1,18 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_PERF_PRECOMP_HPP__ #define __OPENCV_PERF_PRECOMP_HPP__ -#include #include "opencv2/ts.hpp" -#include "opencv2/imgcodecs.hpp" #include "opencv2/stereo.hpp" -#include "opencv2/imgproc.hpp" #include "opencv2/features2d.hpp" #include "opencv2/core/utility.hpp" -#include "opencv2/core/private.hpp" -#include "opencv2/core/cvdef.h" -#include "opencv2/core.hpp" -#include "opencv2/highgui.hpp" #include "opencv2/calib3d.hpp" -#include -#include - -#ifdef GTEST_CREATE_SHARED_LIBRARY -#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined -#endif +namespace opencv_test { +using namespace cv::stereo; +using namespace perf; +} #endif diff --git a/modules/stereo/test/test_block_matching.cpp b/modules/stereo/test/test_block_matching.cpp index dc69a9ea4..159be4907 100644 --- a/modules/stereo/test/test_block_matching.cpp +++ b/modules/stereo/test/test_block_matching.cpp @@ -40,11 +40,8 @@ //M*/ #include "test_precomp.hpp" -#include -using namespace cv; -using namespace cv::stereo; -using namespace std; +namespace opencv_test { namespace { class CV_BlockMatchingTest : public cvtest::BaseTest { @@ -234,3 +231,6 @@ void CV_SGBlockMatchingTest::run(int ) } TEST(block_matching_simple_test, accuracy) { CV_BlockMatchingTest test; test.safe_run(); } TEST(SG_block_matching_simple_test, accuracy) { CV_SGBlockMatchingTest test; test.safe_run(); } + + +}} // namespace \ No newline at end of file diff --git a/modules/stereo/test/test_descriptors.cpp b/modules/stereo/test/test_descriptors.cpp index b466ecf31..3dd3a39ab 100644 --- a/modules/stereo/test/test_descriptors.cpp +++ b/modules/stereo/test/test_descriptors.cpp @@ -40,11 +40,8 @@ //M*/ #include "test_precomp.hpp" -#include -using namespace cv; -using namespace cv::stereo; -using namespace std; +namespace opencv_test { namespace { class CV_DescriptorBaseTest : public cvtest::BaseTest { @@ -443,8 +440,8 @@ void CV_DescriptorBaseTest::run(int ) } } } - int min = numeric_limits::min(); - int max = numeric_limits::max(); + int min = std::numeric_limits::min(); + int max = std::numeric_limits::max(); //check if all values are between int min and int max and not NAN if (0 != cvtest::check(censusImage[0], min, max, 0)) { @@ -463,3 +460,6 @@ TEST(DISABLED_census_transform_testing, accuracy) { CV_CensusTransformTest test; TEST(DISABLED_symetric_census_testing, accuracy) { CV_SymetricCensusTest test; test.safe_run(); } TEST(DISABLED_Dmodified_census_testing, accuracy) { CV_ModifiedCensusTransformTest test; test.safe_run(); } TEST(DISABLED_Dstar_kernel_testing, accuracy) { CV_StarKernelCensusTest test; test.safe_run(); } + + +}} // namespace diff --git a/modules/stereo/test/test_precomp.hpp b/modules/stereo/test/test_precomp.hpp index 1735d935a..90f314e47 100644 --- a/modules/stereo/test/test_precomp.hpp +++ b/modules/stereo/test/test_precomp.hpp @@ -1,28 +1,16 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ -#include #include "opencv2/ts.hpp" -#include "opencv2/imgcodecs.hpp" #include "opencv2/stereo.hpp" -#include "opencv2/imgproc.hpp" #include "opencv2/features2d.hpp" -#include "opencv2/core/utility.hpp" -#include "opencv2/core/private.hpp" -#include "opencv2/core/cvdef.h" -#include "opencv2/core.hpp" -#include "opencv2/highgui.hpp" #include "opencv2/calib3d.hpp" -#include -#include +namespace opencv_test { +using namespace cv::stereo; +} #endif diff --git a/modules/structured_light/test/test_faps.cpp b/modules/structured_light/test/test_faps.cpp index e71b7ddd2..d8900f369 100644 --- a/modules/structured_light/test/test_faps.cpp +++ b/modules/structured_light/test/test_faps.cpp @@ -38,14 +38,12 @@ // the use of this software, even if advised of the possibility of such damage. // //M*/ +#include "test_precomp.hpp" #include #include -#include -#include "test_precomp.hpp" -using namespace std; -using namespace cv; +namespace opencv_test { namespace { const string STRUCTURED_LIGHT_DIR = "structured_light"; const string FOLDER_DATA = "data"; @@ -147,3 +145,5 @@ TEST( SinusoidalPattern, unwrapPhaseMap ) EXPECT_LE( ratio, 0.003 ); } + +}} // namespace diff --git a/modules/structured_light/test/test_getProjPixel.cpp b/modules/structured_light/test/test_getProjPixel.cpp index 91c6db5d9..8237a2781 100644 --- a/modules/structured_light/test/test_getProjPixel.cpp +++ b/modules/structured_light/test/test_getProjPixel.cpp @@ -41,8 +41,7 @@ #include "test_precomp.hpp" -using namespace std; -using namespace cv; +namespace opencv_test { namespace { /****************************************************************************************\ * GetProjPixel test * @@ -98,3 +97,5 @@ TEST( GrayCodePattern, getProjPixel ) CV_GetProjPixelTest test; test.safe_run(); } + +}} // namespace diff --git a/modules/structured_light/test/test_main.cpp b/modules/structured_light/test/test_main.cpp index 74b896b3d..0a9cce2e4 100644 --- a/modules/structured_light/test/test_main.cpp +++ b/modules/structured_light/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("cv") \ No newline at end of file diff --git a/modules/structured_light/test/test_plane.cpp b/modules/structured_light/test/test_plane.cpp index 6514b57cc..8b7578866 100644 --- a/modules/structured_light/test/test_plane.cpp +++ b/modules/structured_light/test/test_plane.cpp @@ -40,13 +40,8 @@ //M*/ #include "test_precomp.hpp" -#include -#include -#include -#include -using namespace std; -using namespace cv; +namespace opencv_test { namespace { const string STRUCTURED_LIGHT_DIR = "structured_light"; const string FOLDER_DATA = "data"; @@ -283,10 +278,10 @@ void CV_PlaneTest::run( int ) // Loading and rectifying pattern images for( size_t i = 0; i < numberOfPatternImages; i++ ) { - ostringstream name1; + std::ostringstream name1; name1 << "pattern_cam1_im" << i + 1 << ".jpg"; captured_pattern[0][i] = imread( folder + name1.str(), 0 ); - ostringstream name2; + std::ostringstream name2; name2 << "pattern_cam2_im" << i + 1 << ".jpg"; captured_pattern[1][i] = imread( folder + name2.str(), 0 ); @@ -359,3 +354,5 @@ TEST( GrayCodePattern, plane_reconstruction ) CV_PlaneTest test; test.safe_run(); } + +}} // namespace diff --git a/modules/structured_light/test/test_precomp.hpp b/modules/structured_light/test/test_precomp.hpp index 7a09e198c..064e8c351 100644 --- a/modules/structured_light/test/test_precomp.hpp +++ b/modules/structured_light/test/test_precomp.hpp @@ -1,16 +1,10 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ #include "opencv2/ts.hpp" #include "opencv2/structured_light.hpp" -#include #endif diff --git a/modules/text/test/test_detection.cpp b/modules/text/test/test_detection.cpp index bd0a30c89..495298573 100644 --- a/modules/text/test/test_detection.cpp +++ b/modules/text/test/test_detection.cpp @@ -5,11 +5,7 @@ #include "test_precomp.hpp" #include "opencv2/imgcodecs.hpp" -using namespace cv; -using namespace cv::text; -using namespace cvtest; - -namespace { +namespace opencv_test { namespace { // Just skip test in case of missed testdata static cv::String findDataFile(const String& path) @@ -88,4 +84,6 @@ INSTANTIATE_TEST_CASE_P(Text, Detection, ), testing::Bool() )); -} + + +}} // namespace diff --git a/modules/text/test/test_main.cpp b/modules/text/test/test_main.cpp index 6a1bfde60..a5419787b 100644 --- a/modules/text/test/test_main.cpp +++ b/modules/text/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("", diff --git a/modules/text/test/test_precomp.hpp b/modules/text/test/test_precomp.hpp index a51ea3233..3a584a31f 100644 --- a/modules/text/test/test_precomp.hpp +++ b/modules/text/test/test_precomp.hpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_TEXT_PRECOMP_HPP__ #define __OPENCV_TEST_TEXT_PRECOMP_HPP__ @@ -5,4 +8,8 @@ #include "opencv2/ts.hpp" #include "opencv2/text.hpp" +namespace opencv_test { +using namespace cv::text; +} + #endif diff --git a/modules/tracking/perf/perf_Tracker.cpp b/modules/tracking/perf/perf_Tracker.cpp index e64b50698..4667c713b 100644 --- a/modules/tracking/perf/perf_Tracker.cpp +++ b/modules/tracking/perf/perf_Tracker.cpp @@ -40,13 +40,8 @@ //M*/ #include "perf_precomp.hpp" -#include -using namespace std; -using namespace cv; -using namespace perf; -using std::tr1::make_tuple; -using std::tr1::get; +namespace opencv_test { namespace { //write sanity: ./bin/opencv_perf_tracking --perf_write_sanity=true --perf_min_samples=1 //verify sanity: ./bin/opencv_perf_tracking --perf_min_samples=1 @@ -58,7 +53,7 @@ using std::tr1::get; const string TRACKING_DIR = "cv/tracking"; const string FOLDER_IMG = "data"; -typedef perf::TestBaseWithParam > tracking; +typedef perf::TestBaseWithParam > tracking; std::vector splitString( std::string s, std::string delimiter ) { @@ -86,7 +81,7 @@ void checkData( const string& datasetMeta, int& startFrame, string& prefix, stri bool getGroundTruth( const string& gtFile, vector& gtBBs ) { - ifstream gt; + std::ifstream gt; //open the ground truth gt.open( gtFile.c_str() ); if( !gt.is_open() ) @@ -413,3 +408,5 @@ PERF_TEST_P(tracking, GOTURN, testing::Combine(TESTSET_NAMES, SEGMENTS)) SANITY_CHECK(bbs_mat, 15, ERROR_RELATIVE); } + +}} // namespace diff --git a/modules/tracking/perf/perf_main.cpp b/modules/tracking/perf/perf_main.cpp index de3cc39b7..cfd91a4dc 100644 --- a/modules/tracking/perf/perf_main.cpp +++ b/modules/tracking/perf/perf_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" CV_PERF_TEST_MAIN(tracking) diff --git a/modules/tracking/perf/perf_precomp.hpp b/modules/tracking/perf/perf_precomp.hpp index c8580117b..70ebecd30 100644 --- a/modules/tracking/perf/perf_precomp.hpp +++ b/modules/tracking/perf/perf_precomp.hpp @@ -1,22 +1,14 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TRACKING_PRECOMP_HPP__ #define __OPENCV_TRACKING_PRECOMP_HPP__ #include "opencv2/ts.hpp" -#include #include -#include -#include -#ifdef GTEST_CREATE_SHARED_LIBRARY -#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined -#endif +namespace opencv_test { +using namespace perf; +} #endif diff --git a/modules/tracking/test/test_aukf.cpp b/modules/tracking/test/test_aukf.cpp index 487934487..73372971c 100644 --- a/modules/tracking/test/test_aukf.cpp +++ b/modules/tracking/test/test_aukf.cpp @@ -42,7 +42,7 @@ #include "test_precomp.hpp" #include "opencv2/tracking/kalman_filters.hpp" -using namespace cv; +namespace opencv_test { namespace { using namespace cv::tracking; // In this two tests Augmented Unscented Kalman Filter are applied to the dynamic system from example "The reentry problem" from @@ -304,10 +304,10 @@ TEST(DISABLED_AUKF, DISABLED_br_mean_squared_error) errors = errors/100.0; sqrt( errors, errors ); - double max_x1 = norm( errors.col(0), NORM_INF ); - double max_x2 = norm( errors.col(1), NORM_INF ); - double max_x3 = norm( errors.col(2), NORM_INF ); - double max_x4 = norm( errors.col(3), NORM_INF ); + double max_x1 = cvtest::norm(errors.col(0), NORM_INF); + double max_x2 = cvtest::norm(errors.col(1), NORM_INF); + double max_x3 = cvtest::norm(errors.col(2), NORM_INF); + double max_x4 = cvtest::norm(errors.col(3), NORM_INF); ASSERT_GE( state_treshold, max_x1 ); ASSERT_GE( state_treshold, max_x2 ); @@ -434,3 +434,5 @@ TEST(AUKF, DISABLED_ungm_mean_squared_error) ASSERT_GE( mse_treshold, average_error ); } + +}} // namespace diff --git a/modules/tracking/test/test_main.cpp b/modules/tracking/test/test_main.cpp index 6b2499344..0e51ddfd0 100644 --- a/modules/tracking/test/test_main.cpp +++ b/modules/tracking/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("cv") diff --git a/modules/tracking/test/test_precomp.hpp b/modules/tracking/test/test_precomp.hpp index 10655b1b1..736aa6b29 100644 --- a/modules/tracking/test/test_precomp.hpp +++ b/modules/tracking/test/test_precomp.hpp @@ -1,19 +1,10 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ -#include #include "opencv2/ts.hpp" -#include "opencv2/imgproc.hpp" #include "opencv2/tracking.hpp" -#include "opencv2/highgui.hpp" -#include "opencv2/videoio.hpp" #endif diff --git a/modules/tracking/test/test_trackerParametersIO.cpp b/modules/tracking/test/test_trackerParametersIO.cpp index eb9ff7fe5..ebe43a5fb 100644 --- a/modules/tracking/test/test_trackerParametersIO.cpp +++ b/modules/tracking/test/test_trackerParametersIO.cpp @@ -3,9 +3,8 @@ // of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -#include "opencv2/tracking.hpp" -using namespace cv; +namespace opencv_test { namespace { TEST(MEDIAN_FLOW_Parameters, IO) { @@ -125,3 +124,5 @@ TEST(KCF_Parameters, Default_Value_If_Absent) ASSERT_EQ(defaultParameters.compressed_size, readParameters.compressed_size); ASSERT_DOUBLE_EQ(defaultParameters.pca_learning_rate, readParameters.pca_learning_rate); } + +}} // namespace diff --git a/modules/tracking/test/test_trackers.cpp b/modules/tracking/test/test_trackers.cpp index 63873f31c..812f68ab1 100644 --- a/modules/tracking/test/test_trackers.cpp +++ b/modules/tracking/test/test_trackers.cpp @@ -40,12 +40,8 @@ //M*/ #include "test_precomp.hpp" -#include "opencv2/tracking.hpp" -#include -using namespace cv; -using namespace testing; -using namespace std; +namespace opencv_test { namespace { #define TESTSET_NAMES testing::Values("david","dudek","faceocc2") @@ -325,7 +321,7 @@ void TrackerTest::checkDataTest() fs.release(); string gtFile = cvtest::TS::ptr()->get_data_path() + TRACKING_DIR + "/" + video + "/gt.txt"; - ifstream gt; + std::ifstream gt; //open the ground truth gt.open( gtFile.c_str() ); if( !gt.is_open() ) @@ -348,7 +344,7 @@ void TrackerTest::checkDataTest() //exclude from the images sequence, the frames where the target is occluded or out of view string omitFile = cvtest::TS::ptr()->get_data_path() + TRACKING_DIR + "/" + video + "/" + FOLDER_OMIT_INIT + "/" + video + ".txt"; - ifstream omit; + std::ifstream omit; omit.open( omitFile.c_str() ); if( omit.is_open() ) { @@ -373,7 +369,7 @@ void TrackerTest::checkDataTest() startFrame += ( segmentIdx - 1 ) * numFrame; endFrame = startFrame + numFrame; - ifstream gt2; + std::ifstream gt2; //open the ground truth gt2.open( gtFile.c_str() ); if( !gt2.is_open() ) @@ -556,4 +552,5 @@ TEST_P(DistanceAndOverlap, Scaled_Data_MOSSE) INSTANTIATE_TEST_CASE_P( Tracking, DistanceAndOverlap, TESTSET_NAMES); +}} // namespace /* End of file. */ diff --git a/modules/tracking/test/test_ukf.cpp b/modules/tracking/test/test_ukf.cpp index 921ab2580..60196ee1d 100644 --- a/modules/tracking/test/test_ukf.cpp +++ b/modules/tracking/test/test_ukf.cpp @@ -42,7 +42,7 @@ #include "test_precomp.hpp" #include "opencv2/tracking/kalman_filters.hpp" -using namespace cv; +namespace opencv_test { namespace { using namespace cv::tracking; // In this two tests Unscented Kalman Filter are applied to the dynamic system from example "The reentry problem" from @@ -304,10 +304,10 @@ TEST(UKF, DISABLED_br_mean_squared_error) errors = errors/100.0; sqrt( errors, errors ); - double max_x1 = norm( errors.col(0), NORM_INF ); - double max_x2 = norm( errors.col(1), NORM_INF ); - double max_x3 = norm( errors.col(2), NORM_INF ); - double max_x4 = norm( errors.col(3), NORM_INF ); + double max_x1 = cvtest::norm(errors.col(0), NORM_INF); + double max_x2 = cvtest::norm(errors.col(1), NORM_INF); + double max_x3 = cvtest::norm(errors.col(2), NORM_INF); + double max_x4 = cvtest::norm(errors.col(3), NORM_INF); ASSERT_GE( state_treshold, max_x1 ); ASSERT_GE( state_treshold, max_x2 ); @@ -432,3 +432,5 @@ TEST(UKF, DISABLED_ungm_mean_squared_error) ASSERT_GE( mse_treshold, average_error ); } + +}} // namespace diff --git a/modules/xfeatures2d/perf/perf_daisy.cpp b/modules/xfeatures2d/perf/perf_daisy.cpp index f5ff36105..154d8eb1d 100644 --- a/modules/xfeatures2d/perf/perf_daisy.cpp +++ b/modules/xfeatures2d/perf/perf_daisy.cpp @@ -1,11 +1,9 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -using namespace std; -using namespace cv; -using namespace cv::xfeatures2d; -using namespace perf; -using std::tr1::make_tuple; -using std::tr1::get; +namespace opencv_test { namespace { typedef perf::TestBaseWithParam daisy; @@ -31,3 +29,5 @@ PERF_TEST_P(daisy, extract, testing::Values(DAISY_IMAGES)) SANITY_CHECK_NOTHING(); } + +}} // namespace diff --git a/modules/xfeatures2d/perf/perf_latch.cpp b/modules/xfeatures2d/perf/perf_latch.cpp index 19badf0ff..d3311500b 100644 --- a/modules/xfeatures2d/perf/perf_latch.cpp +++ b/modules/xfeatures2d/perf/perf_latch.cpp @@ -1,11 +1,9 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -using namespace std; -using namespace cv; -using namespace cv::xfeatures2d; -using namespace perf; -using std::tr1::make_tuple; -using std::tr1::get; +namespace opencv_test { namespace { typedef perf::TestBaseWithParam latch; @@ -32,3 +30,5 @@ PERF_TEST_P(latch, extract, testing::Values(LATCH_IMAGES)) SANITY_CHECK_NOTHING(); } + +}} // namespace diff --git a/modules/xfeatures2d/perf/perf_main.cpp b/modules/xfeatures2d/perf/perf_main.cpp index 14096ba0c..2c3cc5aad 100644 --- a/modules/xfeatures2d/perf/perf_main.cpp +++ b/modules/xfeatures2d/perf/perf_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" #include "opencv2/ts/cuda_perf.hpp" diff --git a/modules/xfeatures2d/perf/perf_msd.cpp b/modules/xfeatures2d/perf/perf_msd.cpp index 35c61087a..0505d6921 100644 --- a/modules/xfeatures2d/perf/perf_msd.cpp +++ b/modules/xfeatures2d/perf/perf_msd.cpp @@ -1,11 +1,9 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -using namespace std; -using namespace cv; -using namespace xfeatures2d; -using namespace perf; -using std::tr1::make_tuple; -using std::tr1::get; +namespace opencv_test { namespace { typedef perf::TestBaseWithParam msd; @@ -31,3 +29,5 @@ PERF_TEST_P(msd, detect, testing::Values(MSD_IMAGES)) sort(points.begin(), points.end(), comparators::KeypointGreater()); SANITY_CHECK_KEYPOINTS(points, 1e-3); } + +}} // namespace \ No newline at end of file diff --git a/modules/xfeatures2d/perf/perf_precomp.hpp b/modules/xfeatures2d/perf/perf_precomp.hpp index 815cc5fea..249d07989 100644 --- a/modules/xfeatures2d/perf/perf_precomp.hpp +++ b/modules/xfeatures2d/perf/perf_precomp.hpp @@ -1,11 +1,6 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_PERF_PRECOMP_HPP__ #define __OPENCV_PERF_PRECOMP_HPP__ @@ -13,9 +8,6 @@ #include "opencv2/ts.hpp" #include "opencv2/xfeatures2d.hpp" -#include "opencv2/imgcodecs.hpp" - -#include "opencv2/opencv_modules.hpp" #ifdef HAVE_OPENCV_OCL # include "opencv2/ocl.hpp" @@ -25,8 +17,9 @@ # include "opencv2/xfeatures2d/cuda.hpp" #endif -#ifdef GTEST_CREATE_SHARED_LIBRARY -#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined -#endif +namespace opencv_test { +using namespace cv::xfeatures2d; +using namespace perf; +} #endif diff --git a/modules/xfeatures2d/perf/perf_surf.cpp b/modules/xfeatures2d/perf/perf_surf.cpp index 1aab5efa1..d48f3b524 100644 --- a/modules/xfeatures2d/perf/perf_surf.cpp +++ b/modules/xfeatures2d/perf/perf_surf.cpp @@ -1,11 +1,9 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -using namespace std; -using namespace cv; -using namespace cv::xfeatures2d; -using namespace perf; -using std::tr1::make_tuple; -using std::tr1::get; +namespace opencv_test { namespace { typedef perf::TestBaseWithParam surf; @@ -64,3 +62,5 @@ PERF_TEST_P(surf, full, testing::Values(SURF_IMAGES)) SANITY_CHECK_NOTHING(); } + +}} // namespace diff --git a/modules/xfeatures2d/perf/perf_surf.cuda.cpp b/modules/xfeatures2d/perf/perf_surf.cuda.cpp index 08615aa74..a989cff01 100644 --- a/modules/xfeatures2d/perf/perf_surf.cuda.cpp +++ b/modules/xfeatures2d/perf/perf_surf.cuda.cpp @@ -46,9 +46,7 @@ #include "opencv2/ts/cuda_perf.hpp" -using namespace std; -using namespace testing; -using namespace perf; +namespace opencv_test { namespace { ////////////////////////////////////////////////////////////////////// // SURF @@ -100,4 +98,5 @@ PERF_TEST_P(Image, CUDA_SURF, #endif // HAVE_OPENCV_CUDAARITHM +}} // namespace #endif // HAVE_CUDA diff --git a/modules/xfeatures2d/perf/perf_surf.ocl.cpp b/modules/xfeatures2d/perf/perf_surf.ocl.cpp index 3df08b2e3..2029b6b76 100644 --- a/modules/xfeatures2d/perf/perf_surf.ocl.cpp +++ b/modules/xfeatures2d/perf/perf_surf.ocl.cpp @@ -47,9 +47,7 @@ #ifdef HAVE_OPENCV_OCL -using namespace cv; -using namespace cv::ocl; -using namespace std; +namespace opencv_test { namespace { typedef perf::TestBaseWithParam OCL_SURF; @@ -106,4 +104,5 @@ PERF_TEST_P(OCL_SURF, DISABLED_without_data_transfer, testing::Values(SURF_IMAGE SANITY_CHECK_NOTHING(); } +}} // namespace #endif // HAVE_OPENCV_OCL diff --git a/modules/xfeatures2d/perf/perf_vgg.cpp b/modules/xfeatures2d/perf/perf_vgg.cpp index eb6c4f69d..8de79a531 100644 --- a/modules/xfeatures2d/perf/perf_vgg.cpp +++ b/modules/xfeatures2d/perf/perf_vgg.cpp @@ -1,11 +1,9 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -using namespace std; -using namespace cv; -using namespace cv::xfeatures2d; -using namespace perf; -using std::tr1::make_tuple; -using std::tr1::get; +namespace opencv_test { namespace { typedef perf::TestBaseWithParam vgg; @@ -33,3 +31,5 @@ PERF_TEST_P(vgg, extract, testing::Values(VGG_IMAGES)) SANITY_CHECK_NOTHING(); } + +}} // namespace diff --git a/modules/xfeatures2d/test/test_detectors.cpp b/modules/xfeatures2d/test/test_detectors.cpp index 72f5539ed..14c50ce24 100644 --- a/modules/xfeatures2d/test/test_detectors.cpp +++ b/modules/xfeatures2d/test/test_detectors.cpp @@ -42,17 +42,7 @@ #include "test_precomp.hpp" -#include -#include -#include -#include -#include -#include -#include - -using namespace cv; -using namespace cv::xfeatures2d; -using namespace std; +namespace opencv_test { namespace { class CV_DetectorsTest : public cvtest::BaseTest { @@ -107,9 +97,10 @@ void getBrightness(const Mat& img, Mat& aff, Mat& out) data[0] = 1; data[1] = 0; data[2] = 0; data[3] = 0; data[4] = 1; data[5] = 0; - add(img, Mat(img.size(), img.type(), Scalar(15)), out); + cv::add(img, Mat(img.size(), img.type(), Scalar(15)), out); } +#if 0 void showOrig(const Mat& img, const vector& orig_pts) { @@ -136,6 +127,7 @@ void show(const string& name, const Mat& new_img, const vector& new_pt namedWindow(name + "_T"); imshow(name + "_T", new_img_color); } +#endif struct WrapPoint { @@ -151,7 +143,7 @@ struct WrapPoint } }; -struct sortByR { bool operator()(const KeyPoint& kp1, const KeyPoint& kp2) { return norm(kp1.pt) < norm(kp2.pt); } }; +struct sortByR { bool operator()(const KeyPoint& kp1, const KeyPoint& kp2) { return cv::norm(kp1.pt) < cv::norm(kp2.pt); } }; bool CV_DetectorsTest::testDetector(const Mat& img, Ptr detector, vector& exp) { @@ -193,7 +185,7 @@ bool CV_DetectorsTest::testDetector(const Mat& img, Ptr detector, vec size_t k = 0; for(; k < new_kpts[j].size(); ++k) - if (norm(new_kpts[j][k].pt - tkp.pt) < nthres && fabs(new_kpts[j][k].size - tkp.size) < thres) + if (cv::norm(new_kpts[j][k].pt - tkp.pt) < nthres && fabs(new_kpts[j][k].size - tkp.size) < thres) break; if (k != new_kpts[j].size()) @@ -221,7 +213,7 @@ bool CV_DetectorsTest::testDetector(const Mat& img, Ptr detector, vec for(; j < result.size(); ++j) { const KeyPoint& r = result[i]; - if (norm(r.pt-e.pt) < nthres && fabs(r.size - e.size) < thres) + if (cv::norm(r.pt-e.pt) < nthres && fabs(r.size - e.size) < thres) break; } if (j != result.size()) @@ -236,7 +228,7 @@ bool CV_DetectorsTest::testDetector(const Mat& img, Ptr detector, vec for(; j < exp.size(); ++j) { const KeyPoint& e = exp[i]; - if (norm(r.pt-e.pt) < nthres && fabs(r.size - e.size) < thres) + if (cv::norm(r.pt-e.pt) < nthres && fabs(r.size - e.size) < thres) break; } if (j != exp.size()) @@ -305,3 +297,5 @@ void CV_DetectorsTest::run( int /*start_from*/ ) TEST(Features2d_Detectors, regression) { CV_DetectorsTest test; test.safe_run(); } + +}} // namespace diff --git a/modules/xfeatures2d/test/test_features2d.cpp b/modules/xfeatures2d/test/test_features2d.cpp index b5118a008..8babebe88 100644 --- a/modules/xfeatures2d/test/test_features2d.cpp +++ b/modules/xfeatures2d/test/test_features2d.cpp @@ -40,11 +40,8 @@ //M*/ #include "test_precomp.hpp" -#include "opencv2/calib3d.hpp" -using namespace std; -using namespace cv; -using namespace cv::xfeatures2d; +namespace opencv_test { namespace { const string FEATURES2D_DIR = "features2d"; const string DETECTOR_DIR = FEATURES2D_DIR + "/feature_detectors"; @@ -117,13 +114,13 @@ bool CV_FeatureDetectorTest::isSimilarKeypoints( const KeyPoint& p1, const KeyPo const float maxAngleDif = 2.f; const float maxResponseDif = 0.1f; - float dist = (float)norm( p1.pt - p2.pt ); + float dist = (float)cv::norm(p1.pt - p2.pt); return (dist < maxPtDif && fabs(p1.size - p2.size) < maxSizeDif && abs(p1.angle - p2.angle) < maxAngleDif && abs(p1.response - p2.response) < maxResponseDif && p1.octave == p2.octave && - p1.class_id == p2.class_id ); + p1.class_id == p2.class_id); } void CV_FeatureDetectorTest::compareKeypointSets( const vector& validKeypoints, const vector& calcKeypoints ) @@ -150,7 +147,7 @@ void CV_FeatureDetectorTest::compareKeypointSets( const vector& validK for( size_t c = 0; c < calcKeypoints.size(); c++ ) { progress = update_progress( progress, (int)(v*calcKeypoints.size() + c), progressCount, 0 ); - float curDist = (float)norm( calcKeypoints[c].pt - validKeypoints[v].pt ); + float curDist = (float)cv::norm(calcKeypoints[c].pt - validKeypoints[v].pt); if( curDist < minDist ) { minDist = curDist; @@ -325,7 +322,7 @@ protected: curMaxDist = dist; } - stringstream ss; + std::stringstream ss; ss << "Max distance between valid and computed descriptors " << curMaxDist; if( curMaxDist <= maxDist ) ss << "." << endl; @@ -409,7 +406,7 @@ protected: Mat calcDescriptors; double t = (double)getTickCount(); #ifdef HAVE_OPENCL - if(ocl::useOpenCL()) + if(cv::ocl::useOpenCL()) { cv::UMat uimg; img.copyTo(uimg); @@ -549,7 +546,7 @@ protected: virtual void run( int ); void generateData( Mat& query, Mat& train ); - void emptyDataTest(); + //void emptyDataTest(); void matchTest( const Mat& query, const Mat& train ); void knnMatchTest( const Mat& query, const Mat& train ); void radiusMatchTest( const Mat& query, const Mat& train ); @@ -561,6 +558,7 @@ private: CV_DescriptorMatcherTest& operator=(const CV_DescriptorMatcherTest&) { return *this; } }; +#if 0 // not used void CV_DescriptorMatcherTest::emptyDataTest() { assert( !dmatcher.empty() ); @@ -638,8 +636,8 @@ void CV_DescriptorMatcherTest::emptyDataTest() ts->printf( cvtest::TS::LOG, "radiusMatch() on empty descriptors must not generate exception (2).\n" ); ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT ); } - } +#endif void CV_DescriptorMatcherTest::generateData( Mat& query, Mat& train ) { @@ -1039,8 +1037,8 @@ TEST( Features2d_DescriptorExtractor_SIFT, regression ) TEST( Features2d_DescriptorExtractor_SURF, regression ) { #ifdef HAVE_OPENCL - bool useOCL = ocl::useOpenCL(); - ocl::setUseOpenCL(false); + bool useOCL = cv::ocl::useOpenCL(); + cv::ocl::setUseOpenCL(false); #endif CV_DescriptorExtractorTest > test( "descriptor-surf", 0.05f, @@ -1048,22 +1046,22 @@ TEST( Features2d_DescriptorExtractor_SURF, regression ) test.safe_run(); #ifdef HAVE_OPENCL - ocl::setUseOpenCL(useOCL); + cv::ocl::setUseOpenCL(useOCL); #endif } #ifdef HAVE_OPENCL TEST( Features2d_DescriptorExtractor_SURF_OCL, regression ) { - bool useOCL = ocl::useOpenCL(); - ocl::setUseOpenCL(true); - if(ocl::useOpenCL()) + bool useOCL = cv::ocl::useOpenCL(); + cv::ocl::setUseOpenCL(true); + if(cv::ocl::useOpenCL()) { CV_DescriptorExtractorTest > test( "descriptor-surf_ocl", 0.05f, SURF::create() ); test.safe_run(); } - ocl::setUseOpenCL(useOCL); + cv::ocl::setUseOpenCL(useOCL); } #endif @@ -1289,7 +1287,7 @@ protected: vector kpt1, kpt2; Mat d1, d2; #ifdef HAVE_OPENCL - if(ocl::useOpenCL()) + if (cv::ocl::useOpenCL()) { cv::UMat uimg1; img1.copyTo(uimg1); @@ -1435,3 +1433,5 @@ TEST( XFeatures2d_DescriptorExtractor, batch ) EXPECT_GT(descriptors[i].rows, 100); } } + +}} // namespace diff --git a/modules/xfeatures2d/test/test_gms_matcher.cpp b/modules/xfeatures2d/test/test_gms_matcher.cpp index 1979cc596..ab1484326 100644 --- a/modules/xfeatures2d/test/test_gms_matcher.cpp +++ b/modules/xfeatures2d/test/test_gms_matcher.cpp @@ -4,9 +4,7 @@ #include "test_precomp.hpp" -using namespace std; -using namespace cv; -using namespace cv::xfeatures2d; +namespace opencv_test { namespace { class CV_GMSMatcherTest : public cvtest::BaseTest { @@ -99,7 +97,7 @@ void CV_GMSMatcherTest::run( int ) Point2f ptTrans( (float) (matTrans.at(0,0)/matTrans.at(2,0)), (float) (matTrans.at(1,0)/matTrans.at(2,0))); - if (norm(ptTrans-ptCur) < correctMatchDistThreshold) + if (cv::norm(ptTrans-ptCur) < correctMatchDistThreshold) nbCorrectMatches++; } @@ -117,3 +115,5 @@ void CV_GMSMatcherTest::run( int ) } TEST(XFeatures2d_GMSMatcher, gms_matcher_regression) { CV_GMSMatcherTest test; test.safe_run(); } + +}} // namespace diff --git a/modules/xfeatures2d/test/test_keypoints.cpp b/modules/xfeatures2d/test/test_keypoints.cpp index 59025115d..42387ca69 100644 --- a/modules/xfeatures2d/test/test_keypoints.cpp +++ b/modules/xfeatures2d/test/test_keypoints.cpp @@ -40,10 +40,8 @@ //M*/ #include "test_precomp.hpp" -#include "opencv2/highgui.hpp" -using namespace std; -using namespace cv; +namespace opencv_test { namespace { const string FEATURES2D_DIR = "features2d"; const string IMAGE_FILENAME = "tsukuba.png"; @@ -142,3 +140,5 @@ TEST(Features2d_Detector_Keypoints_MSDDetector, validation) CV_FeatureDetectorKeypointsTest test(xfeatures2d::MSDDetector::create()); test.safe_run(); } + +}} // namespace diff --git a/modules/xfeatures2d/test/test_main.cpp b/modules/xfeatures2d/test/test_main.cpp index 6b2499344..0e51ddfd0 100644 --- a/modules/xfeatures2d/test/test_main.cpp +++ b/modules/xfeatures2d/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("cv") diff --git a/modules/xfeatures2d/test/test_precomp.hpp b/modules/xfeatures2d/test/test_precomp.hpp index 462442dce..0f4ced609 100644 --- a/modules/xfeatures2d/test/test_precomp.hpp +++ b/modules/xfeatures2d/test/test_precomp.hpp @@ -1,24 +1,14 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ -#include #include "opencv2/ts.hpp" #include "opencv2/ts/cuda_test.hpp" -#include "opencv2/imgproc.hpp" -#include "opencv2/highgui.hpp" #include "opencv2/xfeatures2d.hpp" +#include "opencv2/calib3d.hpp" -#include "opencv2/ts/cuda_test.hpp" - -#include "opencv2/opencv_modules.hpp" #include "cvconfig.h" #ifdef HAVE_OPENCL @@ -29,4 +19,8 @@ # include "opencv2/xfeatures2d/cuda.hpp" #endif +namespace opencv_test { +using namespace cv::xfeatures2d; +} + #endif diff --git a/modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp b/modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp index 1db986534..7338dd5a4 100644 --- a/modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp +++ b/modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp @@ -40,11 +40,8 @@ //M*/ #include "test_precomp.hpp" -#include "opencv2/highgui.hpp" -using namespace std; -using namespace cv; -using namespace cv::xfeatures2d; +namespace opencv_test { namespace { const string IMAGE_TSUKUBA = "/features2d/tsukuba.png"; const string IMAGE_BIKES = "/detectors_descriptors_evaluation/images_datasets/bikes/img1.png"; @@ -115,7 +112,7 @@ void scaleKeyPoints(const vector& src, vector& dst, float sc static float calcCirclesIntersectArea(const Point2f& p0, float r0, const Point2f& p1, float r1) { - float c = static_cast(norm(p0 - p1)), sqr_c = c * c; + float c = static_cast(cv::norm(p0 - p1)), sqr_c = c * c; float sqr_r0 = r0 * r0; float sqr_r1 = r1 * r1; @@ -980,3 +977,5 @@ TEST(Features2d_ScaleInvariance_Descriptor_BoostDesc_BINBOOST_256, regression) 0.98f); test.safe_run(); } + +}} // namespace diff --git a/modules/xfeatures2d/test/test_surf.cuda.cpp b/modules/xfeatures2d/test/test_surf.cuda.cpp index f87f19d79..076dc4b4e 100644 --- a/modules/xfeatures2d/test/test_surf.cuda.cpp +++ b/modules/xfeatures2d/test/test_surf.cuda.cpp @@ -44,7 +44,7 @@ #ifdef HAVE_CUDA -using namespace cvtest; +namespace opencv_test { namespace { ///////////////////////////////////////////////////////////////////////////////////////////////// // SURF @@ -180,4 +180,5 @@ INSTANTIATE_TEST_CASE_P(CUDA_Features2D, SURF, testing::Combine( #endif // HAVE_OPENCV_CUDAARITHM +}} // namespace #endif // HAVE_CUDA diff --git a/modules/xfeatures2d/test/test_surf.ocl.cpp b/modules/xfeatures2d/test/test_surf.ocl.cpp index d3131c3d8..c5b86f213 100644 --- a/modules/xfeatures2d/test/test_surf.ocl.cpp +++ b/modules/xfeatures2d/test/test_surf.ocl.cpp @@ -47,11 +47,8 @@ #ifdef HAVE_OPENCL -namespace cvtest { -namespace ocl { +namespace opencv_test { namespace { -using namespace std; -using std::tr1::get; static bool keyPointsEquals(const cv::KeyPoint& p1, const cv::KeyPoint& p2) { const double maxPtDif = 0.1; @@ -201,6 +198,6 @@ INSTANTIATE_TEST_CASE_P(OCL_Features2D, SURF, testing::Combine( testing::Values(Extended(false), Extended(true)), testing::Values(Upright(false), Upright(true)))); -} } // namespace cvtest::ocl +}} // namespace #endif // HAVE_OPENCL diff --git a/modules/ximgproc/perf/perf_adaptive_manifold.cpp b/modules/ximgproc/perf/perf_adaptive_manifold.cpp index 5702fab68..13c18df0e 100644 --- a/modules/ximgproc/perf/perf_adaptive_manifold.cpp +++ b/modules/ximgproc/perf/perf_adaptive_manifold.cpp @@ -1,51 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -namespace cvtest -{ - -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; - +namespace opencv_test { namespace { typedef tuple AMPerfTestParam; typedef TestBaseWithParam AdaptiveManifoldPerfTest; @@ -90,4 +48,4 @@ PERF_TEST_P( AdaptiveManifoldPerfTest, perf, SANITY_CHECK_NOTHING(); } -} +}} // namespace diff --git a/modules/ximgproc/perf/perf_bilateral_texture_filter.cpp b/modules/ximgproc/perf/perf_bilateral_texture_filter.cpp index f49e4e57c..7e35d2333 100644 --- a/modules/ximgproc/perf/perf_bilateral_texture_filter.cpp +++ b/modules/ximgproc/perf/perf_bilateral_texture_filter.cpp @@ -1,50 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -namespace cvtest -{ - -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { typedef tuple BTFTestParam; typedef TestBaseWithParam BilateralTextureFilterTest; @@ -80,4 +39,5 @@ PERF_TEST_P(BilateralTextureFilterTest, perf, SANITY_CHECK_NOTHING(); } -} + +}} // namespace diff --git a/modules/ximgproc/perf/perf_disparity_wls_filter.cpp b/modules/ximgproc/perf/perf_disparity_wls_filter.cpp index f46c66f92..b6e8402b2 100644 --- a/modules/ximgproc/perf/perf_disparity_wls_filter.cpp +++ b/modules/ximgproc/perf/perf_disparity_wls_filter.cpp @@ -1,51 +1,10 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" #include "opencv2/ximgproc/disparity_filter.hpp" -namespace cvtest -{ - -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { void MakeArtificialExample(RNG rng, Mat& dst_left_view, Mat& dst_left_disparity_map, Mat& dst_right_disparity_map, Rect& dst_ROI); @@ -166,4 +125,5 @@ void MakeArtificialExample(RNG rng, Mat& dst_left_view, Mat& dst_left_disparity_ dst_ROI = Rect(rect_disparity,0,w-rect_disparity,h); } -} + +}} // namespace diff --git a/modules/ximgproc/perf/perf_domain_transform.cpp b/modules/ximgproc/perf/perf_domain_transform.cpp index 2d99c7934..ce9c9d495 100644 --- a/modules/ximgproc/perf/perf_domain_transform.cpp +++ b/modules/ximgproc/perf/perf_domain_transform.cpp @@ -1,50 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -namespace cvtest -{ - -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { CV_ENUM(GuideMatType, CV_8UC1, CV_8UC3, CV_32FC1, CV_32FC3) //reduced set CV_ENUM(SourceMatType, CV_8UC1, CV_8UC3, CV_8UC4, CV_32FC1, CV_32FC3) //reduced set @@ -85,4 +44,4 @@ PERF_TEST_P( DomainTransformTest, perf, SANITY_CHECK_NOTHING(); } -} +}} // namespace diff --git a/modules/ximgproc/perf/perf_fast_hough_transform.cpp b/modules/ximgproc/perf/perf_fast_hough_transform.cpp index 421aadd84..dee9aadc5 100644 --- a/modules/ximgproc/perf/perf_fast_hough_transform.cpp +++ b/modules/ximgproc/perf/perf_fast_hough_transform.cpp @@ -43,18 +43,9 @@ #include "perf_precomp.hpp" -namespace cvtest { +namespace opencv_test { namespace { -using namespace std; -using namespace cv; -using namespace cv::ximgproc; -using namespace perf; -using namespace testing; - -using std::tr1::make_tuple; -using std::tr1::get; - -typedef std::tr1::tuple srcSize_srcType_dstDepth_t; +typedef tuple srcSize_srcType_dstDepth_t; typedef perf::TestBaseWithParam srcSize_srcType_dstDepth; @@ -87,4 +78,4 @@ PERF_TEST_P(srcSize_srcType_dstDepth, FastHoughTransform, #undef ALL_MAT_DEPHTS -} // namespace cvtest +}} // namespace diff --git a/modules/ximgproc/perf/perf_fgs_filter.cpp b/modules/ximgproc/perf/perf_fgs_filter.cpp index 465193b61..3dd0b8123 100644 --- a/modules/ximgproc/perf/perf_fgs_filter.cpp +++ b/modules/ximgproc/perf/perf_fgs_filter.cpp @@ -1,50 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -namespace cvtest -{ - -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { CV_ENUM(GuideTypes, CV_8UC1, CV_8UC3); CV_ENUM(SrcTypes, CV_8UC1, CV_8UC3, CV_16SC1, CV_16SC3, CV_32FC1, CV_32FC3); @@ -78,4 +37,4 @@ PERF_TEST_P( FGSFilterPerfTest, perf, Combine(GuideTypes::all(), SrcTypes::all() SANITY_CHECK_NOTHING(); } -} +}} // namespace diff --git a/modules/ximgproc/perf/perf_guided_filter.cpp b/modules/ximgproc/perf/perf_guided_filter.cpp index 4f2d74e78..db62ad564 100644 --- a/modules/ximgproc/perf/perf_guided_filter.cpp +++ b/modules/ximgproc/perf/perf_guided_filter.cpp @@ -1,50 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -namespace cvtest -{ - -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { CV_ENUM(GuideTypes, CV_8UC1, CV_8UC3, CV_32FC1, CV_32FC3); CV_ENUM(SrcTypes, CV_8UC1, CV_8UC3, CV_32FC1, CV_32FC3); @@ -78,4 +37,4 @@ PERF_TEST_P( GuidedFilterPerfTest, perf, Combine(GuideTypes::all(), SrcTypes::al SANITY_CHECK_NOTHING(); } -} +}} // namespace diff --git a/modules/ximgproc/perf/perf_l0_smooth.cpp b/modules/ximgproc/perf/perf_l0_smooth.cpp index 325c70337..2709003ed 100644 --- a/modules/ximgproc/perf/perf_l0_smooth.cpp +++ b/modules/ximgproc/perf/perf_l0_smooth.cpp @@ -1,50 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -namespace cvtest -{ - -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { typedef tuple L0SmoothTestParam; typedef TestBaseWithParam L0SmoothTest; @@ -78,4 +37,6 @@ PERF_TEST_P(L0SmoothTest, perf, SANITY_CHECK_NOTHING(); } -} + + +}} // namespace diff --git a/modules/ximgproc/perf/perf_main.cpp b/modules/ximgproc/perf/perf_main.cpp index cd025b579..b027d51ca 100644 --- a/modules/ximgproc/perf/perf_main.cpp +++ b/modules/ximgproc/perf/perf_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" CV_PERF_TEST_MAIN(edgefilter) diff --git a/modules/ximgproc/perf/perf_precomp.hpp b/modules/ximgproc/perf/perf_precomp.hpp index 88b1684fd..622b7107b 100644 --- a/modules/ximgproc/perf/perf_precomp.hpp +++ b/modules/ximgproc/perf/perf_precomp.hpp @@ -1,17 +1,15 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_PERF_PRECOMP_HPP__ #define __OPENCV_PERF_PRECOMP_HPP__ #include -#include -#include #include +namespace opencv_test { +using namespace perf; +using namespace cv::ximgproc; +} + #endif diff --git a/modules/ximgproc/perf/perf_ridge_detection_filter.cpp b/modules/ximgproc/perf/perf_ridge_detection_filter.cpp index ef1ded6e6..8d6db950c 100644 --- a/modules/ximgproc/perf/perf_ridge_detection_filter.cpp +++ b/modules/ximgproc/perf/perf_ridge_detection_filter.cpp @@ -3,12 +3,7 @@ // of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -namespace cvtest { - -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { typedef tuple RDFParams; typedef TestBaseWithParam RidgeDetectionFilterPerfTest; @@ -36,4 +31,4 @@ PERF_TEST_P(RidgeDetectionFilterPerfTest, perf, Combine( SANITY_CHECK_NOTHING(); } -} // namespace +}} // namespace diff --git a/modules/ximgproc/perf/perf_rolling_guidance_filter.cpp b/modules/ximgproc/perf/perf_rolling_guidance_filter.cpp index 89548c1fa..709c2f71a 100644 --- a/modules/ximgproc/perf/perf_rolling_guidance_filter.cpp +++ b/modules/ximgproc/perf/perf_rolling_guidance_filter.cpp @@ -1,50 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -namespace cvtest -{ - -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { typedef tuple RGFTestParam; typedef TestBaseWithParam RollingGuidanceFilterTest; @@ -80,4 +39,6 @@ PERF_TEST_P(RollingGuidanceFilterTest, perf, SANITY_CHECK_NOTHING(); } -} + + +}} // namespace diff --git a/modules/ximgproc/perf/perf_weighted_median_filter.cpp b/modules/ximgproc/perf/perf_weighted_median_filter.cpp index 7ab4e7066..ef39975b3 100644 --- a/modules/ximgproc/perf/perf_weighted_median_filter.cpp +++ b/modules/ximgproc/perf/perf_weighted_median_filter.cpp @@ -1,88 +1,49 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - - #include "perf_precomp.hpp" - - namespace cvtest - { - - using std::tr1::tuple; - using std::tr1::get; - using namespace perf; - using namespace testing; - using namespace cv; - using namespace cv::ximgproc; - - typedef tuple WMFTestParam; - typedef TestBaseWithParam WeightedMedianFilterTest; - - PERF_TEST_P(WeightedMedianFilterTest, perf, - Combine( - Values(szODD, szQVGA), - Values(CV_8U, CV_32F), - Values(1, 3), - Values(1, 3), - Values(3, 5), - Values(WMF_EXP, WMF_COS)) - ) - { - RNG rnd(1); - - WMFTestParam params = GetParam(); - - double sigma = rnd.uniform(20.0, 30.0); - Size sz = get<0>(params); - int srcDepth = get<1>(params); - int jCn = get<2>(params); - int srcCn = get<3>(params); - int r = get<4>(params); - WMFWeightType weightType = get<5>(params); - - Mat joint(sz, CV_MAKE_TYPE(CV_8U, jCn)); - Mat src(sz, CV_MAKE_TYPE(srcDepth, srcCn)); - Mat dst(sz, src.type()); - - cv::setNumThreads(cv::getNumberOfCPUs()); - declare.in(joint, src, WARMUP_RNG).out(dst).tbb_threads(cv::getNumberOfCPUs()); - - TEST_CYCLE_N(1) - { - weightedMedianFilter(joint, src, dst, r, sigma, weightType); - } - - SANITY_CHECK_NOTHING(); - } - } +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. +#include "perf_precomp.hpp" + +namespace opencv_test { namespace { + +typedef tuple WMFTestParam; +typedef TestBaseWithParam WeightedMedianFilterTest; + +PERF_TEST_P(WeightedMedianFilterTest, perf, + Combine( + Values(szODD, szQVGA), + Values(CV_8U, CV_32F), + Values(1, 3), + Values(1, 3), + Values(3, 5), + Values(WMF_EXP, WMF_COS)) +) +{ + RNG rnd(1); + + WMFTestParam params = GetParam(); + + double sigma = rnd.uniform(20.0, 30.0); + Size sz = get<0>(params); + int srcDepth = get<1>(params); + int jCn = get<2>(params); + int srcCn = get<3>(params); + int r = get<4>(params); + WMFWeightType weightType = get<5>(params); + + Mat joint(sz, CV_MAKE_TYPE(CV_8U, jCn)); + Mat src(sz, CV_MAKE_TYPE(srcDepth, srcCn)); + Mat dst(sz, src.type()); + + cv::setNumThreads(cv::getNumberOfCPUs()); + declare.in(joint, src, WARMUP_RNG).out(dst).tbb_threads(cv::getNumberOfCPUs()); + + TEST_CYCLE_N(1) + { + weightedMedianFilter(joint, src, dst, r, sigma, weightType); + } + + SANITY_CHECK_NOTHING(); +} + + +}} // namespace diff --git a/modules/ximgproc/perf/pref_joint_bilateral_filter.cpp b/modules/ximgproc/perf/pref_joint_bilateral_filter.cpp index 087308271..4a8d39d1f 100644 --- a/modules/ximgproc/perf/pref_joint_bilateral_filter.cpp +++ b/modules/ximgproc/perf/pref_joint_bilateral_filter.cpp @@ -1,50 +1,10 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -namespace cvtest -{ - -using std::tr1::tuple; -using std::tr1::get; -using namespace perf; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { typedef tuple JBFTestParam; typedef TestBaseWithParam JointBilateralFilterTest; @@ -82,4 +42,5 @@ PERF_TEST_P(JointBilateralFilterTest, perf, SANITY_CHECK_NOTHING(); } -} + +}} // namespace diff --git a/modules/ximgproc/test/test_adaptive_manifold.cpp b/modules/ximgproc/test/test_adaptive_manifold.cpp index 824459c7d..fa65a3a75 100644 --- a/modules/ximgproc/test/test_adaptive_manifold.cpp +++ b/modules/ximgproc/test/test_adaptive_manifold.cpp @@ -1,49 +1,11 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest -{ - -using namespace std; -using namespace std::tr1; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { +Ptr createAMFilterRefImpl(double sigma_s, double sigma_r, bool adjust_outliers = false); +namespace { #ifndef SQR #define SQR(x) ((x)*(x)) @@ -166,8 +128,6 @@ TEST(AdaptiveManifoldTest, AuthorsReferenceAccuracy) typedef tuple AMRefTestParams; typedef TestWithParam AdaptiveManifoldRefImplTest; -Ptr createAMFilterRefImpl(double sigma_s, double sigma_r, bool adjust_outliers = false); - TEST_P(AdaptiveManifoldRefImplTest, RefImplAccuracy) { AMRefTestParams params = GetParam(); @@ -216,4 +176,5 @@ INSTANTIATE_TEST_CASE_P(TypicalSet, AdaptiveManifoldRefImplTest, Values("cv/edgefilter/kodim23.png", "cv/npr/test4.png") )); -} + +}} // namespace \ No newline at end of file diff --git a/modules/ximgproc/test/test_adaptive_manifold_ref_impl.cpp b/modules/ximgproc/test/test_adaptive_manifold_ref_impl.cpp index 97e996a8e..dfb57c40a 100644 --- a/modules/ximgproc/test/test_adaptive_manifold_ref_impl.cpp +++ b/modules/ximgproc/test/test_adaptive_manifold_ref_impl.cpp @@ -1,38 +1,6 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. /* * The MIT License(MIT) @@ -59,14 +27,10 @@ #include "test_precomp.hpp" #include -#include -namespace -{ +namespace opencv_test { namespace { - using std::numeric_limits; - using namespace cv; - using namespace cv::ximgproc; +using namespace cv::ximgproc; struct Buf { @@ -478,7 +442,7 @@ namespace times(buf_.diff, buf_.alpha, buf_.diff); ensureSizeIsEnough(srcSize, buf_.dst); - add(src_f_, buf_.diff, buf_.dst); + cv::add(src_f_, buf_.diff, buf_.dst); // TODO cvtest buf_.dst.convertTo(_dst, CV_8U, 255.0); } @@ -800,8 +764,8 @@ namespace } } - double n = norm(dst); - divide(dst, n, dst); + double n = cvtest::norm(dst, NORM_L2); + cv::divide(dst, n, dst); // TODO cvtest } void calcEta(const Mat_& src_joint_f, const Mat_& theta, const Mat_& cluster, Mat_& dst, float sigma_s, float df, Buf& buf) @@ -860,7 +824,7 @@ namespace // Project pixel colors onto the manifold -- Eq. (3), Eq. (5) ensureSizeIsEnough(buf_.X.size(), buf_.X_squared); - multiply(buf_.X, buf_.X, buf_.X_squared); + cv::multiply(buf_.X, buf_.X, buf_.X_squared); // TODO cvtest channelsSum(buf_.X_squared, buf_.pixel_dist_to_manifold_squared); @@ -897,12 +861,12 @@ namespace ensureSizeIsEnough(src_f_.size(), buf_.w_ki_Psi_blur_resized); resize(buf_.w_ki_Psi_blur, buf_.w_ki_Psi_blur_resized, src_f_.size()); times(buf_.w_ki_Psi_blur_resized, w_ki, buf_.w_ki_Psi_blur_resized); - add(sum_w_ki_Psi_blur_, buf_.w_ki_Psi_blur_resized, sum_w_ki_Psi_blur_); + cv::add(sum_w_ki_Psi_blur_, buf_.w_ki_Psi_blur_resized, sum_w_ki_Psi_blur_); // TODO cvtest ensureSizeIsEnough(src_f_.size(), buf_.w_ki_Psi_blur_0_resized); resize(buf_.w_ki_Psi_blur_0, buf_.w_ki_Psi_blur_0_resized, src_f_.size()); times(buf_.w_ki_Psi_blur_0_resized, w_ki, buf_.w_ki_Psi_blur_0_resized); - add(sum_w_ki_Psi_blur_0_, buf_.w_ki_Psi_blur_0_resized, sum_w_ki_Psi_blur_0_); + cv::add(sum_w_ki_Psi_blur_0_, buf_.w_ki_Psi_blur_0_resized, sum_w_ki_Psi_blur_0_); // TODO cvtest // Compute two new manifolds eta_minus and eta_plus @@ -933,13 +897,13 @@ namespace Mat_& cluster_minus = buf_.cluster_minus[current_tree_level]; ensureSizeIsEnough(dot.size(), cluster_minus); - compare(dot, 0, cluster_minus, CMP_LT); + cvtest::compare(dot, 0, cluster_minus, CMP_LT); bitwise_and(cluster_minus, cluster_k, cluster_minus); Mat_& cluster_plus = buf_.cluster_plus[current_tree_level]; ensureSizeIsEnough(dot.size(), cluster_plus); //compare(dot, 0, cluster_plus, CMP_GT); - compare(dot, 0, cluster_plus, CMP_GE); + cvtest::compare(dot, 0, cluster_plus, CMP_GE); bitwise_and(cluster_plus, cluster_k, cluster_plus); // Algorithm 1, Step 4: Compute new manifolds by weighted low-pass filtering -- Eq. (7-8) @@ -960,12 +924,8 @@ namespace buildManifoldsAndPerformFiltering(eta_plus, cluster_plus, current_tree_level + 1); } } -} -namespace cvtest -{ - -using namespace cv::ximgproc; +} // namespace Ptr createAMFilterRefImpl(double sigma_s, double sigma_r, bool adjust_outliers) { @@ -978,4 +938,4 @@ Ptr createAMFilterRefImpl(double sigma_s, double sigma_r return amf; } -} +} // namespace diff --git a/modules/ximgproc/test/test_anisodiff.cpp b/modules/ximgproc/test/test_anisodiff.cpp index 813bf30e2..83555b79f 100644 --- a/modules/ximgproc/test/test_anisodiff.cpp +++ b/modules/ximgproc/test/test_anisodiff.cpp @@ -1,7 +1,9 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -using namespace cv; -using namespace std; +namespace opencv_test { namespace { TEST(ximgproc_AnisotropicDiffusion, regression) { @@ -23,3 +25,5 @@ TEST(ximgproc_AnisotropicDiffusion, regression) //printf("psnr=%.2f\n", adiff_psnr); ASSERT_GT(adiff_psnr, 25.0); } + +}} // namespace diff --git a/modules/ximgproc/test/test_bilateral_texture_filter.cpp b/modules/ximgproc/test/test_bilateral_texture_filter.cpp index 61fa97224..e79c39017 100644 --- a/modules/ximgproc/test/test_bilateral_texture_filter.cpp +++ b/modules/ximgproc/test/test_bilateral_texture_filter.cpp @@ -1,53 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest -{ - -using namespace std; -using namespace std::tr1; -using namespace testing; -using namespace perf; -using namespace cv; -using namespace cv::ximgproc; - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// +namespace opencv_test { namespace { typedef tuple BTFParams; typedef TestWithParam BilateralTextureFilterTest; @@ -138,4 +94,6 @@ INSTANTIATE_TEST_CASE_P( Values(1, 3) ) ); -} + + +}} // namespace diff --git a/modules/ximgproc/test/test_disparity_wls_filter.cpp b/modules/ximgproc/test/test_disparity_wls_filter.cpp index ed3f58a3b..12bcf34be 100644 --- a/modules/ximgproc/test/test_disparity_wls_filter.cpp +++ b/modules/ximgproc/test/test_disparity_wls_filter.cpp @@ -1,51 +1,10 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" #include "opencv2/ximgproc/disparity_filter.hpp" -namespace cvtest -{ - -using namespace std; -using namespace std::tr1; -using namespace testing; -using namespace perf; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { static string getDataDir() { @@ -151,4 +110,6 @@ TEST_P(DisparityWLSFilterTest, MultiThreadReproducibility) } } INSTANTIATE_TEST_CASE_P(FullSet,DisparityWLSFilterTest,Combine(Values(szODD, szQVGA), SrcTypes::all(), GuideTypes::all(),Values(true,false),Values(true,false))); -} + + +}} // namespace diff --git a/modules/ximgproc/test/test_domain_transform.cpp b/modules/ximgproc/test/test_domain_transform.cpp index c353ee7a0..119834100 100644 --- a/modules/ximgproc/test/test_domain_transform.cpp +++ b/modules/ximgproc/test/test_domain_transform.cpp @@ -1,50 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest -{ - -using namespace std; -using namespace std::tr1; -using namespace testing; -using namespace perf; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { static string getOpenCVExtraDir() { @@ -253,4 +212,4 @@ TEST(DomainTransformTest, AuthorReferenceAccuracy) EXPECT_LE(cvtest::norm(res_IC, ref_IC, NORM_INF), 1); } -} +}} // namespace diff --git a/modules/ximgproc/test/test_fast_hough_transform.cpp b/modules/ximgproc/test/test_fast_hough_transform.cpp index 4d8e35812..aa41132e7 100644 --- a/modules/ximgproc/test/test_fast_hough_transform.cpp +++ b/modules/ximgproc/test/test_fast_hough_transform.cpp @@ -43,15 +43,7 @@ #include "test_precomp.hpp" -namespace cvtest -{ -using namespace cv; -using namespace cv::ximgproc; -using namespace std; -using namespace testing; - -using std::tr1::make_tuple; -using std::tr1::get; +namespace opencv_test { namespace { //----------------------utils--------------------------------------------------- @@ -441,7 +433,7 @@ int TestFHT::run_n_tests_t(int depth, } //----------------------TEST_P-------------------------------------------------- -typedef std::tr1::tuple Depth_Channels_PtsC_nPerTest; +typedef tuple Depth_Channels_PtsC_nPerTest; typedef TestWithParam FastHoughTransformTest; TEST_P(FastHoughTransformTest, accuracy) @@ -467,4 +459,4 @@ INSTANTIATE_TEST_CASE_P(FullSet, FastHoughTransformTest, #undef FHT_ALL_DEPTHS #undef FHT_ALL_CHANNELS -} // namespace cvtest +}} // namespace diff --git a/modules/ximgproc/test/test_fgs_filter.cpp b/modules/ximgproc/test/test_fgs_filter.cpp index 94b4e7dbf..8fed46c90 100644 --- a/modules/ximgproc/test/test_fgs_filter.cpp +++ b/modules/ximgproc/test/test_fgs_filter.cpp @@ -1,50 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest -{ - -using namespace std; -using namespace std::tr1; -using namespace testing; -using namespace perf; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { static string getDataDir() { @@ -150,4 +109,5 @@ TEST_P(FastGlobalSmootherTest, MultiThreadReproducibility) } INSTANTIATE_TEST_CASE_P(FullSet, FastGlobalSmootherTest,Combine(Values(szODD, szQVGA), SrcTypes::all(), GuideTypes::all())); -} + +}} // namespace diff --git a/modules/ximgproc/test/test_fld.cpp b/modules/ximgproc/test/test_fld.cpp index 7e8e6823c..80f877648 100644 --- a/modules/ximgproc/test/test_fld.cpp +++ b/modules/ximgproc/test/test_fld.cpp @@ -1,10 +1,9 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -#include - -using namespace cv; -using namespace cv::ximgproc; -using namespace std; +namespace opencv_test { namespace { const Size img_size(640, 480); const int FLD_TEST_SEED = 0x134679; @@ -171,3 +170,6 @@ TEST_F(ximgproc_FLD, rotatedRect) } ASSERT_EQ(EPOCHS, passedtests); } + + +}} // namespace diff --git a/modules/ximgproc/test/test_guided_filter.cpp b/modules/ximgproc/test/test_guided_filter.cpp index 29fdf8896..bc46ee1db 100644 --- a/modules/ximgproc/test/test_guided_filter.cpp +++ b/modules/ximgproc/test/test_guided_filter.cpp @@ -1,49 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest -{ - -using namespace std; -using namespace std::tr1; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { #ifndef SQR #define SQR(x) ((x)*(x)) @@ -92,7 +52,7 @@ static Mat convertTypeAndSize(Mat src, int dstType, Size dstSize) Mat randItem(src.size(), CV_MAKE_TYPE(src.depth(), 1)); randn(randItem, 0, (maxVal - minVal) / 100); - add(donor, randItem, srcCn[i]); + cv::add(donor, randItem, srcCn[i]); // TODO cvtest } merge(srcCn, dst); @@ -435,4 +395,5 @@ INSTANTIATE_TEST_CASE_P(TypicalSet, GuidedFilterTest, Values("cv/shared/lena.png", "cv/shared/baboon.png") )); -} + +}} // namespace diff --git a/modules/ximgproc/test/test_joint_bilateral_filter.cpp b/modules/ximgproc/test/test_joint_bilateral_filter.cpp index 0436c6664..ef846b50f 100644 --- a/modules/ximgproc/test/test_joint_bilateral_filter.cpp +++ b/modules/ximgproc/test/test_joint_bilateral_filter.cpp @@ -1,49 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest -{ - -using namespace std; -using namespace std::tr1; -using namespace testing; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { static std::string getOpenCVExtraDir() { @@ -133,8 +93,8 @@ void jointBilateralFilterNaive_(InputArray joint_, InputArray src_, OutputArray Mat_ dst = dst_.getMat(); Mat_ jointExt; Mat_ srcExt; - copyMakeBorder(src_, srcExt, radius, radius, radius, radius, borderType); - copyMakeBorder(joint_, jointExt, radius, radius, radius, radius, borderType); + cv::copyMakeBorder(src_, srcExt, radius, radius, radius, radius, borderType); // TODO cvtest + cv::copyMakeBorder(joint_, jointExt, radius, radius, radius, radius, borderType); // TODO cvtest float colorGaussCoef = (float)(-0.5 / (sigmaColor*sigmaColor)); float spaceGaussCoef = (float)(-0.5 / (sigmaSpace*sigmaSpace)); @@ -284,4 +244,5 @@ INSTANTIATE_TEST_CASE_P(Set1, JointBilateralFilterTest_BilateralRef, ) ); -} + +}} // namespace diff --git a/modules/ximgproc/test/test_l0_smooth.cpp b/modules/ximgproc/test/test_l0_smooth.cpp index 9f006a504..7185c6b9d 100644 --- a/modules/ximgproc/test/test_l0_smooth.cpp +++ b/modules/ximgproc/test/test_l0_smooth.cpp @@ -1,50 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest -{ - -using namespace std; -using namespace std::tr1; -using namespace testing; -using namespace perf; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { CV_ENUM(SrcTypes, CV_8UC1, CV_8UC3, CV_16UC1, CV_16UC3); typedef tuple L0SmoothParams; @@ -117,4 +76,5 @@ TEST_P(L0SmoothTest, MultiThreadReproducibility) } INSTANTIATE_TEST_CASE_P(FullSet, L0SmoothTest,Combine(Values(szODD, szQVGA), SrcTypes::all())); -} + +}} // namespace diff --git a/modules/ximgproc/test/test_main.cpp b/modules/ximgproc/test/test_main.cpp index 6f9ac2e0d..a6fc332d4 100644 --- a/modules/ximgproc/test/test_main.cpp +++ b/modules/ximgproc/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("") diff --git a/modules/ximgproc/test/test_precomp.hpp b/modules/ximgproc/test/test_precomp.hpp index 2804a9fb3..1b24cca39 100644 --- a/modules/ximgproc/test/test_precomp.hpp +++ b/modules/ximgproc/test/test_precomp.hpp @@ -1,21 +1,19 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ -#include "opencv2/core.hpp" -#include "opencv2/imgproc.hpp" -#include "opencv2/imgproc/types_c.h" #include "opencv2/ximgproc.hpp" -#include "opencv2/highgui.hpp" #include "opencv2/ts.hpp" #include #include +namespace opencv_test { +using namespace cv::ximgproc; +using namespace perf; // szODD + +Ptr createAMFilterRefImpl(double sigma_s, double sigma_r, bool adjust_outliers); +} + #endif diff --git a/modules/ximgproc/test/test_ridge_detection_filter.cpp b/modules/ximgproc/test/test_ridge_detection_filter.cpp index ba56f1ecf..3fa507aba 100644 --- a/modules/ximgproc/test/test_ridge_detection_filter.cpp +++ b/modules/ximgproc/test/test_ridge_detection_filter.cpp @@ -4,10 +4,7 @@ #include "test_precomp.hpp" -namespace cvtest { - -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { TEST(ximgproc_ridgedetectionfilter, ReferenceAccuracy) { @@ -29,4 +26,4 @@ TEST(ximgproc_ridgedetectionfilter, ReferenceAccuracy) EXPECT_EQ(zeros, 0); } -} // namespace +}} // namespace diff --git a/modules/ximgproc/test/test_rolling_guidance_filter.cpp b/modules/ximgproc/test/test_rolling_guidance_filter.cpp index 3c36759bd..eec5b724e 100644 --- a/modules/ximgproc/test/test_rolling_guidance_filter.cpp +++ b/modules/ximgproc/test/test_rolling_guidance_filter.cpp @@ -1,50 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest -{ - -using namespace std; -using namespace std::tr1; -using namespace testing; -using namespace perf; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { static std::string getOpenCVExtraDir() { @@ -209,4 +168,6 @@ INSTANTIATE_TEST_CASE_P(TypicalSet2, RollingGuidanceFilterTest_BilateralRef, Values(CV_8UC1, CV_8UC3, CV_32FC1, CV_32FC3) ) ); -} + + +}} // namespace diff --git a/modules/ximgproc/test/test_sparse_match_interpolator.cpp b/modules/ximgproc/test/test_sparse_match_interpolator.cpp index fece6dbf2..38d74d358 100644 --- a/modules/ximgproc/test/test_sparse_match_interpolator.cpp +++ b/modules/ximgproc/test/test_sparse_match_interpolator.cpp @@ -1,52 +1,10 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" #include "opencv2/ximgproc/sparse_match_interpolator.hpp" -#include - -namespace cvtest -{ -using namespace std; -using namespace std::tr1; -using namespace testing; -using namespace perf; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { static string getDataDir() { @@ -60,7 +18,7 @@ Mat readOpticalFlow( const String& path ) //FIXME: ensure right sizes of int and float - here and in writeOpticalFlow() Mat_ flow; - ifstream file(path.c_str(), std::ios_base::binary); + std::ifstream file(path.c_str(), std::ios_base::binary); if ( !file.good() ) return flow; // no file - return empty matrix @@ -112,7 +70,7 @@ TEST(InterpolatorTest, ReferenceAccuracy) Mat ref_flow = readOpticalFlow(dir + "/RubberWhale_reference_result.flo"); ASSERT_FALSE(ref_flow.empty()); - ifstream file((dir + "/RubberWhale_sparse_matches.txt").c_str()); + std::ifstream file((dir + "/RubberWhale_sparse_matches.txt").c_str()); float from_x,from_y,to_x,to_y; vector from_points; vector to_points; @@ -192,4 +150,6 @@ TEST_P(InterpolatorTest, MultiThreadReproducibility) } } INSTANTIATE_TEST_CASE_P(FullSet,InterpolatorTest, Combine(Values(szODD,szVGA), GuideTypes::all())); -} \ No newline at end of file + + +}} // namespace diff --git a/modules/ximgproc/test/test_structured_edge_detection.cpp b/modules/ximgproc/test/test_structured_edge_detection.cpp index cd74323c8..b10e14d0d 100644 --- a/modules/ximgproc/test/test_structured_edge_detection.cpp +++ b/modules/ximgproc/test/test_structured_edge_detection.cpp @@ -1,7 +1,9 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest -{ +namespace opencv_test { namespace { TEST(ximpgroc_StructuredEdgeDetection, regression) { @@ -37,4 +39,4 @@ TEST(ximpgroc_StructuredEdgeDetection, regression) } } -} \ No newline at end of file +}} // namespace diff --git a/modules/ximgproc/test/test_thinning.cpp b/modules/ximgproc/test/test_thinning.cpp index b5a9fe2ff..6e61a3e25 100644 --- a/modules/ximgproc/test/test_thinning.cpp +++ b/modules/ximgproc/test/test_thinning.cpp @@ -4,10 +4,7 @@ #include "test_precomp.hpp" -using namespace cv; -using namespace cv::ximgproc; - -namespace { +namespace opencv_test { namespace { static int createTestImage(Mat& src) { @@ -51,4 +48,5 @@ TEST(ximpgroc_Thinning, simple_GUOHALL) #endif } -} + +}} // namespace diff --git a/modules/ximgproc/test/test_weighted_median_filter.cpp b/modules/ximgproc/test/test_weighted_median_filter.cpp index 69a653047..627c1bf5e 100644 --- a/modules/ximgproc/test/test_weighted_median_filter.cpp +++ b/modules/ximgproc/test/test_weighted_median_filter.cpp @@ -1,50 +1,9 @@ -/* - * By downloading, copying, installing or using the software you agree to this license. - * If you do not agree to this license, do not download, install, - * copy or use the software. - * - * - * License Agreement - * For Open Source Computer Vision Library - * (3 - clause BSD License) - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met : - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and / or other materials provided with the distribution. - * - * * Neither the names of the copyright holders nor the names of the contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * This software is provided by the copyright holders and contributors "as is" and - * any express or implied warranties, including, but not limited to, the implied - * warranties of merchantability and fitness for a particular purpose are disclaimed. - * In no event shall copyright holders or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or services; - * loss of use, data, or profits; or business interruption) however caused - * and on any theory of liability, whether in contract, strict liability, - * or tort(including negligence or otherwise) arising in any way out of - * the use of this software, even if advised of the possibility of such damage. - */ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest -{ - -using namespace std; -using namespace std::tr1; -using namespace testing; -using namespace perf; -using namespace cv; -using namespace cv::ximgproc; +namespace opencv_test { namespace { static string getDataDir() { @@ -114,4 +73,5 @@ TEST(WeightedMedianFilterTest, mask_zeros_no_crash) INSTANTIATE_TEST_CASE_P(TypicalSET, WeightedMedianFilterTest, Combine(Values(szODD, szQVGA), Values(WMF_EXP, WMF_IV2, WMF_OFF))); -} + +}} // namespace diff --git a/modules/xphoto/perf/perf_grayworld.cpp b/modules/xphoto/perf/perf_grayworld.cpp index 32eea8f19..d54408230 100644 --- a/modules/xphoto/perf/perf_grayworld.cpp +++ b/modules/xphoto/perf/perf_grayworld.cpp @@ -1,10 +1,11 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -using namespace std; -using namespace cv; -using namespace perf; +namespace opencv_test { namespace { -typedef std::tr1::tuple Size_WBThresh_t; +typedef tuple Size_WBThresh_t; typedef perf::TestBaseWithParam Size_WBThresh; PERF_TEST_P( Size_WBThresh, autowbGrayworld, @@ -14,8 +15,8 @@ PERF_TEST_P( Size_WBThresh, autowbGrayworld, ) ) { - Size size = std::tr1::get<0>(GetParam()); - float wb_thresh = std::tr1::get<1>(GetParam()); + Size size = get<0>(GetParam()); + float wb_thresh = get<1>(GetParam()); Mat src(size, CV_8UC3); Mat dst(size, CV_8UC3); @@ -29,3 +30,5 @@ PERF_TEST_P( Size_WBThresh, autowbGrayworld, SANITY_CHECK(dst); } + +}} // namespace diff --git a/modules/xphoto/perf/perf_learning_based_color_balance.cpp b/modules/xphoto/perf/perf_learning_based_color_balance.cpp index 0c2e49ed7..794fdd10b 100644 --- a/modules/xphoto/perf/perf_learning_based_color_balance.cpp +++ b/modules/xphoto/perf/perf_learning_based_color_balance.cpp @@ -1,51 +1,12 @@ -/* -* By downloading, copying, installing or using the software you agree to this license. -* If you do not agree to this license, do not download, install, -* copy or use the software. -* -* -* License Agreement -* For Open Source Computer Vision Library -* (3 - clause BSD License) -* -* Redistribution and use in source and binary forms, with or without modification, -* are permitted provided that the following conditions are met : -* -* * Redistributions of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* * Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and / or other materials provided with the distribution. -* -* * Neither the names of the copyright holders nor the names of the contributors -* may be used to endorse or promote products derived from this software -* without specific prior written permission. -* -* This software is provided by the copyright holders and contributors "as is" and -* any express or implied warranties, including, but not limited to, the implied -* warranties of merchantability and fitness for a particular purpose are disclaimed. -* In no event shall copyright holders or contributors be liable for any direct, -* indirect, incidental, special, exemplary, or consequential damages -* (including, but not limited to, procurement of substitute goods or services; -* loss of use, data, or profits; or business interruption) however caused -* and on any theory of liability, whether in contract, strict liability, -* or tort(including negligence or otherwise) arising in any way out of -* the use of this software, even if advised of the possibility of such damage. -*/ - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" -#include "opencv2/imgproc.hpp" -using std::tr1::tuple; -using std::tr1::get; -using namespace std; -using namespace cv; -using namespace perf; -using namespace testing; +namespace opencv_test { namespace { typedef tuple learningBasedWBParams; -typedef TestBaseWithParam learningBasedWBPerfTest; +typedef perf::TestBaseWithParam learningBasedWBPerfTest; PERF_TEST_P(learningBasedWBPerfTest, perf, Combine(SZ_ALL_HD, Values(CV_8UC3, CV_16UC3))) { @@ -74,3 +35,6 @@ PERF_TEST_P(learningBasedWBPerfTest, perf, Combine(SZ_ALL_HD, Values(CV_8UC3, CV SANITY_CHECK_NOTHING(); } + + +}} // namespace diff --git a/modules/xphoto/perf/perf_main.cpp b/modules/xphoto/perf/perf_main.cpp index 38462c503..db11778a4 100644 --- a/modules/xphoto/perf/perf_main.cpp +++ b/modules/xphoto/perf/perf_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "perf_precomp.hpp" CV_PERF_TEST_MAIN(xphoto) diff --git a/modules/xphoto/perf/perf_precomp.hpp b/modules/xphoto/perf/perf_precomp.hpp index c05598c62..cc4fd1407 100644 --- a/modules/xphoto/perf/perf_precomp.hpp +++ b/modules/xphoto/perf/perf_precomp.hpp @@ -1,19 +1,10 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_PERF_PRECOMP_HPP__ #define __OPENCV_PERF_PRECOMP_HPP__ #include "opencv2/ts.hpp" #include "opencv2/xphoto.hpp" -#ifdef GTEST_CREATE_SHARED_LIBRARY -#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined -#endif - #endif diff --git a/modules/xphoto/test/dct_image_denoising.cpp b/modules/xphoto/test/dct_image_denoising.cpp index 9426b7922..bc2f7782b 100644 --- a/modules/xphoto/test/dct_image_denoising.cpp +++ b/modules/xphoto/test/dct_image_denoising.cpp @@ -1,7 +1,10 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest -{ +namespace opencv_test { namespace { + TEST(xphoto_dctimagedenoising, regression) { cv::String subfolder = "cv/xphoto/"; @@ -34,4 +37,6 @@ namespace cvtest EXPECT_LE( mse[0] + mse[1] + mse[2] + mse[3], thresholds[i] ); } } -} \ No newline at end of file + + +}} // namespace diff --git a/modules/xphoto/test/simple_color_balance.cpp b/modules/xphoto/test/simple_color_balance.cpp index b1f441352..c88246577 100644 --- a/modules/xphoto/test/simple_color_balance.cpp +++ b/modules/xphoto/test/simple_color_balance.cpp @@ -1,7 +1,10 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest -{ +namespace opencv_test { namespace { + TEST(xphoto_simplecolorbalance, regression) { cv::String dir = cvtest::TS::ptr()->get_data_path() + "cv/xphoto/simple_white_balance/"; @@ -51,4 +54,6 @@ namespace cvtest ASSERT_NEAR(maxDst, newMax, newMax*1e-4); } -} + + +}} // namespace diff --git a/modules/xphoto/test/test_denoise_bm3d.cpp b/modules/xphoto/test/test_denoise_bm3d.cpp index 01968ae44..956da3eb0 100644 --- a/modules/xphoto/test/test_denoise_bm3d.cpp +++ b/modules/xphoto/test/test_denoise_bm3d.cpp @@ -41,7 +41,6 @@ //M*/ #include "test_precomp.hpp" -#include //#define DUMP_RESULTS //#define TEST_TRANSFORMS @@ -61,8 +60,8 @@ using namespace cv::xphoto; #ifdef OPENCV_ENABLE_NONFREE -namespace cvtest -{ +namespace opencv_test { namespace { + TEST(xphoto_DenoisingBm3dGrayscale, regression_L2) { std::string folder = std::string(cvtest::TS::ptr()->get_data_path()) + "cv/xphoto/bm3d_image_denoising/"; @@ -460,6 +459,6 @@ namespace cvtest #endif // TEST_TRANSFORMS -} +}} // namespace -#endif // OPENCV_ENABLE_NONFREE \ No newline at end of file +#endif // OPENCV_ENABLE_NONFREE diff --git a/modules/xphoto/test/test_grayworld.cpp b/modules/xphoto/test/test_grayworld.cpp index dbdada02d..69b03bb1c 100644 --- a/modules/xphoto/test/test_grayworld.cpp +++ b/modules/xphoto/test/test_grayworld.cpp @@ -1,8 +1,9 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -namespace cvtest { - - using namespace cv; +namespace opencv_test { namespace { void ref_autowbGrayworld(InputArray _src, OutputArray _dst, float thresh) { @@ -94,4 +95,5 @@ namespace cvtest { } } -} + +}} // namespace diff --git a/modules/xphoto/test/test_learning_based_color_balance.cpp b/modules/xphoto/test/test_learning_based_color_balance.cpp index 47b12c4fc..a083ff7a7 100644 --- a/modules/xphoto/test/test_learning_based_color_balance.cpp +++ b/modules/xphoto/test/test_learning_based_color_balance.cpp @@ -1,7 +1,10 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" -using namespace cv; -namespace cvtest -{ + +namespace opencv_test { namespace { + TEST(xphoto_simplefeatures, regression) { float acc_thresh = 0.01f; @@ -10,7 +13,7 @@ TEST(xphoto_simplefeatures, regression) Mat test_im(1000, 1000, CV_8UC3); RNG rng(1234); rng.fill(test_im, RNG::NORMAL, Scalar(64, 100, 128), Scalar(10, 10, 10)); - threshold(test_im, test_im, 200.0, 255.0, THRESH_TRUNC); + cvtest::threshold(test_im, test_im, 200.0, 255.0, THRESH_TRUNC); test_im.at(0, 0) = Vec3b(240, 220, 200); // Which should have the following features: @@ -39,4 +42,6 @@ TEST(xphoto_simplefeatures, regression) ASSERT_LE(cv::norm(dst_features[2], ref1, NORM_INF), acc_thresh); ASSERT_LE(cv::norm(dst_features[3], ref1, NORM_INF), acc_thresh); } -} + + +}} // namespace diff --git a/modules/xphoto/test/test_main.cpp b/modules/xphoto/test/test_main.cpp index 6f9ac2e0d..a6fc332d4 100644 --- a/modules/xphoto/test/test_main.cpp +++ b/modules/xphoto/test/test_main.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "test_precomp.hpp" CV_TEST_MAIN("") diff --git a/modules/xphoto/test/test_precomp.hpp b/modules/xphoto/test/test_precomp.hpp index fe59eeefb..18249e235 100644 --- a/modules/xphoto/test/test_precomp.hpp +++ b/modules/xphoto/test/test_precomp.hpp @@ -1,22 +1,10 @@ -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wmissing-declarations" -# if defined __clang__ || defined __APPLE__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -# pragma GCC diagnostic ignored "-Wextra" -# endif -#endif - +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #ifndef __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__ -#include "opencv2/core.hpp" -#include "opencv2/imgproc.hpp" -#include "opencv2/imgproc/types_c.h" -#include "opencv2/highgui.hpp" #include "opencv2/xphoto.hpp" #include "opencv2/ts.hpp" -#include -#include - #endif