histmatchRaster: histogram matching for RasterLayers

View source: R/histmatchRaster.R

histmatchRasterR Documentation

histogram matching for RasterLayers

Description

this function is a wrapper around histmatch for RasterLayers.

Usage

histmatchRaster(
  x,
  y,
  ttab = FALSE,
  minval = NULL,
  maxval = NULL,
  by = NULL,
  ...
)

Arguments

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 NULL, the minimum of both layers)

maxval

upper bound of the possible range for transformation (if NULL, the maximum of both layers)

by

step size used to build the new historgram (if NULL, 1 for integer master layer, 0.01 for double master layer)

...

additional arguments (mask) passed to histmatch

Value

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

Author(s)

Tim Appelhans

See Also

histmatch

Examples

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))


environmentalinformatics-marburg/Rsenal documentation built on July 28, 2023, 6:09 a.m.