Matrix Reductions

gpu::meanStdDev

C++: void gpu::meanStdDev(const GpuMat& mtx, Scalar& mean, Scalar& stddev)

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

Parameters:
  • mtx – Source matrix. CV_8UC1 matrices are supported for now.
  • mean – Mean value.
  • stddev – Standard deviation value.

See also

meanStdDev()

gpu::norm

C++: double gpu::norm(const GpuMat& src1, int normType=NORM_L2)
C++: double gpu::norm(const GpuMat& src1, int normType, GpuMat& buf)
C++: double norm(const GpuMat& src1, const GpuMat& src2, int normType=NORM_L2)

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

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.
  • buf – Optional buffer to avoid extra memory allocations. It is resized automatically.

See also

norm()

gpu::sum

C++: Scalar gpu::sum(const GpuMat& src)
C++: Scalar gpu::sum(const GpuMat& src, GpuMat& buf)

Returns the sum of matrix elements.

Parameters:
  • src – Source image of any depth except for CV_64F .
  • buf – Optional buffer to avoid extra memory allocations. It is resized automatically.

See also

sum()

gpu::absSum

C++: Scalar gpu::absSum(const GpuMat& src)
C++: Scalar gpu::absSum(const GpuMat& src, GpuMat& buf)

Returns the sum of absolute values for matrix elements.

Parameters:
  • src – Source image of any depth except for CV_64F .
  • buf – Optional buffer to avoid extra memory allocations. It is resized automatically.

gpu::sqrSum

C++: Scalar gpu::sqrSum(const GpuMat& src)
C++: Scalar gpu::sqrSum(const GpuMat& src, GpuMat& buf)

Returns the squared sum of matrix elements.

Parameters:
  • src – Source image of any depth except for CV_64F .
  • buf – Optional buffer to avoid extra memory allocations. It is resized automatically.

gpu::minMax

C++: void gpu::minMax(const GpuMat& src, double* minVal, double* maxVal=0, const GpuMat& mask=GpuMat())
C++: void gpu::minMax(const GpuMat& src, double* minVal, double* maxVal, const GpuMat& mask, GpuMat& buf)

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

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

See also

minMaxLoc()

gpu::minMaxLoc

C++: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, const GpuMat& mask=GpuMat())
C++: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal, Point* minLoc, Point* maxLoc, const GpuMat& mask, GpuMat& valbuf, GpuMat& locbuf)

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

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.
  • minValLoc – Pointer to the returned minimum location. Use NULL if not required.
  • maxValLoc – Pointer to the returned maximum location. Use NULL if not required.
  • mask – Optional mask to select a sub-matrix.
  • valbuf – Optional values buffer to avoid extra memory allocations. It is resized automatically.
  • 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.

See also

minMaxLoc()

gpu::countNonZero

C++: int gpu::countNonZero(const GpuMat& src)
C++: int gpu::countNonZero(const GpuMat& src, GpuMat& buf)

Counts non-zero matrix elements.

Parameters:
  • src – Single-channel source image.
  • 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.

See also

countNonZero()

Table Of Contents

Previous topic

Image Processing

Next topic

Object Detection

This Page