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

split.im

Divide Image Into Sub-images


Description

Divides a pixel image into several sub-images according to the value of a factor, or according to the tiles of a tessellation.

Usage

## S3 method for class 'im'
split(x, f, ..., drop = FALSE)

Arguments

x

Pixel image (object of class "im").

f

Splitting criterion. Either a tessellation (object of class "tess") or a pixel image with factor values.

...

Ignored.

drop

Logical value determining whether each subset should be returned as a pixel images (drop=FALSE) or as a one-dimensional vector of pixel values (drop=TRUE).

Details

This is a method for the generic function split for the class of pixel images. The image x will be divided into subsets determined by the data f. The result is a list of these subsets.

The splitting criterion may be either

  • a tessellation (object of class "tess"). Each tile of the tessellation delineates a subset of the spatial domain.

  • a pixel image (object of class "im") with factor values. The levels of the factor determine subsets of the spatial domain.

If drop=FALSE (the default), the result is a list of pixel images, each one a subset of the pixel image x, obtained by restricting the pixel domain to one of the subsets. If drop=TRUE, then the pixel values are returned as numeric vectors.

Value

If drop=FALSE, a list of pixel images (objects of class "im"). It is also of class "solist" so that it can be plotted immediately.

If drop=TRUE, a list of numeric vectors.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner r.turner@auckland.ac.nz.

See Also

Examples

W <- square(1)
  X <- as.im(function(x,y){sqrt(x^2+y^2)}, W)
  Y <- dirichlet(runifrect(12, W))
  plot(split(X,Y))

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.