@@ -68,9 +68,9 @@ Structure similar to :ocv:class:`gpu::DevMem2D_` but containing only a pointer a
gpu::PtrElemStrp\_
gpu::PtrElemStep\_
------------------
.. ocv:class:: gpu::PtrElemStrp\_
.. ocv:class:: gpu::PtrElemStep\_
Structure similar to :ocv:class:`gpu::DevMem2D_` but containing only a pointer and a row step in elements. Width and height fields are excluded due to performance reasons. This class can only be constructed if ``sizeof(T)`` is a multiple of 256. The structure is intended for internal use or for users who write device code. ::
...
...
@@ -123,7 +123,6 @@ Beware that the latter limitation may lead to overloaded matrix operators that c
void upload(const CudaMem& m, Stream& stream);
//! downloads data from device to host memory. Blocking calls.
:param src: Source image. ``CV_8UC1`` and ``CV_8UC4`` types are supported.
:param src: Source image.
:param dst: Destination image with the same type as ``src`` . The size is ``dsize`` (when it is non-zero) or the size is computed from ``src.size()`` , ``fx`` , and ``fy`` .
...
...
@@ -423,7 +431,7 @@ Resizes an image.
\texttt{(double)dsize.height/src.rows}
:param interpolation: Interpolation method. Only ``INTER_NEAREST`` and ``INTER_LINEAR`` are supported.
:param interpolation: Interpolation method. ``INTER_NEAREST`` , ``INTER_LINEAR`` and ``INTER_CUBIC`` are supported for now.
:param stream: Stream for the asynchronous version.
...
...
@@ -503,9 +511,9 @@ Rotates an image around the origin (0,0) and then shifts it.
gpu::copyMakeBorder
-----------------------
Copies a 2D array to a larger destination array and pads borders with the given constant.
Forms a border around an image.
.. ocv:function:: void gpu::copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, const Scalar& value = Scalar(), Stream& stream = Stream::Null())
.. 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.
...
...
@@ -519,6 +527,8 @@ Copies a 2D array to a larger destination array and pads borders with the given
: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.
The function does not work with ``CV_64F`` images on GPUs with the compute capability < 1.3.
.. seealso:: :ocv:func:`countNonZero`
gpu::reduce
------
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())
:param mtx: Source 2D matrix.
:param vec: Destination vector. Its size and type is defined by ``dim`` and ``dtype`` parameters.
:param dim: Dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row. 1 means that the matrix is reduced to a single column.
:param reduceOp: Reduction operation that could be one of the following:
* **CV_REDUCE_SUM** The output is the sum of all rows/columns of the matrix.
* **CV_REDUCE_AVG** The output is the mean vector of all rows/columns of the matrix.
* **CV_REDUCE_MAX** The output is the maximum (column/row-wise) of all rows/columns of the matrix.
* **CV_REDUCE_MIN** The output is the minimum (column/row-wise) of all rows/columns of the matrix.
: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())`` .
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.
:param src1: First multiplied input matrix that should have ``CV_32FC1`` , ``CV_64FC1`` , ``CV_32FC2`` , or ``CV_64FC2`` type.
:param src2: Second multiplied input matrix of the same type as ``src1`` .
:param alpha: Weight of the matrix product.
:param src3: Third optional delta matrix added to the matrix product. It should have the same type as ``src1`` and ``src2`` .
:param beta: Weight of ``src3`` .
:param dst: Destination matrix. It has the proper size and the same type as input matrices.
:param flags: Operation flags:
* **GEMM_1_T** transpose ``src1``
* **GEMM_2_T** transpose ``src2``
* **GEMM_3_T** transpose ``src3``
:param stream: Stream for the asynchronous version.
The function performs generalized matrix multiplication similar to the ``gemm`` functions in BLAS level 3. For example, ``gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T)`` corresponds to
:param src1: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` , and ``CV_32FC1`` matrices are supported for now. Version with scalar supports only ``CV_32FC1`` and ``CV_32FC2`` matrices.
:param src1: First source matrix.
:param src2: Second source matrix or a scalar to be added to ``src1`` .
:param src2: Second source matrix or a scalar to be added to ``src1`` . Matrix should have the same size and type as ``src1`` .
:param dst: Destination matrix with the same size and type as ``src1`` .
: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 mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
:param dtype: Optional depth of the output array.
:param stream: Stream for the asynchronous version.
...
...
@@ -29,15 +33,19 @@ gpu::subtract
-----------------
Computes a matrix-matrix or matrix-scalar difference.
:param src1: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` , and ``CV_32FC1`` matrices are supported for now. Version with scalar supports only ``CV_32FC1`` and ``CV_32FC2`` matrices.
:param src1: First source matrix.
:param src2: Second source matrix or a scalar to be subtracted from ``src1`` .
:param src2: Second source matrix or a scalar to be added to ``src1`` . Matrix should have the same size and type as ``src1`` .
:param dst: Destination matrix with the same size and type as ``src1`` .
: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 mask: Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed.
:param dtype: Optional depth of the output array.
:param stream: Stream for the asynchronous version.
...
...
@@ -49,15 +57,19 @@ gpu::multiply
-----------------
Computes a matrix-matrix or matrix-scalar per-element product.
:param src1: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` , and ``CV_32FC1`` matrices are supported for now. Version with scalar supports only ``CV_32FC1`` matrices.
:param src1: First source matrix.
:param src2: Second source matrix or a scalar to be multiplied by ``src1`` elements.
:param dst: Destination matrix with the same size and type as ``src1`` .
: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 scale: Optional scale factor.
:param dtype: Optional depth of the output array.
:param stream: Stream for the asynchronous version.
...
...
@@ -67,17 +79,23 @@ Computes a matrix-matrix or matrix-scalar per-element product.
gpu::divide
---------------
Computes a matrix-matrix or matrix-scalar sum.
Computes a matrix-matrix or matrix-scalar division.
:param src1: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` , and ``CV_32FC1`` matrices are supported for now. Version with scalar supports only ``CV_32FC1`` matrices.
:param src2: Second source matrix or a scalar. The ``src1`` elements are divided by it.
:param dst: Destination matrix with the same size and type as ``src1`` .
: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 scale: Optional scale factor.
:param dtype: Optional depth of the output array.
:param stream: Stream for the asynchronous version.
...
...
@@ -87,6 +105,42 @@ This function, in contrast to :ocv:func:`divide`, uses a round-down rounding mod
: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:
:param src1: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` and ``CV_32FC1`` matrices are supported for now. Version with scalar supports only ``CV_32FC1`` matrices.
:param src1: First source matrix.
:param src2: Second source matrix or a scalar to be added to ``src1`` .
...
...
@@ -169,11 +223,11 @@ Compares elements of two matrices.