File: image_filtering.rst

package info (click to toggle)
opencv 2.3.1-11%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 82,284 kB
  • sloc: xml: 493,314; cpp: 334,117; ansic: 108,641; java: 15,407; python: 14,061; sh: 107; makefile: 61
file content (699 lines) | stat: -rw-r--r-- 31,055 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
Image Filtering
===============

.. highlight:: cpp

Functions and classes described in this section are used to perform various linear or non-linear filtering operations on 2D images.

.. index:: gpu::BaseRowFilter_GPU

gpu::BaseRowFilter_GPU
----------------------
.. ocv:class:: gpu::BaseRowFilter_GPU

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. ::

    class BaseRowFilter_GPU
    {
    public:
        BaseRowFilter_GPU(int ksize_, int anchor_);
        virtual ~BaseRowFilter_GPU() {}
        virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
        int ksize, anchor;
    };


.. note:: This class does not allocate memory for a destination image. Usually this class is used inside :ocv:class:`gpu::FilterEngine_GPU`.

.. index:: gpu::BaseColumnFilter_GPU

gpu::BaseColumnFilter_GPU
-------------------------
.. ocv:class:: gpu::BaseColumnFilter_GPU

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. ::

    class BaseColumnFilter_GPU
    {
    public:
        BaseColumnFilter_GPU(int ksize_, int anchor_);
        virtual ~BaseColumnFilter_GPU() {}
        virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
        int ksize, anchor;
    };


.. note:: This class does not allocate memory for a destination image. Usually this class is used inside :ocv:class:`gpu::FilterEngine_GPU`.

.. index:: gpu::BaseFilter_GPU

gpu::BaseFilter_GPU
-------------------
.. ocv:class:: gpu::BaseFilter_GPU

Base class for non-separable 2D filters. ::

    class CV_EXPORTS BaseFilter_GPU
    {
    public:
        BaseFilter_GPU(const Size& ksize_, const Point& anchor_);
        virtual ~BaseFilter_GPU() {}
        virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
        Size ksize;
        Point anchor;
    };


.. note:: This class does not allocate memory for a destination image. Usually this class is used inside :ocv:class:`gpu::FilterEngine_GPU`.

.. index:: gpu::FilterEngine_GPU

gpu::FilterEngine_GPU
---------------------
.. ocv:class:: gpu::FilterEngine_GPU

Base class for the Filter Engine. ::

    class CV_EXPORTS FilterEngine_GPU
    {
    public:
        virtual ~FilterEngine_GPU() {}

        virtual void apply(const GpuMat& src, GpuMat& dst,
                           Rect roi = Rect(0,0,-1,-1)) = 0;
    };


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.

By using ``FilterEngine_GPU`` instead of functions you can avoid unnecessary memory allocation for intermediate buffers and get better performance: 
::

    while (...)
    {
        gpu::GpuMat src = getImg();
        gpu::GpuMat dst;
        // Allocate and release buffers at each iterations
        gpu::GaussianBlur(src, dst, ksize, sigma1);
    }

    // Allocate buffers only once
    cv::Ptr<gpu::FilterEngine_GPU> filter =
        gpu::createGaussianFilter_GPU(CV_8UC4, ksize, sigma1);
    while (...)
    {
        gpu::GpuMat src = getImg();
        gpu::GpuMat dst;
        filter->apply(src, dst, cv::Rect(0, 0, src.cols, src.rows));
    }
    // Release buffers only once
    filter.release();

 ``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 perfomance. See below to understand which filters support processing the whole image and which do not and identify image type limitations.

.. note:: The GPU filters do not support the in-place mode.

.. 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`

.. index:: gpu::createFilter2D_GPU

gpu::createFilter2D_GPU
---------------------------
.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createFilter2D_GPU( const Ptr<BaseFilter_GPU>& filter2D, int srcType, int dstType)

    Creates a non-separable filter engine with the specified filter.

    :param filter2D: Non-separable 2D filter.

    :param srcType: Input image type. It must be supported by  ``filter2D`` .

    :param dstType: Output image type. It must be supported by  ``filter2D`` .

Usually this function is used inside such high-level functions as :ocv:func:`gpu::createLinearFilter_GPU`, :ocv:func:`gpu::createBoxFilter_GPU`.

.. index:: gpu::createSeparableFilter_GPU

gpu::createSeparableFilter_GPU
----------------------------------
.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createSeparableFilter_GPU( const Ptr<BaseRowFilter_GPU>& rowFilter, const Ptr<BaseColumnFilter_GPU>& columnFilter, int srcType, int bufType, int dstType)

    Creates a separable filter engine with the specified filters.

    :param rowFilter: "Horizontal" 1D filter.
    
    :param columnFilter: "Vertical" 1D filter.

    :param srcType: Input image type. It must be supported by  ``rowFilter``.

    :param bufType: Buffer image type. It must be supported by  ``rowFilter``  and  ``columnFilter``.

    :param dstType: Output image type. It must be supported by  ``columnFilter``.

Usually this function is used inside such high-level functions as :ocv:func:`gpu::createSeparableLinearFilter_GPU`.

.. index:: gpu::getRowSumFilter_GPU

gpu::getRowSumFilter_GPU
----------------------------
.. ocv:function:: Ptr<BaseRowFilter_GPU> gpu::getRowSumFilter_GPU(int srcType, int sumType, int ksize, int anchor = -1)

    Creates a horizontal 1D box filter.

    :param srcType: Input image type. Only ``CV_8UC1`` type is supported for now.

    :param sumType: Output image type. Only ``CV_32FC1`` type is supported for now.

    :param ksize: Kernel size.

    :param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.

.. 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.

.. index:: gpu::getColumnSumFilter_GPU

gpu::getColumnSumFilter_GPU
-------------------------------
.. ocv:function:: Ptr<BaseColumnFilter_GPU> gpu::getColumnSumFilter_GPU(int sumType, int dstType, int ksize, int anchor = -1)

    Creates a vertical 1D box filter.

    :param sumType: Input image type. Only ``CV_8UC1`` type is supported for now.

    :param dstType: Output image type. Only ``CV_32FC1`` type is supported for now.

    :param ksize: Kernel size.

    :param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.

.. 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.

.. index:: gpu::createBoxFilter_GPU

gpu::createBoxFilter_GPU
----------------------------
.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createBoxFilter_GPU(int srcType, int dstType, const Size& ksize, const Point& anchor = Point(-1,-1))

    Creates a normalized 2D box filter.

.. ocv:function:: Ptr<BaseFilter_GPU> getBoxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1, -1))

    :param srcType: Input image type supporting ``CV_8UC1`` and ``CV_8UC4``.

    :param dstType: Output image type.  It supports only the same values as the source type.

    :param ksize: Kernel size.

    :param anchor: Anchor point. The default value ``Point(-1, -1)`` means that the anchor is at the kernel center.

.. 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.

.. seealso:: :ocv:func:`boxFilter`

.. index:: gpu::boxFilter

gpu::boxFilter
------------------
.. ocv:function:: void gpu::boxFilter(const GpuMat& src, GpuMat& dst, int ddepth, Size ksize, Point anchor = Point(-1,-1))

    Smooths the image using the normalized box filter.

    :param src: Input image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.

    :param dst: Output image type. The size and type is the same as ``src``.

    :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.

    :param ksize: Kernel size.

    :param anchor: Anchor point. The default value ``Point(-1, -1)`` means that the anchor is at the kernel center.

.. 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.

.. seealso:: :ocv:func:`boxFilter`

.. index:: gpu::blur

gpu::blur
-------------
.. ocv:function:: void gpu::blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1))

    Acts as a synonym for the normalized box filter.

    :param src: Input image.  ``CV_8UC1``  and  ``CV_8UC4``  source types are supported.

    :param dst: Output image type with the same size and type as  ``src`` .

    :param ksize: Kernel size.

    :param anchor: Anchor point. The default value Point(-1, -1) means that the anchor is at the kernel center.

.. 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.

.. seealso:: :ocv:func:`blur`, :ocv:func:`gpu::boxFilter`

.. index:: gpu::createMorphologyFilter_GPU

gpu::createMorphologyFilter_GPU
-----------------------------------
.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Point& anchor = Point(-1,-1), int iterations = 1)

    Creates a 2D morphological filter.

.. ocv:function:: Ptr<BaseFilter_GPU> getMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Size& ksize, Point anchor=Point(-1,-1))

    {Morphology operation id. Only ``MORPH_ERODE``     and ``MORPH_DILATE``     are supported.}

    :param type: Input/output image type. Only  ``CV_8UC1``  and  ``CV_8UC4``  are supported.

    :param kernel: 2D 8-bit structuring element for the morphological operation.

    :param size: Size of a horizontal or vertical structuring element used for separable morphological operations.

    :param anchor: Anchor position within the structuring element. Negative values mean that the anchor is at the center.

.. 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.

.. seealso:: :ocv:func:`createMorphologyFilter`

.. index:: gpu::erode

gpu::erode
--------------
.. ocv:function:: void gpu::erode(const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1)

    Erodes an image by using a specific structuring element.

    :param src: Source image. Only  ``CV_8UC1``  and  ``CV_8UC4``  types are supported.

    :param dst: Destination image with the same size and type as  ``src`` .

    :param kernel: Structuring element used for erosion. If  ``kernel=Mat()``, a  3x3 rectangular structuring element is used.

    :param anchor: Position of an anchor within the element. The default value  ``(-1, -1)``  means that the anchor is at the element center.

    :param iterations: Number of times erosion to be applied.

.. 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.

.. seealso:: :ocv:func:`erode`

.. index:: gpu::dilate

gpu::dilate
---------------
.. ocv:function:: void gpu::dilate(const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1)

    Dilates an image by using a specific structuring element.

    :param src: Source image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.

    :param dst: Destination image with the same size and type as ``src``.

    :param kernel: Structuring element used for dilation. If  ``kernel=Mat()``, a  3x3 rectangular structuring element is used.

    :param anchor: Position of an anchor within the element. The default value  ``(-1, -1)``  means that the anchor is at the element center.

    :param iterations: Number of times dilation to be applied.

.. 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.

.. seealso:: :ocv:func:`dilate`

.. index:: gpu::morphologyEx

gpu::morphologyEx
---------------------
.. ocv:function:: void gpu::morphologyEx(const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1)

    Applies an advanced morphological operation to an image.

    :param src: Source image.  ``CV_8UC1``  and  ``CV_8UC4``  source types are supported.

    :param dst: Destination image with the same size and type as  ``src``
    
    :param op: Type of morphological operation. The following types are possible:
        
        * **MORPH_OPEN** opening
            
        * **MORPH_CLOSE** closing
            
        * **MORPH_GRADIENT** morphological gradient
            
        * **MORPH_TOPHAT** "top hat"
            
        * **MORPH_BLACKHAT** "black hat"
            

    :param kernel: Structuring element.

    :param anchor: Position of an anchor within the element. The default value ``Point(-1, -1)`` means that the anchor is at the element center.

    :param iterations: Number of times erosion and dilation to be applied.

.. 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.

.. seealso:: :ocv:func:`morphologyEx` 

.. index:: gpu::createLinearFilter_GPU

gpu::createLinearFilter_GPU
-------------------------------
.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createLinearFilter_GPU(int srcType, int dstType, const Mat& kernel, const Point& anchor = Point(-1,-1))

    Creates a non-separable linear filter.

.. ocv:function:: Ptr<BaseFilter_GPU> gpu::getLinearFilter_GPU(int srcType, int dstType, const Mat& kernel, const Size& ksize, Point anchor = Point(-1, -1))

    :param srcType: Input image type. ``CV_8UC1``  and  ``CV_8UC4`` types are supported.

    :param dstType: Output image type. The same type as ``src`` is supported.

    :param kernel: 2D array of filter coefficients. Floating-point coefficients will be converted to fixed-point representation before the actual processing.

    :param ksize: Kernel size.

    :param anchor: Anchor point. The default value Point(-1, -1) means that the anchor is at the kernel center.

.. 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.

.. seealso:: :ocv:func:`createLinearFilter`

.. index:: gpu::filter2D

gpu::filter2D
-----------------
.. ocv:function:: void gpu::filter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernel, Point anchor=Point(-1,-1))

    Applies the non-separable 2D linear filter to an image.

    :param src: Source image.  ``CV_8UC1``  and  ``CV_8UC4``  source types are supported.

    :param dst: Destination image. The size and the number of channels is the same as  ``src`` .

    :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.

    :param kernel: 2D array of filter coefficients. This filter works with integers kernels. If  ``kernel``  has a ``float``  or  ``double``  type, it uses fixed-point arithmetic.

    :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 cente
    
    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.

.. seealso:: :ocv:func:`filter2D`

.. index:: gpu::Laplacian

gpu::Laplacian
------------------
.. ocv:function:: void gpu::Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize = 1, double scale = 1)

    Applies the Laplacian operator to an image.

    :param src: Source image. ``CV_8UC1``  and  ``CV_8UC4``  source types are supported.

    :param dst: Destination image. The size and number of channels is the same as  ``src`` .

    :param ddepth: Desired depth of the destination image. It supports only the same depth as the source image depth.

    :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.

    :param scale: Optional scale factor for the computed Laplacian values. By default, no scaling is applied (see  :ocv:func:`getDerivKernels` ).

.. 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.

.. seealso:: :ocv:func:`Laplacian`,:ocv:func:`gpu::filter2D` .

.. index:: gpu::getLinearRowFilter_GPU

gpu::getLinearRowFilter_GPU
-------------------------------
.. ocv:function:: Ptr<BaseRowFilter_GPU> gpu::getLinearRowFilter_GPU(int srcType, int bufType, const Mat& rowKernel, int anchor = -1, int borderType = BORDER_CONSTANT)

    Creates a primitive row filter with the specified kernel.

    :param srcType: Source array type. Only  ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1``  source types are supported.

    :param bufType: Intermediate buffer type with as many channels as  ``srcType`` .

    :param rowKernel: Filter coefficients.

    :param anchor: Anchor position within the kernel. Negative values mean that the anchor is positioned at the aperture center.

    :param borderType: Pixel extrapolation method. For details, see :ocv:func:`borderInterpolate`. For details on limitations, see below.

There are two versions of the algorithm: NPP and OpenCV.
        
        * 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. 
        
        * OpenCV version supports only ``CV_32F`` buffer depth and ``BORDER_REFLECT101``,``BORDER_REPLICATE``, and ``BORDER_CONSTANT`` border types. It checks indices outside the image.

.. seealso:: :ocv:func:`createSeparableLinearFilter` .

.. index:: gpu::getLinearColumnFilter_GPU

gpu::getLinearColumnFilter_GPU
----------------------------------
.. ocv:function:: Ptr<BaseColumnFilter_GPU> gpu::getLinearColumnFilter_GPU(int bufType, int dstType, const Mat& columnKernel, int anchor = -1, int borderType = BORDER_CONSTANT)

    Creates a primitive column filter with the specified kernel.

    :param bufType: Inermediate buffer type with as many channels as  ``dstType`` .

    :param dstType: Destination array type. ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1`` destination types are supported.

    :param columnKernel: Filter coefficients.

    :param anchor: Anchor position within the kernel. Negative values mean that the anchor is positioned at the aperture center.

    :param borderType: Pixel extrapolation method. For details, see  :ocv:func:`borderInterpolate` . For details on limitations, see below.

    There are two versions of the algorithm: NPP and OpenCV.
    * 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. 
    * OpenCV version supports only ``CV_32F`` buffer depth and ``BORDER_REFLECT101``, ``BORDER_REPLICATE``, and ``BORDER_CONSTANT`` border types. It checks indices outside image.
    
.. seealso:: :ocv:func:`gpu::getLinearRowFilter_GPU`, :ocv:func:`createSeparableLinearFilter`

.. index:: gpu::createSeparableLinearFilter_GPU

gpu::createSeparableLinearFilter_GPU
----------------------------------------
.. 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)

    Creates a separable linear filter engine.

    :param srcType: Source array type.  ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1``  source types are supported.

    :param dstType: Destination array type.  ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1``  destination types are supported.

    :param rowKernel: Horizontal filter coefficients.
    
    :param columnKernel: Vertical filter coefficients.

    :param anchor: Anchor position within the kernel. Negative values mean that anchor is positioned at the aperture center.

    :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`.
    
    :param columnBorderType: Pixel extrapolation method in the horizontal direction.

.. seealso:: :ocv:func:`gpu::getLinearRowFilter_GPU`, :ocv:func:`gpu::getLinearColumnFilter_GPU`, :ocv:func:`createSeparableLinearFilter`

.. index:: gpu::sepFilter2D

gpu::sepFilter2D
--------------------
.. 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)

    Applies a separable 2D linear filter to an image.

    :param src: Source image.  ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1``  source types are supported.

    :param dst: Destination image with the same size and number of channels as  ``src`` .

    :param ddepth: Destination image depth.  ``CV_8U``, ``CV_16S``, ``CV_32S``, and  ``CV_32F`` are supported.

    :param kernelX: Horizontal filter coefficients.
    
    :param kernelY: Vertical filter coefficients.

    :param anchor: Anchor position within the kernel. The default value ``(-1, 1)`` means that the anchor is at the kernel center.

    :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see  :ocv:func:`borderInterpolate`.
    
    :param columnBorderType: Pixel extrapolation method in the horizontal direction.

.. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`sepFilter2D`

.. index:: gpu::createDerivFilter_GPU

gpu::createDerivFilter_GPU
------------------------------
.. 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)

    Creates a filter engine for the generalized Sobel operator.

    :param srcType: Source image type.  ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1``  source types are supported.

    :param dstType: Destination image type with as many channels as  ``srcType`` .  ``CV_8U``, ``CV_16S``, ``CV_32S``, and  ``CV_32F``  depths are supported.

    :param dx: Derivative order in respect of x.

    :param dy: Derivative order in respect of y.

    :param ksize: Aperture size. See  :ocv:func:`getDerivKernels` for details.

    :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see  :ocv:func:`borderInterpolate`.
    
    :param columnBorderType: Pixel extrapolation method in the horizontal direction.
    

.. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`createDerivFilter`

.. index:: gpu::Sobel

gpu::Sobel
--------------
.. 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)

    Applies the generalized Sobel operator to an image.

    :param src: Source image.  ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1``  source types are supported.

    :param dst: Destination image with the same size and number of channels as source image.

    :param ddepth: Destination image depth.  ``CV_8U``, ``CV_16S``, ``CV_32S``, and  ``CV_32F`` are supported.

    :param dx: Derivative order in respect of x.

    :param dy: Derivative order in respect of y.

    :param ksize: Size of the extended Sobel kernel. Possible valies are 1, 3, 5 or 7.

    :param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. For details, see  :ocv:func:`getDerivKernels` .

    :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see  :ocv:func:`borderInterpolate`.
    
    :param columnBorderType: Pixel extrapolation method in the horizontal direction.

.. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`Sobel`

.. index:: gpu::Scharr

gpu::Scharr
---------------
.. 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)

    Calculates the first x- or y- image derivative using the Scharr operator.

    :param src: Source image.  ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1``  source types are supported.

    :param dst: Destination image with the same size and number of channels as  ``src`` has.

    :param ddepth: Destination image depth.  ``CV_8U``, ``CV_16S``, ``CV_32S``, and  ``CV_32F`` are supported.

    :param xorder: Order of the derivative x.

    :param yorder: Order of the derivative y.

    :param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. See  :ocv:func:`getDerivKernels`  for details.

    :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see  :ocv:func:`borderInterpolate`.
    
    :param columnBorderType: Pixel extrapolation method in the horizontal direction.

.. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`Scharr`

.. index:: gpu::createGaussianFilter_GPU

gpu::createGaussianFilter_GPU
---------------------------------
.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createGaussianFilter_GPU(int type, Size ksize, double sigmaX, double sigmaY = 0, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)

    Creates a Gaussian filter engine.

    :param type: Source and destination image type.  ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1`` are supported.

    :param ksize: Aperture size. See  :ocv:func:`getGaussianKernel` for details.

    :param sigmaX: Gaussian sigma in the horizontal direction. See  :ocv:func:`getGaussianKernel` for details.

    :param sigmaY: Gaussian sigma in the vertical direction. If 0, then  :math:`\texttt{sigmaY}\leftarrow\texttt{sigmaX}` .

    :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see  :ocv:func:`borderInterpolate`.
    
    :param columnBorderType: Pixel extrapolation method in the horizontal direction.

.. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`createGaussianFilter`

.. index:: gpu::GaussianBlur

gpu::GaussianBlur
---------------------
.. ocv:function:: void gpu::GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, double sigmaX, double sigmaY = 0, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)

    Smooths an image using the Gaussian filter.

    :param src: Source image.  ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1``  source types are supported.

    :param dst: Destination image with the same size and type as  ``src``.

    :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  ``sigmaX``  and  ``sigmaY`` .

    :param sigmaX: Gaussian kernel standard deviation in X direction. 
    
    :param sigmaY: Gaussian kernel standard deviation in Y direction. If  ``sigmaY``  is zero, it is set to be equal to  ``sigmaX`` . 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``, ``sigmaX``, and  ``sigmaY`` .

    :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see  :ocv:func:`borderInterpolate`.
    
    :param columnBorderType: Pixel extrapolation method in the horizontal direction.

.. seealso:: :ocv:func:`gpu::createGaussianFilter_GPU`, :ocv:func:`GaussianBlur`

.. index:: gpu::getMaxFilter_GPU

gpu::getMaxFilter_GPU
-------------------------
.. ocv:function:: Ptr<BaseFilter_GPU> gpu::getMaxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1))

    Creates the maximum filter.

    :param srcType: Input image type. Only  ``CV_8UC1``  and  ``CV_8UC4`` are supported.

    :param dstType: Output image type. It supports only the same type as the source type.

    :param ksize: Kernel size.

    :param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.

.. 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.

.. index:: gpu::getMinFilter_GPU

gpu::getMinFilter_GPU
-------------------------
.. ocv:function:: Ptr<BaseFilter_GPU> gpu::getMinFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1))

    Creates the minimum filter.

    :param srcType: Input image type. Only  ``CV_8UC1``  and  ``CV_8UC4`` are supported.

    :param dstType: Output image type. It supports only the same type as the source type.

    :param ksize: Kernel size.

    :param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.

    .. 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.