library(terra)
r <- rast(system.file("ex/logo.tif", package="terra"))
s.int <- sobal(r[[1]])
s.dir <- sobal(r[[1]], method = "direction")
s.edge <- sobal(r[[1]], method = "edge")
opar <- par(no.readonly=TRUE)
par(mfrow=c(2,2))
plot(r[[1]])
plot(s.int, main="intensity")
plot(s.dir, main="direction")
plot(s.edge, main="edge")
par(opar)
Run the code above in your browser using DataLab