Learn R Programming

RStoolbox (version 0.2.6)

rasterEntropy: Multi-layer Pixel Entropy

Description

Shannon entropy is calculated for each pixel based on it's layer values. To be used with categorical / integer valued rasters.

Usage

rasterEntropy(img, ...)

Arguments

img

RasterStack or RasterBrick

...

additional arguments passed to writeRaster

Value

RasterLayer "entropy"

Details

Entropy is calculated as -sum(p log(p)); p being the class frequency per pixel.

Examples

Run this code
# NOT RUN {
data(rlogo)
re <- rasterEntropy(rlogo)
ggR(re, geom_raster = TRUE)
# }

Run the code above in your browser using DataLab