fixed tests for ocl_filter2d, ocl_matchTemplate, ocl_histogram.cpp
authorElena Gvozdeva <elena.gvozdeva@itseez.com>
Wed, 6 Aug 2014 12:14:48 +0000 (16:14 +0400)
committerElena Gvozdeva <elena.gvozdeva@itseez.com>
Thu, 7 Aug 2014 11:36:00 +0000 (15:36 +0400)
modules/imgproc/test/ocl/test_filter2d.cpp
modules/imgproc/test/ocl/test_histogram.cpp
modules/imgproc/test/ocl/test_match_template.cpp

index 03a6bcf..38a25a9 100644 (file)
@@ -125,7 +125,7 @@ OCL_INSTANTIATE_TEST_CASE_P(ImageProc, Filter2D,
                             Combine(
                                 Values(CV_8U, CV_16U, CV_32F),
                                 OCL_ALL_CHANNELS,
-                                Values(3, 5, 9),  // Kernel size
+                                Values(3, 5, 7),  // Kernel size
                                 Values(1, 4, 8),   // Width mutiple
                                 Values((BorderType)BORDER_CONSTANT,
                                        (BorderType)BORDER_REPLICATE,
index e8813c8..9d73614 100644 (file)
@@ -99,6 +99,10 @@ PARAM_TEST_CASE(CalcBackProject, MatDepth, int, bool)
         Size roiSize = randomSize(1, MAX_VALUE);
 
         int totalChannels = 0;
+
+        ranges.clear();
+        channels.clear();
+
         for (int i = 0; i < N; ++i)
         {
             Border srcBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
@@ -202,9 +206,9 @@ OCL_TEST_P(CalcBackProject, Mat)
         OCL_ON(cv::calcBackProject(uimages_roi, channels, uhist_roi, udst_roi, ranges, scale));
 
         Size dstSize = dst_roi.size();
-        int nDiffs = (int)(0.03f*dstSize.height*dstSize.width);
+        int nDiffs = (int)(0.06f*dstSize.area()+1);
 
-        //check if the dst mats are the same except 3% difference
+        //check if the dst mats are the same except 6% difference
         EXPECT_MAT_N_DIFF(dst_roi, udst_roi, nDiffs);
     }
 }
index a525039..a2c7f57 100644 (file)
@@ -99,7 +99,7 @@ PARAM_TEST_CASE(MatchTemplate, MatDepth, Channels, MatchTemplType, bool)
 
     void Near(double threshold = 0.0)
     {
-        OCL_EXPECT_MATS_NEAR_RELATIVE(result, threshold);
+        OCL_EXPECT_MATS_NEAR(result, threshold);
     }
 };
 
@@ -112,7 +112,14 @@ OCL_TEST_P(MatchTemplate, Mat)
         OCL_OFF(cv::matchTemplate(image_roi, templ_roi, result_roi, method));
         OCL_ON(cv::matchTemplate(uimage_roi, utempl_roi, uresult_roi, method));
 
-        Near(1.5e-4);
+        bool isNormed =
+        method == TM_CCORR_NORMED ||
+        method == TM_SQDIFF_NORMED ||
+        method == TM_CCOEFF_NORMED;
+        
+        double eps = isNormed ? 3e-2 : 255.0 * 255.0 * templ.total() * 2e-5;
+        
+        Near(eps);
     }
 }