Histogram equalization

This tool alters the cumulative distribution function (CDF) of a raster image to match, as closely as possible, the CDF of a uniform distribution. Histogram equalization works by first calculating the histogram of the input image. This input histogram is then converted into a CDF. Each grid cell value in the input image is then mapped to the corresponding value in the uniform distribution's CDF that has an equivalent (or as close as possible) cumulative probability value. Histogram equalization provides a very effective means of performing image contrast adjustment in an efficient manner with little need for human input.

The user must specify the names of one or more input images to perform histogram equalization on. Each of the output images will have the names of their corresponding input image with the specified 'Output file suffix' appended. The user must also specify the number of bins, corresponding to the number of intensity values, in the output image.

Histogram equalization is related to the Histogram Matching (Two Images tool (used when an image's CDF is to be matched to a reference CDF derived from a reference image). Similarly, Histogram Matching ,and Gaussian Contrast Stretch are similarly related tools frequently used for image contrast adjustment, where the reference CDFs are uniform and Gaussian (normal) respectively.

Notes:

See Also:

Scripting:

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

wd = pluginHost.getWorkingDirectory()
# You may have multiple input files but they must
# be separated by semicolons in the string.
inputFiles = wd + "input1.dep" + ";" + wd + "input2.dep" + ";" + wd + "input3.dep"
outputSuffix = "_HistoEqual"
numBins = "256"
args = [inputFiles, outputSuffix, numBins]
pluginHost.runPlugin("HistogramEqualization", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
// You may have multiple input files but they must
// be separated by semicolons in the string.
def inputFiles = wd + "input1.dep" + ";" + wd + "input2.dep" + ";" + wd + "input3.dep"
def outputSuffix = "_HistoEqual"
def numBins = "256"
String[] args = [inputFiles, outputSuffix, numBins]
pluginHost.runPlugin("HistogramEqualization", args, false)

Credits: