1 ///////////////////////////////////////////////////////////////////////////////////////
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
11 // For Open Source Computer Vision Library
13 // Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
14 // Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
15 // Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
16 // Third party copyrights are property of their respective owners.
19 // Niko Li, newlife20080214@gmail.com
20 // Jia Haipeng, jiahaipeng95@gmail.com
21 // Shengen Yan, yanshengen@gmail.com
22 // Jiang Liyuan,jlyuan001.good@163.com
23 // Rock Li, Rock.Li@amd.com
24 // Zailong Wu, bullet@yeah.net
25 // Yao Wang, bitwangyaoyao@gmail.com
27 // Redistribution and use in source and binary forms, with or without modification,
28 // are permitted provided that the following conditions are met:
30 // * Redistribution's of source code must retain the above copyright notice,
31 // this list of conditions and the following disclaimer.
33 // * Redistribution's in binary form must reproduce the above copyright notice,
34 // this list of conditions and the following disclaimer in the documentation
35 // and/or other materials provided with the distribution.
37 // * The name of the copyright holders may not be used to endorse or promote products
38 // derived from this software without specific prior written permission.
40 // This software is provided by the copyright holders and contributors "as is" and
41 // any express or implied warranties, including, but not limited to, the implied
42 // warranties of merchantability and fitness for a particular purpose are disclaimed.
43 // In no event shall the Intel Corporation or contributors be liable for any direct,
44 // indirect, incidental, special, exemplary, or consequential damages
45 // (including, but not limited to, procurement of substitute goods or services;
46 // loss of use, data, or profits; or business interruption) however caused
47 // and on any theory of liability, whether in contract, strict liability,
48 // or tort (including negligence or otherwise) arising in any way out of
49 // the use of this software, even if advised of the possibility of such damage.
53 #include "test_precomp.hpp"
59 using namespace cv::ocl;
60 using namespace cvtest;
61 using namespace testing;
64 static bool relativeError(double actual, double expected, double eps)
66 return std::abs(actual - expected) / actual < eps;
69 //////////////////////////////// LUT /////////////////////////////////////////////////
71 PARAM_TEST_CASE(Lut, MatDepth, MatDepth, bool, bool)
75 bool use_roi, same_cn;
87 // ocl dst mat for testing
88 cv::ocl::oclMat gsrc_whole;
89 cv::ocl::oclMat glut_whole;
90 cv::ocl::oclMat gdst_whole;
93 cv::ocl::oclMat gsrc_roi;
94 cv::ocl::oclMat glut_roi;
95 cv::ocl::oclMat gdst_roi;
99 lut_depth = GET_PARAM(0);
101 same_cn = GET_PARAM(2);
102 use_roi = GET_PARAM(3);
107 const int src_type = CV_MAKE_TYPE(CV_8U, cn);
108 const int lut_type = CV_MAKE_TYPE(lut_depth, same_cn ? cn : 1);
109 const int dst_type = CV_MAKE_TYPE(lut_depth, cn);
111 Size roiSize = randomSize(1, MAX_VALUE);
112 Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
113 randomSubMat(src, src_roi, roiSize, srcBorder, src_type, 0, 256);
115 Size lutRoiSize = Size(256, 1);
116 Border lutBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
117 randomSubMat(lut, lut_roi, lutRoiSize, lutBorder, lut_type, 5, 16);
119 Border dstBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
120 randomSubMat(dst, dst_roi, roiSize, dstBorder, dst_type, 5, 16);
122 generateOclMat(gsrc_whole, gsrc_roi, src, roiSize, srcBorder);
123 generateOclMat(glut_whole, glut_roi, lut, lutRoiSize, lutBorder);
124 generateOclMat(gdst_whole, gdst_roi, dst, roiSize, dstBorder);
127 void Near(double threshold = 0.)
129 EXPECT_MAT_NEAR(dst, Mat(gdst_whole), threshold);
130 EXPECT_MAT_NEAR(dst_roi, Mat(gdst_roi), threshold);
136 for (int j = 0; j < LOOP_TIMES; j++)
140 cv::LUT(src_roi, lut_roi, dst_roi);
141 cv::ocl::LUT(gsrc_roi, glut_roi, gdst_roi);
147 ///////////////////////// ArithmTestBase ///////////////////////////
149 PARAM_TEST_CASE(ArithmTestBase, MatDepth, Channels, bool)
170 // ocl dst mat for testing
171 cv::ocl::oclMat gsrc1_whole;
172 cv::ocl::oclMat gsrc2_whole;
173 cv::ocl::oclMat gdst1_whole;
174 cv::ocl::oclMat gdst2_whole;
175 cv::ocl::oclMat gmask_whole;
178 cv::ocl::oclMat gsrc1_roi;
179 cv::ocl::oclMat gsrc2_roi;
180 cv::ocl::oclMat gdst1_roi;
181 cv::ocl::oclMat gdst2_roi;
182 cv::ocl::oclMat gmask_roi;
186 depth = GET_PARAM(0);
188 use_roi = GET_PARAM(2);
193 const int type = CV_MAKE_TYPE(depth, cn);
195 Size roiSize = randomSize(1, MAX_VALUE);
196 Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
197 randomSubMat(src1, src1_roi, roiSize, srcBorder, type, 2, 11);
199 Border src2Border = randomBorder(0, use_roi ? MAX_VALUE : 0);
200 randomSubMat(src2, src2_roi, roiSize, src2Border, type, -1540, 1740);
202 Border dst1Border = randomBorder(0, use_roi ? MAX_VALUE : 0);
203 randomSubMat(dst1, dst1_roi, roiSize, dst1Border, type, 5, 16);
205 Border dst2Border = randomBorder(0, use_roi ? MAX_VALUE : 0);
206 randomSubMat(dst2, dst2_roi, roiSize, dst2Border, type, 5, 16);
208 Border maskBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
209 randomSubMat(mask, mask_roi, roiSize, maskBorder, CV_8UC1, 0, 2);
210 cv::threshold(mask, mask, 0.5, 255., CV_8UC1);
213 generateOclMat(gsrc1_whole, gsrc1_roi, src1, roiSize, srcBorder);
214 generateOclMat(gsrc2_whole, gsrc2_roi, src2, roiSize, src2Border);
215 generateOclMat(gdst1_whole, gdst1_roi, dst1, roiSize, dst1Border);
216 generateOclMat(gdst2_whole, gdst2_roi, dst2, roiSize, dst2Border);
217 generateOclMat(gmask_whole, gmask_roi, mask, roiSize, maskBorder);
219 val = cv::Scalar(rng.uniform(-100.0, 100.0), rng.uniform(-100.0, 100.0),
220 rng.uniform(-100.0, 100.0), rng.uniform(-100.0, 100.0));
223 void Near(double threshold = 0.)
225 EXPECT_MAT_NEAR(dst1, Mat(gdst1_whole), threshold);
226 EXPECT_MAT_NEAR(dst1_roi, Mat(gdst1_roi), threshold);
229 void Near1(double threshold = 0.)
231 EXPECT_MAT_NEAR(dst2, Mat(gdst2_whole), threshold);
232 EXPECT_MAT_NEAR(dst2_roi, Mat(gdst2_roi), threshold);
236 //////////////////////////////// Exp /////////////////////////////////////////////////
238 typedef ArithmTestBase Exp;
242 for (int j = 0; j < LOOP_TIMES; j++)
246 cv::exp(src1_roi, dst1_roi);
247 cv::ocl::exp(gsrc1_roi, gdst1_roi);
253 //////////////////////////////// Log /////////////////////////////////////////////////
255 typedef ArithmTestBase Log;
259 for (int j = 0; j < LOOP_TIMES; j++)
263 cv::log(src1_roi, dst1_roi);
264 cv::ocl::log(gsrc1_roi, gdst1_roi);
269 //////////////////////////////// Add /////////////////////////////////////////////////
271 typedef ArithmTestBase Add;
275 for (int j = 0; j < LOOP_TIMES; j++)
279 cv::add(src1_roi, src2_roi, dst1_roi);
280 cv::ocl::add(gsrc1_roi, gsrc2_roi, gdst1_roi);
285 OCL_TEST_P(Add, Mat_Mask)
287 for (int j = 0; j < LOOP_TIMES; j++)
291 cv::add(src1_roi, src2_roi, dst1_roi, mask_roi);
292 cv::ocl::add(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi);
297 OCL_TEST_P(Add, Scalar)
299 for (int j = 0; j < LOOP_TIMES; j++)
303 cv::add(src1_roi, val, dst1_roi);
304 cv::ocl::add(gsrc1_roi, val, gdst1_roi);
309 OCL_TEST_P(Add, Scalar_Mask)
311 for (int j = 0; j < LOOP_TIMES; j++)
315 cv::add(src1_roi, val, dst1_roi, mask_roi);
316 cv::ocl::add(gsrc1_roi, val, gdst1_roi, gmask_roi);
321 //////////////////////////////// Sub /////////////////////////////////////////////////
323 typedef ArithmTestBase Sub;
327 for (int j = 0; j < LOOP_TIMES; j++)
331 cv::subtract(src1_roi, src2_roi, dst1_roi);
332 cv::ocl::subtract(gsrc1_roi, gsrc2_roi, gdst1_roi);
338 OCL_TEST_P(Sub, Mat_Mask)
340 for (int j = 0; j < LOOP_TIMES; j++)
344 cv::subtract(src1_roi, src2_roi, dst1_roi, mask_roi);
345 cv::ocl::subtract(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi);
350 OCL_TEST_P(Sub, Scalar)
352 for (int j = 0; j < LOOP_TIMES; j++)
356 cv::subtract(src1_roi, val, dst1_roi);
357 cv::ocl::subtract(gsrc1_roi, val, gdst1_roi);
363 OCL_TEST_P(Sub, Scalar_Mask)
365 for (int j = 0; j < LOOP_TIMES; j++)
369 cv::subtract(src1_roi, val, dst1_roi, mask_roi);
370 cv::ocl::subtract(gsrc1_roi, val, gdst1_roi, gmask_roi);
375 //////////////////////////////// Mul /////////////////////////////////////////////////
377 typedef ArithmTestBase Mul;
381 for (int j = 0; j < LOOP_TIMES; j++)
385 cv::multiply(src1_roi, src2_roi, dst1_roi);
386 cv::ocl::multiply(gsrc1_roi, gsrc2_roi, gdst1_roi);
391 OCL_TEST_P(Mul, Scalar)
393 for (int j = 0; j < LOOP_TIMES; j++)
397 cv::multiply(Scalar::all(val[0]), src1_roi, dst1_roi);
398 cv::ocl::multiply(val[0], gsrc1_roi, gdst1_roi);
400 Near(gdst1_roi.depth() >= CV_32F ? 1e-3 : 1);
404 OCL_TEST_P(Mul, Mat_Scalar)
406 for (int j = 0; j < LOOP_TIMES; j++)
410 cv::multiply(src1_roi, src2_roi, dst1_roi, val[0]);
411 cv::ocl::multiply(gsrc1_roi, gsrc2_roi, gdst1_roi, val[0]);
413 Near(gdst1_roi.depth() >= CV_32F ? 1e-3 : 1);
417 //////////////////////////////// Div /////////////////////////////////////////////////
419 typedef ArithmTestBase Div;
423 for (int j = 0; j < LOOP_TIMES; j++)
427 cv::divide(src1_roi, src2_roi, dst1_roi);
428 cv::ocl::divide(gsrc1_roi, gsrc2_roi, gdst1_roi);
433 OCL_TEST_P(Div, Scalar)
435 for (int j = 0; j < LOOP_TIMES; j++)
439 cv::divide(val[0], src1_roi, dst1_roi);
440 cv::ocl::divide(val[0], gsrc1_roi, gdst1_roi);
442 Near(gdst1_roi.depth() >= CV_32F ? 1e-3 : 1);
446 OCL_TEST_P(Div, Mat_Scalar)
448 for (int j = 0; j < LOOP_TIMES; j++)
452 cv::divide(src1_roi, src2_roi, dst1_roi, val[0]);
453 cv::ocl::divide(gsrc1_roi, gsrc2_roi, gdst1_roi, val[0]);
455 Near(gdst1_roi.depth() >= CV_32F ? 4e-3 : 1);
459 //////////////////////////////// Absdiff /////////////////////////////////////////////////
461 typedef ArithmTestBase Min;
465 for (int j = 0; j < LOOP_TIMES; j++)
469 dst1_roi = cv::min(src1_roi, src2_roi);
470 cv::ocl::min(gsrc1_roi, gsrc2_roi, gdst1_roi);
475 typedef ArithmTestBase Max;
479 for (int j = 0; j < LOOP_TIMES; j++)
483 dst1_roi = cv::min(src1_roi, src2_roi);
484 cv::ocl::min(gsrc1_roi, gsrc2_roi, gdst1_roi);
489 //////////////////////////////// Abs /////////////////////////////////////////////////////
491 typedef ArithmTestBase Abs;
495 for (int j = 0; j < LOOP_TIMES; j++)
499 dst1_roi = cv::abs(src1_roi);
500 cv::ocl::abs(gsrc1_roi, gdst1_roi);
505 //////////////////////////////// Absdiff /////////////////////////////////////////////////
507 typedef ArithmTestBase Absdiff;
509 OCL_TEST_P(Absdiff, Mat)
511 for (int j = 0; j < LOOP_TIMES; j++)
515 cv::absdiff(src1_roi, src2_roi, dst1_roi);
516 cv::ocl::absdiff(gsrc1_roi, gsrc2_roi, gdst1_roi);
521 OCL_TEST_P(Absdiff, Scalar)
523 for (int j = 0; j < LOOP_TIMES; j++)
527 cv::absdiff(src1_roi, val, dst1_roi);
528 cv::ocl::absdiff(gsrc1_roi, val, gdst1_roi);
533 //////////////////////////////// CartToPolar /////////////////////////////////////////////////
535 typedef ArithmTestBase CartToPolar;
537 OCL_TEST_P(CartToPolar, angleInDegree)
539 for (int j = 0; j < LOOP_TIMES; j++)
543 cv::cartToPolar(src1_roi, src2_roi, dst1_roi, dst2_roi, true);
544 cv::ocl::cartToPolar(gsrc1_roi, gsrc2_roi, gdst1_roi, gdst2_roi, true);
550 OCL_TEST_P(CartToPolar, angleInRadians)
552 for (int j = 0; j < LOOP_TIMES; j++)
556 cv::cartToPolar(src1_roi, src2_roi, dst1_roi, dst2_roi);
557 cv::ocl::cartToPolar(gsrc1_roi, gsrc2_roi, gdst1_roi, gdst2_roi);
563 //////////////////////////////// PolarToCart /////////////////////////////////////////////////
565 typedef ArithmTestBase PolarToCart;
567 OCL_TEST_P(PolarToCart, angleInDegree)
569 for (int j = 0; j < LOOP_TIMES; j++)
573 cv::polarToCart(src1_roi, src2_roi, dst1_roi, dst2_roi, true);
574 cv::ocl::polarToCart(gsrc1_roi, gsrc2_roi, gdst1_roi, gdst2_roi, true);
581 OCL_TEST_P(PolarToCart, angleInRadians)
583 for (int j = 0; j < LOOP_TIMES; j++)
587 cv::polarToCart(src1_roi, src2_roi, dst1_roi, dst2_roi);
588 cv::ocl::polarToCart(gsrc1_roi, gsrc2_roi, gdst1_roi, gdst2_roi);
595 //////////////////////////////// Magnitude /////////////////////////////////////////////////
597 typedef ArithmTestBase Magnitude;
599 OCL_TEST_P(Magnitude, Mat)
601 for (int j = 0; j < LOOP_TIMES; j++)
605 cv::magnitude(src1_roi, src2_roi, dst1_roi);
606 cv::ocl::magnitude(gsrc1_roi, gsrc2_roi, gdst1_roi);
607 Near(depth == CV_64F ? 1e-5 : 1e-2);
611 //////////////////////////////// Transpose /////////////////////////////////////////////////
613 typedef ArithmTestBase Transpose;
615 OCL_TEST_P(Transpose, Mat)
617 for (int j = 0; j < LOOP_TIMES; j++)
621 cv::transpose(src1_roi, dst1_roi);
622 cv::ocl::transpose(gsrc1_roi, gdst1_roi);
628 OCL_TEST_P(Transpose, SquareInplace)
630 const int type = CV_MAKE_TYPE(depth, cn);
632 for (int j = 0; j < LOOP_TIMES; j++)
634 Size roiSize = randomSize(1, MAX_VALUE);
635 roiSize.height = roiSize.width; // make it square
637 Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0);
638 randomSubMat(src1, src1_roi, roiSize, srcBorder, type, 5, 16);
640 generateOclMat(gsrc1_whole, gsrc1_roi, src1, roiSize, srcBorder);
642 cv::transpose(src1_roi, src1_roi);
643 cv::ocl::transpose(gsrc1_roi, gsrc1_roi);
645 EXPECT_MAT_NEAR(src1, Mat(gsrc1_whole), 0.0);
646 EXPECT_MAT_NEAR(src1_roi, Mat(gsrc1_roi), 0.0);
650 //////////////////////////////// Flip /////////////////////////////////////////////////
652 typedef ArithmTestBase Flip;
656 for (int j = 0; j < LOOP_TIMES; j++)
660 cv::flip(src1_roi, dst1_roi, 0);
661 cv::ocl::flip(gsrc1_roi, gdst1_roi, 0);
668 for (int j = 0; j < LOOP_TIMES; j++)
672 cv::flip(src1_roi, dst1_roi, 1);
673 cv::ocl::flip(gsrc1_roi, gdst1_roi, 1);
678 OCL_TEST_P(Flip, BOTH)
680 for (int j = 0; j < LOOP_TIMES; j++)
684 cv::flip(src1_roi, dst1_roi, -1);
685 cv::ocl::flip(gsrc1_roi, gdst1_roi, -1);
690 //////////////////////////////// MinMax /////////////////////////////////////////////////
692 typedef ArithmTestBase MinMax;
694 OCL_TEST_P(MinMax, MAT)
696 for (int j = 0; j < LOOP_TIMES; j++)
700 double minVal, maxVal;
702 if (src1.depth() != CV_8S)
703 cv::minMaxIdx(src1_roi, &minVal, &maxVal, NULL, NULL);
706 minVal = std::numeric_limits<double>::max();
707 maxVal = -std::numeric_limits<double>::max();
708 for (int i = 0; i < src1_roi.rows; ++i)
709 for (int j = 0; j < src1_roi.cols; ++j)
711 signed char val = src1_roi.at<signed char>(i, j);
712 if (val < minVal) minVal = val;
713 if (val > maxVal) maxVal = val;
717 double minVal_, maxVal_;
718 cv::ocl::minMax(gsrc1_roi, &minVal_, &maxVal_);
720 EXPECT_DOUBLE_EQ(minVal_, minVal);
721 EXPECT_DOUBLE_EQ(maxVal_, maxVal);
725 OCL_TEST_P(MinMax, MASK)
727 for (int j = 0; j < LOOP_TIMES; j++)
731 double minVal, maxVal;
732 cv::Point minLoc, maxLoc;
734 if (src1.depth() != CV_8S)
735 cv::minMaxLoc(src1_roi, &minVal, &maxVal, &minLoc, &maxLoc, mask_roi);
738 minVal = std::numeric_limits<double>::max();
739 maxVal = -std::numeric_limits<double>::max();
740 for (int i = 0; i < src1_roi.rows; ++i)
741 for (int j = 0; j < src1_roi.cols; ++j)
743 signed char val = src1_roi.at<signed char>(i, j);
744 unsigned char m = mask_roi.at<unsigned char>(i, j);
745 if (val < minVal && m) minVal = val;
746 if (val > maxVal && m) maxVal = val;
750 double minVal_, maxVal_;
751 cv::ocl::minMax(gsrc1_roi, &minVal_, &maxVal_, gmask_roi);
753 EXPECT_DOUBLE_EQ(minVal, minVal_);
754 EXPECT_DOUBLE_EQ(maxVal, maxVal_);
758 //////////////////////////////// MinMaxLoc /////////////////////////////////////////////////
760 typedef ArithmTestBase MinMaxLoc;
762 OCL_TEST_P(MinMaxLoc, MAT)
764 for (int j = 0; j < LOOP_TIMES; j++)
768 double minVal, maxVal;
769 cv::Point minLoc, maxLoc;
770 int depth = src1.depth();
773 cv::minMaxLoc(src1_roi, &minVal, &maxVal, &minLoc, &maxLoc);
776 minVal = std::numeric_limits<double>::max();
777 maxVal = -std::numeric_limits<double>::max();
778 for (int i = 0; i < src1_roi.rows; ++i)
779 for (int j = 0; j < src1_roi.cols; ++j)
781 signed char val = src1_roi.at<signed char>(i, j);
797 double minVal_, maxVal_;
798 cv::Point minLoc_, maxLoc_;
799 cv::ocl::minMaxLoc(gsrc1_roi, &minVal_, &maxVal_, &minLoc_, &maxLoc_, cv::ocl::oclMat());
801 double error0 = 0., error1 = 0., minlocVal = 0., minlocVal_ = 0., maxlocVal = 0., maxlocVal_ = 0.;
804 minlocVal = src1_roi.at<unsigned char>(minLoc);
805 minlocVal_ = src1_roi.at<unsigned char>(minLoc_);
806 maxlocVal = src1_roi.at<unsigned char>(maxLoc);
807 maxlocVal_ = src1_roi.at<unsigned char>(maxLoc_);
808 error0 = ::abs(src1_roi.at<unsigned char>(minLoc_) - src1_roi.at<unsigned char>(minLoc));
809 error1 = ::abs(src1_roi.at<unsigned char>(maxLoc_) - src1_roi.at<unsigned char>(maxLoc));
813 minlocVal = src1_roi.at<signed char>(minLoc);
814 minlocVal_ = src1_roi.at<signed char>(minLoc_);
815 maxlocVal = src1_roi.at<signed char>(maxLoc);
816 maxlocVal_ = src1_roi.at<signed char>(maxLoc_);
817 error0 = ::abs(src1_roi.at<signed char>(minLoc_) - src1_roi.at<signed char>(minLoc));
818 error1 = ::abs(src1_roi.at<signed char>(maxLoc_) - src1_roi.at<signed char>(maxLoc));
822 minlocVal = src1_roi.at<unsigned short>(minLoc);
823 minlocVal_ = src1_roi.at<unsigned short>(minLoc_);
824 maxlocVal = src1_roi.at<unsigned short>(maxLoc);
825 maxlocVal_ = src1_roi.at<unsigned short>(maxLoc_);
826 error0 = ::abs(src1_roi.at<unsigned short>(minLoc_) - src1_roi.at<unsigned short>(minLoc));
827 error1 = ::abs(src1_roi.at<unsigned short>(maxLoc_) - src1_roi.at<unsigned short>(maxLoc));
831 minlocVal = src1_roi.at<signed short>(minLoc);
832 minlocVal_ = src1_roi.at<signed short>(minLoc_);
833 maxlocVal = src1_roi.at<signed short>(maxLoc);
834 maxlocVal_ = src1_roi.at<signed short>(maxLoc_);
835 error0 = ::abs(src1_roi.at<signed short>(minLoc_) - src1_roi.at<signed short>(minLoc));
836 error1 = ::abs(src1_roi.at<signed short>(maxLoc_) - src1_roi.at<signed short>(maxLoc));
840 minlocVal = src1_roi.at<int>(minLoc);
841 minlocVal_ = src1_roi.at<int>(minLoc_);
842 maxlocVal = src1_roi.at<int>(maxLoc);
843 maxlocVal_ = src1_roi.at<int>(maxLoc_);
844 error0 = ::abs(src1_roi.at<int>(minLoc_) - src1_roi.at<int>(minLoc));
845 error1 = ::abs(src1_roi.at<int>(maxLoc_) - src1_roi.at<int>(maxLoc));
849 minlocVal = src1_roi.at<float>(minLoc);
850 minlocVal_ = src1_roi.at<float>(minLoc_);
851 maxlocVal = src1_roi.at<float>(maxLoc);
852 maxlocVal_ = src1_roi.at<float>(maxLoc_);
853 error0 = ::abs(src1_roi.at<float>(minLoc_) - src1_roi.at<float>(minLoc));
854 error1 = ::abs(src1_roi.at<float>(maxLoc_) - src1_roi.at<float>(maxLoc));
858 minlocVal = src1_roi.at<double>(minLoc);
859 minlocVal_ = src1_roi.at<double>(minLoc_);
860 maxlocVal = src1_roi.at<double>(maxLoc);
861 maxlocVal_ = src1_roi.at<double>(maxLoc_);
862 error0 = ::abs(src1_roi.at<double>(minLoc_) - src1_roi.at<double>(minLoc));
863 error1 = ::abs(src1_roi.at<double>(maxLoc_) - src1_roi.at<double>(maxLoc));
866 EXPECT_DOUBLE_EQ(minVal_, minVal);
867 EXPECT_DOUBLE_EQ(maxVal_, maxVal);
868 EXPECT_DOUBLE_EQ(minlocVal_, minlocVal);
869 EXPECT_DOUBLE_EQ(maxlocVal_, maxlocVal);
871 EXPECT_DOUBLE_EQ(error0, 0.0);
872 EXPECT_DOUBLE_EQ(error1, 0.0);
876 OCL_TEST_P(MinMaxLoc, MASK)
878 for (int j = 0; j < LOOP_TIMES; j++)
881 double minVal, maxVal;
882 cv::Point minLoc, maxLoc;
883 int depth = src1.depth();
885 cv::minMaxLoc(src1_roi, &minVal, &maxVal, &minLoc, &maxLoc, mask_roi);
888 minVal = std::numeric_limits<double>::max();
889 maxVal = -std::numeric_limits<double>::max();
890 for (int i = 0; i < src1_roi.rows; ++i)
891 for (int j = 0; j < src1_roi.cols; ++j)
893 signed char val = src1_roi.at<signed char>(i, j);
894 unsigned char m = mask_roi.at<unsigned char>(i , j);
895 if (val < minVal && m)
901 if (val > maxVal && m)
910 double minVal_, maxVal_;
911 cv::Point minLoc_, maxLoc_;
912 cv::ocl::minMaxLoc(gsrc1_roi, &minVal_, &maxVal_, &minLoc_, &maxLoc_, gmask_roi);
914 double error0 = 0., error1 = 0., minlocVal = 0., minlocVal_ = 0., maxlocVal = 0., maxlocVal_ = 0.;
915 if (minLoc_.x == -1 || minLoc_.y == -1 || maxLoc_.x == -1 || maxLoc_.y == -1) continue;
918 minlocVal = src1_roi.at<unsigned char>(minLoc);
919 minlocVal_ = src1_roi.at<unsigned char>(minLoc_);
920 maxlocVal = src1_roi.at<unsigned char>(maxLoc);
921 maxlocVal_ = src1_roi.at<unsigned char>(maxLoc_);
922 error0 = ::abs(src1_roi.at<unsigned char>(minLoc_) - src1_roi.at<unsigned char>(minLoc));
923 error1 = ::abs(src1_roi.at<unsigned char>(maxLoc_) - src1_roi.at<unsigned char>(maxLoc));
927 minlocVal = src1_roi.at<signed char>(minLoc);
928 minlocVal_ = src1_roi.at<signed char>(minLoc_);
929 maxlocVal = src1_roi.at<signed char>(maxLoc);
930 maxlocVal_ = src1_roi.at<signed char>(maxLoc_);
931 error0 = ::abs(src1_roi.at<signed char>(minLoc_) - src1_roi.at<signed char>(minLoc));
932 error1 = ::abs(src1_roi.at<signed char>(maxLoc_) - src1_roi.at<signed char>(maxLoc));
936 minlocVal = src1_roi.at<unsigned short>(minLoc);
937 minlocVal_ = src1_roi.at<unsigned short>(minLoc_);
938 maxlocVal = src1_roi.at<unsigned short>(maxLoc);
939 maxlocVal_ = src1_roi.at<unsigned short>(maxLoc_);
940 error0 = ::abs(src1_roi.at<unsigned short>(minLoc_) - src1_roi.at<unsigned short>(minLoc));
941 error1 = ::abs(src1_roi.at<unsigned short>(maxLoc_) - src1_roi.at<unsigned short>(maxLoc));
945 minlocVal = src1_roi.at<signed short>(minLoc);
946 minlocVal_ = src1_roi.at<signed short>(minLoc_);
947 maxlocVal = src1_roi.at<signed short>(maxLoc);
948 maxlocVal_ = src1_roi.at<signed short>(maxLoc_);
949 error0 = ::abs(src1_roi.at<signed short>(minLoc_) - src1_roi.at<signed short>(minLoc));
950 error1 = ::abs(src1_roi.at<signed short>(maxLoc_) - src1_roi.at<signed short>(maxLoc));
954 minlocVal = src1_roi.at<int>(minLoc);
955 minlocVal_ = src1_roi.at<int>(minLoc_);
956 maxlocVal = src1_roi.at<int>(maxLoc);
957 maxlocVal_ = src1_roi.at<int>(maxLoc_);
958 error0 = ::abs(src1_roi.at<int>(minLoc_) - src1_roi.at<int>(minLoc));
959 error1 = ::abs(src1_roi.at<int>(maxLoc_) - src1_roi.at<int>(maxLoc));
963 minlocVal = src1_roi.at<float>(minLoc);
964 minlocVal_ = src1_roi.at<float>(minLoc_);
965 maxlocVal = src1_roi.at<float>(maxLoc);
966 maxlocVal_ = src1_roi.at<float>(maxLoc_);
967 error0 = ::abs(src1_roi.at<float>(minLoc_) - src1_roi.at<float>(minLoc));
968 error1 = ::abs(src1_roi.at<float>(maxLoc_) - src1_roi.at<float>(maxLoc));
972 minlocVal = src1_roi.at<double>(minLoc);
973 minlocVal_ = src1_roi.at<double>(minLoc_);
974 maxlocVal = src1_roi.at<double>(maxLoc);
975 maxlocVal_ = src1_roi.at<double>(maxLoc_);
976 error0 = ::abs(src1_roi.at<double>(minLoc_) - src1_roi.at<double>(minLoc));
977 error1 = ::abs(src1_roi.at<double>(maxLoc_) - src1_roi.at<double>(maxLoc));
980 EXPECT_DOUBLE_EQ(minVal_, minVal);
981 EXPECT_DOUBLE_EQ(maxVal_, maxVal);
982 EXPECT_DOUBLE_EQ(minlocVal_, minlocVal);
983 EXPECT_DOUBLE_EQ(maxlocVal_, maxlocVal);
985 EXPECT_DOUBLE_EQ(error0, 0.0);
986 EXPECT_DOUBLE_EQ(error1, 0.0);
990 //////////////////////////////// Sum /////////////////////////////////////////////////
992 typedef ArithmTestBase Sum;
996 for (int j = 0; j < LOOP_TIMES; j++)
1000 Scalar cpures = cv::sum(src1_roi);
1001 Scalar gpures = cv::ocl::sum(gsrc1_roi);
1004 EXPECT_NEAR(cpures[0], gpures[0], 0.1);
1005 EXPECT_NEAR(cpures[1], gpures[1], 0.1);
1006 EXPECT_NEAR(cpures[2], gpures[2], 0.1);
1007 EXPECT_NEAR(cpures[3], gpures[3], 0.1);
1011 typedef ArithmTestBase SqrSum;
1013 template <typename T, typename WT>
1014 static Scalar sqrSum(const Mat & src)
1016 Scalar sum = Scalar::all(0);
1017 int cn = src.channels();
1018 WT data[4] = { 0, 0, 0, 0 };
1020 int cols = src.cols * cn;
1021 for (int y = 0; y < src.rows; ++y)
1023 const T * const sdata = src.ptr<T>(y);
1024 for (int x = 0; x < cols; )
1025 for (int i = 0; i < cn; ++i, ++x)
1027 WT t = static_cast<WT>(sdata[x]);
1032 for (int i = 0; i < cn; ++i)
1033 sum[i] = static_cast<double>(data[i]);
1038 typedef Scalar (*sumFunc)(const Mat &);
1040 OCL_TEST_P(SqrSum, MAT)
1042 for (int j = 0; j < LOOP_TIMES; j++)
1046 static sumFunc funcs[] = { sqrSum<uchar, int>,
1048 sqrSum<ushort, int>,
1051 sqrSum<float, double>,
1052 sqrSum<double, double>,
1055 sumFunc func = funcs[src1_roi.depth()];
1056 CV_Assert(func != 0);
1058 Scalar cpures = func(src1_roi);
1059 Scalar gpures = cv::ocl::sqrSum(gsrc1_roi);
1062 EXPECT_NEAR(cpures[0], gpures[0], 1.0);
1063 EXPECT_NEAR(cpures[1], gpures[1], 1.0);
1064 EXPECT_NEAR(cpures[2], gpures[2], 1.0);
1065 EXPECT_NEAR(cpures[3], gpures[3], 1.0);
1069 typedef ArithmTestBase AbsSum;
1071 template <typename T, typename WT>
1072 static Scalar absSum(const Mat & src)
1074 Scalar sum = Scalar::all(0);
1075 int cn = src.channels();
1076 WT data[4] = { 0, 0, 0, 0 };
1078 int cols = src.cols * cn;
1079 for (int y = 0; y < src.rows; ++y)
1081 const T * const sdata = src.ptr<T>(y);
1082 for (int x = 0; x < cols; )
1083 for (int i = 0; i < cn; ++i, ++x)
1085 WT t = static_cast<WT>(sdata[x]);
1086 data[i] += t >= 0 ? t : -t;
1090 for (int i = 0; i < cn; ++i)
1091 sum[i] = static_cast<double>(data[i]);
1096 OCL_TEST_P(AbsSum, MAT)
1098 for (int j = 0; j < LOOP_TIMES; j++)
1102 static sumFunc funcs[] = { absSum<uchar, int>,
1104 absSum<ushort, int>,
1107 absSum<float, double>,
1108 absSum<double, double>,
1111 sumFunc func = funcs[src1_roi.depth()];
1112 CV_Assert(func != 0);
1114 Scalar cpures = func(src1_roi);
1115 Scalar gpures = cv::ocl::absSum(gsrc1_roi);
1118 EXPECT_NEAR(cpures[0], gpures[0], 0.1);
1119 EXPECT_NEAR(cpures[1], gpures[1], 0.1);
1120 EXPECT_NEAR(cpures[2], gpures[2], 0.1);
1121 EXPECT_NEAR(cpures[3], gpures[3], 0.1);
1125 //////////////////////////////// CountNonZero /////////////////////////////////////////////////
1127 typedef ArithmTestBase CountNonZero;
1129 OCL_TEST_P(CountNonZero, MAT)
1131 for (int j = 0; j < LOOP_TIMES; j++)
1134 int cpures = cv::countNonZero(src1_roi);
1135 int gpures = cv::ocl::countNonZero(gsrc1_roi);
1137 EXPECT_DOUBLE_EQ((double)cpures, (double)gpures);
1141 //////////////////////////////// Phase /////////////////////////////////////////////////
1143 typedef ArithmTestBase Phase;
1145 OCL_TEST_P(Phase, angleInDegrees)
1147 for (int j = 0; j < LOOP_TIMES; j++)
1150 cv::phase(src1_roi, src2_roi, dst1_roi, true);
1151 cv::ocl::phase(gsrc1_roi, gsrc2_roi, gdst1_roi, true);
1157 OCL_TEST_P(Phase, angleInRadians)
1159 for (int j = 0; j < LOOP_TIMES; j++)
1162 cv::phase(src1_roi, src2_roi, dst1_roi);
1163 cv::ocl::phase(gsrc1_roi, gsrc2_roi, gdst1_roi);
1169 //////////////////////////////// Bitwise_and /////////////////////////////////////////////////
1171 typedef ArithmTestBase Bitwise_and;
1173 OCL_TEST_P(Bitwise_and, Mat)
1175 for (int j = 0; j < LOOP_TIMES; j++)
1179 cv::bitwise_and(src1_roi, src2_roi, dst1_roi);
1180 cv::ocl::bitwise_and(gsrc1_roi, gsrc2_roi, gdst1_roi);
1185 OCL_TEST_P(Bitwise_and, Mat_Mask)
1187 for (int j = 0; j < LOOP_TIMES; j++)
1191 cv::bitwise_and(src1_roi, src2_roi, dst1_roi, mask_roi);
1192 cv::ocl::bitwise_and(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi);
1197 OCL_TEST_P(Bitwise_and, Scalar)
1199 for (int j = 0; j < LOOP_TIMES; j++)
1203 cv::bitwise_and(src1_roi, val, dst1_roi);
1204 cv::ocl::bitwise_and(gsrc1_roi, val, gdst1_roi);
1209 OCL_TEST_P(Bitwise_and, Scalar_Mask)
1211 for (int j = 0; j < LOOP_TIMES; j++)
1215 cv::bitwise_and(src1_roi, val, dst1_roi, mask_roi);
1216 cv::ocl::bitwise_and(gsrc1_roi, val, gdst1_roi, gmask_roi);
1221 //////////////////////////////// Bitwise_or /////////////////////////////////////////////////
1223 typedef ArithmTestBase Bitwise_or;
1225 OCL_TEST_P(Bitwise_or, Mat)
1227 for (int j = 0; j < LOOP_TIMES; j++)
1231 cv::bitwise_or(src1_roi, src2_roi, dst1_roi);
1232 cv::ocl::bitwise_or(gsrc1_roi, gsrc2_roi, gdst1_roi);
1237 OCL_TEST_P(Bitwise_or, Mat_Mask)
1239 for (int j = 0; j < LOOP_TIMES; j++)
1243 cv::bitwise_or(src1_roi, src2_roi, dst1_roi, mask_roi);
1244 cv::ocl::bitwise_or(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi);
1249 OCL_TEST_P(Bitwise_or, Scalar)
1251 for (int j = 0; j < LOOP_TIMES; j++)
1255 cv::bitwise_or(src1_roi, val, dst1_roi);
1256 cv::ocl::bitwise_or(gsrc1_roi, val, gdst1_roi);
1261 OCL_TEST_P(Bitwise_or, Scalar_Mask)
1263 for (int j = 0; j < LOOP_TIMES; j++)
1267 cv::bitwise_or(src1_roi, val, dst1_roi, mask_roi);
1268 cv::ocl::bitwise_or(gsrc1_roi, val, gdst1_roi, gmask_roi);
1273 //////////////////////////////// Bitwise_xor /////////////////////////////////////////////////
1275 typedef ArithmTestBase Bitwise_xor;
1277 OCL_TEST_P(Bitwise_xor, Mat)
1279 for (int j = 0; j < LOOP_TIMES; j++)
1283 cv::bitwise_xor(src1_roi, src2_roi, dst1_roi);
1284 cv::ocl::bitwise_xor(gsrc1_roi, gsrc2_roi, gdst1_roi);
1289 OCL_TEST_P(Bitwise_xor, Mat_Mask)
1291 for (int j = 0; j < LOOP_TIMES; j++)
1295 cv::bitwise_xor(src1_roi, src2_roi, dst1_roi, mask_roi);
1296 cv::ocl::bitwise_xor(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi);
1301 OCL_TEST_P(Bitwise_xor, Scalar)
1303 for (int j = 0; j < LOOP_TIMES; j++)
1307 cv::bitwise_xor(src1_roi, val, dst1_roi);
1308 cv::ocl::bitwise_xor(gsrc1_roi, val, gdst1_roi);
1313 OCL_TEST_P(Bitwise_xor, Scalar_Mask)
1315 for (int j = 0; j < LOOP_TIMES; j++)
1319 cv::bitwise_xor(src1_roi, val, dst1_roi, mask_roi);
1320 cv::ocl::bitwise_xor(gsrc1_roi, val, gdst1_roi, gmask_roi);
1325 //////////////////////////////// Bitwise_not /////////////////////////////////////////////////
1327 typedef ArithmTestBase Bitwise_not;
1329 OCL_TEST_P(Bitwise_not, Mat)
1331 for (int j = 0; j < LOOP_TIMES; j++)
1335 cv::bitwise_not(src1_roi, dst1_roi);
1336 cv::ocl::bitwise_not(gsrc1_roi, gdst1_roi);
1341 //////////////////////////////// Compare /////////////////////////////////////////////////
1343 typedef ArithmTestBase Compare;
1345 OCL_TEST_P(Compare, Mat)
1347 int cmp_codes[] = { CMP_EQ, CMP_GT, CMP_GE, CMP_LT, CMP_LE, CMP_NE };
1348 int cmp_num = sizeof(cmp_codes) / sizeof(int);
1350 for (int i = 0; i < cmp_num; ++i)
1351 for (int j = 0; j < LOOP_TIMES; j++)
1355 cv::compare(src1_roi, src2_roi, dst1_roi, cmp_codes[i]);
1356 cv::ocl::compare(gsrc1_roi, gsrc2_roi, gdst1_roi, cmp_codes[i]);
1362 //////////////////////////////// Pow /////////////////////////////////////////////////
1364 typedef ArithmTestBase Pow;
1366 OCL_TEST_P(Pow, Mat)
1368 for (int j = 0; j < LOOP_TIMES; j++)
1372 cv::pow(src1_roi, p, dst1_roi);
1373 cv::ocl::pow(gsrc1_roi, p, gdst1_roi);
1378 //////////////////////////////// AddWeighted /////////////////////////////////////////////////
1380 typedef ArithmTestBase AddWeighted;
1382 OCL_TEST_P(AddWeighted, Mat)
1384 for (int j = 0; j < LOOP_TIMES; j++)
1388 const double alpha = 2.0, beta = 1.0, gama = 3.0;
1390 cv::addWeighted(src1_roi, alpha, src2_roi, beta, gama, dst1_roi);
1391 cv::ocl::addWeighted(gsrc1_roi, alpha, gsrc2_roi, beta, gama, gdst1_roi);
1397 //////////////////////////////// setIdentity /////////////////////////////////////////////////
1399 typedef ArithmTestBase SetIdentity;
1401 OCL_TEST_P(SetIdentity, Mat)
1403 for (int j = 0; j < LOOP_TIMES; j++)
1407 cv::setIdentity(dst1_roi, val);
1408 cv::ocl::setIdentity(gdst1_roi, val);
1414 //////////////////////////////// meanStdDev /////////////////////////////////////////////////
1416 typedef ArithmTestBase MeanStdDev;
1418 OCL_TEST_P(MeanStdDev, Mat)
1420 for (int j = 0; j < LOOP_TIMES; j++)
1424 Scalar cpu_mean, cpu_stddev;
1425 Scalar gpu_mean, gpu_stddev;
1427 cv::meanStdDev(src1_roi, cpu_mean, cpu_stddev);
1428 cv::ocl::meanStdDev(gsrc1_roi, gpu_mean, gpu_stddev);
1430 for (int i = 0; i < 4; ++i)
1432 EXPECT_NEAR(cpu_mean[i], gpu_mean[i], 0.1);
1433 EXPECT_NEAR(cpu_stddev[i], gpu_stddev[i], 0.1);
1438 //////////////////////////////// Norm /////////////////////////////////////////////////
1440 typedef ArithmTestBase Norm;
1442 OCL_TEST_P(Norm, NORM_INF)
1444 for (int relative = 0; relative < 2; ++relative)
1445 for (int j = 0; j < LOOP_TIMES; j++)
1449 int type = NORM_INF;
1451 type |= NORM_RELATIVE;
1453 const double cpuRes = cv::norm(src1_roi, src2_roi, type);
1454 const double gpuRes = cv::ocl::norm(gsrc1_roi, gsrc2_roi, type);
1456 EXPECT_NEAR(cpuRes, gpuRes, 0.1);
1460 OCL_TEST_P(Norm, NORM_L1)
1462 for (int relative = 0; relative < 2; ++relative)
1463 for (int j = 0; j < LOOP_TIMES; j++)
1469 type |= NORM_RELATIVE;
1471 const double cpuRes = cv::norm(src1_roi, src2_roi, type);
1472 const double gpuRes = cv::ocl::norm(gsrc1_roi, gsrc2_roi, type);
1474 EXPECT_PRED3(relativeError, cpuRes, gpuRes, 1e-6);
1478 OCL_TEST_P(Norm, NORM_L2)
1480 for (int relative = 0; relative < 2; ++relative)
1481 for (int j = 0; j < LOOP_TIMES; j++)
1487 type |= NORM_RELATIVE;
1489 const double cpuRes = cv::norm(src1_roi, src2_roi, type);
1490 const double gpuRes = cv::ocl::norm(gsrc1_roi, gsrc2_roi, type);
1492 EXPECT_PRED3(relativeError, cpuRes, gpuRes, 1e-6);
1496 //////////////////////////////////////// Instantiation /////////////////////////////////////////
1498 INSTANTIATE_TEST_CASE_P(Arithm, Lut, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool(), Bool()));
1499 INSTANTIATE_TEST_CASE_P(Arithm, Exp, Combine(testing::Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1500 INSTANTIATE_TEST_CASE_P(Arithm, Log, Combine(testing::Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1501 INSTANTIATE_TEST_CASE_P(Arithm, Add, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1502 INSTANTIATE_TEST_CASE_P(Arithm, Sub, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1503 INSTANTIATE_TEST_CASE_P(Arithm, Mul, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1504 INSTANTIATE_TEST_CASE_P(Arithm, Div, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1505 INSTANTIATE_TEST_CASE_P(Arithm, Min, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1506 INSTANTIATE_TEST_CASE_P(Arithm, Max, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1507 INSTANTIATE_TEST_CASE_P(Arithm, Abs, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1508 INSTANTIATE_TEST_CASE_P(Arithm, Absdiff, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1509 INSTANTIATE_TEST_CASE_P(Arithm, CartToPolar, Combine(Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1510 INSTANTIATE_TEST_CASE_P(Arithm, PolarToCart, Combine(Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1511 INSTANTIATE_TEST_CASE_P(Arithm, Magnitude, Combine(Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1512 INSTANTIATE_TEST_CASE_P(Arithm, Transpose, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1513 INSTANTIATE_TEST_CASE_P(Arithm, Flip, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1514 INSTANTIATE_TEST_CASE_P(Arithm, MinMax, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(Channels(1)), Bool()));
1515 INSTANTIATE_TEST_CASE_P(Arithm, MinMaxLoc, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(Channels(1)), Bool()));
1516 INSTANTIATE_TEST_CASE_P(Arithm, Sum, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1517 INSTANTIATE_TEST_CASE_P(Arithm, SqrSum, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1518 INSTANTIATE_TEST_CASE_P(Arithm, AbsSum, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1519 INSTANTIATE_TEST_CASE_P(Arithm, CountNonZero, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(Channels(1)), Bool()));
1520 INSTANTIATE_TEST_CASE_P(Arithm, Phase, Combine(Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1521 INSTANTIATE_TEST_CASE_P(Arithm, Bitwise_and, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1522 INSTANTIATE_TEST_CASE_P(Arithm, Bitwise_or, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1523 INSTANTIATE_TEST_CASE_P(Arithm, Bitwise_xor, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1524 INSTANTIATE_TEST_CASE_P(Arithm, Bitwise_not, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1525 INSTANTIATE_TEST_CASE_P(Arithm, Compare, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(Channels(1)), Bool()));
1526 INSTANTIATE_TEST_CASE_P(Arithm, Pow, Combine(Values(CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1527 INSTANTIATE_TEST_CASE_P(Arithm, AddWeighted, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1528 INSTANTIATE_TEST_CASE_P(Arithm, SetIdentity, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1529 INSTANTIATE_TEST_CASE_P(Arithm, MeanStdDev, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1530 INSTANTIATE_TEST_CASE_P(Arithm, Norm, Combine(Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), Values(1, 2, 3, 4), Bool()));
1532 #endif // HAVE_OPENCL