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

pixellate.owin

Convert Window to Pixel Image


Description

Convert a window to a pixel image by measuring the area of intersection between the window and each pixel in a raster.

Usage

## S3 method for class 'owin'
pixellate(x, W = NULL, ..., DivideByPixelArea=FALSE)

Arguments

x

Window (object of class "owin") to be converted.

W

Optional. Window determining the pixel raster on which the conversion should occur.

...

Optional. Extra arguments passed to as.mask to determine the pixel raster.

DivideByPixelArea

Logical value, indicating whether the resulting pixel values should be divided by the pixel area.

Details

This is a method for the generic function pixellate.

It converts a window x into a pixel image, by measuring the amount of x that is inside each pixel.

(The related function as.im also converts x into a pixel image, but records only the presence or absence of x in each pixel.)

The pixel raster for the conversion is determined by the argument W and the extra arguments ....

  • If W is given, and it is a binary mask (a window of type "mask") then it determines the pixel raster.

  • If W is given, but it is not a binary mask (it is a window of another type) then it will be converted to a binary mask using as.mask(W, ...).

  • If W is not given, it defaults to as.mask(as.rectangle(x), ...)

In the second and third cases it would be common to use the argument dimyx to control the number of pixels. See the Examples.

The algorithm then computes the area of intersection of each pixel with the window.

The result is a pixel image with pixel entries equal to these intersection areas.

Value

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

Author(s)

See Also

Examples

plot(pixellate(letterR, dimyx=15))
   W <- grow.rectangle(as.rectangle(letterR), 0.2)
   plot(pixellate(letterR, W, dimyx=15))

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.