# mean.im

##### Maximum, Minimum, Mean, Median, Range or Sum of Pixel Values in an Image

Calculates the mean, median, range, sum, maximum or minimum of the pixel values in a pixel image.

##### Usage

```
## S3 method for class 'im':
max(x, \dots)
## S3 method for class 'im':
min(x, \dots)
## S3 method for class 'im':
mean(x, \dots)
## S3 method for class 'im':
median(x, \dots)
## S3 method for class 'im':
range(x, \dots)
## S3 method for class 'im':
sum(x, \dots)
```

##### Arguments

- x
- A pixel image (object of class
`"im"`

). - ...
- Arguments passed to
`mean.default`

.

##### Details

These functions calculate the mean, median, range, sum, maximum
or minimum of the pixel values in the image
`x`

.

An object of class `"im"`

describes a pixel image. See `im.object`

)
for details of this class.

The function `mean.im`

is a method for the generic
function `mean`

for the class `"im"`

.
Similarly `median.im`

is a method for the generic
`median`

and `range.im`

is a method for `range`

.
If the image `x`

is logical-valued, the mean value of `x`

is
the fraction of pixels that have the value `TRUE`

. The median is
not defined.

If the image `x`

is factor-valued, then the mean of `x`

is the mean of the integer codes of the pixel values. The median and range
are not defined.

Any arguments in `...`

are passed to the default method,
for example `mean.default`

.
In particular, using the argument `trim`

will compute the
trimmed mean, as explained in the help for `mean.default`

.

Other information about an image can be obtained using
`summary.im`

or `quantile.im`

.

##### Value

- A single number.

##### See Also

`mean`

,
`median`

,
`range`

,
`sum`

,
`mean.default`

,
`median.default`

,
`range.default`

,
`quantile.im`

,
`im.object`

,
`summary.im`

.

##### Examples

```
X <- as.im(function(x,y) {x^2}, unit.square())
mean(X)
median(X)
range(X)
mean(X, trim=0.05)
```

*Documentation reproduced from package spatstat, version 1.31-3, License: GPL (>= 2)*