Documentation

mean2

Average or mean of matrix elements

Syntax

B = mean2(A)
gpuarrayB = mean2(gpuarrayA)

Description

B = mean2(A) computes the mean of the values in A.

gpuarrayB = mean2(gpuarrayA) computes the mean of the values in gpuarrayA, performing the operation on a GPU. This syntax requires the Parallel Computing Toolbox™.

This function supports code generation (see Tips).

Class Support

The input image A can be numeric or logical. The output image B is a scalar of class double.

The input image gpuarrayA is a gpuArray whose underlying class is numeric or logical. The output image gpuarrayB is a gpuArray scalar with the underlying class double.

Examples

collapse all

Compute the mean of an image

Read image.

I = imread('liftingbody.png');

Compute mean.

val = mean2(I)
val =

  140.2991

More About

collapse all

Tips

Algorithms

mean2 computes the mean of an array A using mean(A(:)).

See Also

| |

Was this topic helpful?