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

cut.im

Convert Pixel Image from Numeric to Factor


Description

Transform the values of a pixel image from numeric values into a factor.

Usage

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

Arguments

x

A pixel image. An object of class "im".

...

Arguments passed to cut.default. They determine the breakpoints for the mapping from numerical values to factor values. See cut.default.

Details

This simple function applies the generic cut operation to the pixel values of the image x. The range of pixel values is divided into several intervals, and each interval is associated with a level of a factor. The result is another pixel image, with the same window and pixel grid as x, but with the numeric value of each pixel discretised by replacing it by the factor level.

This function is a convenient way to inspect an image and to obtain summary statistics. See the examples.

To select a subset of an image, use the subset operator [.im instead.

Value

A pixel image (object of class "im") with pixel values that are a factor. See im.object.

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also

Examples

# artificial image data
  Z <- setcov(square(1))

  Y <- cut(Z, 3)
  Y <- cut(Z, breaks=seq(0,1,length=5))

  # cut at the quartiles
  # (divides the image into 4 equal areas)
  Y <- cut(Z, quantile(Z))

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.