Open Source Computer Vision Library https://opencv.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

300 lines
9.7 KiB

Per-element Operations
=======================
.. highlight:: cpp
gpu::add
------------
13 years ago
Computes a matrix-matrix or matrix-scalar sum.
.. ocv:function:: void gpu::add(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
.. ocv:function:: void gpu::add(const GpuMat& src1, const Scalar& src2, GpuMat& dst, Stream& stream = Stream::Null())
13 years ago
: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.
13 years ago
:param src2: Second source matrix or a scalar to be added to ``src1`` .
13 years ago
:param dst: Destination matrix with the same size and type as ``src1`` .
13 years ago
:param stream: Stream for the asynchronous version.
13 years ago
.. seealso:: :ocv:func:`add`
gpu::subtract
-----------------
13 years ago
Computes a matrix-matrix or matrix-scalar difference.
13 years ago
.. ocv:function:: void gpu::subtract(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
13 years ago
.. ocv:function:: void gpu::subtract(const GpuMat& src1, const Scalar& src2, GpuMat& dst, Stream& stream = Stream::Null())
13 years ago
: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.
13 years ago
:param src2: Second source matrix or a scalar to be subtracted from ``src1`` .
13 years ago
:param dst: Destination matrix with the same size and type as ``src1`` .
13 years ago
:param stream: Stream for the asynchronous version.
13 years ago
.. seealso:: :ocv:func:`subtract`
gpu::multiply
-----------------
13 years ago
Computes a matrix-matrix or matrix-scalar per-element product.
13 years ago
.. ocv:function:: void gpu::multiply(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
13 years ago
.. ocv:function:: void gpu::multiply(const GpuMat& src1, const Scalar& src2, GpuMat& dst, Stream& stream = Stream::Null())
13 years ago
: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 to be multiplied by ``src1`` elements.
13 years ago
:param dst: Destination matrix with the same size and type as ``src1`` .
:param stream: Stream for the asynchronous version.
13 years ago
.. seealso:: :ocv:func:`multiply`
gpu::divide
---------------
13 years ago
Computes a matrix-matrix or matrix-scalar sum.
13 years ago
.. ocv:function:: void gpu::divide(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
13 years ago
.. ocv:function:: void gpu::divide(const GpuMat& src1, const Scalar& src2, GpuMat& dst, Stream& stream = Stream::Null())
13 years ago
: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.
13 years ago
:param dst: Destination matrix with the same size and type as ``src1`` .
13 years ago
:param stream: Stream for the asynchronous version.
13 years ago
This function, in contrast to :ocv:func:`divide`, uses a round-down rounding mode.
13 years ago
.. seealso:: :ocv:func:`divide`
gpu::exp
------------
13 years ago
Computes an exponent of each matrix element.
13 years ago
.. ocv:function:: void gpu::exp(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
:param src: Source matrix. ``CV_32FC1`` matrixes are supported for now.
13 years ago
:param dst: Destination matrix with the same size and type as ``src`` .
:param stream: Stream for the asynchronous version.
.. seealso:: :ocv:func:`exp`
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`` :
13 years ago
.. math::
13 years ago
\texttt{dst} (I) = \fork{\texttt{src}(I)^p}{if \texttt{p} is integer}{|\texttt{src}(I)|^p}{otherwise}
.. seealso:: :ocv:func:`pow`
gpu::log
------------
13 years ago
Computes a natural logarithm of absolute value of each matrix element.
13 years ago
.. ocv:function:: void gpu::log(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
:param src: Source matrix. ``CV_32FC1`` matrixes are supported for now.
13 years ago
:param dst: Destination matrix with the same size and type as ``src`` .
13 years ago
:param stream: Stream for the asynchronous version.
13 years ago
.. seealso:: :ocv:func:`log`
gpu::absdiff
----------------
13 years ago
Computes per-element absolute difference of two matrices (or of a matrix and scalar).
.. ocv:function:: void gpu::absdiff(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
.. ocv:function:: void gpu::absdiff(const GpuMat& src1, const Scalar& src2, GpuMat& dst, Stream& stream = Stream::Null())
13 years ago
: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.
13 years ago
:param src2: Second source matrix or a scalar to be added to ``src1`` .
13 years ago
:param dst: Destination matrix with the same size and type as ``src1`` .
13 years ago
:param stream: Stream for the asynchronous version.
13 years ago
.. seealso:: :ocv:func:`absdiff`
gpu::compare
----------------
13 years ago
Compares elements of two matrices.
13 years ago
.. ocv:function:: void gpu::compare(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, int cmpop, Stream& stream = Stream::Null())
:param src1: First source matrix. ``CV_8UC4`` and ``CV_32FC1`` matrices are supported for now.
13 years ago
:param src2: Second source matrix with the same size and type as ``a`` .
:param dst: 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:
13 years ago
* **CMP_EQ:** ``src1(.) == src2(.)``
* **CMP_GT:** ``src1(.) < src2(.)``
* **CMP_GE:** ``src1(.) <= src2(.)``
* **CMP_LT:** ``src1(.) < src2(.)``
* **CMP_LE:** ``src1(.) <= src2(.)``
* **CMP_NE:** ``src1(.) != src2(.)``
13 years ago
:param stream: Stream for the asynchronous version.
.. seealso:: :ocv:func:`compare`
gpu::bitwise_not
--------------------
13 years ago
Performs a per-element bitwise inversion.
13 years ago
.. ocv:function:: void gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null())
:param src: Source matrix.
13 years ago
: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
-------------------
13 years ago
Performs a per-element bitwise disjunction of two matrices.
13 years ago
.. ocv:function:: void gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null())
:param src1: First source matrix.
13 years ago
:param src2: Second source matrix with the same size and type as ``src1`` .
13 years ago
: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
--------------------
13 years ago
Performs a per-element bitwise conjunction of two matrices.
13 years ago
.. ocv:function:: void gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null())
:param src1: First source matrix.
13 years ago
:param src2: Second source matrix with the same size and type as ``src1`` .
13 years ago
: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
--------------------
13 years ago
Performs a per-element bitwise ``exclusive or`` operation of two matrices.
13 years ago
.. ocv:function:: void gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null())
:param src1: First source matrix.
13 years ago
:param src2: Second source matrix with the same size and type as ``src1`` .
13 years ago
: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::min
------------
13 years ago
Computes the per-element minimum of two matrices (or a matrix and a scalar).
13 years ago
.. ocv:function:: void gpu::min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
13 years ago
.. 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.
13 years ago
:param dst: Destination matrix with the same size and type as ``src1`` .
:param stream: Stream for the asynchronous version.
13 years ago
.. seealso:: :ocv:func:`min`
gpu::max
------------
13 years ago
Computes the per-element maximum of two matrices (or a matrix and a scalar).
13 years ago
.. ocv:function:: void gpu::max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
13 years ago
.. 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.
13 years ago
:param dst: Destination matrix with the same size and type as ``src1`` .
:param stream: Stream for the asynchronous version.
13 years ago
.. seealso:: :ocv:func:`max`