Matrix Reductions
cuda::norm
Returns the norm of a matrix (or difference of two matrices).
-
C++: double cuda::norm(InputArray src1, int normType)
-
C++: double cuda::norm(InputArray src1, int normType, GpuMat& buf)
-
C++: double cuda::norm(InputArray src1, int normType, InputArray mask, GpuMat& buf)
-
C++: double cuda::norm(InputArray src1, InputArray src2, int normType=NORM_L2)
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.
- mask – optional operation mask; it must have the same size as src1 and CV_8UC1 type.
- buf – Optional buffer to avoid extra memory allocations. It is resized automatically.
|
cuda::sum
Returns the sum of matrix elements.
-
C++: Scalar cuda::sum(InputArray src)
-
C++: Scalar cuda::sum(InputArray src, GpuMat& buf)
-
C++: Scalar cuda::sum(InputArray src, InputArray mask, GpuMat& buf)
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.
- buf – Optional buffer to avoid extra memory allocations. It is resized automatically.
|
cuda::absSum
Returns the sum of absolute values for matrix elements.
-
C++: Scalar cuda::absSum(InputArray src)
-
C++: Scalar cuda::absSum(InputArray src, GpuMat& buf)
-
C++: Scalar cuda::absSum(InputArray src, InputArray mask, GpuMat& buf)
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.
- buf – Optional buffer to avoid extra memory allocations. It is resized automatically.
|
cuda::sqrSum
Returns the squared sum of matrix elements.
-
C++: Scalar cuda::sqrSum(InputArray src)
-
C++: Scalar cuda::sqrSum(InputArray src, GpuMat& buf)
-
C++: Scalar cuda::sqrSum(InputArray src, InputArray mask, GpuMat& buf)
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.
- buf – Optional buffer to avoid extra memory allocations. It is resized automatically.
|
cuda::minMax
Finds global minimum and maximum matrix elements and returns their values.
-
C++: void cuda::minMax(InputArray src, double* minVal, double* maxVal=0, InputArray mask=noArray())
-
C++: void cuda::minMax(InputArray src, double* minVal, double* maxVal, InputArray mask, GpuMat& buf)
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.
cuda::minMaxLoc
Finds global minimum and maximum matrix elements and returns their values with locations.
-
C++: void cuda::minMaxLoc(InputArray src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, InputArray mask=noArray())
-
C++: void cuda::minMaxLoc(InputArray src, double* minVal, double* maxVal, Point* minLoc, Point* maxLoc, InputArray mask, GpuMat& valbuf, GpuMat& locbuf)
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.
- 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.
cuda::countNonZero
Counts non-zero matrix elements.
-
C++: int cuda::countNonZero(InputArray src)
-
C++: int cuda::countNonZero(InputArray src, GpuMat& buf)
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.
cuda::reduce
Reduces a matrix to a vector.
-
C++: void cuda::reduce(InputArray mtx, OutputArray vec, int dim, int reduceOp, int dtype=-1, Stream& stream=Stream::Null())
-
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.
cuda::meanStdDev
Computes a mean value and a standard deviation of matrix elements.
-
C++: void cuda::meanStdDev(InputArray mtx, Scalar& mean, Scalar& stddev)
-
C++: void cuda::meanStdDev(InputArray mtx, Scalar& mean, Scalar& stddev, GpuMat& buf)
Parameters: |
- mtx – Source matrix. CV_8UC1 matrices are supported for now.
- mean – Mean value.
- stddev – Standard deviation value.
- buf – Optional buffer to avoid extra memory allocations. It is resized automatically.
|
cuda::rectStdDev
Computes a standard deviation of integral images.
-
C++: void cuda::rectStdDev(InputArray src, InputArray sqr, OutputArray dst, Rect rect, Stream& stream=Stream::Null())
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.
- stream – Stream for the asynchronous version.
|
cuda::normalize
Normalizes the norm or value range of an array.
-
C++: void cuda::normalize(InputArray src, OutputArray dst, double alpha=1, double beta=0, int norm_type=NORM_L2, int dtype=-1, InputArray mask=noArray())
-
C++: void cuda::normalize(InputArray src, OutputArray dst, double alpha, double beta, int norm_type, int dtype, InputArray mask, GpuMat& norm_buf, GpuMat& cvt_buf)
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.
- normType – 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.
- norm_buf – Optional buffer to avoid extra memory allocations. It is resized automatically.
- cvt_buf – Optional buffer to avoid extra memory allocations. It is resized automatically.
|
cuda::integral
Computes an integral image.
-
C++: void cuda::integral(InputArray src, OutputArray sum, Stream& stream=Stream::Null())
-
C++: void cuda::integral(InputArray src, OutputArray sum, GpuMat& buffer, Stream& stream=Stream::Null())
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 .
- buffer – Optional buffer to avoid extra memory allocations. It is resized automatically.
- stream – Stream for the asynchronous version.
|
cuda::sqrIntegral
Computes a squared integral image.
-
C++: void cuda::sqrIntegral(InputArray src, OutputArray sqsum, Stream& stream=Stream::Null())
-
C++: void cuda::sqrIntegral(InputArray src, OutputArray sqsum, GpuMat& buf, Stream& stream=Stream::Null())
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 .
- buf – Optional buffer to avoid extra memory allocations. It is resized automatically.
- stream – Stream for the asynchronous version.
|
Help and Feedback
You did not find what you were looking for?
- Ask a question on the Q&A forum.
- If you think something is missing or wrong in the documentation,
please file a bug report.