R: Random Pixel Noise

rnoise {spatstat} | R Documentation

## Random Pixel Noise

### Description

Generate a pixel image whose pixel values are random numbers following a specified probability distribution.

### Usage

    rnoise(rgen = runif, w = square(1), ...)

### Arguments

`rgen` | Random generator for the pixel values. A function in the R language.
`w` | Window (region or pixel raster) in which to generate the image. Any data acceptable to `as.mask`.
`...` | Arguments, matched by name, to be passed to `rgen` to specify the parameters of the probability distribution, or passed to `as.mask` to control the pixel resolution.

### Details

The argument `w` could be a window (class `"owin"`), a pixel image (class `"im"`) or other data. It is first converted to a binary mask by `as.mask` using any relevant arguments in `...`.

Then each pixel inside the window (i.e. with logical value `TRUE` in the mask) is assigned a random numerical value by calling the function `rgen`.

The function `rgen` would typically be one of the standard random variable generators like `runif` (uniformly distributed random values) or `rnorm` (Gaussian random values). Its first argument `n` is the number of values to be generated. Other arguments to `rgen` must be matched by name.

### Value

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

### Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au

Rolf Turner r.turner@auckland.ac.nz

and Ege Rubak rubak@math.aau.dk

### See Also

`as.mask`, `as.im`, `Distributions`.

### Examples

      plot(rnoise(), main="Uniform noise")
      plot(rnoise(rnorm, dimyx=32, mean=2, sd=1),
           main="White noise")

[Package spatstat version 1.63-3 Index]