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

as.matrix.im

Convert Pixel Image to Matrix or Array


Description

Converts a pixel image to a matrix or an array.

Usage

## S3 method for class 'im'
as.matrix(x, ...)
  ## S3 method for class 'im'
as.array(x, ...)

Arguments

x

A pixel image (object of class "im").

...

See below.

Details

The function as.matrix.im converts the pixel image x into a matrix containing the pixel values. It is handy when you want to extract a summary of the pixel values. See the Examples.

The function as.array.im converts the pixel image to an array. By default this is a three-dimensional array of dimension n by m by 1. If the extra arguments ... are given, they will be passed to array, and they may change the dimensions of the array.

Value

A matrix or array.

Author(s)

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

See Also

Examples

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

   M <- as.matrix(Z)

   median(M)
   
   # plot the cumulative distribution function of pixel values
   # plot(ecdf(as.matrix(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.