HistogramTransform

HistogramTransform[image]

transforms pixel values of image so that its histogram is nearly flat.

HistogramTransform[image,ref]

modifies pixel values of image so that its histogram would have nearly the same distribution as ref.

HistogramTransform[image,ref,n]

uses n equally spaced quantiles.

HistogramTransform[{x1,x2,},]

transforms values xi.

Details

  • HistogramTransform is a point operation that changes the shape of the image histogram. Histogram transformation is typically used for equalization or matching with a reference distribution.
  • HistogramTransform[image] returns an image with an approximately flat histogram, effectively known as histogram equalization.
  • HistogramTransform[image,ref] finds an interpolating function between the quantiles of image and ref and applies it to each pixel in image, effectively known as histogram matching.
  • HistogramTransform works with 3D as well as 2D images, and also with lists of arbitrary rank datasets.
  • HistogramTransform[image,] returns an image of the same type as the input image.
  • With multichannel images, HistogramTransform[image] operates separately on each channel.
  • HistogramTransform[{data1,data2,},] transforms multiple datasets datai.
  • In HistogramTransform[image,ref], ref should be a univariate distribution, an image with either one channel or the same number of channels as image, a list of values, or a list of datasets with length equal to the number of channels in image.
  • HistogramTransform[source] is equivalent to HistogramTransform[source,UniformDistribution[{0,1}]].
  • HistogramTransform[source,ref,n] finds an interpolating function with n equally spaced quantiles.
  • HistogramTransform[image,ref] is equivalent to HistogramTransform[image,ref,256].
  • With HistogramTransform[data,ref,Automatic], the number of quantiles is the same as the number of bins used in Histogram[data].

Examples

open allclose all

Basic Examples  (3)

Equalize the histogram of an image:

Match the image histogram with a reference image:

Match histograms of two color images:

Scope  (6)

Data  (5)

Transform a dataset so that it is distributed normally:

Transform multiple datasets so that they are distributed uniformly:

Make the pixel values follow a normal distribution:

Compare the two histograms:

Reshape the image histogram so that each channel follows a normal distribution:

Equalize the histogram of a 3D image:

Parameters  (1)

Reducing the number of quantiles will affect the quality of the transformation function:

Applications  (6)

Basic Applications  (3)

Equalize only the brightness of a color image:

Equalize only the saturation of a color image:

Create an image effect by composing an image and its equalized version:

Color Transformation  (2)

Transfer colors between images:

Perform the transfer in the Lab color space instead:

Colorize a grayscale image by searching for neighborhoods with similar luminance in a color image:

Convert images into a color space where luminance and color information are not correlated:

Normalize the luminance images by reshaping the histogram:

Compute luminance neighborhood statistics and construct a function that gives the color associated to the closest luminance neighborhood:

For each pixel of the grayscale image, create a new pixel by preserving the initial luminance and selecting the nearest color in the reference image:

Multidimensional Probability Density Function Transfer  (1)

Reshape the histogram of a multidimensional dataset by iteratively reshaping random marginal histograms:

Reshape a bivariate dataset to match binormal samples:

Assess the result by visualizing the joint histograms before and after the transfer:

Test whether the transformed data is distributed according to the reference distribution:

Reshape the joint histogram of the hue and the saturation to a circle:

Visualize the joint histograms before and after the transfer:

Create the corresponding result image:

Reshape the 3D joint histogram of an RGB image:

Properties & Relations  (1)

HistogramTransformInterpolation can be used to get the transformation function used in HistogramTransform:

Wolfram Research (2012), HistogramTransform, Wolfram Language function, https://reference.wolfram.com/language/ref/HistogramTransform.html (updated 2014).

Text

Wolfram Research (2012), HistogramTransform, Wolfram Language function, https://reference.wolfram.com/language/ref/HistogramTransform.html (updated 2014).

CMS

Wolfram Language. 2012. "HistogramTransform." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/HistogramTransform.html.

APA

Wolfram Language. (2012). HistogramTransform. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HistogramTransform.html

BibTeX

@misc{reference.wolfram_2024_histogramtransform, author="Wolfram Research", title="{HistogramTransform}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/HistogramTransform.html}", note=[Accessed: 23-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_histogramtransform, organization={Wolfram Research}, title={HistogramTransform}, year={2014}, url={https://reference.wolfram.com/language/ref/HistogramTransform.html}, note=[Accessed: 23-November-2024 ]}