# NOT RUN {
# Calculate GLCM textures on a matrix
d <- matrix(seq(1:25), nrow=5, ncol=5, byrow=TRUE)
# Calculate using default 90 degree shift
glcm(d, statistics=c('variance'))
# Calculate over all directions
glcm(d, shift=list(c(0,1), c(1,1), c(1,0), c(1,-1)),
statistics=c('variance'))
# }
# NOT RUN {
# Calculate GLCM textures on a raster
require(raster)
# Calculate using default 90 degree shift
textures_shift1 <- glcm(raster(L5TSR_1986, layer=1))
plot(textures_shift1)
# Calculate over all directions
textures_all_dir <- glcm(raster(L5TSR_1986, layer=1),
shift=list(c(0,1), c(1,1), c(1,0), c(1,-1)))
plot(textures_all_dir)
# }
Run the code above in your browser using DataLab