### Navigation

- index
- next |
- previous |
- OpenCV 2.4.10.0 documentation »
- OpenCV API Reference »
- ocl. OpenCL-accelerated Computer Vision »

# Matrix Reductions

## ocl::absSum

Returns the sum of absolute values for matrix elements.

C++:`` Scalar `ocl::``absSum`(const oclMat& m)

  Parameters: | m – The Source image of all depth.

Counts the abs sum of matrix elements for each channel. Supports all data types.

## ocl::countNonZero

Returns the number of non-zero elements in src

C++:`` int `ocl::``countNonZero`(const oclMat& src)

  Parameters: | src – Single-channel array

Counts non-zero array elements. Supports all data types.

## ocl::min

C++:`` void `ocl::``min`(const oclMat& src1, const oclMat& src2, oclMat& dst)

  Parameters: | src1 – the first input array. src2 – the second input array, must be the same size and same type as `src1`. dst – the destination array, it will have the same size and same type as `src1`.

Computes element-wise minima of two arrays. Supports all data types.

## ocl::max

C++:`` void `ocl::``max`(const oclMat& src1, const oclMat& src2, oclMat& dst)

  Parameters: | src1 – the first input array. src2 – the second input array, must be the same size and same type as `src1`. dst – the destination array, it will have the same size and same type as `src1`.

Computes element-wise maxima of two arrays. Supports all data types.

## ocl::minMax

Returns void

C++:`` void `ocl::``minMax`(const oclMat& src, double* minVal, double* maxVal=0, const oclMat& mask=oclMat())

  Parameters: | src – Single-channel array minVal – Pointer to returned minimum value, should not be NULL maxVal – Pointer to returned maximum value, should not be NULL mask – The optional mask used to select a sub-array

Finds global minimum and maximum in a whole array or sub-array. Supports all data types.

## ocl::minMaxLoc

Returns void

C++:`` void `ocl::``minMaxLoc`(const oclMat& src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, const oclMat& mask=oclMat())

  Parameters: | src – Single-channel array minVal – Pointer to returned minimum value, should not be NULL maxVal – Pointer to returned maximum value, should not be NULL minLoc – Pointer to returned minimum location (in 2D case), should not be NULL maxLoc – Pointer to returned maximum location (in 2D case) should not be NULL mask – The optional mask used to select a sub-array

The functions minMaxLoc find minimum and maximum element values and their positions. The extremums are searched across the whole array, or, if mask is not an empty array, in the specified array region. The functions do not work with multi-channel arrays.

## ocl::sqrSum

Returns the squared sum of matrix elements for each channel

C++:`` Scalar `ocl::``sqrSum`(const oclMat& m)

  Parameters: | m – The Source image of all depth.

Counts the squared sum of matrix elements for each channel. Supports all data types.

## ocl::sum

Returns the sum of matrix elements for each channel

C++:`` Scalar `ocl::``sum`(const oclMat& m)

  Parameters: | m – The Source image of all depth.

Counts the sum of matrix elements for each channel.

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

### Navigation

- index
- next |
- previous |
- OpenCV 2.4.10.0 documentation »
- OpenCV API Reference »
- ocl. OpenCL-accelerated Computer Vision »