OpenCV  4.1.0
Open Source Computer Vision
Functions
Matrix Reductions

Functions

Scalar cv::cuda::absSum (InputArray src, InputArray mask=noArray())
 Returns the sum of absolute values for matrix elements.
 
void cv::cuda::calcAbsSum (InputArray src, OutputArray dst, InputArray mask=noArray(), Stream &stream=Stream::Null())
 
void cv::cuda::calcNorm (InputArray src, OutputArray dst, int normType, InputArray mask=noArray(), Stream &stream=Stream::Null())
 
void cv::cuda::calcNormDiff (InputArray src1, InputArray src2, OutputArray dst, int normType=NORM_L2, Stream &stream=Stream::Null())
 
void cv::cuda::calcSqrSum (InputArray src, OutputArray dst, InputArray mask=noArray(), Stream &stream=Stream::Null())
 
void cv::cuda::calcSum (InputArray src, OutputArray dst, InputArray mask=noArray(), Stream &stream=Stream::Null())
 
int cv::cuda::countNonZero (InputArray src)
 Counts non-zero matrix elements.
 
void cv::cuda::countNonZero (InputArray src, OutputArray dst, Stream &stream=Stream::Null())
 
void cv::cuda::findMinMax (InputArray src, OutputArray dst, InputArray mask=noArray(), Stream &stream=Stream::Null())
 
void cv::cuda::findMinMaxLoc (InputArray src, OutputArray minMaxVals, OutputArray loc, InputArray mask=noArray(), Stream &stream=Stream::Null())
 
void cv::cuda::integral (InputArray src, OutputArray sum, Stream &stream=Stream::Null())
 Computes an integral image.
 
void cv::cuda::meanStdDev (InputArray mtx, Scalar &mean, Scalar &stddev)
 Computes a mean value and a standard deviation of matrix elements.
 
void cv::cuda::meanStdDev (InputArray mtx, OutputArray dst, Stream &stream=Stream::Null())
 
void cv::cuda::minMax (InputArray src, double *minVal, double *maxVal, InputArray mask=noArray())
 Finds global minimum and maximum matrix elements and returns their values.
 
void cv::cuda::minMaxLoc (InputArray src, double *minVal, double *maxVal, Point *minLoc, Point *maxLoc, InputArray mask=noArray())
 Finds global minimum and maximum matrix elements and returns their values with locations.
 
double cv::cuda::norm (InputArray src1, int normType, InputArray mask=noArray())
 Returns the norm of a matrix (or difference of two matrices).
 
double cv::cuda::norm (InputArray src1, InputArray src2, int normType=NORM_L2)
 Returns the difference of two matrices.
 
void cv::cuda::normalize (InputArray src, OutputArray dst, double alpha, double beta, int norm_type, int dtype, InputArray mask=noArray(), Stream &stream=Stream::Null())
 Normalizes the norm or value range of an array.
 
void cv::cuda::rectStdDev (InputArray src, InputArray sqr, OutputArray dst, Rect rect, Stream &stream=Stream::Null())
 Computes a standard deviation of integral images.
 
void cv::cuda::reduce (InputArray mtx, OutputArray vec, int dim, int reduceOp, int dtype=-1, Stream &stream=Stream::Null())
 Reduces a matrix to a vector.
 
void cv::cuda::sqrIntegral (InputArray src, OutputArray sqsum, Stream &stream=Stream::Null())
 Computes a squared integral image.
 
Scalar cv::cuda::sqrSum (InputArray src, InputArray mask=noArray())
 Returns the squared sum of matrix elements.
 
Scalar cv::cuda::sum (InputArray src, InputArray mask=noArray())
 Returns the sum of matrix elements.
 

Detailed Description

Function Documentation

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

Returns the sum of absolute values for matrix elements.

Parameters
srcSource image of any depth except for CV_64F .
maskoptional operation mask; it must have the same size as src1 and CV_8UC1 type.
void cv::cuda::calcAbsSum ( InputArray  src,
OutputArray  dst,
InputArray  mask = noArray(),
Stream &  stream = Stream::Null() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void cv::cuda::calcNorm ( InputArray  src,
OutputArray  dst,
int  normType,
InputArray  mask = noArray(),
Stream &  stream = Stream::Null() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void cv::cuda::calcNormDiff ( InputArray  src1,
InputArray  src2,
OutputArray  dst,
int  normType = NORM_L2,
Stream &  stream = Stream::Null() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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

Counts non-zero matrix elements.

Parameters
srcSingle-channel source image.

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

See Also
countNonZero
void cv::cuda::countNonZero ( InputArray  src,
OutputArray  dst,
Stream &  stream = Stream::Null() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void cv::cuda::findMinMaxLoc ( InputArray  src,
OutputArray  minMaxVals,
OutputArray  loc,
InputArray  mask = noArray(),
Stream &  stream = Stream::Null() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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

Computes an integral image.

Parameters
srcSource image. Only CV_8UC1 images are supported for now.
sumIntegral image containing 32-bit unsigned integer values packed into CV_32SC1 .
streamStream for the asynchronous version.
See Also
integral
void cv::cuda::meanStdDev ( InputArray  mtx,
Scalar &  mean,
Scalar &  stddev 
)

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

Parameters
mtxSource matrix. CV_8UC1 matrices are supported for now.
meanMean value.
stddevStandard deviation value.
See Also
meanStdDev
void cv::cuda::meanStdDev ( InputArray  mtx,
OutputArray  dst,
Stream &  stream = Stream::Null() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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

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

Parameters
srcSingle-channel source image.
minValPointer to the returned minimum value. Use NULL if not required.
maxValPointer to the returned maximum value. Use NULL if not required.
maskOptional mask to select a sub-matrix.

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

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

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

Parameters
srcSingle-channel source image.
minValPointer to the returned minimum value. Use NULL if not required.
maxValPointer to the returned maximum value. Use NULL if not required.
minLocPointer to the returned minimum location. Use NULL if not required.
maxLocPointer to the returned maximum location. Use NULL if not required.
maskOptional mask to select a sub-matrix.

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

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

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

Parameters
src1Source matrix. Any matrices except 64F are supported.
normTypeNorm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.
maskoptional operation mask; it must have the same size as src1 and CV_8UC1 type.
See Also
norm
double cv::cuda::norm ( InputArray  src1,
InputArray  src2,
int  normType = NORM_L2 
)

Returns the difference of two matrices.

Parameters
src1Source matrix. Any matrices except 64F are supported.
src2Second source matrix (if any) with the same size and type as src1.
normTypeNorm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.
See Also
norm
void cv::cuda::normalize ( InputArray  src,
OutputArray  dst,
double  alpha,
double  beta,
int  norm_type,
int  dtype,
InputArray  mask = noArray(),
Stream &  stream = Stream::Null() 
)

Normalizes the norm or value range of an array.

Parameters
srcInput array.
dstOutput array of the same size as src .
alphaNorm value to normalize to or the lower range boundary in case of the range normalization.
betaUpper range boundary in case of the range normalization; it is not used for the norm normalization.
norm_typeNormalization type ( NORM_MINMAX , NORM_L2 , NORM_L1 or NORM_INF ).
dtypeWhen 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).
maskOptional operation mask.
streamStream for the asynchronous version.
See Also
normalize
void cv::cuda::rectStdDev ( InputArray  src,
InputArray  sqr,
OutputArray  dst,
Rect  rect,
Stream &  stream = Stream::Null() 
)

Computes a standard deviation of integral images.

Parameters
srcSource image. Only the CV_32SC1 type is supported.
sqrSquared source image. Only the CV_32FC1 type is supported.
dstDestination image with the same type and size as src .
rectRectangular window.
streamStream for the asynchronous version.
void cv::cuda::reduce ( InputArray  mtx,
OutputArray  vec,
int  dim,
int  reduceOp,
int  dtype = -1,
Stream &  stream = Stream::Null() 
)

Reduces a matrix to a vector.

Parameters
mtxSource 2D matrix.
vecDestination vector. Its size and type is defined by dim and dtype parameters.
dimDimension 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.
reduceOpReduction 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.
dtypeWhen 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.

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.

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

Computes a squared integral image.

Parameters
srcSource image. Only CV_8UC1 images are supported for now.
sqsumSquared integral image containing 64-bit unsigned integer values packed into CV_64FC1 .
streamStream for the asynchronous version.
Scalar cv::cuda::sqrSum ( InputArray  src,
InputArray  mask = noArray() 
)

Returns the squared sum of matrix elements.

Parameters
srcSource image of any depth except for CV_64F .
maskoptional operation mask; it must have the same size as src1 and CV_8UC1 type.
Scalar cv::cuda::sum ( InputArray  src,
InputArray  mask = noArray() 
)

Returns the sum of matrix elements.

Parameters
srcSource image of any depth except for CV_64F .
maskoptional operation mask; it must have the same size as src1 and CV_8UC1 type.
See Also
sum