Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

integral.im

Integral of a Pixel Image


Description

Computes the integral of a pixel image.

Usage

integral(f, domain=NULL, ...)

## S3 method for class 'im'
integral(f, domain=NULL, ...)

Arguments

f

A pixel image (object of class "im") with pixel values that can be treated as numeric or complex values.

domain

Optional. Window specifying the domain of integration. Alternatively a tessellation.

...

Ignored.

Details

The function integral is generic, with methods for "im", "msr", "linim" and "linfun".

The method integral.im treats the pixel image f as a function of the spatial coordinates, and computes its integral. The integral is calculated by summing the pixel values and multiplying by the area of one pixel.

The pixel values of f may be numeric, integer, logical or complex. They cannot be factor or character values.

The logical values TRUE and FALSE are converted to 1 and 0 respectively, so that the integral of a logical image is the total area of the TRUE pixels, in the same units as unitname(x).

If domain is a window (class "owin") then the integration will be restricted to this window. If domain is a tessellation (class "tess") then the integral of f in each tile of domain will be computed.

Value

A single numeric or complex value (or a vector of such values if domain is a tessellation).

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

See Also

Examples

# approximate integral of f(x,y) dx dy
   f <- function(x,y){3*x^2 + 2*y}
   Z <- as.im(f, square(1))
   integral.im(Z)
   # correct answer is 2

   # integrate over the subset [0.1,0.9] x [0.2,0.8]
   W <- owin(c(0.1,0.9), c(0.2,0.8))
   integral.im(Z, W)

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.