View source: R/histmatchRaster.R
histmatchRaster | R Documentation |
this function is a wrapper around histmatch
for
RasterLayers.
histmatchRaster(
x,
y,
ttab = FALSE,
minval = NULL,
maxval = NULL,
by = NULL,
...
)
x |
RasterLayer to be adjusted |
y |
target RasterLayer |
ttab |
logical, whether to return the transformation table |
minval |
lower bound of the possible range for transformation
(if |
maxval |
upper bound of the possible range for transformation
(if |
by |
step size used to build the new historgram
(if |
... |
additional arguments (mask) passed to |
if ttab = FALSE
a RasterLayer, if ttab = TRUE
a list
with components
recode
the trasnsformation table used to match the histograms
newraster
the transformed RasterLayer
Tim Appelhans
histmatch
library(latticeExtra)
tofix <- raster(matrix(rnorm(10000, 100, 3), nrow = 100, ncol = 100))
master <- raster(matrix(rnorm(10000, 130, 7), nrow = 100, ncol = 100))
raw_p <- densityplot(tofix[], xlim = c(80, 160), plot.points = FALSE) +
as.layer(densityplot(master[], xlim = c(80, 160),
plot.points = FALSE, col = "red"))
raw_p
fixed <- histmatchRaster(tofix, master)
raw_p + as.layer(densityplot(fixed[], xlim = c(80, 160),
plot.points = FALSE, col = "black", lty = 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.