C # Digital Image processing Algorithm learning notes (II.)--point arithmetic and histogram
In Digital image processing, point operation is a simple and important technique. A point operation is an image processing operation that determines the output grayscale value of a pixel based on the input gray value of the object's pixels. It is also sometimes referred to as contrast enhancement, contrast stretch, or grayscale transformation. The point operation does not change the spatial operation of the image, it changes the gray histogram of the image in a certain way.
A grayscale histogram is the simplest and most useful tool that summarizes the grayscale content of an image.
Definition of grayscale histogram:
Grayscale histogram is a function of grayscale, which describes the number of pixels in the image that have this grayscale level. If it is represented by a Cartesian coordinate system, its horizontal axis is the gray level, and the ordinate is the probability that the gray level will appear (the number of pixels).
The distribution function of gray histogram is: H (k) =nk; where k refers to the K gray level, and NK is the sum of the pixels of the gray level rk.
Linear point operation: The point operation of gray image can be divided into linear point operation and nonlinear point operation.
Linear point Operation definition:
The linear point operation is the point operation in which the output gray level is linearly related to the input gray level. In this case, the gray-level transform function is: g (x, Y) =pf (x, y) +l
where f (x, y) is the grayscale value of the input image at the point (x, Y), and g (x, y) is the gray value of the corresponding output point. Obviously, if P=1 and L=0,g (x, y) are copies of f (x, y), if p<1, the contrast of the output image will increase, and if p>1, the contrast will be reduced.
Full-scale histogram gray-scale stretching: gray-scale stretching also belongs to Linear point operation
Definition of grayscale stretching:
If the grayscale value of an image is distributed across a full-scale grayscale range, that is, between 0-255, it is more likely to be identified by distinction. Grayscale stretching, also known as contrast stretching, is a simple linear point operation. It expands the histogram of the image so that it fills the entire gray scale range.
Set f (x, y) as the input image, its minimum gray level A and the maximum gray level B is defined as: A=min[f (a,y)] b=max[f (x, y)]
Map A and B linearly to 0-255, i.e. g (x, Y) =255/(b-a) *[f (x, y)-A]
Histogram equalization Definition:
Histogram equalization, also known as histogram leveling, it is a very important non-linear point operation. The local contrast of the method, especially when the contrast of the useful data of the image is quite close. In this way, the brightness can be better distributed on the histogram.
The idea of histogram equalization is to transform the histogram of the original image into a form of equilibrium distribution, which increases the dynamic range of the gray value of the pixel, which can achieve the effect of enhancing the overall contrast of the image.
The algorithm is as follows: first calculate the probability of pixels appearing in each gray level of the image f: P (i) =ni/n i=0,1,..., L-1
Where NI represents the amount of gray level I out of the number of times, L is the image of all the grayscale book. P is actually the histogram of the image normalized to a range of 0-1. c as the cumulative probability function corresponding to p, defined as: C (i) =p (x0) +p (x1) +p (x2) +...+p (xi)
C is the cumulative normalized histogram of the image.
Creates a change in the form y=t (x), which produces a Y for each value in the original image, so that the cumulative probability function of y can be linearized within the scope of ownership, and the conversion formula is: Yi=t (xi) =c (i)
At this point the T is to map different levels into the 0-1 range.
Histogram matching definition:
Histogram matching, also known as histogram regulation, is the histogram of the transformation image of a certain form of a specified figure. The ability to specify the histogram shape of the desired processed image is very useful in some applications, it is a nonlinear point operation, and the histogram equalization is actually
is a special case of histogram matching.
Converting an existing histogram ha (AK) image to an image C (x, y) with a specified histogram, HC (CK), is generally divided into two steps: First, the image a (x, y) is transformed into an intermediate image B (x, y) with a balanced histogram, and B (x, y) is transformed to C (x, y).
C # Digital Image processing Algorithm learning notes (II.)--point arithmetic and histogram