# import raster image
data(normforest)
normforest <- terra::unwrap(normforest)
# convert to matrix
mat <- matrix(normforest[], ncol = ncol(normforest), nrow = nrow(normforest))
# calculate the fractal dimension
Sfd <- sfd_(mat)
Run the code above in your browser using DataLab