mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
gpuarithm module for arithmetics operations on matrices
This commit is contained in:
@@ -8,10 +8,7 @@ gpu. GPU-accelerated Computer Vision
|
||||
introduction
|
||||
initalization_and_information
|
||||
data_structures
|
||||
operations_on_matrices
|
||||
per_element_operations
|
||||
image_processing
|
||||
matrix_reductions
|
||||
object_detection
|
||||
feature_detection_and_description
|
||||
image_filtering
|
||||
|
||||
@@ -414,28 +414,6 @@ The methods support arbitrary permutations of the original channels, including r
|
||||
|
||||
|
||||
|
||||
gpu::threshold
|
||||
------------------
|
||||
Applies a fixed-level threshold to each array element.
|
||||
|
||||
.. ocv:function:: double gpu::threshold(const GpuMat& src, GpuMat& dst, double thresh, double maxval, int type, Stream& stream = Stream::Null())
|
||||
|
||||
:param src: Source array (single-channel).
|
||||
|
||||
:param dst: Destination array with the same size and type as ``src`` .
|
||||
|
||||
:param thresh: Threshold value.
|
||||
|
||||
:param maxval: Maximum value to use with ``THRESH_BINARY`` and ``THRESH_BINARY_INV`` threshold types.
|
||||
|
||||
:param type: Threshold type. For details, see :ocv:func:`threshold` . The ``THRESH_OTSU`` threshold type is not supported.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`threshold`
|
||||
|
||||
|
||||
|
||||
gpu::resize
|
||||
---------------
|
||||
Resizes an image.
|
||||
|
||||
@@ -1,207 +0,0 @@
|
||||
Matrix Reductions
|
||||
=================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
gpu::meanStdDev
|
||||
-------------------
|
||||
Computes a mean value and a standard deviation of matrix elements.
|
||||
|
||||
.. ocv:function:: void gpu::meanStdDev(const GpuMat& mtx, Scalar& mean, Scalar& stddev)
|
||||
.. ocv:function:: void gpu::meanStdDev(const GpuMat& mtx, Scalar& mean, Scalar& stddev, GpuMat& buf)
|
||||
|
||||
:param mtx: Source matrix. ``CV_8UC1`` matrices are supported for now.
|
||||
|
||||
:param mean: Mean value.
|
||||
|
||||
:param stddev: Standard deviation value.
|
||||
|
||||
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
|
||||
|
||||
.. seealso:: :ocv:func:`meanStdDev`
|
||||
|
||||
|
||||
|
||||
gpu::norm
|
||||
-------------
|
||||
Returns the norm of a matrix (or difference of two matrices).
|
||||
|
||||
.. ocv:function:: double gpu::norm(const GpuMat& src1, int normType=NORM_L2)
|
||||
|
||||
.. ocv:function:: double gpu::norm(const GpuMat& src1, int normType, GpuMat& buf)
|
||||
|
||||
.. ocv:function:: double gpu::norm(const GpuMat& src1, int normType, const GpuMat& mask, GpuMat& buf)
|
||||
|
||||
.. ocv:function:: double gpu::norm(const GpuMat& src1, const GpuMat& src2, int normType=NORM_L2)
|
||||
|
||||
:param src1: Source matrix. Any matrices except 64F are supported.
|
||||
|
||||
:param src2: Second source matrix (if any) with the same size and type as ``src1``.
|
||||
|
||||
:param normType: Norm type. ``NORM_L1`` , ``NORM_L2`` , and ``NORM_INF`` are supported for now.
|
||||
|
||||
:param mask: optional operation mask; it must have the same size as ``src1`` and ``CV_8UC1`` type.
|
||||
|
||||
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
|
||||
|
||||
.. seealso:: :ocv:func:`norm`
|
||||
|
||||
|
||||
|
||||
gpu::sum
|
||||
------------
|
||||
Returns the sum of matrix elements.
|
||||
|
||||
.. ocv:function:: Scalar gpu::sum(const GpuMat& src)
|
||||
|
||||
.. ocv:function:: Scalar gpu::sum(const GpuMat& src, GpuMat& buf)
|
||||
|
||||
.. ocv:function:: Scalar gpu::sum(const GpuMat& src, const GpuMat& mask, GpuMat& buf)
|
||||
|
||||
:param src: Source image of any depth except for ``CV_64F`` .
|
||||
|
||||
:param mask: optional operation mask; it must have the same size as ``src1`` and ``CV_8UC1`` type.
|
||||
|
||||
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
|
||||
|
||||
.. seealso:: :ocv:func:`sum`
|
||||
|
||||
|
||||
|
||||
gpu::absSum
|
||||
---------------
|
||||
Returns the sum of absolute values for matrix elements.
|
||||
|
||||
.. ocv:function:: Scalar gpu::absSum(const GpuMat& src)
|
||||
|
||||
.. ocv:function:: Scalar gpu::absSum(const GpuMat& src, GpuMat& buf)
|
||||
|
||||
.. ocv:function:: Scalar gpu::absSum(const GpuMat& src, const GpuMat& mask, GpuMat& buf)
|
||||
|
||||
:param src: Source image of any depth except for ``CV_64F`` .
|
||||
|
||||
:param mask: optional operation mask; it must have the same size as ``src1`` and ``CV_8UC1`` type.
|
||||
|
||||
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
|
||||
|
||||
|
||||
|
||||
gpu::sqrSum
|
||||
---------------
|
||||
Returns the squared sum of matrix elements.
|
||||
|
||||
.. ocv:function:: Scalar gpu::sqrSum(const GpuMat& src)
|
||||
|
||||
.. ocv:function:: Scalar gpu::sqrSum(const GpuMat& src, GpuMat& buf)
|
||||
|
||||
.. ocv:function:: Scalar gpu::sqrSum(const GpuMat& src, const GpuMat& mask, GpuMat& buf)
|
||||
|
||||
:param src: Source image of any depth except for ``CV_64F`` .
|
||||
|
||||
:param mask: optional operation mask; it must have the same size as ``src1`` and ``CV_8UC1`` type.
|
||||
|
||||
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
|
||||
|
||||
|
||||
|
||||
gpu::minMax
|
||||
---------------
|
||||
Finds global minimum and maximum matrix elements and returns their values.
|
||||
|
||||
.. ocv:function:: void gpu::minMax(const GpuMat& src, double* minVal, double* maxVal=0, const GpuMat& mask=GpuMat())
|
||||
|
||||
.. ocv:function:: void gpu::minMax(const GpuMat& src, double* minVal, double* maxVal, const GpuMat& mask, GpuMat& buf)
|
||||
|
||||
:param src: Single-channel source image.
|
||||
|
||||
:param minVal: Pointer to the returned minimum value. Use ``NULL`` if not required.
|
||||
|
||||
:param maxVal: Pointer to the returned maximum value. Use ``NULL`` if not required.
|
||||
|
||||
:param mask: Optional mask to select a sub-matrix.
|
||||
|
||||
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
|
||||
|
||||
The function does not work with ``CV_64F`` images on GPUs with the compute capability < 1.3.
|
||||
|
||||
.. seealso:: :ocv:func:`minMaxLoc`
|
||||
|
||||
|
||||
|
||||
gpu::minMaxLoc
|
||||
------------------
|
||||
Finds global minimum and maximum matrix elements and returns their values with locations.
|
||||
|
||||
.. ocv:function:: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, const GpuMat& mask=GpuMat())
|
||||
|
||||
.. ocv:function:: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal, Point* minLoc, Point* maxLoc, const GpuMat& mask, GpuMat& valbuf, GpuMat& locbuf)
|
||||
|
||||
:param src: Single-channel source image.
|
||||
|
||||
:param minVal: Pointer to the returned minimum value. Use ``NULL`` if not required.
|
||||
|
||||
:param maxVal: Pointer to the returned maximum value. Use ``NULL`` if not required.
|
||||
|
||||
:param minLoc: Pointer to the returned minimum location. Use ``NULL`` if not required.
|
||||
|
||||
:param maxLoc: Pointer to the returned maximum location. Use ``NULL`` if not required.
|
||||
|
||||
:param mask: Optional mask to select a sub-matrix.
|
||||
|
||||
:param valbuf: Optional values buffer to avoid extra memory allocations. It is resized automatically.
|
||||
|
||||
:param locbuf: Optional locations buffer to avoid extra memory allocations. It is resized automatically.
|
||||
|
||||
The function does not work with ``CV_64F`` images on GPU with the compute capability < 1.3.
|
||||
|
||||
.. seealso:: :ocv:func:`minMaxLoc`
|
||||
|
||||
|
||||
|
||||
gpu::countNonZero
|
||||
---------------------
|
||||
Counts non-zero matrix elements.
|
||||
|
||||
.. ocv:function:: int gpu::countNonZero(const GpuMat& src)
|
||||
|
||||
.. ocv:function:: int gpu::countNonZero(const GpuMat& src, GpuMat& buf)
|
||||
|
||||
:param src: Single-channel source image.
|
||||
|
||||
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
|
||||
|
||||
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.
|
||||
|
||||
.. seealso:: :ocv:func:`reduce`
|
||||
@@ -1,274 +0,0 @@
|
||||
Operations on Matrices
|
||||
======================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
gpu::gemm
|
||||
------------------
|
||||
Performs generalized matrix multiplication.
|
||||
|
||||
.. ocv:function:: void gpu::gemm(const GpuMat& src1, const GpuMat& src2, double alpha, const GpuMat& src3, double beta, GpuMat& dst, int flags = 0, Stream& stream = Stream::Null())
|
||||
|
||||
: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
|
||||
|
||||
.. math::
|
||||
|
||||
\texttt{dst} = \texttt{alpha} \cdot \texttt{src1} ^T \cdot \texttt{src2} + \texttt{beta} \cdot \texttt{src3} ^T
|
||||
|
||||
.. note:: Transposition operation doesn't support ``CV_64FC2`` input type.
|
||||
|
||||
.. seealso:: :ocv:func:`gemm`
|
||||
|
||||
|
||||
|
||||
gpu::transpose
|
||||
------------------
|
||||
Transposes a matrix.
|
||||
|
||||
.. ocv:function:: void gpu::transpose( const GpuMat& src1, GpuMat& dst, Stream& stream=Stream::Null() )
|
||||
|
||||
:param src1: Source matrix. 1-, 4-, 8-byte element sizes are supported for now (CV_8UC1, CV_8UC4, CV_16UC2, CV_32FC1, etc).
|
||||
|
||||
:param dst: Destination matrix.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`transpose`
|
||||
|
||||
|
||||
|
||||
gpu::flip
|
||||
-------------
|
||||
Flips a 2D matrix around vertical, horizontal, or both axes.
|
||||
|
||||
.. ocv:function:: void gpu::flip( const GpuMat& a, GpuMat& b, int flipCode, Stream& stream=Stream::Null() )
|
||||
|
||||
:param a: Source matrix. Supports 1, 3 and 4 channels images with ``CV_8U``, ``CV_16U``, ``CV_32S`` or ``CV_32F`` depth.
|
||||
|
||||
:param b: Destination matrix.
|
||||
|
||||
:param flipCode: Flip mode for the source:
|
||||
|
||||
* ``0`` Flips around x-axis.
|
||||
|
||||
* ``>0`` Flips around y-axis.
|
||||
|
||||
* ``<0`` Flips around both axes.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`flip`
|
||||
|
||||
|
||||
|
||||
gpu::LUT
|
||||
------------
|
||||
Transforms the source matrix into the destination matrix using the given look-up table: ``dst(I) = lut(src(I))``
|
||||
|
||||
.. ocv:function:: void gpu::LUT(const GpuMat& src, const Mat& lut, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
: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`` .
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`LUT`
|
||||
|
||||
|
||||
|
||||
gpu::merge
|
||||
--------------
|
||||
Makes a multi-channel matrix out of several single-channel matrices.
|
||||
|
||||
.. ocv:function:: void gpu::merge(const GpuMat* src, size_t n, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
.. ocv:function:: void gpu::merge(const vector<GpuMat>& src, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
:param src: Array/vector of source matrices.
|
||||
|
||||
:param n: Number of source matrices.
|
||||
|
||||
:param dst: Destination matrix.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`merge`
|
||||
|
||||
|
||||
|
||||
gpu::split
|
||||
--------------
|
||||
Copies each plane of a multi-channel matrix into an array.
|
||||
|
||||
.. ocv:function:: void gpu::split(const GpuMat& src, GpuMat* dst, Stream& stream = Stream::Null())
|
||||
|
||||
.. ocv:function:: void gpu::split(const GpuMat& src, vector<GpuMat>& dst, Stream& stream = Stream::Null())
|
||||
|
||||
:param src: Source matrix.
|
||||
|
||||
:param dst: Destination array/vector of single-channel matrices.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`split`
|
||||
|
||||
|
||||
|
||||
gpu::magnitude
|
||||
------------------
|
||||
Computes magnitudes of complex matrix elements.
|
||||
|
||||
.. ocv:function:: void gpu::magnitude( const GpuMat& xy, GpuMat& magnitude, Stream& stream=Stream::Null() )
|
||||
|
||||
.. ocv:function:: void gpu::magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, Stream& stream = Stream::Null())
|
||||
|
||||
:param xy: Source complex matrix in the interleaved format ( ``CV_32FC2`` ).
|
||||
|
||||
:param x: Source matrix containing real components ( ``CV_32FC1`` ).
|
||||
|
||||
:param y: Source matrix containing imaginary components ( ``CV_32FC1`` ).
|
||||
|
||||
:param magnitude: Destination matrix of float magnitudes ( ``CV_32FC1`` ).
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`magnitude`
|
||||
|
||||
|
||||
|
||||
gpu::magnitudeSqr
|
||||
---------------------
|
||||
Computes squared magnitudes of complex matrix elements.
|
||||
|
||||
.. ocv:function:: void gpu::magnitudeSqr( const GpuMat& xy, GpuMat& magnitude, Stream& stream=Stream::Null() )
|
||||
|
||||
.. ocv:function:: void gpu::magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, Stream& stream = Stream::Null())
|
||||
|
||||
:param xy: Source complex matrix in the interleaved format ( ``CV_32FC2`` ).
|
||||
|
||||
:param x: Source matrix containing real components ( ``CV_32FC1`` ).
|
||||
|
||||
:param y: Source matrix containing imaginary components ( ``CV_32FC1`` ).
|
||||
|
||||
:param magnitude: Destination matrix of float magnitude squares ( ``CV_32FC1`` ).
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
gpu::phase
|
||||
--------------
|
||||
Computes polar angles of complex matrix elements.
|
||||
|
||||
.. ocv:function:: void gpu::phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees=false, Stream& stream = Stream::Null())
|
||||
|
||||
:param x: Source matrix containing real components ( ``CV_32FC1`` ).
|
||||
|
||||
:param y: Source matrix containing imaginary components ( ``CV_32FC1`` ).
|
||||
|
||||
:param angle: Destination matrix of angles ( ``CV_32FC1`` ).
|
||||
|
||||
:param angleInDegrees: Flag for angles that must be evaluated in degrees.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`phase`
|
||||
|
||||
|
||||
|
||||
gpu::cartToPolar
|
||||
--------------------
|
||||
Converts Cartesian coordinates into polar.
|
||||
|
||||
.. ocv:function:: void gpu::cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees=false, Stream& stream = Stream::Null())
|
||||
|
||||
:param x: Source matrix containing real components ( ``CV_32FC1`` ).
|
||||
|
||||
:param y: Source matrix containing imaginary components ( ``CV_32FC1`` ).
|
||||
|
||||
:param magnitude: Destination matrix of float magnitudes ( ``CV_32FC1`` ).
|
||||
|
||||
:param angle: Destination matrix of angles ( ``CV_32FC1`` ).
|
||||
|
||||
:param angleInDegrees: Flag for angles that must be evaluated in degrees.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`cartToPolar`
|
||||
|
||||
|
||||
|
||||
gpu::polarToCart
|
||||
--------------------
|
||||
Converts polar coordinates into Cartesian.
|
||||
|
||||
.. ocv:function:: void gpu::polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees=false, Stream& stream = Stream::Null())
|
||||
|
||||
:param magnitude: Source matrix containing magnitudes ( ``CV_32FC1`` ).
|
||||
|
||||
:param angle: Source matrix containing angles ( ``CV_32FC1`` ).
|
||||
|
||||
:param x: Destination matrix of real components ( ``CV_32FC1`` ).
|
||||
|
||||
:param y: Destination matrix of imaginary components ( ``CV_32FC1`` ).
|
||||
|
||||
:param angleInDegrees: Flag that indicates angles in degrees.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`polarToCart`
|
||||
|
||||
|
||||
|
||||
gpu::normalize
|
||||
--------------
|
||||
Normalizes the norm or value range of an array.
|
||||
|
||||
.. ocv:function:: void gpu::normalize(const GpuMat& src, GpuMat& dst, double alpha = 1, double beta = 0, int norm_type = NORM_L2, int dtype = -1, const GpuMat& mask = GpuMat())
|
||||
|
||||
.. ocv:function:: void gpu::normalize(const GpuMat& src, GpuMat& dst, double a, double b, int norm_type, int dtype, const GpuMat& mask, GpuMat& norm_buf, GpuMat& cvt_buf)
|
||||
|
||||
:param src: input array.
|
||||
|
||||
: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 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 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 norm_buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
|
||||
|
||||
:param cvt_buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
|
||||
|
||||
.. seealso:: :ocv:func:`normalize`
|
||||
@@ -1,445 +0,0 @@
|
||||
Per-element Operations
|
||||
=======================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
gpu::add
|
||||
------------
|
||||
Computes a matrix-matrix or matrix-scalar sum.
|
||||
|
||||
.. ocv:function:: void gpu::add( const GpuMat& a, const GpuMat& b, GpuMat& c, const GpuMat& mask=GpuMat(), int dtype=-1, Stream& stream=Stream::Null() )
|
||||
|
||||
.. 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 b: Second source matrix to be added to ``a`` . Matrix should have the same size and type as ``a`` .
|
||||
|
||||
: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 dtype: Optional depth of the output array.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`add`
|
||||
|
||||
|
||||
|
||||
gpu::subtract
|
||||
-----------------
|
||||
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 a: First source matrix.
|
||||
|
||||
:param b: Second source matrix to be added to ``a`` . Matrix should have the same size and type as ``a`` .
|
||||
|
||||
: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 dtype: Optional depth of the output array.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`subtract`
|
||||
|
||||
|
||||
|
||||
gpu::multiply
|
||||
-----------------
|
||||
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 b: Second source matrix to be multiplied by ``a`` elements.
|
||||
|
||||
:param sc: A scalar to be multiplied by ``a`` elements.
|
||||
|
||||
: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 dtype: Optional depth of the output array.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`multiply`
|
||||
|
||||
|
||||
|
||||
gpu::divide
|
||||
-----------
|
||||
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() )
|
||||
|
||||
.. ocv:function:: void gpu::divide(const GpuMat& a, const Scalar& sc, GpuMat& c, double scale = 1, int dtype = -1, Stream& stream = Stream::Null())
|
||||
|
||||
.. ocv:function:: void gpu::divide( double scale, const GpuMat& b, GpuMat& c, int dtype=-1, Stream& stream=Stream::Null() )
|
||||
|
||||
:param a: First source matrix or a scalar.
|
||||
|
||||
:param b: Second source matrix. The ``a`` elements are divided by it.
|
||||
|
||||
:param sc: A scalar to be divided by the elements of ``a`` matrix.
|
||||
|
||||
: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 dtype: Optional depth of the output array.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
This function, in contrast to :ocv:func:`divide`, uses a round-down rounding mode.
|
||||
|
||||
.. seealso:: :ocv:func:`divide`
|
||||
|
||||
|
||||
gpu::addWeighted
|
||||
----------------
|
||||
Computes the weighted sum of two arrays.
|
||||
|
||||
.. ocv:function:: void gpu::addWeighted(const GpuMat& src1, double alpha, const GpuMat& src2, double beta, double gamma, GpuMat& dst, int dtype = -1, Stream& stream = Stream::Null())
|
||||
|
||||
:param src1: First source array.
|
||||
|
||||
: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:
|
||||
|
||||
.. math::
|
||||
|
||||
\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} + \texttt{src2} (I)* \texttt{beta} + \texttt{gamma} )
|
||||
|
||||
where ``I`` is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently.
|
||||
|
||||
.. seealso:: :ocv:func:`addWeighted`
|
||||
|
||||
|
||||
|
||||
gpu::abs
|
||||
------------
|
||||
Computes an absolute value of each matrix element.
|
||||
|
||||
.. ocv:function:: void gpu::abs(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
:param src: Source matrix. Supports ``CV_16S`` and ``CV_32F`` depth.
|
||||
|
||||
:param dst: Destination matrix with the same size and type as ``src`` .
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`abs`
|
||||
|
||||
|
||||
|
||||
gpu::sqr
|
||||
------------
|
||||
Computes a square value of each matrix element.
|
||||
|
||||
.. ocv:function:: void gpu::sqr(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
:param src: Source matrix. Supports ``CV_8U`` , ``CV_16U`` , ``CV_16S`` and ``CV_32F`` depth.
|
||||
|
||||
:param dst: Destination matrix with the same size and type as ``src`` .
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
gpu::sqrt
|
||||
------------
|
||||
Computes a square root of each matrix element.
|
||||
|
||||
.. ocv:function:: void gpu::sqrt(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
:param src: Source matrix. Supports ``CV_8U`` , ``CV_16U`` , ``CV_16S`` and ``CV_32F`` depth.
|
||||
|
||||
:param dst: Destination matrix with the same size and type as ``src`` .
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`sqrt`
|
||||
|
||||
|
||||
|
||||
gpu::exp
|
||||
------------
|
||||
Computes an exponent of each matrix element.
|
||||
|
||||
.. ocv:function:: void gpu::exp( const GpuMat& a, GpuMat& b, Stream& stream=Stream::Null() )
|
||||
|
||||
:param a: Source matrix. Supports ``CV_8U`` , ``CV_16U`` , ``CV_16S`` and ``CV_32F`` depth.
|
||||
|
||||
:param b: Destination matrix with the same size and type as ``a`` .
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`exp`
|
||||
|
||||
|
||||
|
||||
gpu::log
|
||||
------------
|
||||
Computes a natural logarithm of absolute value of each matrix element.
|
||||
|
||||
.. ocv:function:: void gpu::log( const GpuMat& a, GpuMat& b, Stream& stream=Stream::Null() )
|
||||
|
||||
:param a: Source matrix. Supports ``CV_8U`` , ``CV_16U`` , ``CV_16S`` and ``CV_32F`` depth.
|
||||
|
||||
:param b: Destination matrix with the same size and type as ``a`` .
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`log`
|
||||
|
||||
|
||||
|
||||
gpu::pow
|
||||
------------
|
||||
Raises every matrix element to a power.
|
||||
|
||||
.. ocv:function:: void gpu::pow(const GpuMat& src, double power, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
:param src: Source matrix. Supports all type, except ``CV_64F`` depth.
|
||||
|
||||
:param power: Exponent of power.
|
||||
|
||||
:param dst: Destination matrix with the same size and type as ``src`` .
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
The function ``pow`` raises every element of the input matrix to ``p`` :
|
||||
|
||||
.. math::
|
||||
|
||||
\texttt{dst} (I) = \fork{\texttt{src}(I)^p}{if \texttt{p} is integer}{|\texttt{src}(I)|^p}{otherwise}
|
||||
|
||||
.. seealso:: :ocv:func:`pow`
|
||||
|
||||
|
||||
|
||||
gpu::absdiff
|
||||
----------------
|
||||
Computes per-element absolute difference of two matrices (or of a matrix and scalar).
|
||||
|
||||
.. ocv:function:: void gpu::absdiff( const GpuMat& a, const GpuMat& b, GpuMat& c, Stream& stream=Stream::Null() )
|
||||
|
||||
.. ocv:function:: void gpu::absdiff( const GpuMat& a, const Scalar& s, GpuMat& c, Stream& stream=Stream::Null() )
|
||||
|
||||
:param a: First source matrix.
|
||||
|
||||
:param b: Second source matrix to be added to ``a`` .
|
||||
|
||||
:param s: A scalar to be added to ``a`` .
|
||||
|
||||
:param c: Destination matrix with the same size and type as ``a`` .
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`absdiff`
|
||||
|
||||
|
||||
|
||||
gpu::compare
|
||||
----------------
|
||||
Compares elements of two matrices.
|
||||
|
||||
.. ocv:function:: void gpu::compare( const GpuMat& a, const GpuMat& b, GpuMat& c, int cmpop, Stream& stream=Stream::Null() )
|
||||
|
||||
.. ocv:function:: void gpu::compare(const GpuMat& a, Scalar sc, GpuMat& c, int cmpop, Stream& stream = Stream::Null())
|
||||
|
||||
:param a: First source matrix.
|
||||
|
||||
:param b: Second source matrix with the same size and type as ``a`` .
|
||||
|
||||
:param sc: A scalar to be compared with ``a`` .
|
||||
|
||||
:param c: Destination matrix with the same size as ``a`` and the ``CV_8UC1`` type.
|
||||
|
||||
:param cmpop: Flag specifying the relation between the elements to be checked:
|
||||
|
||||
* **CMP_EQ:** ``a(.) == b(.)``
|
||||
* **CMP_GT:** ``a(.) < b(.)``
|
||||
* **CMP_GE:** ``a(.) <= b(.)``
|
||||
* **CMP_LT:** ``a(.) < b(.)``
|
||||
* **CMP_LE:** ``a(.) <= b(.)``
|
||||
* **CMP_NE:** ``a(.) != b(.)``
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`compare`
|
||||
|
||||
|
||||
|
||||
gpu::bitwise_not
|
||||
--------------------
|
||||
Performs a per-element bitwise inversion.
|
||||
|
||||
.. ocv:function:: void gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null())
|
||||
|
||||
:param src: Source matrix.
|
||||
|
||||
:param dst: Destination matrix with the same size and type as ``src`` .
|
||||
|
||||
:param mask: Optional operation mask. 8-bit single channel image.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
gpu::bitwise_or
|
||||
-------------------
|
||||
Performs a per-element bitwise disjunction of two matrices or of matrix and scalar.
|
||||
|
||||
.. ocv:function:: void gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null())
|
||||
.. ocv:function:: void gpu::bitwise_or(const GpuMat& src1, const Scalar& sc, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
:param src1: First source matrix.
|
||||
|
||||
:param src2: Second source matrix with the same size and type as ``src1`` .
|
||||
|
||||
:param dst: Destination matrix with the same size and type as ``src1`` .
|
||||
|
||||
:param mask: Optional operation mask. 8-bit single channel image.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
gpu::bitwise_and
|
||||
--------------------
|
||||
Performs a per-element bitwise conjunction of two matrices or of matrix and scalar.
|
||||
|
||||
.. ocv:function:: void gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null())
|
||||
.. ocv:function:: void gpu::bitwise_and(const GpuMat& src1, const Scalar& sc, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
:param src1: First source matrix.
|
||||
|
||||
:param src2: Second source matrix with the same size and type as ``src1`` .
|
||||
|
||||
:param dst: Destination matrix with the same size and type as ``src1`` .
|
||||
|
||||
:param mask: Optional operation mask. 8-bit single channel image.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
gpu::bitwise_xor
|
||||
--------------------
|
||||
Performs a per-element bitwise ``exclusive or`` operation of two matrices of matrix and scalar.
|
||||
|
||||
.. ocv:function:: void gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null())
|
||||
.. ocv:function:: void gpu::bitwise_xor(const GpuMat& src1, const Scalar& sc, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
:param src1: First source matrix.
|
||||
|
||||
:param src2: Second source matrix with the same size and type as ``src1`` .
|
||||
|
||||
:param dst: Destination matrix with the same size and type as ``src1`` .
|
||||
|
||||
:param mask: Optional operation mask. 8-bit single channel image.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
gpu::rshift
|
||||
--------------------
|
||||
Performs pixel by pixel right shift of an image by a constant value.
|
||||
|
||||
.. ocv:function:: void gpu::rshift( const GpuMat& src, Scalar_<int> sc, GpuMat& dst, Stream& stream=Stream::Null() )
|
||||
|
||||
:param src: Source matrix. Supports 1, 3 and 4 channels images with integers elements.
|
||||
|
||||
:param sc: Constant values, one per channel.
|
||||
|
||||
:param dst: Destination matrix with the same size and type as ``src`` .
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
gpu::lshift
|
||||
--------------------
|
||||
Performs pixel by pixel right left of an image by a constant value.
|
||||
|
||||
.. ocv:function:: void gpu::lshift( const GpuMat& src, Scalar_<int> sc, GpuMat& dst, Stream& stream=Stream::Null() )
|
||||
|
||||
:param src: Source matrix. Supports 1, 3 and 4 channels images with ``CV_8U`` , ``CV_16U`` or ``CV_32S`` depth.
|
||||
|
||||
:param sc: Constant values, one per channel.
|
||||
|
||||
:param dst: Destination matrix with the same size and type as ``src`` .
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
gpu::min
|
||||
------------
|
||||
Computes the per-element minimum of two matrices (or a matrix and a scalar).
|
||||
|
||||
.. ocv:function:: void gpu::min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
.. ocv:function:: void gpu::min(const GpuMat& src1, double src2, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
:param src1: First source matrix.
|
||||
|
||||
:param src2: Second source matrix or a scalar to compare ``src1`` elements with.
|
||||
|
||||
:param dst: Destination matrix with the same size and type as ``src1`` .
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`min`
|
||||
|
||||
|
||||
|
||||
gpu::max
|
||||
------------
|
||||
Computes the per-element maximum of two matrices (or a matrix and a scalar).
|
||||
|
||||
.. ocv:function:: void gpu::max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
.. ocv:function:: void gpu::max(const GpuMat& src1, double src2, GpuMat& dst, Stream& stream = Stream::Null())
|
||||
|
||||
:param src1: First source matrix.
|
||||
|
||||
:param src2: Second source matrix or a scalar to compare ``src1`` elements with.
|
||||
|
||||
:param dst: Destination matrix with the same size and type as ``src1`` .
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
.. seealso:: :ocv:func:`max`
|
||||
Reference in New Issue
Block a user