nearestValue: Image of Nearest Defined Pixel Value

View source: R/images.R

nearestValueR Documentation

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").

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.

Value

Another image of the same kind as X.

Author(s)

\adrian

.

See Also

blur, Smooth.ppp

Examples

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

spatstat.geom documentation built on Sept. 18, 2024, 9:08 a.m.