| OpenCV 5.0.0alpha Open Source Computer Vision

Loading...
Searching...
No Matches
Functions
Per-element Operations
CUDA-accelerated Computer Vision » Operations on Matrices

## Detailed Description

## Functions
void | cv::cuda::abs (InputArray src, OutputArray dst, Stream &stream=Stream::Null())
| Computes an absolute value of each matrix element.
void | cv::cuda::absdiff (InputArray src1, InputArray src2, OutputArray dst, Stream &stream=Stream::Null())
| Computes per-element absolute difference of two matrices (or of a matrix and scalar).
void | cv::cuda::absdiffWithScalar (InputArray src1, Scalar src2, OutputArray dst, Stream &stream=Stream::Null())
| Computes per-element absolute difference of a matrix and scalar.
void | cv::cuda::add (InputArray src1, InputArray src2, OutputArray dst, InputArray mask=noArray(), int dtype=-1, Stream &stream=Stream::Null())
| Computes a matrix-matrix or matrix-scalar sum.
void | cv::cuda::addWeighted (InputArray src1, double alpha, InputArray src2, double beta, double gamma, OutputArray dst, int dtype=-1, Stream &stream=Stream::Null())
| Computes the weighted sum of two arrays.
void | cv::cuda::addWithScalar (InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), int dtype=-1, Stream &stream=Stream::Null())
| Computes a matrix-scalar sum.
void | cv::cuda::bitwise_and (InputArray src1, InputArray src2, OutputArray dst, InputArray mask=noArray(), Stream &stream=Stream::Null())
| Performs a per-element bitwise conjunction of two matrices (or of matrix and scalar).
void | cv::cuda::bitwise_and_with_scalar (InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), Stream &stream=Stream::Null())
| Performs a per-element bitwise conjunction of a matrix and a scalar.
void | cv::cuda::bitwise_not (InputArray src, OutputArray dst, InputArray mask=noArray(), Stream &stream=Stream::Null())
| Performs a per-element bitwise inversion.
void | cv::cuda::bitwise_or (InputArray src1, InputArray src2, OutputArray dst, InputArray mask=noArray(), Stream &stream=Stream::Null())
| Performs a per-element bitwise disjunction of two matrices (or of matrix and scalar).
void | cv::cuda::bitwise_or_with_scalar (InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), Stream &stream=Stream::Null())
| Performs a per-element bitwise disjunction of a matrix and scalar.
void | cv::cuda::bitwise_xor (InputArray src1, InputArray src2, OutputArray dst, InputArray mask=noArray(), Stream &stream=Stream::Null())
| Performs a per-element bitwise exclusive or operation of two matrices (or of matrix and scalar).
void | cv::cuda::bitwise_xor_with_scalar (InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), Stream &stream=Stream::Null())
| Performs a per-element bitwise exclusive or operation of a matrix and a scalar.
void | cv::cuda::cartToPolar (InputArray x, InputArray y, OutputArray magnitude, OutputArray angle, bool angleInDegrees=false, Stream &stream=Stream::Null())
| Converts Cartesian coordinates into polar.
void | cv::cuda::cartToPolar (InputArray xy, OutputArray magnitude, OutputArray angle, bool angleInDegrees=false, Stream &stream=Stream::Null())
| Converts Cartesian coordinates into polar.
void | cv::cuda::cartToPolar (InputArray xy, OutputArray magnitudeAngle, bool angleInDegrees=false, Stream &stream=Stream::Null())
| Converts Cartesian coordinates into polar.
void | cv::cuda::compare (InputArray src1, InputArray src2, OutputArray dst, int cmpop, Stream &stream=Stream::Null())
| Compares elements of two matrices (or of a matrix and scalar).
void | cv::cuda::compareWithScalar (InputArray src1, Scalar src2, OutputArray dst, int cmpop, Stream &stream=Stream::Null())
| Compares elements of a matrix and scalar.
void | cv::cuda::divide (InputArray src1, InputArray src2, OutputArray dst, double scale=1, int dtype=-1, Stream &stream=Stream::Null())
| Computes a matrix-matrix or matrix-scalar division.
void | cv::cuda::divideWithScalar (InputArray src1, Scalar src2, OutputArray dst, double scale=1, int dtype=-1, Stream &stream=Stream::Null())
| Computes a matrix-scalar division.
void | cv::cuda::exp (InputArray src, OutputArray dst, Stream &stream=Stream::Null())
| Computes an exponent of each matrix element.
void | cv::cuda::inRange (InputArray src, const Scalar &lowerb, const Scalar &upperb, OutputArray dst, Stream &stream=Stream::Null())
| Checks if array elements lie between two scalars.
void | cv::cuda::log (InputArray src, OutputArray dst, Stream &stream=Stream::Null())
| Computes a natural logarithm of absolute value of each matrix element.
void | cv::cuda::lshift (InputArray src, Scalar val, OutputArray dst, Stream &stream=Stream::Null())
void | cv::cuda::lshift (InputArray src, Scalar_< int > val, OutputArray dst, Stream &stream=Stream::Null())
| Performs pixel by pixel right left of an image by a constant value.
void | cv::cuda::magnitude (InputArray x, InputArray y, OutputArray magnitude, Stream &stream=Stream::Null())
void | cv::cuda::magnitude (InputArray xy, OutputArray magnitude, Stream &stream=Stream::Null())
| Computes magnitudes of complex matrix elements.
void | cv::cuda::magnitudeSqr (InputArray x, InputArray y, OutputArray magnitude, Stream &stream=Stream::Null())
void | cv::cuda::magnitudeSqr (InputArray xy, OutputArray magnitude, Stream &stream=Stream::Null())
| Computes squared magnitudes of complex matrix elements.
void | cv::cuda::max (InputArray src1, InputArray src2, OutputArray dst, Stream &stream=Stream::Null())
| Computes the per-element maximum of two matrices (or a matrix and a scalar).
void | cv::cuda::maxWithScalar (InputArray src1, Scalar src2, OutputArray dst, Stream &stream=Stream::Null())
| Computes the per-element maximum of a matrix and a scalar.
void | cv::cuda::min (InputArray src1, InputArray src2, OutputArray dst, Stream &stream=Stream::Null())
| Computes the per-element minimum of two matrices (or a matrix and a scalar).
void | cv::cuda::minWithScalar (InputArray src1, Scalar src2, OutputArray dst, Stream &stream=Stream::Null())
| Computes the per-element minimum or a matrix and a scalar.
void | cv::cuda::multiply (InputArray src1, InputArray src2, OutputArray dst, double scale=1, int dtype=-1, Stream &stream=Stream::Null())
| Computes a matrix-matrix or matrix-scalar per-element product.
void | cv::cuda::multiplyWithScalar (InputArray src1, Scalar src2, OutputArray dst, double scale=1, int dtype=-1, Stream &stream=Stream::Null())
| Computes a matrix-scalar per-element product.
void | cv::cuda::phase (InputArray x, InputArray y, OutputArray angle, bool angleInDegrees=false, Stream &stream=Stream::Null())
| Computes polar angles of complex matrix elements.
void | cv::cuda::phase (InputArray xy, OutputArray angle, bool angleInDegrees=false, Stream &stream=Stream::Null())
| Computes polar angles of complex matrix elements.
void | cv::cuda::polarToCart (InputArray magnitude, InputArray angle, OutputArray x, OutputArray y, bool angleInDegrees=false, Stream &stream=Stream::Null())
| Converts polar coordinates into Cartesian.
void | cv::cuda::polarToCart (InputArray magnitude, InputArray angle, OutputArray xy, bool angleInDegrees=false, Stream &stream=Stream::Null())
| Converts polar coordinates into Cartesian.
void | cv::cuda::polarToCart (InputArray magnitudeAngle, OutputArray xy, bool angleInDegrees=false, Stream &stream=Stream::Null())
| Converts polar coordinates into Cartesian.
void | cv::cuda::pow (InputArray src, double power, OutputArray dst, Stream &stream=Stream::Null())
| Raises every matrix element to a power.
void | cv::cuda::rshift (InputArray src, Scalar val, OutputArray dst, Stream &stream=Stream::Null())
void | cv::cuda::rshift (InputArray src, Scalar_< int > val, OutputArray dst, Stream &stream=Stream::Null())
| Performs pixel by pixel right shift of an image by a constant value.
static void | cv::cuda::scaleAdd (InputArray src1, double alpha, InputArray src2, OutputArray dst, Stream &stream=Stream::Null())
| adds scaled array to another one (dst = alpha*src1 + src2)
void | cv::cuda::sqr (InputArray src, OutputArray dst, Stream &stream=Stream::Null())
| Computes a square value of each matrix element.
void | cv::cuda::sqrt (InputArray src, OutputArray dst, Stream &stream=Stream::Null())
| Computes a square root of each matrix element.
void | cv::cuda::subtract (InputArray src1, InputArray src2, OutputArray dst, InputArray mask=noArray(), int dtype=-1, Stream &stream=Stream::Null())
| Computes a matrix-matrix or matrix-scalar difference.
void | cv::cuda::subtractWithScalar (InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), int dtype=-1, Stream &stream=Stream::Null())
| Computes matrix-scalar difference.
double | cv::cuda::threshold (InputArray src, OutputArray dst, double thresh, double maxval, int type, Stream &stream=Stream::Null())
| Applies a fixed-level threshold to each array element.

## Function Documentation

## ◆ abs()

void cv::cuda::abs | ( | InputArray | src,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes an absolute value of each matrix element.

Parameters

  src | Source matrix.
  dst | Destination matrix with the same size and type as src .
  stream | Stream for the asynchronous version.

See also
  abs

## ◆ absdiff()

void cv::cuda::absdiff | ( | InputArray | src1,
|  | InputArray | src2,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes per-element absolute difference of two matrices (or of a matrix and scalar).

Parameters

  src1 | First source matrix or scalar.
  src2 | Second source matrix or scalar.
  dst | Destination matrix that has the same size and type as the input array(s).
  stream | Stream for the asynchronous version.

Warning
  In python both `src1` and `src2` have to be matrices, see absdiffWithScalar for scalar overload.

See also
  cv::absdiff, absdiffWithScalar

## ◆ absdiffWithScalar()

void cv::cuda::absdiffWithScalar | ( | InputArray | src1,
|  | Scalar | src2,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Computes per-element absolute difference of a matrix and scalar.

Parameters

  src1 | First source matrix.
  src2 | Second source scalar.
  dst | Destination matrix that has the same size and type as the input array.
  stream | Stream for the asynchronous version.

See also
  absdiff

Here is the call graph for this function:

## ◆ add()

void cv::cuda::add | ( | InputArray | src1,
|  | InputArray | src2,
|  | OutputArray | dst,
|  | InputArray | mask = noArray(),
|  | int | dtype = -1,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes a matrix-matrix or matrix-scalar sum.

Parameters

  src1 | First source matrix or scalar.
  src2 | Second source matrix or scalar. Matrix should have the same size and type as src1 .
  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.
  mask | Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.
  dtype | Optional depth of the output array.
  stream | Stream for the asynchronous version.

Warning
  In python both `src1` and `src2` have to be matrices, see addWithScalar for scalar overload.

See also
  cv::add, addWithScalar

## ◆ addWeighted()

void cv::cuda::addWeighted | ( | InputArray | src1,
|  | double | alpha,
|  | InputArray | src2,
|  | double | beta,
|  | double | gamma,
|  | OutputArray | dst,
|  | int | dtype = -1,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes the weighted sum of two arrays.

Parameters

  src1 | First source array.
  alpha | Weight for the first array elements.
  src2 | Second source array of the same size and channel number as src1 .
  beta | Weight for the second array elements.
  dst | Destination array that has the same size and number of channels as the input arrays.
  gamma | Scalar added to each sum.
  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().
  stream | Stream for the asynchronous version.

The function addWeighted calculates the weighted sum of two arrays as follows:

\[\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.

See also
  addWeighted

## ◆ addWithScalar()

void cv::cuda::addWithScalar | ( | InputArray | src1,
|  | Scalar | src2,
|  | OutputArray | dst,
|  | InputArray | mask = noArray(),
|  | int | dtype = -1,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Computes a matrix-scalar sum.

Parameters

  src1 | First source matrix.
  src2 | Second source scalar.
  dst | Destination matrix that has the same size and number of channels as the input array. The depth is defined by dtype or `src1` depth.
  mask | Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.
  dtype | Optional depth of the output array.
  stream | Stream for the asynchronous version.

See also
  add

Here is the call graph for this function:

## ◆ bitwise_and()

void cv::cuda::bitwise_and | ( | InputArray | src1,
|  | InputArray | src2,
|  | OutputArray | dst,
|  | InputArray | mask = noArray(),
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Performs a per-element bitwise conjunction of two matrices (or of matrix and scalar).

Parameters

  src1 | First source matrix or scalar.
  src2 | Second source matrix or scalar.
  dst | Destination matrix that has the same size and type as the input array(s).
  mask | Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.
  stream | Stream for the asynchronous version.

Warning
  In python both `src1` and `src2` have to be matrices, see bitwise_and_with_scalar for scalar overload.

See also
  bitwise_and_with_scalar

## ◆ bitwise_and_with_scalar()

void cv::cuda::bitwise_and_with_scalar | ( | InputArray | src1,
|  | Scalar | src2,
|  | OutputArray | dst,
|  | InputArray | mask = noArray(),
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Performs a per-element bitwise conjunction of a matrix and a scalar.

Parameters

  src1 | First source matrix.
  src2 | Second source scalar.
  dst | Destination matrix that has the same size and type as the input array.
  mask | Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.
  stream | Stream for the asynchronous version.

See also
  bitwise_and

Here is the call graph for this function:

## ◆ bitwise_not()

void cv::cuda::bitwise_not | ( | InputArray | src,
|  | OutputArray | dst,
|  | InputArray | mask = noArray(),
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Performs a per-element bitwise inversion.

Parameters

  src | Source matrix.
  dst | Destination matrix with the same size and type as src .
  mask | Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.
  stream | Stream for the asynchronous version.

## ◆ bitwise_or()

void cv::cuda::bitwise_or | ( | InputArray | src1,
|  | InputArray | src2,
|  | OutputArray | dst,
|  | InputArray | mask = noArray(),
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Performs a per-element bitwise disjunction of two matrices (or of matrix and scalar).

Parameters

  src1 | First source matrix or scalar.
  src2 | Second source matrix or scalar.
  dst | Destination matrix that has the same size and type as the input array(s).
  mask | Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.
  stream | Stream for the asynchronous version.

Warning
  In python both `src1` and `src2` have to be matrices, see bitwise_or_with_scalar for scalar overload.

See also
  cv::bitwise_or, bitwise_or_with_scalar

## ◆ bitwise_or_with_scalar()

void cv::cuda::bitwise_or_with_scalar | ( | InputArray | src1,
|  | Scalar | src2,
|  | OutputArray | dst,
|  | InputArray | mask = noArray(),
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Performs a per-element bitwise disjunction of a matrix and scalar.

Parameters

  src1 | First source matrix.
  src2 | Second source scalar.
  dst | Destination matrix that has the same size and type as the input array.
  mask | Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.
  stream | Stream for the asynchronous version.

See also
  bitwise_or

Here is the call graph for this function:

## ◆ bitwise_xor()

void cv::cuda::bitwise_xor | ( | InputArray | src1,
|  | InputArray | src2,
|  | OutputArray | dst,
|  | InputArray | mask = noArray(),
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Performs a per-element bitwise exclusive or operation of two matrices (or of matrix and scalar).

Parameters

  src1 | First source matrix or scalar.
  src2 | Second source matrix or scalar.
  dst | Destination matrix that has the same size and type as the input array.
  mask | Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.
  stream | Stream for the asynchronous version.

Warning
  In python both `src1` and `src2` have to be matrices, see bitwise_xor_with_scalar for scalar overload.

See also
  cv::bitwise_xor, bitwise_xor_with_scalar

## ◆ bitwise_xor_with_scalar()

void cv::cuda::bitwise_xor_with_scalar | ( | InputArray | src1,
|  | Scalar | src2,
|  | OutputArray | dst,
|  | InputArray | mask = noArray(),
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Performs a per-element bitwise exclusive or operation of a matrix and a scalar.

Parameters

  src1 | First source matrix.
  src2 | Second source scalar.
  dst | Destination matrix that has the same size and type as the input array(s).
  mask | Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.
  stream | Stream for the asynchronous version.

See also
  bitwise_xor

Here is the call graph for this function:

## ◆ cartToPolar() [1/3]

void cv::cuda::cartToPolar | ( | InputArray | x,
|  | InputArray | y,
|  | OutputArray | magnitude,
|  | OutputArray | angle,
|  | bool | angleInDegrees = false,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Converts Cartesian coordinates into polar.

Parameters

  x | Source matrix containing real components ( CV_32FC1 ).
  y | Source matrix containing imaginary components ( CV_32FC1 ).
  magnitude | Destination matrix of float magnitudes ( CV_32FC1 ).
  angle | Destination matrix of angles ( CV_32FC1 ).
  angleInDegrees | Flag for angles that must be evaluated in degrees.
  stream | Stream for the asynchronous version.

See also
  cartToPolar

## ◆ cartToPolar() [2/3]

void cv::cuda::cartToPolar | ( | InputArray | xy,
|  | OutputArray | magnitude,
|  | OutputArray | angle,
|  | bool | angleInDegrees = false,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Converts Cartesian coordinates into polar.

Parameters

  xy | Source matrix containing real and imaginary components ( CV_32FC2 ).
  magnitude | Destination matrix of float magnitudes ( CV_32FC1 ).
  angle | Destination matrix of angles ( CV_32FC1 ).
  angleInDegrees | Flag for angles that must be evaluated in degrees.
  stream | Stream for the asynchronous version.

See also
  cartToPolar

## ◆ cartToPolar() [3/3]

void cv::cuda::cartToPolar | ( | InputArray | xy,
|  | OutputArray | magnitudeAngle,
|  | bool | angleInDegrees = false,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Converts Cartesian coordinates into polar.

Parameters

  xy | Source matrix containing real and imaginary components ( CV_32FC2 ).
  magnitudeAngle | Destination matrix of float magnitudes and angles ( CV_32FC2 ).
  angleInDegrees | Flag for angles that must be evaluated in degrees.
  stream | Stream for the asynchronous version.

See also
  cartToPolar

## ◆ compare()

void cv::cuda::compare | ( | InputArray | src1,
|  | InputArray | src2,
|  | OutputArray | dst,
|  | int | cmpop,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Compares elements of two matrices (or of a matrix and scalar).

Parameters

  src1 | First source matrix or scalar.
  src2 | Second source matrix or scalar.
  dst | Destination matrix that has the same size as the input array(s) and type CV_8U.
  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(.)
  stream | Stream for the asynchronous version.

Warning
  In python both `src1` and `src2` have to be matrices, see compareWithScalar for scalar overload.

See also
  cv::compare, compareWithScalar

## ◆ compareWithScalar()

void cv::cuda::compareWithScalar | ( | InputArray | src1,
|  | Scalar | src2,
|  | OutputArray | dst,
|  | int | cmpop,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Compares elements of a matrix and scalar.

Parameters

  src1 | First source matrix.
  src2 | Second source scalar.
  dst | Destination matrix that has the same size as the input array and type CV_8U.
  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(.)
  stream | Stream for the asynchronous version.

See also
  compare

Here is the call graph for this function:

## ◆ divide()

void cv::cuda::divide | ( | InputArray | src1,
|  | InputArray | src2,
|  | OutputArray | dst,
|  | double | scale = 1,
|  | int | dtype = -1,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes a matrix-matrix or matrix-scalar division.

Parameters

  src1 | First source matrix or scalar.
  src2 | Second source matrix or scalar.
  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.
  scale | Optional scale factor.
  dtype | Optional depth of the output array.
  stream | Stream for the asynchronous version.

This function, in contrast to divide, uses a round-down rounding mode.

Warning
  In python both `src1` and `src2` have to be matrices, see divideWithScalar for scalar overload.

See also
  cv::divide, divideWithScalar

## ◆ divideWithScalar()

void cv::cuda::divideWithScalar | ( | InputArray | src1,
|  | Scalar | src2,
|  | OutputArray | dst,
|  | double | scale = 1,
|  | int | dtype = -1,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Computes a matrix-scalar division.

Parameters

  src1 | First source matrix.
  src2 | Second source scalar.
  dst | Destination matrix that has the same size and number of channels as the input array. The depth is defined by dtype or `src1` depth.
  scale | Optional scale factor.
  dtype | Optional depth of the output array.
  stream | Stream for the asynchronous version.

This function, in contrast to divide, uses a round-down rounding mode.

See also
  divide

Here is the call graph for this function:

## ◆ exp()

void cv::cuda::exp | ( | InputArray | src,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes an exponent of each matrix element.

Parameters

  src | Source matrix.
  dst | Destination matrix with the same size and type as src .
  stream | Stream for the asynchronous version.

See also
  exp

## ◆ inRange()

void cv::cuda::inRange | ( | InputArray | src,
|  | const Scalar & | lowerb,
|  | const Scalar & | upperb,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Checks if array elements lie between two scalars.

The function checks the range as follows:

- For every element of a single-channel input array:

  \[\texttt{dst} (I)= \texttt{lowerb}_0 \leq \texttt{src} (I)_0 \leq \texttt{upperb}_0\]

- For two-channel arrays:

  \[\texttt{dst} (I)= \texttt{lowerb}_0 \leq \texttt{src} (I)_0 \leq \texttt{upperb}_0 \land \texttt{lowerb}_1 \leq \texttt{src} (I)_1 \leq \texttt{upperb}_1\]

- and so forth.

That is, dst (I) is set to 255 (all 1 -bits) if src (I) is within the specified 1D, 2D, 3D, ... box and 0 otherwise.

Note that unlike the CPU inRange, this does NOT accept an array for lowerb or upperb, only a cv::Scalar.

Parameters

  src | first input array.
  lowerb | inclusive lower boundary cv::Scalar.
  upperb | inclusive upper boundary cv::Scalar.
  dst | output array of the same size as src and CV_8U type.
  stream | Stream for the asynchronous version.

See also
  cv::inRange

## ◆ log()

void cv::cuda::log | ( | InputArray | src,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes a natural logarithm of absolute value of each matrix element.

Parameters

  src | Source matrix.
  dst | Destination matrix with the same size and type as src .
  stream | Stream for the asynchronous version.

See also
  log

## ◆ lshift() [1/2]

void cv::cuda::lshift | ( | InputArray | src,
|  | Scalar | val,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Here is the call graph for this function:

## ◆ lshift() [2/2]

void cv::cuda::lshift | ( | InputArray | src,
|  | Scalar_< int > | val,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Performs pixel by pixel right left of an image by a constant value.

Parameters

  src | Source matrix. Supports 1, 3 and 4 channels images with CV_8U , CV_16U or CV_32S depth.
  val | Constant values, one per channel.
  dst | Destination matrix with the same size and type as src .
  stream | Stream for the asynchronous version.

## ◆ magnitude() [1/2]

void cv::cuda::magnitude | ( | InputArray | x,
|  | InputArray | y,
|  | OutputArray | magnitude,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. computes magnitude of each (x(i), y(i)) vector supports only floating-point source

Parameters

  x | Source matrix containing real components ( CV_32FC1 ).
  y | Source matrix containing imaginary components ( CV_32FC1 ).
  magnitude | Destination matrix of float magnitudes ( CV_32FC1 ).
  stream | Stream for the asynchronous version.

## ◆ magnitude() [2/2]

void cv::cuda::magnitude | ( | InputArray | xy,
|  | OutputArray | magnitude,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes magnitudes of complex matrix elements.

Parameters

  xy | Source complex matrix in the interleaved format ( CV_32FC2 ).
  magnitude | Destination matrix of float magnitudes ( CV_32FC1 ).
  stream | Stream for the asynchronous version.

See also
  magnitude

## ◆ magnitudeSqr() [1/2]

void cv::cuda::magnitudeSqr | ( | InputArray | x,
|  | InputArray | y,
|  | OutputArray | magnitude,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. computes squared magnitude of each (x(i), y(i)) vector supports only floating-point source

Parameters

  x | Source matrix containing real components ( CV_32FC1 ).
  y | Source matrix containing imaginary components ( CV_32FC1 ).
  magnitude | Destination matrix of float magnitude squares ( CV_32FC1 ).
  stream | Stream for the asynchronous version.

## ◆ magnitudeSqr() [2/2]

void cv::cuda::magnitudeSqr | ( | InputArray | xy,
|  | OutputArray | magnitude,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes squared magnitudes of complex matrix elements.

Parameters

  xy | Source complex matrix in the interleaved format ( CV_32FC2 ).
  magnitude | Destination matrix of float magnitude squares ( CV_32FC1 ).
  stream | Stream for the asynchronous version.

## ◆ max()

void cv::cuda::max | ( | InputArray | src1,
|  | InputArray | src2,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes the per-element maximum of two matrices (or a matrix and a scalar).

Parameters

  src1 | First source matrix or scalar.
  src2 | Second source matrix or scalar.
  dst | Destination matrix that has the same size and type as the input array(s).
  stream | Stream for the asynchronous version.

Warning
  In python both `src1` and `src2` have to be matrices, see maxWithScalar for scalar overload.

See also
  cv::max, maxWithScalar

## ◆ maxWithScalar()

void cv::cuda::maxWithScalar | ( | InputArray | src1,
|  | Scalar | src2,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Computes the per-element maximum of a matrix and a scalar.

Parameters

  src1 | First source matrix.
  src2 | Second source scalar.
  dst | Destination matrix that has the same size and type as the input array.
  stream | Stream for the asynchronous version.

See also
  max

Here is the call graph for this function:

## ◆ min()

void cv::cuda::min | ( | InputArray | src1,
|  | InputArray | src2,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes the per-element minimum of two matrices (or a matrix and a scalar).

Parameters

  src1 | First source matrix or scalar.
  src2 | Second source matrix or scalar.
  dst | Destination matrix that has the same size and type as the input array(s).
  stream | Stream for the asynchronous version.

Warning
  In python both `src1` and `src2` have to be matrices, see minWithScalar for scalar overload.

See also
  cv::min, minWithScalar

## ◆ minWithScalar()

void cv::cuda::minWithScalar | ( | InputArray | src1,
|  | Scalar | src2,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Computes the per-element minimum or a matrix and a scalar.

Parameters

  src1 | First source matrix.
  src2 | Second source scalar.
  dst | Destination matrix that has the same size and type as the input array.
  stream | Stream for the asynchronous version.

See also
  min

Here is the call graph for this function:

## ◆ multiply()

void cv::cuda::multiply | ( | InputArray | src1,
|  | InputArray | src2,
|  | OutputArray | dst,
|  | double | scale = 1,
|  | int | dtype = -1,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes a matrix-matrix or matrix-scalar per-element product.

Parameters

  src1 | First source matrix or scalar.
  src2 | Second source matrix or scalar.
  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.
  scale | Optional scale factor.
  dtype | Optional depth of the output array.
  stream | Stream for the asynchronous version.

Warning
  In python both `src1` and `src2` have to be matrices, see multiplyWithScalar for scalar overload.

See also
  cv::multiply, multiplyWithScalar

## ◆ multiplyWithScalar()

void cv::cuda::multiplyWithScalar | ( | InputArray | src1,
|  | Scalar | src2,
|  | OutputArray | dst,
|  | double | scale = 1,
|  | int | dtype = -1,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Computes a matrix-scalar per-element product.

Parameters

  src1 | First source matrix.
  src2 | Second source scalar.
  dst | Destination matrix that has the same size and number of channels as the input array. The depth is defined by dtype or `src1` depth.
  scale | Optional scale factor.
  dtype | Optional depth of the output array.
  stream | Stream for the asynchronous version.

See also
  multiply

Here is the call graph for this function:

## ◆ phase() [1/2]

void cv::cuda::phase | ( | InputArray | x,
|  | InputArray | y,
|  | OutputArray | angle,
|  | bool | angleInDegrees = false,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes polar angles of complex matrix elements.

Parameters

  x | Source matrix containing real components ( CV_32FC1 ).
  y | Source matrix containing imaginary components ( CV_32FC1 ).
  angle | Destination matrix of angles ( CV_32FC1 ).
  angleInDegrees | Flag for angles that must be evaluated in degrees.
  stream | Stream for the asynchronous version.

See also
  phase

## ◆ phase() [2/2]

void cv::cuda::phase | ( | InputArray | xy,
|  | OutputArray | angle,
|  | bool | angleInDegrees = false,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes polar angles of complex matrix elements.

Parameters

  xy | Source matrix containing real and imaginary components ( CV_32FC2 ).
  angle | Destination matrix of angles ( CV_32FC1 ).
  angleInDegrees | Flag for angles that must be evaluated in degrees.
  stream | Stream for the asynchronous version.

See also
  phase

## ◆ polarToCart() [1/3]

void cv::cuda::polarToCart | ( | InputArray | magnitude,
|  | InputArray | angle,
|  | OutputArray | x,
|  | OutputArray | y,
|  | bool | angleInDegrees = false,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Converts polar coordinates into Cartesian.

Parameters

  magnitude | Source matrix containing magnitudes ( CV_32FC1 or CV_64FC1 ).
  angle | Source matrix containing angles ( same type as magnitude ).
  x | Destination matrix of real components ( same type as magnitude ).
  y | Destination matrix of imaginary components ( same type as magnitude ).
  angleInDegrees | Flag that indicates angles in degrees.
  stream | Stream for the asynchronous version.

## ◆ polarToCart() [2/3]

void cv::cuda::polarToCart | ( | InputArray | magnitude,
|  | InputArray | angle,
|  | OutputArray | xy,
|  | bool | angleInDegrees = false,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Converts polar coordinates into Cartesian.

Parameters

  magnitude | Source matrix containing magnitudes ( CV_32FC1 or CV_64FC1 ).
  angle | Source matrix containing angles ( same type as magnitude ).
  xy | Destination matrix of real and imaginary components ( same depth as magnitude, i.e. CV_32FC2 or CV_64FC2 ).
  angleInDegrees | Flag that indicates angles in degrees.
  stream | Stream for the asynchronous version.

## ◆ polarToCart() [3/3]

void cv::cuda::polarToCart | ( | InputArray | magnitudeAngle,
|  | OutputArray | xy,
|  | bool | angleInDegrees = false,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Converts polar coordinates into Cartesian.

Parameters

  magnitudeAngle | Source matrix containing magnitudes and angles ( CV_32FC2 or CV_64FC2 ).
  xy | Destination matrix of real and imaginary components ( same depth as source ).
  angleInDegrees | Flag that indicates angles in degrees.
  stream | Stream for the asynchronous version.

## ◆ pow()

void cv::cuda::pow | ( | InputArray | src,
|  | double | power,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Raises every matrix element to a power.

Parameters

  src | Source matrix.
  power | Exponent of power.
  dst | Destination matrix with the same size and type as src .
  stream | Stream for the asynchronous version.

The function pow raises every element of the input matrix to power :

\[\texttt{dst} (I) = \fork{\texttt{src}(I)^power}{if \texttt{power} is integer}{|\texttt{src}(I)|^power}{otherwise}\]

See also
  pow

## ◆ rshift() [1/2]

void cv::cuda::rshift | ( | InputArray | src,
|  | Scalar | val,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Here is the call graph for this function:

## ◆ rshift() [2/2]

void cv::cuda::rshift | ( | InputArray | src,
|  | Scalar_< int > | val,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Performs pixel by pixel right shift of an image by a constant value.

Parameters

  src | Source matrix. Supports 1, 3 and 4 channels images with integers elements.
  val | Constant values, one per channel.
  dst | Destination matrix with the same size and type as src .
  stream | Stream for the asynchronous version.

## ◆ scaleAdd()

static void cv::cuda::scaleAdd | ( | InputArray | src1,
|  | double | alpha,
|  | InputArray | src2,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )
| inline static

`#include <opencv2/cudaarithm.hpp>`

adds scaled array to another one (dst = alpha*src1 + src2)

Here is the call graph for this function:

## ◆ sqr()

void cv::cuda::sqr | ( | InputArray | src,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes a square value of each matrix element.

Parameters

  src | Source matrix.
  dst | Destination matrix with the same size and type as src .
  stream | Stream for the asynchronous version.

## ◆ sqrt()

void cv::cuda::sqrt | ( | InputArray | src,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes a square root of each matrix element.

Parameters

  src | Source matrix.
  dst | Destination matrix with the same size and type as src .
  stream | Stream for the asynchronous version.

See also
  sqrt

## ◆ subtract()

void cv::cuda::subtract | ( | InputArray | src1,
|  | InputArray | src2,
|  | OutputArray | dst,
|  | InputArray | mask = noArray(),
|  | int | dtype = -1,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Computes a matrix-matrix or matrix-scalar difference.

Parameters

  src1 | First source matrix or scalar.
  src2 | Second source matrix or scalar. Matrix should have the same size and type as `src1`.
  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.
  mask | Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.
  dtype | Optional depth of the output array.
  stream | Stream for the asynchronous version.

Warning
  In python both `src1` and `src2` have to be matrices, see subtractWithScalar for scalar overload.

See also
  cv::subtract, subtractWithScalar

## ◆ subtractWithScalar()

void cv::cuda::subtractWithScalar | ( | InputArray | src1,
|  | Scalar | src2,
|  | OutputArray | dst,
|  | InputArray | mask = noArray(),
|  | int | dtype = -1,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudaarithm.hpp>`

Computes matrix-scalar difference.

Parameters

  src1 | First source matrix.
  src2 | Second source scalar.
  dst | Destination matrix that has the same size and number of channels as the input array. The depth is defined by dtype or `src1` depth.
  mask | Optional operation mask, 8-bit single channel array, that specifies elements of the destination array to be changed. The mask can be used only with single channel images.
  dtype | Optional depth of the output array.
  stream | Stream for the asynchronous version.

See also
  cv::subtract

Here is the call graph for this function:

## ◆ threshold()

double cv::cuda::threshold | ( | InputArray | src,
|  | OutputArray | dst,
|  | double | thresh,
|  | double | maxval,
|  | int | type,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudaarithm.hpp>`

Applies a fixed-level threshold to each array element.

Parameters

  src | Source array (single-channel).
  dst | Destination array with the same size and type as src .
  thresh | Threshold value.
  maxval | Maximum value to use with THRESH_BINARY and THRESH_BINARY_INV threshold types.
  type | Threshold type. For details, see threshold . The THRESH_OTSU and THRESH_TRIANGLE threshold types are not supported.
  stream | Stream for the asynchronous version.

See also
  threshold