You can use field `user_block_size` to set specific block size for :ocv:func:`gpu::convolve` function. If you leave its default value `Size(0,0)` then automatic estimation of block size will be used (which is optimized for speed). By varying `user_block_size` you can reduce memory requirements at the cost of speed.
:param user_block_size: Block size. If you leave default value `Size(0,0)` then automatic estimation of block size will be used (which is optimized for speed). By varying `user_block_size` you can reduce memory requirements at the cost of speed.
@@ -43,86 +43,108 @@ Copies each plane of a multi-channel matrix into an array.
...
@@ -43,86 +43,108 @@ Copies each plane of a multi-channel matrix into an array.
gpu::copyMakeBorder
gpu::transpose
-----------------------
--------------
Forms a border around an image.
Transposes a matrix.
.. ocv:function:: void gpu::copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, int borderType, const Scalar& value = Scalar(), Stream& stream = Stream::Null())
:param src: Source image. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` , and ``CV_32FC1`` types are supported.
:param src1: Source matrix. 1-, 4-, 8-byte element sizes are supported for now.
:param dst: Destination image with the same type as ``src``. The size is ``Size(src.cols+left+right, src.rows+top+bottom)`` .
:param dst: Destination matrix.
:param top:
:param stream: Stream for the asynchronous version.
:param bottom:
.. seealso:: :ocv:func:`transpose`
:param left:
:param right: Number of pixels in each direction from the source image rectangle to extrapolate. For example: ``top=1, bottom=1, left=1, right=1`` mean that 1 pixel-wide border needs to be built.
:param borderType: Border type. See :ocv:func:`borderInterpolate` for details. ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , ``BORDER_CONSTANT`` , ``BORDER_REFLECT`` and ``BORDER_WRAP`` are supported for now.
gpu::flip
---------
Flips a 2D matrix around vertical, horizontal, or both axes.
:param lut: Look-up table of 256 elements. It is a continuous ``CV_8U`` matrix.
:param src: Source matrix. ``CV_8UC1`` and ``CV_8UC3`` matrices are supported for now.
:param lut: Look-up table of 256 elements. It is a continuous ``CV_8U`` matrix.
:param dst: Destination matrix with the same depth as ``lut`` and the same number of channels as ``src`` .
gpu::copyMakeBorder
-----------------------
Forms a border around an image.
.. ocv:function:: void gpu::copyMakeBorder(InputArray src, OutputArray dst, int top, int bottom, int left, int right, int borderType, Scalar value = Scalar(), Stream& stream = Stream::Null())
:param src: Source image. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` , and ``CV_32FC1`` types are supported.
:param dst: Destination image with the same type as ``src``. The size is ``Size(src.cols+left+right, src.rows+top+bottom)`` .
:param top:
:param bottom:
:param left:
:param right: Number of pixels in each direction from the source image rectangle to extrapolate. For example: ``top=1, bottom=1, left=1, right=1`` mean that 1 pixel-wide border needs to be built.
:param borderType: Border type. See :ocv:func:`borderInterpolate` for details. ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , ``BORDER_CONSTANT`` , ``BORDER_REFLECT`` and ``BORDER_WRAP`` are supported for now.
:param value: Border value.
:param stream: Stream for the asynchronous version.
:param stream: Stream for the asynchronous version.
.. ocv:function:: void gpu::add( const GpuMat& a, const Scalar& sc, GpuMat& c, const GpuMat& mask=GpuMat(), int dtype=-1, Stream& stream=Stream::Null() )
:param a: First source matrix.
:param src1: First source matrix or scalar.
:param b: Second source matrix to be added to ``a`` . Matrix should have the same size and type as ``a`` .
:param src2: Second source matrix or scalar. Matrix should have the same size and type as ``src1`` .
:param sc: A scalar to be added to ``a`` .
:param dst: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``src1`` depth.
:param c: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``a`` depth.
:param mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
:param mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
...
@@ -32,20 +28,16 @@ Computes a matrix-matrix or matrix-scalar sum.
...
@@ -32,20 +28,16 @@ Computes a matrix-matrix or matrix-scalar sum.
gpu::subtract
gpu::subtract
-----------------
-------------
Computes a matrix-matrix or matrix-scalar difference.
Computes a matrix-matrix or matrix-scalar difference.
.. ocv:function:: void gpu::subtract( const GpuMat& a, const GpuMat& b, GpuMat& c, const GpuMat& mask=GpuMat(), int dtype=-1, Stream& stream=Stream::Null() )
.. ocv:function:: void gpu::subtract( const GpuMat& a, const Scalar& sc, GpuMat& c, const GpuMat& mask=GpuMat(), int dtype=-1, Stream& stream=Stream::Null() )
:param src1: First source matrix or scalar.
:param a: First source matrix.
:param src2: Second source matrix or scalar. Matrix should have the same size and type as ``src1`` .
:param b: Second source matrix to be added to ``a`` . Matrix should have the same size and type as ``a`` .
:param dst: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``src1`` depth.
:param sc: A scalar to be added to ``a`` .
:param c: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``a`` depth.
:param mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
:param mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
...
@@ -58,20 +50,16 @@ Computes a matrix-matrix or matrix-scalar difference.
...
@@ -58,20 +50,16 @@ Computes a matrix-matrix or matrix-scalar difference.
gpu::multiply
gpu::multiply
-----------------
-------------
Computes a matrix-matrix or matrix-scalar per-element product.
Computes a matrix-matrix or matrix-scalar per-element product.
.. ocv:function:: void gpu::multiply( const GpuMat& a, const GpuMat& b, GpuMat& c, double scale=1, int dtype=-1, Stream& stream=Stream::Null() )
.. ocv:function:: void gpu::multiply( const GpuMat& a, const Scalar& sc, GpuMat& c, double scale=1, int dtype=-1, Stream& stream=Stream::Null() )
:param a: First source matrix.
:param src1: First source matrix or scalar.
:param b: Second source matrix to be multiplied by ``a`` elements.
:param src2: Second source matrix or scalar.
:param sc: A scalar to be multiplied by ``a`` elements.
:param dst: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``src1`` depth.
:param c: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``a`` depth.
:param scale: Optional scale factor.
:param scale: Optional scale factor.
...
@@ -87,19 +75,15 @@ gpu::divide
...
@@ -87,19 +75,15 @@ gpu::divide
-----------
-----------
Computes a matrix-matrix or matrix-scalar division.
Computes a matrix-matrix or matrix-scalar division.
.. ocv:function:: void gpu::divide( const GpuMat& a, const GpuMat& b, GpuMat& c, double scale=1, int dtype=-1, Stream& stream=Stream::Null() )
:param b: Second source matrix. The ``a`` elements are divided by it.
:param src2: Second source matrix or scalar.
:param sc: A scalar to be divided by the elements of ``a`` matrix.
:param dst: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``src1`` depth.
:param c: Destination matrix that has the same size and number of channels as the input array(s). The depth is defined by ``dtype`` or ``a`` depth.
:param scale: Optional scale factor.
:param scale: Optional scale factor.
...
@@ -113,47 +97,31 @@ This function, in contrast to :ocv:func:`divide`, uses a round-down rounding mod
...
@@ -113,47 +97,31 @@ This function, in contrast to :ocv:func:`divide`, uses a round-down rounding mod
gpu::addWeighted
gpu::absdiff
----------------
------------
Computes the weighted sum of two arrays.
Computes per-element absolute difference of two matrices (or of a matrix and scalar).
:param dst: Destination array that has the same size and number of channels as the input arrays.
:param src1: First source matrix or scalar.
:param gamma: Scalar added to each sum.
:param src2: Second source matrix or scalar.
:param dtype: Optional depth of the destination array. When both input arrays have the same depth, ``dtype`` can be set to ``-1``, which will be equivalent to ``src1.depth()``.
:param dst: Destination matrix that has the same size and type as the input array(s).
:param stream: Stream for the asynchronous version.
:param stream: Stream for the asynchronous version.
The function ``addWeighted`` calculates the weighted sum of two arrays as follows:
:param alpha: Weight for the first array elements.
:param src2: Second source array of the same size and channel number as ``src1`` .
:param beta: Weight for the second array elements.
:param dst: Destination array that has the same size and number of channels as the input arrays.
:param gamma: Scalar added to each sum.
:param dtype: Optional depth of the destination array. When both input arrays have the same depth, ``dtype`` can be set to ``-1``, which will be equivalent to ``src1.depth()``.
:param stream: Stream for the asynchronous version.
The function ``addWeighted`` calculates the weighted sum of two arrays as follows:
@@ -142,12 +142,12 @@ Finds global minimum and maximum matrix elements and returns their values with l
...
@@ -142,12 +142,12 @@ Finds global minimum and maximum matrix elements and returns their values with l
gpu::countNonZero
gpu::countNonZero
---------------------
-----------------
Counts non-zero matrix elements.
Counts non-zero matrix elements.
.. ocv:function:: int gpu::countNonZero(const GpuMat& src)
.. ocv:function:: int gpu::countNonZero(InputArray src)
.. ocv:function:: int gpu::countNonZero(const GpuMat& src, GpuMat& buf)
.. ocv:function:: int gpu::countNonZero(InputArray src, GpuMat& buf)
:param src: Single-channel source image.
:param src: Single-channel source image.
...
@@ -163,7 +163,7 @@ gpu::reduce
...
@@ -163,7 +163,7 @@ gpu::reduce
-----------
-----------
Reduces a matrix to a vector.
Reduces a matrix to a vector.
.. ocv:function:: void gpu::reduce(const GpuMat& mtx, GpuMat& vec, int dim, int reduceOp, int dtype = -1, Stream& stream = Stream::Null())
.. ocv:function:: void gpu::reduce(InputArray mtx, OutputArray vec, int dim, int reduceOp, int dtype = -1, Stream& stream = Stream::Null())
:param mtx: Source 2D matrix.
:param mtx: Source 2D matrix.
...
@@ -183,33 +183,72 @@ Reduces a matrix to a vector.
...
@@ -183,33 +183,72 @@ Reduces a matrix to a vector.
:param dtype: When it is negative, the destination vector will have the same type as the source matrix. Otherwise, its type will be ``CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), mtx.channels())`` .
:param dtype: When it is negative, the destination vector will have the same type as the source matrix. Otherwise, its type will be ``CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), mtx.channels())`` .
:param stream: Stream for the asynchronous version.
The function ``reduce`` reduces the matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained. For example, the function can be used to compute horizontal and vertical projections of a raster image. In case of ``CV_REDUCE_SUM`` and ``CV_REDUCE_AVG`` , the output may have a larger element bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction modes.
The function ``reduce`` reduces the matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained. For example, the function can be used to compute horizontal and vertical projections of a raster image. In case of ``CV_REDUCE_SUM`` and ``CV_REDUCE_AVG`` , the output may have a larger element bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction modes.
.. seealso:: :ocv:func:`reduce`
.. seealso:: :ocv:func:`reduce`
gpu::meanStdDev
---------------
Computes a mean value and a standard deviation of matrix elements.
:param dst: output array of the same size as ``src`` .
:param dst: Output array of the same size as ``src`` .
:param alpha: norm value to normalize to or the lower range boundary in case of the range normalization.
:param alpha: Norm value to normalize to or the lower range boundary in case of the range normalization.
:param beta: upper range boundary in case of the range normalization; it is not used for the norm normalization.
:param beta: Upper range boundary in case of the range normalization; it is not used for the norm normalization.
:param normType: normalization type (see the details below).
:param normType: Normalization type ( ``NORM_MINMAX`` , ``NORM_L2`` , ``NORM_L1`` or ``NORM_INF`` ).
:param dtype: when negative, the output array has the same type as ``src``; otherwise, it has the same number of channels as ``src`` and the depth ``=CV_MAT_DEPTH(dtype)``.
:param dtype: When negative, the output array has the same type as ``src``; otherwise, it has the same number of channels as ``src`` and the depth ``=CV_MAT_DEPTH(dtype)``.
:param mask: optional operation mask.
:param mask: Optional operation mask.
:param norm_buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
:param norm_buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
...
@@ -219,37 +258,38 @@ Normalizes the norm or value range of an array.
...
@@ -219,37 +258,38 @@ Normalizes the norm or value range of an array.
gpu::meanStdDev
gpu::integral
-------------------
-------------
Computes a mean value and a standard deviation of matrix elements.
@@ -381,7 +381,7 @@ Creates a non-separable linear filter.
...
@@ -381,7 +381,7 @@ Creates a non-separable linear filter.
:param dstType: Output image type. The same type as ``src`` is 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. Supports size up to 16. For larger kernels use :ocv:func:`gpu::convolve`.
: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:class:`gpu::Convolution`.
:param anchor: Anchor point. The default value Point(-1, -1) means that the anchor is at the kernel center.
:param anchor: Anchor point. The default value Point(-1, -1) means that the anchor is at the kernel center.
...
@@ -411,7 +411,7 @@ Applies the non-separable 2D linear filter to an image.
...
@@ -411,7 +411,7 @@ Applies the non-separable 2D linear filter to an image.
:param stream: Stream for the asynchronous version.
:param stream: Stream for the asynchronous version.