Last data update: 2014.03.03
|
R: Simple moving window function.
movingwindow | R Documentation |
Simple moving window function.
Description
Very simple function to apply a kernel to a matrix across a moving window.
Usage
movingwindow(x, kernel)
Arguments
x |
A matrix.
|
kernel |
The kernel to be applied to the matrix, for example a Sobel kernel.
|
Details
This function is used in the calculation of slope and aspect by slopeasp().
Value
Returns the transformed matrix.
Note
Should be rewritten in C for greater efficiency.
Author(s)
Sarah Goslee
See Also
slopeasp
Examples
data(dem)
dem.smoothed <- movingwindow(dem, matrix(c(1,1,1,1,0,1,1,1,1), 3, 3)/8)
par(mfrow=c(1,2))
image(dem)
image(dem.smoothed)
Results
|