ArticleslgStudy

science

Histogram matching

Histogram matching is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Histogram matching rather than just read about it. In short: In image processing, histogram matching or histogram specification is the transformation of an image so that its histogram matches a specified histogram. The well-known histogram equalization method is a special case in which the specified histogram is uniformly distributed.

Histogram matching — main illustration
Histogram matching — illustration

Key takeaways

  • Histogram matching belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Histogram matching to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Histogram matching from memory before moving on to harder problems.

Reference excerpt

In image processing, histogram matching or histogram specification is the transformation of an image so that its histogram matches a specified histogram. The well-known histogram equalization method is a special case in which the specified histogram is uniformly distributed. It is possible to use histogram matching to balance detector responses as a relative detector calibration technique. It can be used to normalize two images, when the images were acquired at the same local illumination (such as shadows) over the same location, but by different sensors, atmospheric conditions or global illumination.

Implementation Consider a grayscale input image X. It has a probability density function pr(r), where r is a grayscale value, and pr(r) is the probability of that value. This probability can easily be computed from the histogram of the image by

p r ( r j ) = n j n {\textstyle p_{r}(r_{j})={n_{j} \over n}}

where nj is the frequency of the grayscale value rj, and n is the total number of pixels in the image. Now consider a desired output probability density function pz(z). A transformation of pr(r) is needed to convert it to pz(z).

Each pdf (probability density function) can easily be mapped to its cumulative distribution function by

S ( r k ) = ∑ j = 0 k p r ( r j ) , k = 0 , 1 , 2 , 3 , … , L − 1 {\displaystyle S(r_{k})=\sum _{j=0}^{k}p_{r}(r_{j}),\qquad k=0,1,2,3,\ldots ,L-1}

G ( z k ) = ∑ j = 0 k p z ( z j ) , k = 0 , 1 , 2 , 3 , … , L − 1 {\displaystyle G(z_{k})=\sum _{j=0}^{k}p_{z}(z_{j}),\qquad k=0,1,2,3,\ldots ,L-1}

where L is the total number possible of gray levels (256 for a standard image). The idea is to map each r value in X to the z value that has the same probability in the desired pdf. I.e. S(rj) = G(zi) or z = G−1(S(r)).

Example The following input grayscale image is to be changed to match the reference histogram.

The input image has the following histogram:

It will be matched to this reference histogram to emphasize the lower gray levels.

After matching, the output image has the following histogram: And the new image looks like this:

Algorithm Given two images, the reference and the target images, we compute their histograms. Following, we calculate the cumulative distribution functions of the two images' histograms: F 1 ( ) {\displaystyle F_{1}()\,} for the reference image and F 2 ( ) {\displaystyle F_{2}()\,} for the target image. Then for each gray level G 1 ∈ [ 0 , 255 ] {\displaystyle G_{1}\in [0,255]} , we find the gray level G 2 {\displaystyle G_{2}\,} for which F 1 ( G 1 ) = F 2 ( G 2 ) {\displaystyle F_{1}(G_{1})=F_{2}(G_{2})\,} , and this is the result of histogram matching function: M ( G 1 ) = G 2 {\displaystyle M(G_{1})=G_{2}\,} . Finally, we apply the function M ( ) {\displaystyle M()} on each pixel of the reference image.

Exact histogram matching In typical real-world applications, histogram matching can only approximate the specified histogram. All pixels of a particular value in the original image must be transformed to just one value in the output image. Because of this there may be holes or open spots in the output matched histogram. Exact histogram matching is the problem of finding a transformation for a discrete image so that its histogram exactly matches the specified histogram. Several techniques have been proposed for this. One simplistic approach converts the discrete-valued image into a continuous-valued image and adds small random values to each pixel so their values can be ranked without ties. However, this introduces noise to the output image.

… excerpt ends here. Continue reading the full article.

Illustrations

Histogram matching: An example of histogram matching
An example of histogram matching
Histogram matching: Input image CDF matched to desired output CDF
Input image CDF matched to desired output CDF
Histogram matching illustration
Histogram matching: Histogram of input image
Histogram of input image
Histogram matching: Desired reference histogram
Desired reference histogram

Worked examples

Example 1 — a first encounter with Histogram matching

Start with the simplest possible case. Write down what Histogram matching claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Histogram matching before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Histogram matching ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Histogram matching

In research
Histogram matching appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Histogram matching in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Histogram matching is common in secondary-school and first-year university syllabi. It links to neighbouring topics Image processing, so understanding it makes those chapters shorter.
In everyday life
Look for Histogram matching outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Histogram matching in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Histogram matching means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Histogram matching out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Histogram matching in simple terms?

In image processing, histogram matching or histogram specification is the transformation of an image so that its histogram matches a specified histogram. The well-known histogram equalization method is a special case in which the specified histogram is uniformly distributed.

Why does Histogram matching matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Histogram matching?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Histogram matching.

Tags

  • Image processing

Keep exploring