Calculates entropy on integer raster (i.e., 8 bit 0-255)
Entropy calculated as: H = -sum(Pi*ln(Pi)) where; Pi, Proportion of one value to total values Pi=n(p)/m and m, Number of unique values. Expected range: 0 to log(m) H=0 if window contains the same value in all cells. H increases with the number of different values in the window.
Maximum entropy is reached when all values are different, same as log(m) max.ent <- function(x) log( length( unique(x) ) )
raster.entropy( x, d = 5, categorical = FALSE, global = FALSE, filename = FALSE, ... )
x | Object of class raster (requires integer raster) |
---|---|
d | Size of matrix (window) |
categorical | Is the data categorical or continuous (FALSE/TRUE) |
global | Should the model use a global or local n to calculate entropy (FALSE/TRUE) |
filename | Raster file written to disk |
... | Optional arguments passed to writeRaster or dataType |
raster class object or specified format raster written to disk
Fuchs M., R. Hoffmann, F. Schwonke (2008) Change Detection with GRASS GIS - Comparison of images taken by different sensor.