if (FALSE) {
library(raster)
library(RStoolbox)
data(lsat)
lsat <- radCor(lsat, metaData = readMeta(system.file(
"external/landsat/LT52240631988227CUB02_MTL.txt",
package="RStoolbox")), method = "apref")
# Using Modified Soil-adjusted Vegetation Index (MSAVI)
( wmsavi <- swvi(red = lsat[[3]], nir = lsat[[4]], swir = lsat[[5]]) )
plotRGB(lsat, r=6,g=5,b=2, scale=1, stretch="lin")
plot(wmsavi, legend=FALSE, col=rev(terrain.colors(100, alpha=0.35)), add=TRUE )
# Using Modified Triangular Vegetation Index 2 (MTVI)
( wmtvi <- swvi(red = lsat[[3]], nir = lsat[[4]], swir = lsat[[5]],
green = lsat[[3]], mtvi = TRUE) )
plotRGB(lsat, r=6,g=5,b=2, scale=1, stretch="lin")
plot(wmtvi, legend=FALSE, col=rev(terrain.colors(100, alpha=0.35)), add=TRUE )
}
Run the code above in your browser using DataLab