6 Functions and classes described in this section are used to perform various linear or non-linear filtering operations on 2D images.
10 gpu::BaseRowFilter_GPU
11 ----------------------
12 .. ocv:class:: gpu::BaseRowFilter_GPU
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. ::
16 class BaseRowFilter_GPU
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;
26 .. note:: This class does not allocate memory for a destination image. Usually this class is used inside :ocv:class:`gpu::FilterEngine_GPU`.
30 gpu::BaseColumnFilter_GPU
31 -------------------------
32 .. ocv:class:: gpu::BaseColumnFilter_GPU
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. ::
36 class BaseColumnFilter_GPU
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;
46 .. note:: This class does not allocate memory for a destination image. Usually this class is used inside :ocv:class:`gpu::FilterEngine_GPU`.
52 .. ocv:class:: gpu::BaseFilter_GPU
54 Base class for non-separable 2D filters. ::
56 class CV_EXPORTS BaseFilter_GPU
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;
67 .. note:: This class does not allocate memory for a destination image. Usually this class is used inside :ocv:class:`gpu::FilterEngine_GPU`.
73 .. ocv:class:: gpu::FilterEngine_GPU
75 Base class for the Filter Engine. ::
77 class CV_EXPORTS FilterEngine_GPU
80 virtual ~FilterEngine_GPU() {}
82 virtual void apply(const GpuMat& src, GpuMat& dst,
83 Rect roi = Rect(0,0,-1,-1), Stream& stream = Stream::Null()) = 0;
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.
89 By using ``FilterEngine_GPU`` instead of functions you can avoid unnecessary memory allocation for intermediate buffers and get better performance: ::
93 gpu::GpuMat src = getImg();
95 // Allocate and release buffers at each iterations
96 gpu::GaussianBlur(src, dst, ksize, sigma1);
99 // Allocate buffers only once
100 cv::Ptr<gpu::FilterEngine_GPU> filter =
101 gpu::createGaussianFilter_GPU(CV_8UC4, ksize, sigma1);
104 gpu::GpuMat src = getImg();
106 filter->apply(src, dst, cv::Rect(0, 0, src.cols, src.rows));
108 // Release buffers only once
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.
114 .. note:: The GPU filters do not support the in-place mode.
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`
120 gpu::createFilter2D_GPU
121 ---------------------------
122 Creates a non-separable filter engine with the specified filter.
124 .. ocv:function:: Ptr<FilterEngine_GPU> gpu::createFilter2D_GPU( const Ptr<BaseFilter_GPU>& filter2D, int srcType, int dstType)
126 :param filter2D: Non-separable 2D filter.
128 :param srcType: Input image type. It must be supported by ``filter2D`` .
130 :param dstType: Output image type. It must be supported by ``filter2D`` .
132 Usually this function is used inside such high-level functions as :ocv:func:`gpu::createLinearFilter_GPU`, :ocv:func:`gpu::createBoxFilter_GPU`.
136 gpu::createSeparableFilter_GPU
137 ----------------------------------
138 Creates a separable filter engine with the specified filters.
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)
142 :param rowFilter: "Horizontal" 1D filter.
144 :param columnFilter: "Vertical" 1D filter.
146 :param srcType: Input image type. It must be supported by ``rowFilter`` .
148 :param bufType: Buffer image type. It must be supported by ``rowFilter`` and ``columnFilter`` .
150 :param dstType: Output image type. It must be supported by ``columnFilter`` .
152 Usually this function is used inside such high-level functions as :ocv:func:`gpu::createSeparableLinearFilter_GPU`.
156 gpu::getRowSumFilter_GPU
157 ----------------------------
158 Creates a horizontal 1D box filter.
160 .. ocv:function:: Ptr<BaseRowFilter_GPU> gpu::getRowSumFilter_GPU(int srcType, int sumType, int ksize, int anchor = -1)
162 :param srcType: Input image type. Only ``CV_8UC1`` type is supported for now.
164 :param sumType: Output image type. Only ``CV_32FC1`` type is supported for now.
166 :param ksize: Kernel size.
168 :param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.
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.
174 gpu::getColumnSumFilter_GPU
175 -------------------------------
176 Creates a vertical 1D box filter.
178 .. ocv:function:: Ptr<BaseColumnFilter_GPU> gpu::getColumnSumFilter_GPU(int sumType, int dstType, int ksize, int anchor = -1)
180 :param sumType: Input image type. Only ``CV_8UC1`` type is supported for now.
182 :param dstType: Output image type. Only ``CV_32FC1`` type is supported for now.
184 :param ksize: Kernel size.
186 :param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.
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.
192 gpu::createBoxFilter_GPU
193 ----------------------------
194 Creates a normalized 2D box filter.
196 .. ocv:function:: Ptr<FilterEngine_GPU> gpu::createBoxFilter_GPU(int srcType, int dstType, const Size& ksize, const Point& anchor = Point(-1,-1))
198 .. ocv:function:: Ptr<BaseFilter_GPU> gpu::getBoxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1, -1))
200 :param srcType: Input image type supporting ``CV_8UC1`` and ``CV_8UC4`` .
202 :param dstType: Output image type. It supports only the same values as the source type.
204 :param ksize: Kernel size.
206 :param anchor: Anchor point. The default value ``Point(-1, -1)`` means that the anchor is at the kernel center.
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.
210 .. seealso:: :ocv:func:`boxFilter`
216 Smooths the image using the normalized box filter.
218 .. ocv:function:: void gpu::boxFilter(const GpuMat& src, GpuMat& dst, int ddepth, Size ksize, Point anchor = Point(-1,-1), Stream& stream = Stream::Null())
220 :param src: Input image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
222 :param dst: Output image type. The size and type is the same as ``src`` .
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.
226 :param ksize: Kernel size.
228 :param anchor: Anchor point. The default value ``Point(-1, -1)`` means that the anchor is at the kernel center.
230 :param stream: Stream for the asynchronous version.
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.
234 .. seealso:: :ocv:func:`boxFilter`
240 Acts as a synonym for the normalized box filter.
242 .. ocv:function:: void gpu::blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1), Stream& stream = Stream::Null())
244 :param src: Input image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
246 :param dst: Output image type with the same size and type as ``src`` .
248 :param ksize: Kernel size.
250 :param anchor: Anchor point. The default value Point(-1, -1) means that the anchor is at the kernel center.
252 :param stream: Stream for the asynchronous version.
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.
256 .. seealso:: :ocv:func:`blur`, :ocv:func:`gpu::boxFilter`
260 gpu::createMorphologyFilter_GPU
261 -----------------------------------
262 Creates a 2D morphological filter.
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)
266 .. ocv:function:: Ptr<BaseFilter_GPU> gpu::getMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Size& ksize, Point anchor=Point(-1,-1))
268 :param op: Morphology operation id. Only ``MORPH_ERODE`` and ``MORPH_DILATE`` are supported.
270 :param type: Input/output image type. Only ``CV_8UC1`` and ``CV_8UC4`` are supported.
272 :param kernel: 2D 8-bit structuring element for the morphological operation.
274 :param ksize: Size of a horizontal or vertical structuring element used for separable morphological operations.
276 :param anchor: Anchor position within the structuring element. Negative values mean that the anchor is at the center.
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.
280 .. seealso:: :ocv:func:`createMorphologyFilter`
286 Erodes an image by using a specific structuring element.
288 .. ocv:function:: void gpu::erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor=Point(-1, -1), int iterations=1 )
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() )
292 :param src: Source image. Only ``CV_8UC1`` and ``CV_8UC4`` types are supported.
294 :param dst: Destination image with the same size and type as ``src`` .
296 :param kernel: Structuring element used for erosion. If ``kernel=Mat()``, a 3x3 rectangular structuring element is used.
298 :param anchor: Position of an anchor within the element. The default value ``(-1, -1)`` means that the anchor is at the element center.
300 :param iterations: Number of times erosion to be applied.
302 :param stream: Stream for the asynchronous version.
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.
306 .. seealso:: :ocv:func:`erode`
312 Dilates an image by using a specific structuring element.
314 .. ocv:function:: void gpu::dilate( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor=Point(-1, -1), int iterations=1 )
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() )
318 :param src: Source image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
320 :param dst: Destination image with the same size and type as ``src``.
322 :param kernel: Structuring element used for dilation. If ``kernel=Mat()``, a 3x3 rectangular structuring element is used.
324 :param anchor: Position of an anchor within the element. The default value ``(-1, -1)`` means that the anchor is at the element center.
326 :param iterations: Number of times dilation to be applied.
328 :param stream: Stream for the asynchronous version.
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.
332 .. seealso:: :ocv:func:`dilate`
337 ---------------------
338 Applies an advanced morphological operation to an image.
340 .. ocv:function:: void gpu::morphologyEx( const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor=Point(-1, -1), int iterations=1 )
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() )
344 :param src: Source image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
346 :param dst: Destination image with the same size and type as ``src`` .
348 :param op: Type of morphological operation. The following types are possible:
350 * **MORPH_OPEN** opening
352 * **MORPH_CLOSE** closing
354 * **MORPH_GRADIENT** morphological gradient
356 * **MORPH_TOPHAT** "top hat"
358 * **MORPH_BLACKHAT** "black hat"
360 :param kernel: Structuring element.
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.
364 :param iterations: Number of times erosion and dilation to be applied.
366 :param stream: Stream for the asynchronous version.
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.
370 .. seealso:: :ocv:func:`morphologyEx`
374 gpu::createLinearFilter_GPU
375 -------------------------------
376 Creates a non-separable linear filter.
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)
380 :param srcType: Input image type. Supports ``CV_8U`` , ``CV_16U`` and ``CV_32F`` one and four channel image.
382 :param dstType: Output image type. The same type as ``src`` is supported.
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`.
386 :param anchor: Anchor point. The default value Point(-1, -1) means that the anchor is at the kernel center.
388 :param borderType: Pixel extrapolation method. For details, see :ocv:func:`borderInterpolate` .
390 .. seealso:: :ocv:func:`createLinearFilter`
396 Applies the non-separable 2D linear filter to an image.
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())
400 :param src: Source image. Supports ``CV_8U`` , ``CV_16U`` and ``CV_32F`` one and four channel image.
402 :param dst: Destination image. The size and the number of channels is the same as ``src`` .
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.
406 :param kernel: 2D array of filter coefficients.
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.
410 :param borderType: Pixel extrapolation method. For details, see :ocv:func:`borderInterpolate` .
412 :param stream: Stream for the asynchronous version.
414 .. seealso:: :ocv:func:`filter2D`, :ocv:func:`gpu::convolve`
420 Applies the Laplacian operator to an image.
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())
424 :param src: Source image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
426 :param dst: Destination image. The size and number of channels is the same as ``src`` .
428 :param ddepth: Desired depth of the destination image. It supports only the same depth as the source image depth.
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.
432 :param scale: Optional scale factor for the computed Laplacian values. By default, no scaling is applied (see :ocv:func:`getDerivKernels` ).
434 :param borderType: Pixel extrapolation method. For details, see :ocv:func:`borderInterpolate` .
436 :param stream: Stream for the asynchronous version.
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.
440 .. seealso:: :ocv:func:`Laplacian`, :ocv:func:`gpu::filter2D`
444 gpu::getLinearRowFilter_GPU
445 -------------------------------
446 Creates a primitive row filter with the specified kernel.
448 .. ocv:function:: Ptr<BaseRowFilter_GPU> gpu::getLinearRowFilter_GPU( int srcType, int bufType, const Mat& rowKernel, int anchor=-1, int borderType=BORDER_DEFAULT )
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.
452 :param bufType: Intermediate buffer type with as many channels as ``srcType`` .
454 :param rowKernel: Filter coefficients. Support kernels with ``size <= 16`` .
456 :param anchor: Anchor position within the kernel. Negative values mean that the anchor is positioned at the aperture center.
458 :param borderType: Pixel extrapolation method. For details, see :ocv:func:`borderInterpolate`. For details on limitations, see below.
460 There are two versions of the algorithm: NPP and OpenCV.
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.
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.
466 .. seealso:: :ocv:func:`createSeparableLinearFilter` .
470 gpu::getLinearColumnFilter_GPU
471 ----------------------------------
472 Creates a primitive column filter with the specified kernel.
474 .. ocv:function:: Ptr<BaseColumnFilter_GPU> gpu::getLinearColumnFilter_GPU( int bufType, int dstType, const Mat& columnKernel, int anchor=-1, int borderType=BORDER_DEFAULT )
476 :param bufType: Intermediate buffer type with as many channels as ``dstType`` .
478 :param dstType: Destination array type. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` destination types are supported.
480 :param columnKernel: Filter coefficients. Support kernels with ``size <= 16`` .
482 :param anchor: Anchor position within the kernel. Negative values mean that the anchor is positioned at the aperture center.
484 :param borderType: Pixel extrapolation method. For details, see :ocv:func:`borderInterpolate` . For details on limitations, see below.
486 There are two versions of the algorithm: NPP and OpenCV.
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.
490 * OpenCV version supports only ``CV_32F`` buffer depth and ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , and ``BORDER_CONSTANT`` border types. It checks indices outside image.
492 .. seealso:: :ocv:func:`gpu::getLinearRowFilter_GPU`, :ocv:func:`createSeparableLinearFilter`
496 gpu::createSeparableLinearFilter_GPU
497 ----------------------------------------
498 Creates a separable linear filter engine.
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)
502 :param srcType: Source array type. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
504 :param dstType: Destination array type. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` destination types are supported.
506 :param rowKernel: Horizontal filter coefficients. Support kernels with ``size <= 16`` .
508 :param columnKernel: Vertical filter coefficients. Support kernels with ``size <= 16`` .
510 :param anchor: Anchor position within the kernel. Negative values mean that anchor is positioned at the aperture center.
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`.
514 :param columnBorderType: Pixel extrapolation method in the horizontal direction.
516 .. seealso:: :ocv:func:`gpu::getLinearRowFilter_GPU`, :ocv:func:`gpu::getLinearColumnFilter_GPU`, :ocv:func:`createSeparableLinearFilter`
522 Applies a separable 2D linear filter to an image.
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 )
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() )
529 :param src: Source image. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
531 :param dst: Destination image with the same size and number of channels as ``src`` .
533 :param ddepth: Destination image depth. ``CV_8U`` , ``CV_16S`` , ``CV_32S`` , and ``CV_32F`` are supported.
535 :param kernelX: Horizontal filter coefficients.
537 :param kernelY: Vertical filter coefficients.
539 :param anchor: Anchor position within the kernel. The default value ``(-1, 1)`` means that the anchor is at the kernel center.
541 :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
543 :param columnBorderType: Pixel extrapolation method in the horizontal direction.
545 :param stream: Stream for the asynchronous version.
547 .. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`sepFilter2D`
551 gpu::createDerivFilter_GPU
552 ------------------------------
553 Creates a filter engine for the generalized Sobel operator.
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)
557 :param srcType: Source image type. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
559 :param dstType: Destination image type with as many channels as ``srcType`` , ``CV_8U`` , ``CV_16S`` , ``CV_32S`` , and ``CV_32F`` depths are supported.
561 :param dx: Derivative order in respect of x.
563 :param dy: Derivative order in respect of y.
565 :param ksize: Aperture size. See :ocv:func:`getDerivKernels` for details.
567 :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
569 :param columnBorderType: Pixel extrapolation method in the horizontal direction.
571 .. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`createDerivFilter`
577 Applies the generalized Sobel operator to an image.
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 )
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() )
583 :param src: Source image. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
585 :param dst: Destination image with the same size and number of channels as source image.
587 :param ddepth: Destination image depth. ``CV_8U`` , ``CV_16S`` , ``CV_32S`` , and ``CV_32F`` are supported.
589 :param dx: Derivative order in respect of x.
591 :param dy: Derivative order in respect of y.
593 :param ksize: Size of the extended Sobel kernel. Possible values are 1, 3, 5 or 7.
595 :param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. For details, see :ocv:func:`getDerivKernels` .
597 :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
599 :param columnBorderType: Pixel extrapolation method in the horizontal direction.
601 :param stream: Stream for the asynchronous version.
603 .. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`Sobel`
609 Calculates the first x- or y- image derivative using the Scharr operator.
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 )
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() )
615 :param src: Source image. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
617 :param dst: Destination image with the same size and number of channels as ``src`` has.
619 :param ddepth: Destination image depth. ``CV_8U`` , ``CV_16S`` , ``CV_32S`` , and ``CV_32F`` are supported.
621 :param dx: Order of the derivative x.
623 :param dy: Order of the derivative y.
625 :param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. See :ocv:func:`getDerivKernels` for details.
627 :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
629 :param columnBorderType: Pixel extrapolation method in the horizontal direction.
631 :param stream: Stream for the asynchronous version.
633 .. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`Scharr`
637 gpu::createGaussianFilter_GPU
638 ---------------------------------
639 Creates a Gaussian filter engine.
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 )
643 :param type: Source and destination image type. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` are supported.
645 :param ksize: Aperture size. See :ocv:func:`getGaussianKernel` for details.
647 :param sigma1: Gaussian sigma in the horizontal direction. See :ocv:func:`getGaussianKernel` for details.
649 :param sigma2: Gaussian sigma in the vertical direction. If 0, then :math:`\texttt{sigma2}\leftarrow\texttt{sigma1}` .
651 :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
653 :param columnBorderType: Pixel extrapolation method in the horizontal direction.
655 .. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`createGaussianFilter`
660 ---------------------
661 Smooths an image using the Gaussian filter.
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 )
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() )
667 :param src: Source image. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
669 :param dst: Destination image with the same size and type as ``src`` .
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`` .
673 :param sigma1: Gaussian kernel standard deviation in X direction.
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`` .
677 :param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
679 :param columnBorderType: Pixel extrapolation method in the horizontal direction.
681 :param stream: Stream for the asynchronous version.
683 .. seealso:: :ocv:func:`gpu::createGaussianFilter_GPU`, :ocv:func:`GaussianBlur`
687 gpu::getMaxFilter_GPU
688 -------------------------
689 Creates the maximum filter.
691 .. ocv:function:: Ptr<BaseFilter_GPU> gpu::getMaxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1))
693 :param srcType: Input image type. Only ``CV_8UC1`` and ``CV_8UC4`` are supported.
695 :param dstType: Output image type. It supports only the same type as the source type.
697 :param ksize: Kernel size.
699 :param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.
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.
705 gpu::getMinFilter_GPU
706 -------------------------
707 Creates the minimum filter.
709 .. ocv:function:: Ptr<BaseFilter_GPU> gpu::getMinFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1))
711 :param srcType: Input image type. Only ``CV_8UC1`` and ``CV_8UC4`` are supported.
713 :param dstType: Output image type. It supports only the same type as the source type.
715 :param ksize: Kernel size.
717 :param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.
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.