5x5 gaussian blur optimization
[platform/upstream/opencv.git] / modules / imgproc / test / ocl / test_filters.cpp
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
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.
8 //
9 //
10 //                           License Agreement
11 //                For Open Source Computer Vision Library
12 //
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.
17 //
18 // @Authors
19 //    Niko Li, newlife20080214@gmail.com
20 //    Jia Haipeng, jiahaipeng95@gmail.com
21 //    Zero Lin, Zero.Lin@amd.com
22 //    Zhang Ying, zhangying913@gmail.com
23 //    Yao Wang, bitwangyaoyao@gmail.com
24 //
25 // Redistribution and use in source and binary forms, with or without modification,
26 // are permitted provided that the following conditions are met:
27 //
28 //   * Redistribution's of source code must retain the above copyright notice,
29 //     this list of conditions and the following disclaimer.
30 //
31 //   * Redistribution's in binary form must reproduce the above copyright notice,
32 //     this list of conditions and the following disclaimer in the documentation
33 //     and/or other materials provided with the distribution.
34 //
35 //   * The name of the copyright holders may not be used to endorse or promote products
36 //     derived from this software without specific prior written permission.
37 //
38 // This software is provided by the copyright holders and contributors "as is" and
39 // any express or implied warranties, including, but not limited to, the implied
40 // warranties of merchantability and fitness for a particular purpose are disclaimed.
41 // In no event shall the Intel Corporation or contributors be liable for any direct,
42 // indirect, incidental, special, exemplary, or consequential damages
43 // (including, but not limited to, procurement of substitute goods or services;
44 // loss of use, data, or profits; or business interruption) however caused
45 // and on any theory of liability, whether in contract, strict liability,
46 // or tort (including negligence or otherwise) arising in any way out of
47 // the use of this software, even if advised of the possibility of such damage.
48 //
49 //M*/
50
51 #include "../test_precomp.hpp"
52 #include "cvconfig.h"
53 #include "opencv2/ts/ocl_test.hpp"
54
55 #ifdef HAVE_OPENCL
56
57 namespace cvtest {
58 namespace ocl {
59
60 PARAM_TEST_CASE(FilterTestBase, MatType,
61                 int, // kernel size
62                 Size, // dx, dy
63                 BorderType, // border type
64                 double, // optional parameter
65                 bool, // roi or not
66                 int)  // width multiplier
67 {
68     int type, borderType, ksize;
69     Size size;
70     double param;
71     bool useRoi;
72     int widthMultiple;
73
74     TEST_DECLARE_INPUT_PARAMETER(src);
75     TEST_DECLARE_OUTPUT_PARAMETER(dst);
76
77     virtual void SetUp()
78     {
79         type = GET_PARAM(0);
80         ksize = GET_PARAM(1);
81         size = GET_PARAM(2);
82         borderType = GET_PARAM(3);
83         param = GET_PARAM(4);
84         useRoi = GET_PARAM(5);
85         widthMultiple = GET_PARAM(6);
86     }
87
88     void random_roi(int minSize = 1)
89     {
90         if (minSize == 0)
91             minSize = ksize;
92
93         Size roiSize = randomSize(minSize, MAX_VALUE);
94         roiSize.width &= ~((widthMultiple * 2) - 1);
95         roiSize.width += widthMultiple;
96
97         Border srcBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
98         randomSubMat(src, src_roi, roiSize, srcBorder, type, 5, 256);
99
100         Border dstBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
101         randomSubMat(dst, dst_roi, roiSize, dstBorder, type, -60, 70);
102
103         UMAT_UPLOAD_INPUT_PARAMETER(src);
104         UMAT_UPLOAD_OUTPUT_PARAMETER(dst);
105     }
106
107     void Near()
108     {
109         int depth = CV_MAT_DEPTH(type);
110         bool isFP = depth >= CV_32F;
111
112         if (isFP)
113             Near(1e-6, true);
114         else
115             Near(1, false);
116     }
117
118     void Near(double threshold, bool relative)
119     {
120         if (relative)
121             OCL_EXPECT_MATS_NEAR_RELATIVE(dst, threshold);
122         else
123             OCL_EXPECT_MATS_NEAR(dst, threshold);
124     }
125 };
126
127 ////////////////////////////////////////////////////////////////////////////////////////////////////
128 // Bilateral
129
130 typedef FilterTestBase Bilateral;
131
132 OCL_TEST_P(Bilateral, Mat)
133 {
134     for (int j = 0; j < test_loop_times; j++)
135     {
136         random_roi();
137
138         double sigmacolor = rng.uniform(20, 100);
139         double sigmaspace = rng.uniform(10, 40);
140
141         OCL_OFF(cv::bilateralFilter(src_roi, dst_roi, ksize, sigmacolor, sigmaspace, borderType));
142         OCL_ON(cv::bilateralFilter(usrc_roi, udst_roi, ksize, sigmacolor, sigmaspace, borderType));
143
144         Near();
145     }
146 }
147
148 /////////////////////////////////////////////////////////////////////////////////////////////////
149 // Laplacian
150
151 typedef FilterTestBase LaplacianTest;
152
153 OCL_TEST_P(LaplacianTest, Accuracy)
154 {
155     double scale = param;
156
157     for (int j = 0; j < test_loop_times; j++)
158     {
159         random_roi();
160
161         OCL_OFF(cv::Laplacian(src_roi, dst_roi, -1, ksize, scale, 10, borderType));
162         OCL_ON(cv::Laplacian(usrc_roi, udst_roi, -1, ksize, scale, 10, borderType));
163
164         Near();
165     }
166 }
167
168 PARAM_TEST_CASE(Deriv3x3_cols16_rows2_Base, MatType,
169                 int, // kernel size
170                 Size, // dx, dy
171                 BorderType, // border type
172                 double, // optional parameter
173                 bool, // roi or not
174                 int)  // width multiplier
175 {
176     int type, borderType, ksize;
177     Size size;
178     double param;
179     bool useRoi;
180     int widthMultiple;
181
182     TEST_DECLARE_INPUT_PARAMETER(src);
183     TEST_DECLARE_OUTPUT_PARAMETER(dst);
184
185     virtual void SetUp()
186     {
187         type = GET_PARAM(0);
188         ksize = GET_PARAM(1);
189         size = GET_PARAM(2);
190         borderType = GET_PARAM(3);
191         param = GET_PARAM(4);
192         useRoi = GET_PARAM(5);
193         widthMultiple = GET_PARAM(6);
194     }
195
196     void random_roi()
197     {
198         size = Size(3, 3);
199
200         Size roiSize = randomSize(size.width, MAX_VALUE, size.height, MAX_VALUE);
201         roiSize.width = std::max(size.width + 13, roiSize.width & (~0xf));
202         roiSize.height = std::max(size.height + 1, roiSize.height & (~0x1));
203
204         Border srcBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
205         randomSubMat(src, src_roi, roiSize, srcBorder, type, 5, 256);
206
207         Border dstBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
208         randomSubMat(dst, dst_roi, roiSize, dstBorder, type, -60, 70);
209
210         UMAT_UPLOAD_INPUT_PARAMETER(src);
211         UMAT_UPLOAD_OUTPUT_PARAMETER(dst);
212     }
213
214     void Near()
215     {
216         Near(1, false);
217     }
218
219     void Near(double threshold, bool relative)
220     {
221         if (relative)
222             OCL_EXPECT_MATS_NEAR_RELATIVE(dst, threshold);
223         else
224             OCL_EXPECT_MATS_NEAR(dst, threshold);
225     }
226 };
227
228 typedef Deriv3x3_cols16_rows2_Base Laplacian3_cols16_rows2;
229
230 OCL_TEST_P(Laplacian3_cols16_rows2, Accuracy)
231 {
232     double scale = param;
233
234     for (int j = 0; j < test_loop_times; j++)
235     {
236         random_roi();
237
238         OCL_OFF(cv::Laplacian(src_roi, dst_roi, -1, ksize, scale, 10, borderType));
239         OCL_ON(cv::Laplacian(usrc_roi, udst_roi, -1, ksize, scale, 10, borderType));
240
241         Near();
242     }
243 }
244
245
246 /////////////////////////////////////////////////////////////////////////////////////////////////
247 // Sobel
248
249 typedef FilterTestBase SobelTest;
250
251 OCL_TEST_P(SobelTest, Mat)
252 {
253     int dx = size.width, dy = size.height;
254     double scale = param;
255
256     for (int j = 0; j < test_loop_times; j++)
257     {
258         random_roi();
259
260         OCL_OFF(cv::Sobel(src_roi, dst_roi, -1, dx, dy, ksize, scale, /* delta */0, borderType));
261         OCL_ON(cv::Sobel(usrc_roi, udst_roi, -1, dx, dy, ksize, scale, /* delta */0, borderType));
262
263         Near();
264     }
265 }
266
267 typedef Deriv3x3_cols16_rows2_Base Sobel3x3_cols16_rows2;
268
269 OCL_TEST_P(Sobel3x3_cols16_rows2, Mat)
270 {
271     int dx = size.width, dy = size.height;
272     double scale = param;
273
274     for (int j = 0; j < test_loop_times; j++)
275     {
276         random_roi();
277
278         OCL_OFF(cv::Sobel(src_roi, dst_roi, -1, dx, dy, ksize, scale, /* delta */0, borderType));
279         OCL_ON(cv::Sobel(usrc_roi, udst_roi, -1, dx, dy, ksize, scale, /* delta */0, borderType));
280
281         Near();
282     }
283 }
284
285 /////////////////////////////////////////////////////////////////////////////////////////////////
286 // Scharr
287
288 typedef FilterTestBase ScharrTest;
289
290 OCL_TEST_P(ScharrTest, Mat)
291 {
292     int dx = size.width, dy = size.height;
293     double scale = param;
294
295     for (int j = 0; j < test_loop_times; j++)
296     {
297         random_roi();
298
299         OCL_OFF(cv::Scharr(src_roi, dst_roi, -1, dx, dy, scale, /* delta */ 0, borderType));
300         OCL_ON(cv::Scharr(usrc_roi, udst_roi, -1, dx, dy, scale, /* delta */ 0, borderType));
301
302         Near();
303     }
304 }
305
306 typedef Deriv3x3_cols16_rows2_Base Scharr3x3_cols16_rows2;
307
308 OCL_TEST_P(Scharr3x3_cols16_rows2, Mat)
309 {
310     int dx = size.width, dy = size.height;
311     double scale = param;
312
313     for (int j = 0; j < test_loop_times; j++)
314     {
315         random_roi();
316
317         OCL_OFF(cv::Scharr(src_roi, dst_roi, -1, dx, dy, scale, /* delta */ 0, borderType));
318         OCL_ON(cv::Scharr(usrc_roi, udst_roi, -1, dx, dy, scale, /* delta */ 0, borderType));
319
320         Near();
321     }
322 }
323
324 /////////////////////////////////////////////////////////////////////////////////////////////////
325 // GaussianBlur
326
327 typedef FilterTestBase GaussianBlurTest;
328
329 OCL_TEST_P(GaussianBlurTest, Mat)
330 {
331     for (int j = 0; j < test_loop_times + 1; j++)
332     {
333         random_roi();
334
335         double sigma1 = rng.uniform(0.1, 1.0);
336         double sigma2 = j % 2 == 0 ? sigma1 : rng.uniform(0.1, 1.0);
337
338         OCL_OFF(cv::GaussianBlur(src_roi, dst_roi, Size(ksize, ksize), sigma1, sigma2, borderType));
339         OCL_ON(cv::GaussianBlur(usrc_roi, udst_roi, Size(ksize, ksize), sigma1, sigma2, borderType));
340
341         Near(CV_MAT_DEPTH(type) >= CV_32F ? 1e-3 : 4, CV_MAT_DEPTH(type) >= CV_32F);
342     }
343 }
344
345 PARAM_TEST_CASE(GaussianBlur_multicols_Base, MatType,
346                 int, // kernel size
347                 Size, // dx, dy
348                 BorderType, // border type
349                 double, // optional parameter
350                 bool, // roi or not
351                 int)  // width multiplier
352 {
353     int type, borderType, ksize;
354     Size size;
355     double param;
356     bool useRoi;
357     int widthMultiple;
358
359     TEST_DECLARE_INPUT_PARAMETER(src);
360     TEST_DECLARE_OUTPUT_PARAMETER(dst);
361
362     virtual void SetUp()
363     {
364         type = GET_PARAM(0);
365         ksize = GET_PARAM(1);
366         size = GET_PARAM(2);
367         borderType = GET_PARAM(3);
368         param = GET_PARAM(4);
369         useRoi = GET_PARAM(5);
370         widthMultiple = GET_PARAM(6);
371     }
372
373     void random_roi()
374     {
375         size = Size(ksize, ksize);
376
377         Size roiSize = randomSize(size.width, MAX_VALUE, size.height, MAX_VALUE);
378         if (ksize == 3)
379         {
380             roiSize.width = std::max((size.width + 15) & 0x10, roiSize.width & (~0xf));
381             roiSize.height = std::max(size.height + 1, roiSize.height & (~0x1));
382         }
383         else if (ksize == 5)
384         {
385             roiSize.width = std::max((size.width + 3) & 0x4, roiSize.width & (~0x3));
386         }
387
388         Border srcBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
389         randomSubMat(src, src_roi, roiSize, srcBorder, type, 5, 256);
390
391         Border dstBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
392         randomSubMat(dst, dst_roi, roiSize, dstBorder, type, -60, 70);
393
394         UMAT_UPLOAD_INPUT_PARAMETER(src);
395         UMAT_UPLOAD_OUTPUT_PARAMETER(dst);
396     }
397
398     void Near()
399     {
400         Near(1, false);
401     }
402
403     void Near(double threshold, bool relative)
404     {
405         if (relative)
406             OCL_EXPECT_MATS_NEAR_RELATIVE(dst, threshold);
407         else
408             OCL_EXPECT_MATS_NEAR(dst, threshold);
409     }
410 };
411
412 typedef GaussianBlur_multicols_Base GaussianBlur_multicols;
413
414 OCL_TEST_P(GaussianBlur_multicols, Mat)
415 {
416     Size kernelSize(ksize, ksize);
417
418     for (int j = 0; j < test_loop_times; j++)
419     {
420         random_roi();
421
422         double sigma1 = rng.uniform(0.1, 1.0);
423         double sigma2 = j % 2 == 0 ? sigma1 : rng.uniform(0.1, 1.0);
424
425         OCL_OFF(cv::GaussianBlur(src_roi, dst_roi, Size(ksize, ksize), sigma1, sigma2, borderType));
426         OCL_ON(cv::GaussianBlur(usrc_roi, udst_roi, Size(ksize, ksize), sigma1, sigma2, borderType));
427
428         Near(CV_MAT_DEPTH(type) >= CV_32F ? 1e-3 : 4, CV_MAT_DEPTH(type) >= CV_32F);
429     }
430 }
431
432 /////////////////////////////////////////////////////////////////////////////////////////////////
433 // Erode
434
435 typedef FilterTestBase Erode;
436
437 OCL_TEST_P(Erode, Mat)
438 {
439     Size kernelSize(ksize, ksize);
440     int iterations = (int)param;
441
442     for (int j = 0; j < test_loop_times; j++)
443     {
444         random_roi();
445         Mat kernel = ksize==0 ? Mat() : randomMat(kernelSize, CV_8UC1, 0, 3);
446
447         OCL_OFF(cv::erode(src_roi, dst_roi, kernel, Point(-1, -1), iterations) );
448         OCL_ON(cv::erode(usrc_roi, udst_roi, kernel, Point(-1, -1), iterations) );
449
450         Near();
451     }
452 }
453
454 /////////////////////////////////////////////////////////////////////////////////////////////////
455 // Dilate
456
457 typedef FilterTestBase Dilate;
458
459 OCL_TEST_P(Dilate, Mat)
460 {
461     Size kernelSize(ksize, ksize);
462     int iterations = (int)param;
463
464     for (int j = 0; j < test_loop_times; j++)
465     {
466         random_roi();
467         Mat kernel = ksize==0 ? Mat() : randomMat(kernelSize, CV_8UC1, 0, 3);
468
469         OCL_OFF(cv::dilate(src_roi, dst_roi, kernel, Point(-1, -1), iterations) );
470         OCL_ON(cv::dilate(usrc_roi, udst_roi, kernel, Point(-1, -1), iterations) );
471
472         Near();
473     }
474 }
475
476 PARAM_TEST_CASE(MorphFilter3x3_cols16_rows2_Base, MatType,
477                 int, // kernel size
478                 Size, // dx, dy
479                 BorderType, // border type
480                 double, // optional parameter
481                 bool, // roi or not
482                 int)  // width multiplier
483 {
484     int type, borderType, ksize;
485     Size size;
486     double param;
487     bool useRoi;
488     int widthMultiple;
489
490     TEST_DECLARE_INPUT_PARAMETER(src);
491     TEST_DECLARE_OUTPUT_PARAMETER(dst);
492
493     virtual void SetUp()
494     {
495         type = GET_PARAM(0);
496         ksize = GET_PARAM(1);
497         size = GET_PARAM(2);
498         borderType = GET_PARAM(3);
499         param = GET_PARAM(4);
500         useRoi = GET_PARAM(5);
501         widthMultiple = GET_PARAM(6);
502     }
503
504     void random_roi()
505     {
506         size = Size(3, 3);
507
508         Size roiSize = randomSize(size.width, MAX_VALUE, size.height, MAX_VALUE);
509         roiSize.width = std::max(size.width + 13, roiSize.width & (~0xf));
510         roiSize.height = std::max(size.height + 1, roiSize.height & (~0x1));
511
512         Border srcBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
513         randomSubMat(src, src_roi, roiSize, srcBorder, type, 5, 256);
514
515         Border dstBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
516         randomSubMat(dst, dst_roi, roiSize, dstBorder, type, -60, 70);
517
518         UMAT_UPLOAD_INPUT_PARAMETER(src);
519         UMAT_UPLOAD_OUTPUT_PARAMETER(dst);
520     }
521
522     void Near()
523     {
524         Near(1, false);
525     }
526
527     void Near(double threshold, bool relative)
528     {
529         if (relative)
530             OCL_EXPECT_MATS_NEAR_RELATIVE(dst, threshold);
531         else
532             OCL_EXPECT_MATS_NEAR(dst, threshold);
533     }
534 };
535
536 typedef MorphFilter3x3_cols16_rows2_Base MorphFilter3x3_cols16_rows2;
537
538 OCL_TEST_P(MorphFilter3x3_cols16_rows2, Mat)
539 {
540     Size kernelSize(ksize, ksize);
541     int iterations = (int)param;
542
543     for (int j = 0; j < test_loop_times; j++)
544     {
545         random_roi();
546         Mat kernel = ksize==0 ? Mat() : randomMat(kernelSize, CV_8UC1, 0, 3);
547
548         OCL_OFF(cv::dilate(src_roi, dst_roi, kernel, Point(-1, -1), iterations) );
549         OCL_ON(cv::dilate(usrc_roi, udst_roi, kernel, Point(-1, -1), iterations) );
550
551         Near();
552     }
553 }
554
555 /////////////////////////////////////////////////////////////////////////////////////////////////
556 // MorphologyEx
557 IMPLEMENT_PARAM_CLASS(MorphOp, int)
558 PARAM_TEST_CASE(MorphologyEx, MatType,
559                 int, // kernel size
560                 MorphOp, // MORPH_OP
561                 int, // iterations
562                 bool)
563 {
564     int type, ksize, op, iterations;
565     bool useRoi;
566
567     TEST_DECLARE_INPUT_PARAMETER(src);
568     TEST_DECLARE_OUTPUT_PARAMETER(dst);
569
570     virtual void SetUp()
571     {
572         type = GET_PARAM(0);
573         ksize = GET_PARAM(1);
574         op = GET_PARAM(2);
575         iterations = GET_PARAM(3);
576         useRoi = GET_PARAM(4);
577     }
578
579     void random_roi(int minSize = 1)
580     {
581         if (minSize == 0)
582             minSize = ksize;
583
584         Size roiSize = randomSize(minSize, MAX_VALUE);
585
586         Border srcBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
587         randomSubMat(src, src_roi, roiSize, srcBorder, type, 5, 256);
588
589         Border dstBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
590         randomSubMat(dst, dst_roi, roiSize, dstBorder, type, -60, 70);
591
592         UMAT_UPLOAD_INPUT_PARAMETER(src);
593         UMAT_UPLOAD_OUTPUT_PARAMETER(dst);
594     }
595
596     void Near()
597     {
598         int depth = CV_MAT_DEPTH(type);
599         bool isFP = depth >= CV_32F;
600
601         if (isFP)
602             Near(1e-6, true);
603         else
604             Near(1, false);
605     }
606
607     void Near(double threshold, bool relative)
608     {
609         if (relative)
610             OCL_EXPECT_MATS_NEAR_RELATIVE(dst, threshold);
611         else
612             OCL_EXPECT_MATS_NEAR(dst, threshold);
613     }
614 };
615
616 OCL_TEST_P(MorphologyEx, Mat)
617 {
618     Size kernelSize(ksize, ksize);
619
620     for (int j = 0; j < test_loop_times; j++)
621     {
622         random_roi();
623         Mat kernel = randomMat(kernelSize, CV_8UC1, 0, 3);
624
625         OCL_OFF(cv::morphologyEx(src_roi, dst_roi, op, kernel, Point(-1, -1), iterations) );
626         OCL_ON(cv::morphologyEx(usrc_roi, udst_roi, op, kernel, Point(-1, -1), iterations) );
627
628         Near();
629     }
630 }
631
632 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
633
634 #define FILTER_BORDER_SET_NO_ISOLATED \
635     Values((BorderType)BORDER_CONSTANT, (BorderType)BORDER_REPLICATE, (BorderType)BORDER_REFLECT, (BorderType)BORDER_WRAP, (BorderType)BORDER_REFLECT_101/*, \
636             (int)BORDER_CONSTANT|BORDER_ISOLATED, (int)BORDER_REPLICATE|BORDER_ISOLATED, \
637             (int)BORDER_REFLECT|BORDER_ISOLATED, (int)BORDER_WRAP|BORDER_ISOLATED, \
638             (int)BORDER_REFLECT_101|BORDER_ISOLATED*/) // WRAP and ISOLATED are not supported by cv:: version
639
640 #define FILTER_BORDER_SET_NO_WRAP_NO_ISOLATED \
641     Values((BorderType)BORDER_CONSTANT, (BorderType)BORDER_REPLICATE, (BorderType)BORDER_REFLECT, /*(int)BORDER_WRAP,*/ (BorderType)BORDER_REFLECT_101/*, \
642             (int)BORDER_CONSTANT|BORDER_ISOLATED, (int)BORDER_REPLICATE|BORDER_ISOLATED, \
643             (int)BORDER_REFLECT|BORDER_ISOLATED, (int)BORDER_WRAP|BORDER_ISOLATED, \
644             (int)BORDER_REFLECT_101|BORDER_ISOLATED*/) // WRAP and ISOLATED are not supported by cv:: version
645
646 #define FILTER_TYPES Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4)
647
648 OCL_INSTANTIATE_TEST_CASE_P(Filter, Bilateral, Combine(
649                             Values(CV_8UC1, CV_8UC3),
650                             Values(5, 9), // kernel size
651                             Values(Size(0, 0)), // not used
652                             FILTER_BORDER_SET_NO_ISOLATED,
653                             Values(0.0), // not used
654                             Bool(),
655                             Values(1, 4)));
656
657 OCL_INSTANTIATE_TEST_CASE_P(Filter, LaplacianTest, Combine(
658                             FILTER_TYPES,
659                             Values(1, 3, 5), // kernel size
660                             Values(Size(0, 0)), // not used
661                             FILTER_BORDER_SET_NO_WRAP_NO_ISOLATED,
662                             Values(1.0, 0.2, 3.0), // kernel scale
663                             Bool(),
664                             Values(1))); // not used
665
666 OCL_INSTANTIATE_TEST_CASE_P(Filter, Laplacian3_cols16_rows2, Combine(
667                             Values((MatType)CV_8UC1),
668                             Values(3), // kernel size
669                             Values(Size(0, 0)), // not used
670                             FILTER_BORDER_SET_NO_WRAP_NO_ISOLATED,
671                             Values(1.0, 0.2, 3.0), // kernel scale
672                             Bool(),
673                             Values(1))); // not used
674
675 OCL_INSTANTIATE_TEST_CASE_P(Filter, SobelTest, Combine(
676                             FILTER_TYPES,
677                             Values(3, 5), // kernel size
678                             Values(Size(1, 0), Size(1, 1), Size(2, 0), Size(2, 1)), // dx, dy
679                             FILTER_BORDER_SET_NO_WRAP_NO_ISOLATED,
680                             Values(0.0), // not used
681                             Bool(),
682                             Values(1))); // not used
683
684 OCL_INSTANTIATE_TEST_CASE_P(Filter, Sobel3x3_cols16_rows2, Combine(
685                             Values((MatType)CV_8UC1),
686                             Values(3), // kernel size
687                             Values(Size(1, 0), Size(1, 1), Size(2, 0), Size(2, 1)), // dx, dy
688                             FILTER_BORDER_SET_NO_WRAP_NO_ISOLATED,
689                             Values(0.0), // not used
690                             Bool(),
691                             Values(1))); // not used
692
693 OCL_INSTANTIATE_TEST_CASE_P(Filter, ScharrTest, Combine(
694                             FILTER_TYPES,
695                             Values(0), // not used
696                             Values(Size(0, 1), Size(1, 0)), // dx, dy
697                             FILTER_BORDER_SET_NO_WRAP_NO_ISOLATED,
698                             Values(1.0, 0.2), // kernel scale
699                             Bool(),
700                             Values(1))); // not used
701
702 OCL_INSTANTIATE_TEST_CASE_P(Filter, Scharr3x3_cols16_rows2, Combine(
703                             FILTER_TYPES,
704                             Values(0), // not used
705                             Values(Size(0, 1), Size(1, 0)), // dx, dy
706                             FILTER_BORDER_SET_NO_WRAP_NO_ISOLATED,
707                             Values(1.0, 0.2), // kernel scale
708                             Bool(),
709                             Values(1))); // not used
710
711 OCL_INSTANTIATE_TEST_CASE_P(Filter, GaussianBlurTest, Combine(
712                             FILTER_TYPES,
713                             Values(3, 5), // kernel size
714                             Values(Size(0, 0)), // not used
715                             FILTER_BORDER_SET_NO_WRAP_NO_ISOLATED,
716                             Values(0.0), // not used
717                             Bool(),
718                             Values(1))); // not used
719
720 OCL_INSTANTIATE_TEST_CASE_P(Filter, GaussianBlur_multicols, Combine(
721                             Values((MatType)CV_8UC1),
722                             Values(3, 5), // kernel size
723                             Values(Size(0, 0)), // not used
724                             FILTER_BORDER_SET_NO_WRAP_NO_ISOLATED,
725                             Values(0.0), // not used
726                             Bool(),
727                             Values(1))); // not used
728
729 OCL_INSTANTIATE_TEST_CASE_P(Filter, Erode, Combine(
730                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32FC1, CV_32FC3, CV_32FC4, CV_64FC1, CV_64FC4),
731                             Values(0, 3, 5, 7), // kernel size, 0 means kernel = Mat()
732                             Values(Size(0, 0)), //not used
733                             Values((BorderType)BORDER_CONSTANT),
734                             Values(1.0, 2.0, 3.0),
735                             Bool(),
736                             Values(1))); // not used
737
738 OCL_INSTANTIATE_TEST_CASE_P(Filter, Dilate, Combine(
739                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32FC1, CV_32FC3, CV_32FC4, CV_64FC1, CV_64FC4),
740                             Values(0, 3, 5, 7), // kernel size, 0 means kernel = Mat()
741                             Values(Size(0, 0)), // not used
742                             Values((BorderType)BORDER_CONSTANT),
743                             Values(1.0, 2.0, 3.0),
744                             Bool(),
745                             Values(1))); // not used
746
747 OCL_INSTANTIATE_TEST_CASE_P(Filter, MorphFilter3x3_cols16_rows2, Combine(
748                             Values((MatType)CV_8UC1),
749                             Values(0, 3), // kernel size, 0 means kernel = Mat()
750                             Values(Size(0, 0)), // not used
751                             Values((BorderType)BORDER_CONSTANT),
752                             Values(1.0, 2.0, 3.0),
753                             Bool(),
754                             Values(1))); // not used
755
756 OCL_INSTANTIATE_TEST_CASE_P(Filter, MorphologyEx, Combine(
757                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32FC1, CV_32FC3, CV_32FC4),
758                             Values(3, 5, 7), // kernel size
759                             Values((MorphOp)MORPH_OPEN, (MorphOp)MORPH_CLOSE, (MorphOp)MORPH_GRADIENT, (MorphOp)MORPH_TOPHAT, (MorphOp)MORPH_BLACKHAT), // used as generator of operations
760                             Values(1, 2, 3),
761                             Bool()));
762
763
764 } } // namespace cvtest::ocl
765
766 #endif // HAVE_OPENCL