CLAHE Python bindings
[profile/ivi/opencv.git] / modules / gpu / doc / image_filtering.rst
1 Image Filtering
2 ===============
3
4 .. highlight:: cpp
5
6 Functions and classes described in this section are used to perform various linear or non-linear filtering operations on 2D images.
7
8
9
10 gpu::BaseRowFilter_GPU
11 ----------------------
12 .. ocv:class:: gpu::BaseRowFilter_GPU
13
14 Base class for linear or non-linear filters that processes rows of 2D arrays. Such filters are used for the "horizontal" filtering passes in separable filters. ::
15
16     class BaseRowFilter_GPU
17     {
18     public:
19         BaseRowFilter_GPU(int ksize_, int anchor_);
20         virtual ~BaseRowFilter_GPU() {}
21         virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) = 0;
22         int ksize, anchor;
23     };
24
25
26 .. note:: This class does not allocate memory for a destination image. Usually this class is used inside :ocv:class:`gpu::FilterEngine_GPU`.
27
28
29
30 gpu::BaseColumnFilter_GPU
31 -------------------------
32 .. ocv:class:: gpu::BaseColumnFilter_GPU
33
34 Base class for linear or non-linear filters that processes columns of 2D arrays. Such filters are used for the "vertical" filtering passes in separable filters. ::
35
36     class BaseColumnFilter_GPU
37     {
38     public:
39         BaseColumnFilter_GPU(int ksize_, int anchor_);
40         virtual ~BaseColumnFilter_GPU() {}
41         virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) = 0;
42         int ksize, anchor;
43     };
44
45
46 .. note:: This class does not allocate memory for a destination image. Usually this class is used inside :ocv:class:`gpu::FilterEngine_GPU`.
47
48
49
50 gpu::BaseFilter_GPU
51 -------------------
52 .. ocv:class:: gpu::BaseFilter_GPU
53
54 Base class for non-separable 2D filters. ::
55
56     class CV_EXPORTS BaseFilter_GPU
57     {
58     public:
59         BaseFilter_GPU(const Size& ksize_, const Point& anchor_);
60         virtual ~BaseFilter_GPU() {}
61         virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) = 0;
62         Size ksize;
63         Point anchor;
64     };
65
66
67 .. note:: This class does not allocate memory for a destination image. Usually this class is used inside :ocv:class:`gpu::FilterEngine_GPU`.
68
69
70
71 gpu::FilterEngine_GPU
72 ---------------------
73 .. ocv:class:: gpu::FilterEngine_GPU
74
75 Base class for the Filter Engine. ::
76
77     class CV_EXPORTS FilterEngine_GPU
78     {
79     public:
80         virtual ~FilterEngine_GPU() {}
81
82         virtual void apply(const GpuMat& src, GpuMat& dst,
83                            Rect roi = Rect(0,0,-1,-1), Stream& stream = Stream::Null()) = 0;
84     };
85
86
87 The class can be used to apply an arbitrary filtering operation to an image. It contains all the necessary intermediate buffers. Pointers to the initialized ``FilterEngine_GPU`` instances are returned by various ``create*Filter_GPU`` functions (see below), and they are used inside high-level functions such as :ocv:func:`gpu::filter2D`, :ocv:func:`gpu::erode`, :ocv:func:`gpu::Sobel` , and others.
88
89 By using ``FilterEngine_GPU`` instead of functions you can avoid unnecessary memory allocation for intermediate buffers and get better performance: ::
90
91     while (...)
92     {
93         gpu::GpuMat src = getImg();
94         gpu::GpuMat dst;
95         // Allocate and release buffers at each iterations
96         gpu::GaussianBlur(src, dst, ksize, sigma1);
97     }
98
99     // Allocate buffers only once
100     cv::Ptr<gpu::FilterEngine_GPU> filter =
101         gpu::createGaussianFilter_GPU(CV_8UC4, ksize, sigma1);
102     while (...)
103     {
104         gpu::GpuMat src = getImg();
105         gpu::GpuMat dst;
106         filter->apply(src, dst, cv::Rect(0, 0, src.cols, src.rows));
107     }
108     // Release buffers only once
109     filter.release();
110
111
112 ``FilterEngine_GPU`` can process a rectangular sub-region of an image. By default, if ``roi == Rect(0,0,-1,-1)`` , ``FilterEngine_GPU`` processes the inner region of an image ( ``Rect(anchor.x, anchor.y, src_size.width - ksize.width, src_size.height - ksize.height)`` ) because some filters do not check whether indices are outside the image for better performance. See below to understand which filters support processing the whole image and which do not and identify image type limitations.
113
114 .. note:: The GPU filters do not support the in-place mode.
115
116 .. seealso:: :ocv:class:`gpu::BaseRowFilter_GPU`, :ocv:class:`gpu::BaseColumnFilter_GPU`, :ocv:class:`gpu::BaseFilter_GPU`, :ocv:func:`gpu::createFilter2D_GPU`, :ocv:func:`gpu::createSeparableFilter_GPU`, :ocv:func:`gpu::createBoxFilter_GPU`, :ocv:func:`gpu::createMorphologyFilter_GPU`, :ocv:func:`gpu::createLinearFilter_GPU`, :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`gpu::createDerivFilter_GPU`, :ocv:func:`gpu::createGaussianFilter_GPU`
117
118
119
120 gpu::createFilter2D_GPU
121 ---------------------------
122 Creates a non-separable filter engine with the specified filter.
123
124 .. ocv:function:: Ptr<FilterEngine_GPU> gpu::createFilter2D_GPU( const Ptr<BaseFilter_GPU>& filter2D, int srcType, int dstType)
125
126     :param filter2D: Non-separable 2D filter.
127
128     :param srcType: Input image type. It must be supported by  ``filter2D`` .
129
130     :param dstType: Output image type. It must be supported by  ``filter2D`` .
131
132 Usually this function is used inside such high-level functions as :ocv:func:`gpu::createLinearFilter_GPU`, :ocv:func:`gpu::createBoxFilter_GPU`.
133
134
135
136 gpu::createSeparableFilter_GPU
137 ----------------------------------
138 Creates a separable filter engine with the specified filters.
139
140 .. ocv:function:: Ptr<FilterEngine_GPU> gpu::createSeparableFilter_GPU( const Ptr<BaseRowFilter_GPU>& rowFilter, const Ptr<BaseColumnFilter_GPU>& columnFilter, int srcType, int bufType, int dstType)
141
142     :param rowFilter: "Horizontal" 1D filter.
143
144     :param columnFilter: "Vertical" 1D filter.
145
146     :param srcType: Input image type. It must be supported by  ``rowFilter`` .
147
148     :param bufType: Buffer image type. It must be supported by  ``rowFilter``  and  ``columnFilter`` .
149
150     :param dstType: Output image type. It must be supported by  ``columnFilter`` .
151
152 Usually this function is used inside such high-level functions as :ocv:func:`gpu::createSeparableLinearFilter_GPU`.
153
154
155
156 gpu::getRowSumFilter_GPU
157 ----------------------------
158 Creates a horizontal 1D box filter.
159
160 .. ocv:function:: Ptr<BaseRowFilter_GPU> gpu::getRowSumFilter_GPU(int srcType, int sumType, int ksize, int anchor = -1)
161
162     :param srcType: Input image type. Only ``CV_8UC1`` type is supported for now.
163
164     :param sumType: Output image type. Only ``CV_32FC1`` type is supported for now.
165
166     :param ksize: Kernel size.
167
168     :param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.
169
170 .. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
171
172
173
174 gpu::getColumnSumFilter_GPU
175 -------------------------------
176 Creates a vertical 1D box filter.
177
178 .. ocv:function:: Ptr<BaseColumnFilter_GPU> gpu::getColumnSumFilter_GPU(int sumType, int dstType, int ksize, int anchor = -1)
179
180     :param sumType: Input image type. Only ``CV_8UC1`` type is supported for now.
181
182     :param dstType: Output image type. Only ``CV_32FC1`` type is supported for now.
183
184     :param ksize: Kernel size.
185
186     :param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.
187
188 .. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
189
190
191
192 gpu::createBoxFilter_GPU
193 ----------------------------
194 Creates a normalized 2D box filter.
195
196 .. ocv:function:: Ptr<FilterEngine_GPU> gpu::createBoxFilter_GPU(int srcType, int dstType, const Size& ksize, const Point& anchor = Point(-1,-1))
197
198 .. ocv:function:: Ptr<BaseFilter_GPU> gpu::getBoxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1, -1))
199
200     :param srcType: Input image type supporting ``CV_8UC1`` and ``CV_8UC4`` .
201
202     :param dstType: Output image type.  It supports only the same values as the source type.
203
204     :param ksize: Kernel size.
205
206     :param anchor: Anchor point. The default value ``Point(-1, -1)`` means that the anchor is at the kernel center.
207
208 .. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
209
210 .. seealso:: :ocv:func:`boxFilter`
211
212
213
214 gpu::boxFilter
215 ------------------
216 Smooths the image using the normalized box filter.
217
218 .. ocv:function:: void gpu::boxFilter(const GpuMat& src, GpuMat& dst, int ddepth, Size ksize, Point anchor = Point(-1,-1), Stream& stream = Stream::Null())
219
220     :param src: Input image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
221
222     :param dst: Output image type. The size and type is the same as ``src`` .
223
224     :param ddepth: Output image depth. If -1, the output image has the same depth as the input one. The only values allowed here are ``CV_8U`` and -1.
225
226     :param ksize: Kernel size.
227
228     :param anchor: Anchor point. The default value ``Point(-1, -1)`` means that the anchor is at the kernel center.
229
230     :param stream: Stream for the asynchronous version.
231
232 .. note::    This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
233
234 .. seealso:: :ocv:func:`boxFilter`
235
236
237
238 gpu::blur
239 -------------
240 Acts as a synonym for the normalized box filter.
241
242 .. ocv:function:: void gpu::blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1), Stream& stream = Stream::Null())
243
244     :param src: Input image.  ``CV_8UC1``  and  ``CV_8UC4``  source types are supported.
245
246     :param dst: Output image type with the same size and type as  ``src`` .
247
248     :param ksize: Kernel size.
249
250     :param anchor: Anchor point. The default value Point(-1, -1) means that the anchor is at the kernel center.
251
252     :param stream: Stream for the asynchronous version.
253
254 .. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
255
256 .. seealso:: :ocv:func:`blur`, :ocv:func:`gpu::boxFilter`
257
258
259
260 gpu::createMorphologyFilter_GPU
261 -----------------------------------
262 Creates a 2D morphological filter.
263
264 .. ocv:function:: Ptr<FilterEngine_GPU> gpu::createMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Point& anchor = Point(-1,-1), int iterations = 1)
265
266 .. ocv:function:: Ptr<BaseFilter_GPU> gpu::getMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Size& ksize, Point anchor=Point(-1,-1))
267
268     :param op: Morphology operation id. Only ``MORPH_ERODE`` and ``MORPH_DILATE`` are supported.
269
270     :param type: Input/output image type. Only  ``CV_8UC1``  and  ``CV_8UC4``  are supported.
271
272     :param kernel: 2D 8-bit structuring element for the morphological operation.
273
274     :param ksize: Size of a horizontal or vertical structuring element used for separable morphological operations.
275
276     :param anchor: Anchor position within the structuring element. Negative values mean that the anchor is at the center.
277
278 .. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
279
280 .. seealso:: :ocv:func:`createMorphologyFilter`
281
282
283
284 gpu::erode
285 --------------
286 Erodes an image by using a specific structuring element.
287
288 .. ocv:function:: void gpu::erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor=Point(-1, -1), int iterations=1 )
289
290 .. ocv:function:: void gpu::erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, GpuMat& buf, Point anchor=Point(-1, -1), int iterations=1, Stream& stream=Stream::Null() )
291
292     :param src: Source image. Only  ``CV_8UC1``  and  ``CV_8UC4``  types are supported.
293
294     :param dst: Destination image with the same size and type as  ``src`` .
295
296     :param kernel: Structuring element used for erosion. If  ``kernel=Mat()``, a  3x3 rectangular structuring element is used.
297
298     :param anchor: Position of an anchor within the element. The default value  ``(-1, -1)``  means that the anchor is at the element center.
299
300     :param iterations: Number of times erosion to be applied.
301
302     :param stream: Stream for the asynchronous version.
303
304 .. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
305
306 .. seealso:: :ocv:func:`erode`
307
308
309
310 gpu::dilate
311 ---------------
312 Dilates an image by using a specific structuring element.
313
314 .. ocv:function:: void gpu::dilate( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor=Point(-1, -1), int iterations=1 )
315
316 .. ocv:function:: void gpu::dilate( const GpuMat& src, GpuMat& dst, const Mat& kernel, GpuMat& buf, Point anchor=Point(-1, -1), int iterations=1, Stream& stream=Stream::Null() )
317
318     :param src: Source image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
319
320     :param dst: Destination image with the same size and type as ``src``.
321
322     :param kernel: Structuring element used for dilation. If  ``kernel=Mat()``, a  3x3 rectangular structuring element is used.
323
324     :param anchor: Position of an anchor within the element. The default value  ``(-1, -1)``  means that the anchor is at the element center.
325
326     :param iterations: Number of times dilation to be applied.
327
328     :param stream: Stream for the asynchronous version.
329
330 .. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
331
332 .. seealso:: :ocv:func:`dilate`
333
334
335
336 gpu::morphologyEx
337 ---------------------
338 Applies an advanced morphological operation to an image.
339
340 .. ocv:function::  void gpu::morphologyEx( const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor=Point(-1, -1), int iterations=1 )
341
342 .. ocv:function:: void gpu::morphologyEx( const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, GpuMat& buf1, GpuMat& buf2, Point anchor=Point(-1, -1), int iterations=1, Stream& stream=Stream::Null() )
343
344     :param src: Source image.  ``CV_8UC1``  and  ``CV_8UC4``  source types are supported.
345
346     :param dst: Destination image with the same size and type as  ``src`` .
347
348     :param op: Type of morphological operation. The following types are possible:
349
350         * **MORPH_OPEN** opening
351
352         * **MORPH_CLOSE** closing
353
354         * **MORPH_GRADIENT** morphological gradient
355
356         * **MORPH_TOPHAT** "top hat"
357
358         * **MORPH_BLACKHAT** "black hat"
359
360     :param kernel: Structuring element.
361
362     :param anchor: Position of an anchor within the element. The default value ``Point(-1, -1)`` means that the anchor is at the element center.
363
364     :param iterations: Number of times erosion and dilation to be applied.
365
366     :param stream: Stream for the asynchronous version.
367
368 .. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
369
370 .. seealso:: :ocv:func:`morphologyEx`
371
372
373
374 gpu::createLinearFilter_GPU
375 -------------------------------
376 Creates a non-separable linear filter.
377
378 .. ocv:function:: Ptr<FilterEngine_GPU> gpu::createLinearFilter_GPU(int srcType, int dstType, const Mat& kernel, Point anchor = Point(-1,-1), int borderType = BORDER_DEFAULT)
379
380     :param srcType: Input image type. Supports  ``CV_8U``  ,  ``CV_16U``  and  ``CV_32F``  one and four channel image.
381
382     :param dstType: Output image type. The same type as ``src`` is supported.
383
384     :param kernel: 2D array of filter coefficients. Floating-point coefficients will be converted to fixed-point representation before the actual processing. Supports size up to 16. For larger kernels use :ocv:func:`gpu::convolve`.
385
386     :param anchor: Anchor point. The default value Point(-1, -1) means that the anchor is at the kernel center.
387
388     :param borderType: Pixel extrapolation method. For details, see :ocv:func:`borderInterpolate` .
389
390 .. seealso:: :ocv:func:`createLinearFilter`
391
392
393
394 gpu::filter2D
395 -----------------
396 Applies the non-separable 2D linear filter to an image.
397
398 .. ocv:function:: void gpu::filter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernel, Point anchor=Point(-1,-1), int borderType = BORDER_DEFAULT, Stream& stream = Stream::Null())
399
400     :param src: Source image. Supports  ``CV_8U``  ,  ``CV_16U``  and  ``CV_32F``  one and four channel image.
401
402     :param dst: Destination image. The size and the number of channels is the same as  ``src`` .
403
404     :param ddepth: Desired depth of the destination image. If it is negative, it is the same as  ``src.depth()`` . It supports only the same depth as the source image depth.
405
406     :param kernel: 2D array of filter coefficients.
407
408     :param anchor: Anchor of the kernel that indicates the relative position of a filtered point within the kernel. The anchor resides within the kernel. The special default value (-1,-1) means that the anchor is at the kernel center.
409
410     :param borderType: Pixel extrapolation method. For details, see :ocv:func:`borderInterpolate` .
411
412     :param stream: Stream for the asynchronous version.
413
414 .. seealso:: :ocv:func:`filter2D`, :ocv:func:`gpu::convolve`
415
416
417
418 gpu::Laplacian
419 ------------------
420 Applies the Laplacian operator to an image.
421
422 .. ocv:function:: void gpu::Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize = 1, double scale = 1, int borderType = BORDER_DEFAULT, Stream& stream = Stream::Null())
423
424     :param src: Source image. ``CV_8UC1``  and  ``CV_8UC4``  source types are supported.
425
426     :param dst: Destination image. The size and number of channels is the same as  ``src`` .
427
428     :param ddepth: Desired depth of the destination image. It supports only the same depth as the source image depth.
429
430     :param ksize: Aperture size used to compute the second-derivative filters (see :ocv:func:`getDerivKernels`). It must be positive and odd. Only  ``ksize``  = 1 and  ``ksize``  = 3 are supported.
431
432     :param scale: Optional scale factor for the computed Laplacian values. By default, no scaling is applied (see  :ocv:func:`getDerivKernels` ).
433
434     :param borderType: Pixel extrapolation method. For details, see :ocv:func:`borderInterpolate` .
435
436     :param stream: Stream for the asynchronous version.
437
438 .. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
439
440 .. seealso:: :ocv:func:`Laplacian`, :ocv:func:`gpu::filter2D`
441
442
443
444 gpu::getLinearRowFilter_GPU
445 -------------------------------
446 Creates a primitive row filter with the specified kernel.
447
448 .. ocv:function:: Ptr<BaseRowFilter_GPU> gpu::getLinearRowFilter_GPU( int srcType, int bufType, const Mat& rowKernel, int anchor=-1, int borderType=BORDER_DEFAULT )
449
450     :param srcType: Source array type. Only  ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1``  source types are supported.
451
452     :param bufType: Intermediate buffer type with as many channels as  ``srcType`` .
453
454     :param rowKernel: Filter coefficients. Support kernels with ``size <= 16`` .
455
456     :param anchor: Anchor position within the kernel. Negative values mean that the anchor is positioned at the aperture center.
457
458     :param borderType: Pixel extrapolation method. For details, see :ocv:func:`borderInterpolate`. For details on limitations, see below.
459
460 There are two versions of the algorithm: NPP and OpenCV.
461
462     * NPP version is called when ``srcType == CV_8UC1`` or ``srcType == CV_8UC4`` and ``bufType == srcType`` . Otherwise, the OpenCV version is called. NPP supports only ``BORDER_CONSTANT`` border type and does not check indices outside the image.
463
464     * OpenCV version supports only ``CV_32F`` buffer depth and ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , and ``BORDER_CONSTANT`` border types. It checks indices outside the image.
465
466 .. seealso:: :ocv:func:`createSeparableLinearFilter` .
467
468
469
470 gpu::getLinearColumnFilter_GPU
471 ----------------------------------
472 Creates a primitive column filter with the specified kernel.
473
474 .. ocv:function:: Ptr<BaseColumnFilter_GPU> gpu::getLinearColumnFilter_GPU( int bufType, int dstType, const Mat& columnKernel, int anchor=-1, int borderType=BORDER_DEFAULT )
475
476     :param bufType: Intermediate buffer type with as many channels as  ``dstType`` .
477
478     :param dstType: Destination array type. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` destination types are supported.
479
480     :param columnKernel: Filter coefficients. Support kernels with ``size <= 16`` .
481
482     :param anchor: Anchor position within the kernel. Negative values mean that the anchor is positioned at the aperture center.
483
484     :param borderType: Pixel extrapolation method. For details, see  :ocv:func:`borderInterpolate` . For details on limitations, see below.
485
486 There are two versions of the algorithm: NPP and OpenCV.
487
488     * NPP version is called when ``dstType == CV_8UC1`` or ``dstType == CV_8UC4`` and ``bufType == dstType`` . Otherwise, the OpenCV version is called. NPP supports only ``BORDER_CONSTANT`` border type and does not check indices outside the image.
489
490     * OpenCV version supports only ``CV_32F`` buffer depth and ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , and ``BORDER_CONSTANT`` border types. It checks indices outside image.
491
492 .. seealso:: :ocv:func:`gpu::getLinearRowFilter_GPU`, :ocv:func:`createSeparableLinearFilter`
493
494
495
496 gpu::createSeparableLinearFilter_GPU
497 ----------------------------------------
498 Creates a separable linear filter engine.
499
500 .. ocv:function:: Ptr<FilterEngine_GPU> gpu::createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat& rowKernel, const Mat& columnKernel, const Point& anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
501
502     :param srcType: Source array type.  ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1``  source types are supported.
503
504     :param dstType: Destination array type.  ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1``  destination types are supported.
505
506     :param rowKernel: Horizontal filter coefficients. Support kernels with ``size <= 16`` .
507
508     :param columnKernel: Vertical filter coefficients. Support kernels with ``size <= 16`` .
509
510     :param anchor: Anchor position within the kernel. Negative values mean that anchor is positioned at the aperture center.
511
512     :param rowBorderType: Pixel extrapolation method in the vertical direction For details, see  :ocv:func:`borderInterpolate`. For details on limitations, see :ocv:func:`gpu::getLinearRowFilter_GPU`, cpp:ocv:func:`gpu::getLinearColumnFilter_GPU`.
513
514     :param columnBorderType: Pixel extrapolation method in the horizontal direction.
515
516 .. seealso:: :ocv:func:`gpu::getLinearRowFilter_GPU`, :ocv:func:`gpu::getLinearColumnFilter_GPU`, :ocv:func:`createSeparableLinearFilter`
517
518
519
520 gpu::sepFilter2D
521 --------------------
522 Applies a separable 2D linear filter to an image.
523
524 .. ocv:function:: void gpu::sepFilter2D( const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY, Point anchor=Point(-1,-1), int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1 )
525
526 .. ocv:function:: void gpu::sepFilter2D( const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY, GpuMat& buf, Point anchor=Point(-1,-1), int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1, Stream& stream=Stream::Null() )
527
528
529     :param src: Source image.  ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_32SC1`` , ``CV_32FC1``  source types are supported.
530
531     :param dst: Destination image with the same size and number of channels as  ``src`` .
532
533     :param ddepth: Destination image depth.  ``CV_8U`` , ``CV_16S`` , ``CV_32S`` , and  ``CV_32F`` are supported.
534
535     :param kernelX: Horizontal filter coefficients.
536
537     :param kernelY: Vertical filter coefficients.
538
539     :param anchor: Anchor position within the kernel. The default value ``(-1, 1)`` means that the anchor is at the kernel center.
540
541     :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see  :ocv:func:`borderInterpolate`.
542
543     :param columnBorderType: Pixel extrapolation method in the horizontal direction.
544
545     :param stream: Stream for the asynchronous version.
546
547 .. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`sepFilter2D`
548
549
550
551 gpu::createDerivFilter_GPU
552 ------------------------------
553 Creates a filter engine for the generalized Sobel operator.
554
555 .. ocv:function:: Ptr<FilterEngine_GPU> gpu::createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
556
557     :param srcType: Source image type.  ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1``  source types are supported.
558
559     :param dstType: Destination image type with as many channels as  ``srcType`` ,  ``CV_8U`` , ``CV_16S`` , ``CV_32S`` , and  ``CV_32F``  depths are supported.
560
561     :param dx: Derivative order in respect of x.
562
563     :param dy: Derivative order in respect of y.
564
565     :param ksize: Aperture size. See  :ocv:func:`getDerivKernels` for details.
566
567     :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see  :ocv:func:`borderInterpolate`.
568
569     :param columnBorderType: Pixel extrapolation method in the horizontal direction.
570
571 .. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`createDerivFilter`
572
573
574
575 gpu::Sobel
576 --------------
577 Applies the generalized Sobel operator to an image.
578
579 .. ocv:function:: void gpu::Sobel( const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, int ksize=3, double scale=1, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1 )
580
581 .. ocv:function:: void gpu::Sobel( const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, GpuMat& buf, int ksize=3, double scale=1, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1, Stream& stream=Stream::Null() )
582
583     :param src: Source image.  ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1``  source types are supported.
584
585     :param dst: Destination image with the same size and number of channels as source image.
586
587     :param ddepth: Destination image depth.  ``CV_8U`` , ``CV_16S`` , ``CV_32S`` , and  ``CV_32F`` are supported.
588
589     :param dx: Derivative order in respect of x.
590
591     :param dy: Derivative order in respect of y.
592
593     :param ksize: Size of the extended Sobel kernel. Possible values are 1, 3, 5 or 7.
594
595     :param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. For details, see  :ocv:func:`getDerivKernels` .
596
597     :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see  :ocv:func:`borderInterpolate`.
598
599     :param columnBorderType: Pixel extrapolation method in the horizontal direction.
600
601     :param stream: Stream for the asynchronous version.
602
603 .. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`Sobel`
604
605
606
607 gpu::Scharr
608 ---------------
609 Calculates the first x- or y- image derivative using the Scharr operator.
610
611 .. ocv:function:: void gpu::Scharr( const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, double scale=1, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1 )
612
613 .. ocv:function:: void gpu::Scharr( const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, GpuMat& buf, double scale=1, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1, Stream& stream=Stream::Null() )
614
615     :param src: Source image.  ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1``  source types are supported.
616
617     :param dst: Destination image with the same size and number of channels as  ``src`` has.
618
619     :param ddepth: Destination image depth.  ``CV_8U`` , ``CV_16S`` , ``CV_32S`` , and  ``CV_32F`` are supported.
620
621     :param dx: Order of the derivative x.
622
623     :param dy: Order of the derivative y.
624
625     :param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. See  :ocv:func:`getDerivKernels`  for details.
626
627     :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see  :ocv:func:`borderInterpolate`.
628
629     :param columnBorderType: Pixel extrapolation method in the horizontal direction.
630
631     :param stream: Stream for the asynchronous version.
632
633 .. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`Scharr`
634
635
636
637 gpu::createGaussianFilter_GPU
638 ---------------------------------
639 Creates a Gaussian filter engine.
640
641 .. ocv:function:: Ptr<FilterEngine_GPU> gpu::createGaussianFilter_GPU( int type, Size ksize, double sigma1, double sigma2=0, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1 )
642
643     :param type: Source and destination image type.  ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` are supported.
644
645     :param ksize: Aperture size. See  :ocv:func:`getGaussianKernel` for details.
646
647     :param sigma1: Gaussian sigma in the horizontal direction. See  :ocv:func:`getGaussianKernel` for details.
648
649     :param sigma2: Gaussian sigma in the vertical direction. If 0, then  :math:`\texttt{sigma2}\leftarrow\texttt{sigma1}` .
650
651     :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see  :ocv:func:`borderInterpolate`.
652
653     :param columnBorderType: Pixel extrapolation method in the horizontal direction.
654
655 .. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`createGaussianFilter`
656
657
658
659 gpu::GaussianBlur
660 ---------------------
661 Smooths an image using the Gaussian filter.
662
663 .. ocv:function:: void gpu::GaussianBlur( const GpuMat& src, GpuMat& dst, Size ksize, double sigma1, double sigma2=0, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1 )
664
665 .. ocv:function:: void gpu::GaussianBlur( const GpuMat& src, GpuMat& dst, Size ksize, GpuMat& buf, double sigma1, double sigma2=0, int rowBorderType=BORDER_DEFAULT, int columnBorderType=-1, Stream& stream=Stream::Null() )
666
667     :param src: Source image.  ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1``  source types are supported.
668
669     :param dst: Destination image with the same size and type as  ``src`` .
670
671     :param ksize: Gaussian kernel size.  ``ksize.width``  and  ``ksize.height``  can differ but they both must be positive and odd. If they are zeros, they are computed from  ``sigma1``  and  ``sigma2`` .
672
673     :param sigma1: Gaussian kernel standard deviation in X direction.
674
675     :param sigma2: Gaussian kernel standard deviation in Y direction. If  ``sigma2``  is zero, it is set to be equal to  ``sigma1`` . If they are both zeros, they are computed from  ``ksize.width``  and  ``ksize.height``, respectively. See  :ocv:func:`getGaussianKernel` for details. To fully control the result regardless of possible future modification of all this semantics, you are recommended to specify all of  ``ksize`` , ``sigma1`` , and  ``sigma2`` .
676
677     :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see  :ocv:func:`borderInterpolate`.
678
679     :param columnBorderType: Pixel extrapolation method in the horizontal direction.
680
681     :param stream: Stream for the asynchronous version.
682
683 .. seealso:: :ocv:func:`gpu::createGaussianFilter_GPU`, :ocv:func:`GaussianBlur`
684
685
686
687 gpu::getMaxFilter_GPU
688 -------------------------
689 Creates the maximum filter.
690
691 .. ocv:function:: Ptr<BaseFilter_GPU> gpu::getMaxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1))
692
693     :param srcType: Input image type. Only  ``CV_8UC1``  and  ``CV_8UC4`` are supported.
694
695     :param dstType: Output image type. It supports only the same type as the source type.
696
697     :param ksize: Kernel size.
698
699     :param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.
700
701 .. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
702
703
704
705 gpu::getMinFilter_GPU
706 -------------------------
707 Creates the minimum filter.
708
709 .. ocv:function:: Ptr<BaseFilter_GPU> gpu::getMinFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1))
710
711     :param srcType: Input image type. Only  ``CV_8UC1``  and  ``CV_8UC4`` are supported.
712
713     :param dstType: Output image type. It supports only the same type as the source type.
714
715     :param ksize: Kernel size.
716
717     :param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.
718
719 .. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.