From: Ilya Lavrenov Date: Wed, 9 Apr 2014 10:15:22 +0000 (+0400) Subject: added UMat::setTo accuracy test X-Git-Tag: submit/tizen_ivi/20141117.190038~2^2~487^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bcd715186742ae9ab5bad894f3b287425967e14e;p=profile%2Fivi%2Fopencv.git added UMat::setTo accuracy test --- diff --git a/modules/core/test/ocl/test_matrix_operation.cpp b/modules/core/test/ocl/test_matrix_operation.cpp index 9016095..ee591e9 100644 --- a/modules/core/test/ocl/test_matrix_operation.cpp +++ b/modules/core/test/ocl/test_matrix_operation.cpp @@ -107,6 +107,7 @@ PARAM_TEST_CASE(CopyTo, MatDepth, Channels, bool, bool) { int depth, cn; bool use_roi, use_mask; + Scalar val; TEST_DECLARE_INPUT_PARAMETER(src); TEST_DECLARE_INPUT_PARAMETER(mask); @@ -143,6 +144,8 @@ PARAM_TEST_CASE(CopyTo, MatDepth, Channels, bool, bool) if (use_mask) UMAT_UPLOAD_INPUT_PARAMETER(mask); UMAT_UPLOAD_OUTPUT_PARAMETER(dst); + + val = randomScalar(-MAX_VALUE, MAX_VALUE); } }; @@ -168,12 +171,38 @@ OCL_TEST_P(CopyTo, Accuracy) } } +typedef CopyTo SetTo; + +OCL_TEST_P(SetTo, Accuracy) +{ + for (int j = 0; j < test_loop_times; j++) + { + generateTestData(); + + if (use_mask) + { + OCL_OFF(dst_roi.setTo(val, mask_roi)); + OCL_ON(udst_roi.setTo(val, umask_roi)); + } + else + { + OCL_OFF(dst_roi.setTo(val)); + OCL_ON(udst_roi.setTo(val)); + } + + OCL_EXPECT_MATS_NEAR(dst, 0); + } +} + OCL_INSTANTIATE_TEST_CASE_P(MatrixOperation, ConvertTo, Combine( OCL_ALL_DEPTHS, OCL_ALL_DEPTHS, OCL_ALL_CHANNELS, Bool())); OCL_INSTANTIATE_TEST_CASE_P(MatrixOperation, CopyTo, Combine( OCL_ALL_DEPTHS, OCL_ALL_CHANNELS, Bool(), Bool())); +OCL_INSTANTIATE_TEST_CASE_P(MatrixOperation, SetTo, Combine( + OCL_ALL_DEPTHS, OCL_ALL_CHANNELS, Bool(), Bool())); + } } // namespace cvtest::ocl #endif