I am using a aerial dataset - (COWC), which is a large, high quality set of annotated cars from overhead imagery.

The imagery has a resolution of 15 cm ground sample distance (GSD) that is approximately twice as good as the current best resolution of commercial satellite imagery (30 cm GSD for DigitalGlobe).

Now I need to downsample the 15cm resolution to 30cm, 45cm, 60cm resolution, so it is needed to convolve the raw imagery with a Gaussian kernel and reduce the image dimensions by half

what kernel I should apply, how would I calculate it ?


1 Answer 1


In R, you could use the function aggregate with a custom function for the fun argument. For example:

# create a demo raster
r <- raster()
r <- setValues(r, seq(length(r)))

# define a 5*5 Gauss filter template
gf <- focalWeight(r, 2, "Gauss")[5:9,5:9]
w <- as.vector(gf/sum(gf))

# aggregate the r 
filter <- function(x, ...) return(sum(x*w, ...))
r2 <- aggregate(r, fact=5, fun=filter)

If you want to aggregate your raster to a resolution where the scaling factor is not an integer, then you need to, firstly, blur the image and then use nearest neighbor resampling to aggregate your blurred image to the desired spatial scale.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.