nearestValue | R Documentation |
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.
nearestValue(X)
X |
A pixel image (object of class |
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
.
Another image of the same kind as X
.
.
blur
, Smooth.ppp
X <- as.im(function(x,y) { x + y }, letterR)
Y <- nearestValue(X)
plot(solist("X"=X,"nearestValue(X)"=Y), main="", panel.end=letterR)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.