Mathematical principles of histogram matching

Mathematical principles of histogram matching

The mathematical principle of histogram matching is closely related to histogram equalization. It is recommended to understand histogram equalization (another blog post by the blogger introduces the mathematical principle of histogram equalization, click to open the link ), and then look at the histogram Image matching, the images in the text are taken from Digital Image Processing - Gonzalez - Third Edition, the translation of the book is general, and it can be compared in Chinese and English.

Note: Read carefully and patiently, you will understand the principle.

s=T(r), r is the input gray level, s is the output gray level, T is the grayscale transformation function (the histogram processing is also a grayscale transformation), ps(s) is the probability density function of s, pr( r) is the probability density function of r.

Derivation of the grayscale conversion function for histogram equalization:

Now let's consider what the histogram equalization is to do, and for what purpose. That is: complete the following transformation, from a->b. At this time, we consider the coefficient L-1 just now, why is it L-1? Input gray level 0≤r≤L-1, output gray level 0≤s≤L-1, L is a power of 2, 8-bit gray level L=256. We require that the area enclosed by the probability density function of s is 1, so ps(s) (the probability density function ps of s, the lower corner cannot be marked) should be = 1/L-1.


Now that ps(s)=1/L-1 is known, we want to find the grayscale transformation function T, and we need to find a relationship. r and s are both random variables, and s=T(r), then what is the relationship between the probability density function of s and the probability density function of r? That is, how to find the probability density function of a random variable function.


Here we know: , the relationship between s and r is derived from the formula, that is, the grayscale transformation function T of histogram equalization is known.


The core idea of ​​histogram matching:

Histogram matching requires the realization that the output image has the shape of the specified histogram.

In general grayscale transformation, only one mapping is required: r->s, such as histogram equalization. The histogram matching requires two mappings, r->s->z. What is z here, you can know after reading this article.

What is T for histogram equalization? From the above, we know that it is the cumulative distribution function of r × coefficient L-1 (CDF, ​​supplement: the probability density function is PDF). A random variable r, what is obtained by the cumulative distribution function? is also a random variable, s. So what is the probability density function of s? The answer is the constant 1 (as in the formula derivation above, back-to-front process, the only difference is the coefficients). That is to say, s has nothing to do with the form of the PDF of r.

s has nothing to do with the form of r's PDF, what does it mean? Means the following equation holds!!! z is another random variable, and it doesn't matter what pz(z) is, because s has nothing to do with the form of the PDF of r, then the histogram matching is achieved. That is to say, pz(z) is pre-specified by us, that is, the shape of the histogram of z is pre-specified. This completes r->s->z by the following formula.







Reference books:

[1]: Digital Image Processing - Gonzalez - Third Edition

[2]: "Probability Theory and Mathematical Statistics" Zhejiang University Edition (Fourth Edition)


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324614390&siteId=291194637