mean.im {spatstat}R Documentation

Mean Pixel Value in an Image

Description

Calculates the mean of the pixel values in a pixel image. The mean method for class "im".

Usage

  ## S3 method for class 'im':
  mean(x, ...)

Arguments

x A pixel image (object of class "im").
... Arguments passed to mean.default.

Details

This function calculates the mean value of the pixels 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".

If the image x is logical-valued, the mean value of x is the fraction of pixels that have the value TRUE. If the image x is factor-valued, then the mean of x is the mean of the integer codes of the pixel values.

Any arguments in ... are passed to 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.

Value

A single number.

Author(s)

Adrian Baddeley adrian@maths.uwa.edu.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner rolf@math.unb.ca http://www.math.unb.ca/~rolf

See Also

mean, mean.default, im.object, summary.im.

Examples

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

[Package spatstat version 1.11-3 Index]