TAPI: stitching: blender: fix OpenCL path & adjust test condition
authorAlexander Alekhin <alexander.alekhin@itseez.com>
Wed, 12 Mar 2014 15:33:30 +0000 (19:33 +0400)
committerAndrey Pavlenko <andrey.pavlenko@itseez.com>
Fri, 11 Apr 2014 09:09:16 +0000 (13:09 +0400)
modules/stitching/src/opencl/multibandblend.cl
modules/stitching/test/test_blenders.cpp

index d42ad82..72d3de0 100644 (file)
 
 #define workType TYPE(weight_T1, src_CN)
 #define convertSrcToWorkType CONVERT_TO(workType)
-#define convertWorkTypeToDstType CONVERT(workType, dst_T)
+#define convertToDstType CONVERT_TO(dst_T) // sat_rte provides incompatible results with CPU path
 
 __kernel void feed(
         DECLARE_MAT_ARG(src), DECLARE_MAT_ARG(weight),
@@ -241,7 +241,7 @@ __kernel void feed(
 
         weight_T w = LOAD_MAT_AT(weight, weight_byteOffset);
         workType src_value = convertSrcToWorkType(LOAD_MAT_AT(src, src_byteOffset));
-        STORE_MAT_AT(dst, dst_byteOffset, LOAD_MAT_AT(dst, dst_byteOffset) + convertWorkTypeToDstType(src_value * w));
+        STORE_MAT_AT(dst, dst_byteOffset, LOAD_MAT_AT(dst, dst_byteOffset) + convertToDstType(src_value * w));
         STORE_MAT_AT(dstWeight, dstWeight_byteOffset, LOAD_MAT_AT(dstWeight, dstWeight_byteOffset) + w);
     }
 }
@@ -252,7 +252,7 @@ __kernel void feed(
 
 #define workType TYPE(weight_T1, mat_CN)
 #define convertSrcToWorkType CONVERT_TO(workType)
-#define convertWorkTypeToDstType CONVERT(workType, mat_T)
+#define convertToDstType CONVERT_TO(mat_T) // sat_rte provides incompatible results with CPU path
 
 #if weight_DEPTH >= CV_32F
 #define WEIGHT_EPS 1e-5f
@@ -275,7 +275,7 @@ __kernel void normalizeUsingWeightMap(
         weight_T w = LOAD_MAT_AT(weight, weight_byteOffset);
         workType value = convertSrcToWorkType(LOAD_MAT_AT(mat, mat_byteOffset));
         value = value / (w + WEIGHT_EPS);
-        STORE_MAT_AT(mat, mat_byteOffset, convertWorkTypeToDstType(value));
+        STORE_MAT_AT(mat, mat_byteOffset, convertToDstType(value));
     }
 }
 
index cb84482..f7c7835 100644 (file)
@@ -73,6 +73,6 @@ TEST(MultiBandBlender, CanBlendTwoImages)
     Mat result; result_s.convertTo(result, CV_8U);
 
     Mat expected = imread(string(cvtest::TS::ptr()->get_data_path()) + "stitching/baboon_lena.png");
-    double rmsErr = cvtest::norm(expected, result, NORM_L2) / sqrt(double(expected.size().area()));
-    ASSERT_LT(rmsErr, 1e-3);
+    double psnr = cvtest::PSNR(expected, result);
+    EXPECT_GE(psnr, 50);
 }