diff --git a/modules/ocl/src/initialization.cpp b/modules/ocl/src/initialization.cpp index d1ad695ff8..5d81517959 100644 --- a/modules/ocl/src/initialization.cpp +++ b/modules/ocl/src/initialization.cpp @@ -319,7 +319,7 @@ namespace cv char clVersion[256]; for (unsigned i = 0; i < numPlatforms; ++i) { - cl_uint numsdev; + cl_uint numsdev = 0; cl_int status = clGetDeviceIDs(platforms[i], devicetype, 0, NULL, &numsdev); if(status != CL_DEVICE_NOT_FOUND) openCLVerifyCall(status); diff --git a/modules/ocl/test/main.cpp b/modules/ocl/test/main.cpp index 4ba02cf9bc..1250691a1f 100644 --- a/modules/ocl/test/main.cpp +++ b/modules/ocl/test/main.cpp @@ -73,14 +73,12 @@ void print_info() #endif } -std::string workdir; int main(int argc, char **argv) { - TS::ptr()->init("ocl"); + TS::ptr()->init("."); InitGoogleTest(&argc, argv); const char *keys = "{ h | help | false | print help message }" - "{ w | workdir | ../../../samples/c/| set working directory }" "{ t | type | gpu | set device type:cpu or gpu}" "{ p | platform | 0 | set platform id }" "{ d | device | 0 | set device id }"; @@ -92,7 +90,6 @@ int main(int argc, char **argv) cmd.printParams(); return 0; } - workdir = cmd.get("workdir"); string type = cmd.get("type"); unsigned int pid = cmd.get("platform"); int device = cmd.get("device"); diff --git a/modules/ocl/test/test_calib3d.cpp b/modules/ocl/test/test_calib3d.cpp index 14fb31f53a..950f19d3c0 100644 --- a/modules/ocl/test/test_calib3d.cpp +++ b/modules/ocl/test/test_calib3d.cpp @@ -50,7 +50,6 @@ using namespace cv; -extern std::string workdir; PARAM_TEST_CASE(StereoMatchBM, int, int) { int n_disp; @@ -66,9 +65,9 @@ PARAM_TEST_CASE(StereoMatchBM, int, int) TEST_P(StereoMatchBM, Regression) { - Mat left_image = readImage("stereobm/aloe-L.png", IMREAD_GRAYSCALE); - Mat right_image = readImage("stereobm/aloe-R.png", IMREAD_GRAYSCALE); - Mat disp_gold = readImage("stereobm/aloe-disp.png", IMREAD_GRAYSCALE); + Mat left_image = readImage("gpu/stereobm/aloe-L.png", IMREAD_GRAYSCALE); + Mat right_image = readImage("gpu/stereobm/aloe-R.png", IMREAD_GRAYSCALE); + Mat disp_gold = readImage("gpu/stereobm/aloe-disp.png", IMREAD_GRAYSCALE); ocl::oclMat d_left, d_right; ocl::oclMat d_disp(left_image.size(), CV_8U); Mat disp; @@ -113,9 +112,9 @@ PARAM_TEST_CASE(StereoMatchBP, int, int, int, float, float, float, float) }; TEST_P(StereoMatchBP, Regression) { - Mat left_image = readImage("stereobp/aloe-L.png"); - Mat right_image = readImage("stereobp/aloe-R.png"); - Mat disp_gold = readImage("stereobp/aloe-disp.png", IMREAD_GRAYSCALE); + Mat left_image = readImage("gpu/stereobp/aloe-L.png"); + Mat right_image = readImage("gpu/stereobp/aloe-R.png"); + Mat disp_gold = readImage("gpu/stereobp/aloe-disp.png", IMREAD_GRAYSCALE); ocl::oclMat d_left, d_right; ocl::oclMat d_disp; Mat disp; @@ -166,9 +165,9 @@ PARAM_TEST_CASE(StereoMatchConstSpaceBP, int, int, int, int, float, float, float }; TEST_P(StereoMatchConstSpaceBP, Regression) { - Mat left_image = readImage("csstereobp/aloe-L.png"); - Mat right_image = readImage("csstereobp/aloe-R.png"); - Mat disp_gold = readImage("csstereobp/aloe-disp.png", IMREAD_GRAYSCALE); + Mat left_image = readImage("gpu/csstereobp/aloe-L.png"); + Mat right_image = readImage("gpu/csstereobp/aloe-R.png"); + Mat disp_gold = readImage("gpu/csstereobp/aloe-disp.png", IMREAD_GRAYSCALE); ocl::oclMat d_left, d_right; ocl::oclMat d_disp; diff --git a/modules/ocl/test/test_canny.cpp b/modules/ocl/test/test_canny.cpp index 10032e897c..b378b2281b 100644 --- a/modules/ocl/test/test_canny.cpp +++ b/modules/ocl/test/test_canny.cpp @@ -48,7 +48,6 @@ //////////////////////////////////////////////////////// // Canny -extern std::string workdir; IMPLEMENT_PARAM_CLASS(AppertureSize, int); IMPLEMENT_PARAM_CLASS(L2gradient, bool); @@ -67,7 +66,7 @@ PARAM_TEST_CASE(Canny, AppertureSize, L2gradient) TEST_P(Canny, Accuracy) { - cv::Mat img = readImage(workdir + "fruits.jpg", cv::IMREAD_GRAYSCALE); + cv::Mat img = readImage("cv/shared/fruits.png", cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); double low_thresh = 50.0; diff --git a/modules/ocl/test/test_moments.cpp b/modules/ocl/test/test_moments.cpp index 86f4779d68..e3ab1fa3ce 100644 --- a/modules/ocl/test/test_moments.cpp +++ b/modules/ocl/test/test_moments.cpp @@ -45,7 +45,7 @@ TEST_P(MomentsTest, Mat) { if(test_contours) { - Mat src = imread( workdir + "../cpp/pic3.png", IMREAD_GRAYSCALE ); + Mat src = readImage( "cv/shared/pic3.png", IMREAD_GRAYSCALE ); ASSERT_FALSE(src.empty()); Mat canny_output; vector > contours; diff --git a/modules/ocl/test/test_objdetect.cpp b/modules/ocl/test/test_objdetect.cpp index bc719b0974..e9b571e602 100644 --- a/modules/ocl/test/test_objdetect.cpp +++ b/modules/ocl/test/test_objdetect.cpp @@ -63,11 +63,8 @@ PARAM_TEST_CASE(HOG, Size, int) { winSize = GET_PARAM(0); type = GET_PARAM(1); - img_rgb = readImage(workdir + "../gpu/road.png"); - if(img_rgb.empty()) - { - std::cout << "Couldn't read road.png" << std::endl; - } + img_rgb = readImage("gpu/hog/road.png"); + ASSERT_FALSE(img_rgb.empty()); } }; @@ -211,18 +208,11 @@ PARAM_TEST_CASE(Haar, int, CascadeName) virtual void SetUp() { flags = GET_PARAM(0); - cascadeName = (workdir + "../../data/haarcascades/").append(GET_PARAM(1)); - if( (!cascade.load( cascadeName )) || (!cpucascade.load(cascadeName)) ) - { - std::cout << "ERROR: Could not load classifier cascade" << std::endl; - return; - } - img = readImage(workdir + "lena.jpg", IMREAD_GRAYSCALE); - if(img.empty()) - { - std::cout << "Couldn't read lena.jpg" << std::endl; - return ; - } + cascadeName = (string(cvtest::TS::ptr()->get_data_path()) + "cv/cascadeandhog/cascades/").append(GET_PARAM(1)); + ASSERT_TRUE(cascade.load( cascadeName )); + ASSERT_TRUE(cpucascade.load(cascadeName)); + img = readImage("cv/shared/lena.png", IMREAD_GRAYSCALE); + ASSERT_FALSE(img.empty()); equalizeHist(img, img); d_img.upload(img); } diff --git a/modules/ocl/test/test_optflow.cpp b/modules/ocl/test/test_optflow.cpp index 34adb352c2..941ade129e 100644 --- a/modules/ocl/test/test_optflow.cpp +++ b/modules/ocl/test/test_optflow.cpp @@ -75,7 +75,7 @@ PARAM_TEST_CASE(GoodFeaturesToTrack, MinDistance) TEST_P(GoodFeaturesToTrack, Accuracy) { - cv::Mat frame = readImage(workdir + "../gpu/rubberwhale1.png", cv::IMREAD_GRAYSCALE); + cv::Mat frame = readImage("gpu/opticalflow/rubberwhale1.png", cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame.empty()); int maxCorners = 1000; @@ -146,10 +146,10 @@ PARAM_TEST_CASE(TVL1, bool) TEST_P(TVL1, Accuracy) { - cv::Mat frame0 = readImage(workdir + "../gpu/rubberwhale1.png", cv::IMREAD_GRAYSCALE); + cv::Mat frame0 = readImage("gpu/opticalflow/rubberwhale1.png", cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame0.empty()); - cv::Mat frame1 = readImage(workdir + "../gpu/rubberwhale2.png", cv::IMREAD_GRAYSCALE); + cv::Mat frame1 = readImage("gpu/opticalflow/rubberwhale2.png", cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame1.empty()); cv::ocl::OpticalFlowDual_TVL1_OCL d_alg; @@ -188,10 +188,10 @@ PARAM_TEST_CASE(Sparse, bool, bool) TEST_P(Sparse, Mat) { - cv::Mat frame0 = readImage(workdir + "../gpu/rubberwhale1.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR); + cv::Mat frame0 = readImage("gpu/opticalflow/rubberwhale1.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR); ASSERT_FALSE(frame0.empty()); - cv::Mat frame1 = readImage(workdir + "../gpu/rubberwhale2.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR); + cv::Mat frame1 = readImage("gpu/opticalflow/rubberwhale2.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR); ASSERT_FALSE(frame1.empty()); cv::Mat gray_frame; @@ -301,10 +301,10 @@ PARAM_TEST_CASE(Farneback, PyrScale, PolyN, FarnebackOptFlowFlags, UseInitFlow) TEST_P(Farneback, Accuracy) { - cv::Mat frame0 = imread(workdir + "/rubberwhale1.png", cv::IMREAD_GRAYSCALE); + cv::Mat frame0 = readImage("gpu/opticalflow/rubberwhale1.png", cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame0.empty()); - cv::Mat frame1 = imread(workdir + "/rubberwhale2.png", cv::IMREAD_GRAYSCALE); + cv::Mat frame1 = readImage("gpu/opticalflow/rubberwhale2.png", cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame1.empty()); double polySigma = polyN <= 5 ? 1.1 : 1.5;