Matrix Reductions#

Detailed Description#

Function Documentation#

absSum()#

Scalar cv::cuda::absSum(
InputArray src,
InputArray mask = noArray() )

#include <opencv2/cudaarithm.hpp>

Returns the sum of absolute values for matrix elements.

Parameters

  • src — Source image of any depth except for CV_64F .

  • mask — optional operation mask; it must have the same size as src1 and CV_8UC1 type.

calcAbsSum()#

void cv::cuda::calcAbsSum(
InputArray src,
OutputArray dst,
InputArray mask = noArray(),
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.

calcNorm()#

void cv::cuda::calcNorm(
InputArray src,
OutputArray dst,
int normType,
InputArray mask = noArray(),
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.

calcNormDiff()#

void cv::cuda::calcNormDiff(
InputArray src1,
InputArray src2,
OutputArray dst,
int normType = NORM_L2,
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.

calcSqrSum()#

void cv::cuda::calcSqrSum(
InputArray src,
OutputArray dst,
InputArray mask = noArray(),
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.

calcSum()#

void cv::cuda::calcSum(
InputArray src,
OutputArray dst,
InputArray mask = noArray(),
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.

countNonZero()#

int cv::cuda::countNonZero(InputArray src)

#include <opencv2/cudaarithm.hpp>

Counts non-zero matrix elements.

The function does not work with CV_64F images on GPUs with the compute capability < 1.3.

See also

countNonZero

Parameters

  • src — Single-channel source image.

countNonZero()#

void cv::cuda::countNonZero(
InputArray src,
OutputArray dst,
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.

findMinMax()#

void cv::cuda::findMinMax(
InputArray src,
OutputArray dst,
InputArray mask = noArray(),
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.

findMinMaxLoc()#

void cv::cuda::findMinMaxLoc(
InputArray src,
OutputArray minMaxVals,
OutputArray loc,
InputArray mask = noArray(),
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.

integral()#

void cv::cuda::integral(
InputArray src,
OutputArray sum,
Stream & stream = Stream::Null() )

#include <opencv2/cudaarithm.hpp>

Computes an integral image.

See also

integral

Parameters

  • src — Source image. Only CV_8UC1 images are supported for now.

  • sum — Integral image containing 32-bit unsigned integer values packed into CV_32SC1 .

  • streamStream for the asynchronous version.

meanStdDev()#

void cv::cuda::meanStdDev(
InputArray mtx,
OutputArray dst,
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.

Parameters

  • mtx — Source matrix. CV_8UC1 and CV_32FC1 matrices are supported for now.

  • dst — Target GpuMat with size 1x2 and type CV_64FC1. The first value is mean, the second - stddev.

  • streamStream for the asynchronous version.

meanStdDev()#

void cv::cuda::meanStdDev(
InputArray mtx,
Scalar & mean,
Scalar & stddev )

#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.

Parameters

  • mtx — Source matrix. CV_8UC1 and CV_32FC1 matrices are supported for now.

  • mean — Mean value.

  • stddev — Standard deviation value.

meanStdDev()#

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

#include <opencv2/cudaarithm.hpp>

Computes a mean value and a standard deviation of matrix elements.

See also

meanStdDev

Parameters

  • src — Source matrix. CV_8UC1 and CV_32FC1 matrices are supported for now.

  • dst — Target GpuMat with size 1x2 and type CV_64FC1. The first value is mean, the second - stddev.

  • mask — Operation mask.

  • streamStream for the asynchronous version.

meanStdDev()#

void cv::cuda::meanStdDev(
InputArray src,
Scalar & mean,
Scalar & stddev,
InputArray mask )

#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.

Parameters

  • src — Source matrix. CV_8UC1 and CV_32FC1 matrices are supported for now.

  • mean — Mean value.

  • stddev — Standard deviation value.

  • mask — Operation mask.

minMax()#

void cv::cuda::minMax(
InputArray src,
double * minVal,
double * maxVal,
InputArray mask = noArray() )

#include <opencv2/cudaarithm.hpp>

Finds global minimum and maximum matrix elements and returns their values.

The function does not work with CV_64F images on GPUs with the compute capability < 1.3.

See also

minMaxLoc

Parameters

  • src — Single-channel source image.

  • minVal — Pointer to the returned minimum value. Use NULL if not required.

  • maxVal — Pointer to the returned maximum value. Use NULL if not required.

  • mask — Optional mask to select a sub-matrix.

minMaxLoc()#

void cv::cuda::minMaxLoc(
InputArray src,
double * minVal,
double * maxVal,
Point * minLoc,
Point * maxLoc,
InputArray mask = noArray() )

#include <opencv2/cudaarithm.hpp>

Finds global minimum and maximum matrix elements and returns their values with locations.

The function does not work with CV_64F images on GPU with the compute capability < 1.3.

See also

minMaxLoc

Parameters

  • src — Single-channel source image.

  • minVal — Pointer to the returned minimum value. Use NULL if not required.

  • maxVal — Pointer to the returned maximum value. Use NULL if not required.

  • minLoc — Pointer to the returned minimum location. Use NULL if not required.

  • maxLoc — Pointer to the returned maximum location. Use NULL if not required.

  • mask — Optional mask to select a sub-matrix.

norm()#

double cv::cuda::norm(
InputArray src1,
InputArray src2,
int normType = NORM_L2 )

#include <opencv2/cudaarithm.hpp>

Returns the difference of two matrices.

See also

norm

Parameters

  • src1 — Source matrix. Any matrices except 64F are supported.

  • src2 — Second source matrix (if any) with the same size and type as src1.

  • normType — Norm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.

norm()#

double cv::cuda::norm(
InputArray src1,
int normType,
InputArray mask = noArray() )

#include <opencv2/cudaarithm.hpp>

Returns the norm of a matrix (or difference of two matrices).

See also

norm

Parameters

  • src1 — Source matrix. Any matrices except 64F are supported.

  • normType — Norm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.

  • mask — optional operation mask; it must have the same size as src1 and CV_8UC1 type.

normalize()#

void cv::cuda::normalize(
InputArray src,
OutputArray dst,
double alpha,
double beta,
int norm_type,
int dtype,
InputArray mask = noArray(),
Stream & stream = Stream::Null() )

#include <opencv2/cudaarithm.hpp>

Normalizes the norm or value range of an array.

See also

normalize

Parameters

  • src — Input array.

  • dst — Output array of the same size as src .

  • alpha — Norm value to normalize to or the lower range boundary in case of the range normalization.

  • beta — Upper range boundary in case of the range normalization; it is not used for the norm normalization.

  • norm_type — Normalization type ( NORM_MINMAX , NORM_L2 , NORM_L1 or NORM_INF ).

  • 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).

  • mask — Optional operation mask.

  • streamStream for the asynchronous version.

rectStdDev()#

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

#include <opencv2/cudaarithm.hpp>

Computes a standard deviation of integral images.

Parameters

  • src — Source image. Only the CV_32SC1 type is supported.

  • sqr — Squared source image. Only the CV_32FC1 type is supported.

  • dst — Destination image with the same type and size as src.

  • rect — Rectangular window.

  • streamStream for the asynchronous version.

reduce()#

void cv::cuda::reduce(
InputArray mtx,
OutputArray vec,
int dim,
int reduceOp,
int dtype = -1,
Stream & stream = Stream::Null() )

#include <opencv2/cudaarithm.hpp>

Reduces a matrix to a vector.

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 REDUCE_SUM and 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.

See also

reduce

Parameters

  • mtx — Source 2D matrix.

  • vec — Destination vector. Its size and type is defined by dim and dtype parameters.

  • 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.

  • reduceOp — Reduction operation that could be one of the following:

    • REDUCE_SUM The output is the sum of all rows/columns of the matrix.

    • REDUCE_AVG The output is the mean vector of all rows/columns of the matrix.

    • REDUCE_MAX The output is the maximum (column/row-wise) of all rows/columns of the matrix.

    • REDUCE_MIN The output is the minimum (column/row-wise) of all rows/columns of the matrix.

  • 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()) .

  • streamStream for the asynchronous version.

sqrIntegral()#

void cv::cuda::sqrIntegral(
InputArray src,
OutputArray sqsum,
Stream & stream = Stream::Null() )

#include <opencv2/cudaarithm.hpp>

Computes a squared integral image.

Parameters

  • src — Source image. Only CV_8UC1 images are supported for now.

  • sqsum — Squared integral image containing 64-bit unsigned integer values packed into CV_64FC1 .

  • streamStream for the asynchronous version.

sqrSum()#

Scalar cv::cuda::sqrSum(
InputArray src,
InputArray mask = noArray() )

#include <opencv2/cudaarithm.hpp>

Returns the squared sum of matrix elements.

Parameters

  • src — Source image of any depth except for CV_64F .

  • mask — optional operation mask; it must have the same size as src1 and CV_8UC1 type.

sum()#

Scalar cv::cuda::sum(
InputArray src,
InputArray mask = noArray() )

#include <opencv2/cudaarithm.hpp>

Returns the sum of matrix elements.

See also

sum

Parameters

  • src — Source image of any depth except for CV_64F .

  • mask — optional operation mask; it must have the same size as src1 and CV_8UC1 type.