blur | R Documentation |
This function takes a numeric array of any dimension as input and returns a blurred array of the same dimensions as output.
blur(
x,
xmin = 0,
xmax = 2^ceiling(log(max(x + 1), 2)) - 1,
sigma = max(dim(x))/2^(length(dim(x)) + 1)
)
x |
a numerical 'array' (including 'matrix') |
xmin |
the smallest possible value in |
xmax |
the largest possible value in |
sigma |
the standard deviation of the gaussian distribution with which
to convolve |
This function is adapted from spatstat.explore::blur()
, part of
the spatstat package collection.
The procedure takes the following steps:
Rescale the value range
from [\code{xmin},\code{xmax}]
to [0,1]
.
Convolve x
with N(0,\code{sigma}^2)
.
Rescale the result back to the original value range.
An array of the same dimensions as x
.
square <- matrix(byrow = TRUE, nrow = 6L, c(
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 0, 0, 0,
0, 1, 0, 0, 1, 1, 1, 0,
0, 1, 0, 0, 1, 0, 1, 0,
0, 1, 1, 1, 1, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0
))
square_blur <- blur(square)
image(t(square))
image(t(square_blur))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.