Learn R Programming

spatstat.geom (version 2.1-0)

nearestValue: Image of Nearest Defined Pixel Value

Description

Given a pixel image defined on a subset of a rectangle, this function assigns a value to every pixel in the rectangle, by looking up the value of the nearest pixel that has a value.

Usage

nearestValue(X)

Arguments

X

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

Value

Another image of the same kind as X.

Details

A pixel image in spatstat is always stored on a rectangular grid of pixels, but its value may be NA on some pixels, indicating that the image is not defined at those pixels.

This function assigns a value to every pixel in the rectangular grid. For each pixel a in the grid, if the value of X is not defined at a, the function finds the nearest other pixel b at which the value of X is defined, and takes the pixel value at b as the new pixel value at a.

See Also

blur, Smooth.ppp

Examples

Run this code
# NOT RUN {
  X <- as.im(function(x,y) { x + y }, letterR)
  Y <- nearestValue(X)
  plot(solist("X"=X,"nearestValue(X)"=Y), main="", panel.end=letterR)
# }

Run the code above in your browser using DataLab