Learn R Programming

spatstat (version 1.20-2)

as.matrix.im: Convert Pixel Image to Matrix

Description

Convert a pixel image to a matrix

Usage

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

Arguments

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

Value

  • A matrix.

Details

This function takes the pixel image x and returns a matrix containing the pixel values.

It is handy when you want to extract a summary of the pixel values. See the Examples.

Examples

Run this code
# 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)))

Run the code above in your browser using DataLab