Histogram matching (two images)

This tool alters the cumulative distribution function (CDF) of a raster image to match, as closely as possible, the CDF of a reference image. Histogram matching works by first calculating the histograms of the input image (i.e. the image to be adjusted) and the reference image. These histograms are then converted into CDFs. Each grid cell value in the input image is then mapped to the corresponding value in the reference CDF that has the an equivalent (or as close as possible) cumulative probability value. A common application of this is to match the images from two sensors with slightly different responses, or images from the same sensor, but the sensor's response is known to change over time.

Histogram matching (two images) is related to the Histogram Matching tool, which can be used when a reference CDF is used directly rather than deriving it from a reference image. Histogram Equalization and Gaussian Contrast Stretch are similarly related tools, where the reference CDFs are uniform and Gaussian (normal) respectively.


See Also:


The following is an example of a Python script that uses this tool:

wd = pluginHost.getWorkingDirectory()
inputRaster = wd + "input.dep"
inputHisto = wd = "histo.dep"
outputFile = wd + "output.dep"
args = [inputFile, inputHisto, outputFile]
pluginHost.runPlugin("TwoImageHistogramMatching", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def inputFile = wd + "input.dep"
def inputHisto = wd = "histo.dep"
def outputFile = wd + "output.dep"
String[] args = [inputFile, inputHisto, outputFile]
pluginHost.runPlugin("TwoImageHistogramMatching", args, false)