Average or mean of matrix elements
B = mean2(A)
Read an image into the workspace.
I = imread('liftingbody.png');
Compute the mean.
meanval = mean2(I)
meanval = 140.2991
Read a grayscale image into the workspace as a
object, then calculate the mean of the pixel intensity values using a
I = gpuArray(imread('liftingbody.png')); meanval = mean2(I)
A— Input data
Input data, specified as a numerical or logical array.
To perform the computation using a GPU, specify
gpuArray that contains a
numeric or logical array.
Usage notes and limitations:
mean2 supports the generation of C
code (requires MATLAB®
Coder™). For more information, see Code Generation for Image Processing.
This function fully supports GPU arrays. For more information, see Image Processing on a GPU.