[R-sig-Geo] Spatial Resampling

adrian at maths.uwa.edu.au adrian at maths.uwa.edu.au
Fri Jul 25 03:59:50 CEST 2008


Pujan Raj Regmi <regmi_pujan at hotmail.com> writes:

> I have a satellite image of 12m spatial resolution (4 bands). I want to
> resample to coarser level. i.e. to 18m, 24m,30m,36m and so on.
> The result I got from ENVI are not realistic so I want to do it in R
> using weighted average from neighboring pixels.

In package 'spatstat' the function 'blur' will perform spatial averaging
of a pixel image, using Gaussian weights. The function 'as.im' can be used
to change the dimensions of a pixel image.

So for example if Z is a pixel image (object of class "im") then
    old.pixelsize <- Z$xstep
    blurZ <- blur(Z, 1.5 * old.pixelsize)
    old.dim <- Z$dim
    new.dim <- floor(old.dim/2)
    Y <- as.im(blurZ, dimyx=new.dim)
computes a Gaussian kernel-weighted average of pixel values, then
subsamples the image.

Adrian Baddeley




More information about the R-sig-Geo mailing list