A histogram adaptive equalization method based on hierarchical clustering

By using a histogram equalization method based on hierarchical clustering, the problems of reduced global contrast and insufficient enhancement of local details in traditional methods are solved, achieving automatic optimization of image quality and improvement of robustness.

CN115187493BActive Publication Date: 2025-11-25UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210706239.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-21
Publication Date
2025-11-25
Estimated Expiration
2042-06-21

AI Technical Summary

Technical Problem

Traditional histogram equalization methods are ineffective at enhancing local details when processing low-light images and can easily lead to a decrease in global contrast, lacking robustness.

Method used

A histogram equalization method based on hierarchical clustering is adopted. The image gray values ​​are divided into K classes by hierarchical precision K, the equalization interval of each class is set, and each equalization mode is traversed. The final result is optimized by image quality measurement index to avoid global over-enhancement.

Benefits of technology

It achieves automatic optimization of the best equalized image while tolerating local noise and bright spots, and has high robustness without the need for complicated parameter settings, adapting to different image needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115187493B_ABST
    Figure CN115187493B_ABST
Patent Text Reader

Abstract

The application discloses a histogram equalization method based on hierarchical clustering and belongs to the technical field of image processing.The application comprises the following steps: carrying out gray processing on an original image and counting a histogram of the original image, carrying out hierarchical clustering on a one-dimensional point value mapped from the histogram and scheme traversal, superimposing an equalization mode of corresponding combination and seeking an equalization image first satisfying an evaluation condition as an equalization image of an optimal criterion index, and finally obtaining an equalization result.The application can tolerate the interference of local noise and local bright spots in an image and has high robustness.The application can automatically seek an optimal equalization image.In addition to automatic optimization, the application can manually adjust whether the required interval is equalized according to requirements.Under the condition of prior knowledge, the application can obtain an expected result faster.The application is simple to reproduce, does not need to set any parameters, has low basic hardware requirements and does not need a large and complicated pre-training process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image processing technology, and in particular relates to a histogram equalization method based on hierarchical clustering. Background Technology

[0002] Image enhancement plays a vital role in various aspects of digital image processing. Histogram equalization is a classic image enhancement method, particularly effective for low-light images. Its principle is to redistribute the grayscale values ​​of each level of the image evenly across the entire image, effectively enhancing image contrast and sharpness in most cases.

[0003] However, traditional histogram equalization methods, due to their nature of updating the entire image, fail to produce clear results in local highlights and noise areas, and also suffer from a significant decrease in contrast. Many improved methods, such as bimodal histogram equalization, local image histogram equalization based on the exposure image, and gamma correction, optimize the entire image but neglect the enhancement of local details. Therefore, it is essential to improve histogram equalization to achieve good robustness, that is, to prevent global over-enhancement while still achieving local enhancement. Summary of the Invention

[0004] This invention provides a histogram equalization method based on hierarchical clustering, which can prevent global over-enhancement of histogram equalization while achieving local enhancement.

[0005] The technical solution adopted in this invention is as follows:

[0006] A histogram equalization method based on hierarchical clustering, the method comprising:

[0007] Step S1: Convert the original image to grayscale to obtain a grayscale image, and define the size of the grayscale image as M×N;

[0008] The histogram of the grayscale image is statistically analyzed to obtain the grayscale histogram;

[0009] Step S2: Map the grayscale histogram to one-dimensional point values ​​to obtain M×N point values ​​(grayscale values); and initialize the grading precision K to 1;

[0010] Step S3: Based on the current value of the grading accuracy K, divide the M×N point values ​​into K classes, and use each class as a combination element to obtain the current grading accuracy. K -1 equalization mode;

[0011] Step S4: Set the equalization interval for each category in the current grading;

[0012] Step S5, sequentially traversing each equalization mode of the current classification, based on the equalization interval corresponding to the category included in the current equalization mode, performing equalization processing to obtain the current equalization image;

[0013] Based on the preset image quality measurement index, the equalization evaluation value of the current equalization image is obtained;

[0014] Detect whether the equalization evaluation value of the current equalization image reaches the preset condition, if yes, stop traversing, and obtain the final equalization result based on the current equalization processing image;

[0015] Otherwise, when all equalization modes of the current classification are traversed and no equalization image with equalization evaluation value reaching the preset condition is obtained, update the classification precision K=K+1, and continue to execute step S3.

[0016] Further, in step S4, the equalization interval of each category of the current classification is set as:

[0017] If K=1, it means that the original image is equalized, and the corresponding equalization interval is [0, 255];

[0018] If K=2, it includes two categories: category 1 and category 2, based on the minimum pixel value x1 and the maximum pixel value x2 of category 1, interval 1 is obtained as [x1, x2], based on the minimum pixel value x3 and the maximum pixel value x4 of category 2, interval 2 is obtained as [x3, x4], wherein x1≤x2≤x3≤x4;

[0019] The equalization interval of category 1 is set as [0, x2], and the equalization interval of category 2 is set as [x3, 255]; that is, two equalization;

[0020] If K≥3, it includes K categories, which are respectively denoted as category 1 to category K;

[0021] For any k-th category, based on the minimum pixel value x 2k-1 and the maximum pixel value x 2k of the k-th category, interval k is obtained as [x 2k-1 , x 2k ], wherein k=1, 2, …, K, and x1≤x2≤…≤x K ;

[0022] The equalization interval of category 1 is set as [0, x2], and the equalization interval of category K is set as [x 2K-1 , 255];

[0023] For any t-th category in the middle, its equalization interval is set as [x 2t-1 , x 2t, wherein t=2, 3, …, K-1, that is, the intermediate interval gray value is equalized to the original interval.

[0024] Further, in step S3, the M*N gray values G can be divided into K classes by using a clustering algorithm, including but not limited to: K-means algorithm, EM algorithm, Gaussian mixture model algorithm, and the like clustering mode is divided into K classes; or a self-defined method can be used to divide the image into K blocks, and the block pixel set is K classes.

[0025] Further, in step S5, equalization processing is performed, and the current equalization image is obtained as:

[0026] If the interval corresponding to a certain class is equalized, then the interval point value after equalization is spliced;

[0027] If the interval corresponding to a certain class does not need to be equalized, then after the intervals corresponding to other classes are equalized, the interval point value is directly merged.

[0028] The technical scheme provided by the present application at least brings the following beneficial effects:

[0029] (1) The present application can tolerate the interference of local noise and local bright spots in the image, and has high robustness. The best equalization image can be automatically optimized.

[0030] (2) In addition to automatic optimization, the present application can manually adjust whether the required interval is equalized according to the requirements. In the case of prior knowledge, the present application will obtain the expected result faster.

[0031] (3) The present application is simple to reproduce, does not need to set any parameters, has low basic hardware requirements, and does not need a large amount of tedious pre-training process. DETAILED DESCRIPTION

[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.

[0033] Figure 1 The processing process schematic diagram of the histogram equalization method based on hierarchical clustering provided by the embodiment of the present application;

[0034] Figure 2 The gray image of the original image in the embodiment of the present application;

[0035] Figure 3 The original histogram of the gray image of the original image in the embodiment of the present application;

[0036] Figure 4 For the embodiment of the present application, when K=2, the equalized histogram, wherein (4-a) represents equalization of only the first type, (4-b) represents equalization of only the second type, and (4-c) represents equalization of both the first and second types;

[0037] Figure 5 For the embodiment of the present application, when K=2, the equalized histogram, wherein (4-a) represents equalization of only the first type, (4-b) represents equalization of only the second type, and (4-c) represents equalization of both the first and second types; Figure 4 For the embodiment of the present application, when K=2, the equalized histogram, wherein (4-a) represents equalization of only the first type, (4-b) represents equalization of only the second type, and (4-c) represents equalization of both the first and second types;

[0038] Figure 6 For the embodiment of the present application, when K=2, the equalized histogram, wherein (4-a) represents equalization of only the first type, (4-b) represents equalization of only the second type, and (4-c) represents equalization of both the first and second types; DETAILED DESCRIPTION

[0039] For the embodiment of the present application, when K=2, the equalized histogram, wherein (4-a) represents equalization of only the first type, (4-b) represents equalization of only the second type, and (4-c) represents equalization of both the first and second types;

[0040] As shown in Figure 1 , the hierarchical clustering-based histogram equalization method provided by the embodiment of the present application specifically includes the following steps:

[0041] Step 1, gray-scale the original image and count its histogram;

[0042] That is, gray-scale the original image to obtain a gray-scale image, and count the gray-scale histogram of the gray-scale image; in the embodiment of the present application, the gray-scale image of the original image is as shown in Figure 2 , and the counted gray-scale histogram is as shown in Figure 3 ;

[0043] Step 2, perform hierarchical clustering on the gray-scale histogram;

[0044] Step 201, define the size of the gray-scale image as MxN, and define K to represent the hierarchical precision, that is, K represents that the gray-scale image pixel points are divided into K categories, each category has 2 K -1 equalization modes, the initial value of K is 1, and the maximum value of K is 255. When K=1, it is full-image equalization, when 2≤K<255, it is segmented equalization, and when K=255, it is the original image unchanged.

[0045] Step 202, map the gray-scale histogram to a one-dimensional value (G), G represents a gray-scale value, and there are MxN points.

[0046] (1) When K = 1, the whole image is directly equalized, and there is only one equalization mode at this time;

[0047] (2) When K = 2, all point values are divided into 2 classes. At this time, the equalization mode includes three kinds: only equalize the first class, as shown in Figure 4 (a); only equalize the second class, as shown in Figure 4 (b); and equalize both the first and second classes, as shown in Figure 4 (c);

[0048] (3) When K = 3, all point values are divided into 3 classes. Take the class as the element of the equalization combination, and execute all equalization combinations, i.e. only equalize the first class, only equalize the second class, only equalize the third class, only equalize the first and second classes, only equalize the second and third classes, only equalize the first and third classes, and equalize the first, second and third classes at the same time;

[0049] (4) When K ≥ 4, all point values are divided into K classes, and there are 2 K -1 equalization combinations, and all equalization combinations are executed;

[0050] Step 3, determine the equalization interval of each class of each level in the hierarchical clustering;

[0051] That is, steps 2 and 3 complete the hierarchical clustering and its scheme traversal.

[0052] Step 4, starting from the classification level K = 1, traverse each equalization mode of each level, and perform equalization processing according to the equalization interval determined in step 3 (redistribute the image gray value to the specified interval, and then merge the points in each interval after equalization, i.e. superimpose the equalization mode of the corresponding combination), to obtain the current equalization image;

[0053] Step 5, based on the preset image quality measurement index (including but not limited to: PSNR (peak signal-to-noise ratio), signal-to-noise ratio, and other image quality measurement indexes), obtain the equalization evaluation value (i.e. criterion index) of the current equalization image, if the equalization evaluation value meets the preset condition, stop traversal, and obtain the final equalization result based on the current equalization processing image.

[0054] That is, the first equalization image that meets the evaluation condition is taken as the equalization image of the optimal criterion index, and the final equalization result.

[0055] For example, after superimposing only the first class equalization, as shown in Figure 5 (a); after superimposing only the second class equalization, as shown in Figure 5 (a); after superimposing the first and second classes at the same time, as shown in Figure 5 (c); obtain the criterion index in step 3 of each level, and give the optimal criterion index result.

[0056] As a possible implementation, in step 3, the equalization interval of each level and each type is specifically:

[0057] If K = 1, that is, the original image is equalized;

[0058] If K = 2, that is, all intervals need to be equalized, including two intervals: interval 1 is [x1, x2], and interval 2 is [x3, x4], wherein x1≤x2≤x3≤x4. For any interval, the two end values X i , X i+1 are the minimum pixel value and the maximum pixel value of the current class respectively. When K = 2, interval 1 is equalized to [0, x2], and interval 2 is equalized to [x3, 255]. That is, two sections are equalized;

[0059] If K = 3, there are three intervals: interval 1 is [x1, x2], interval 2 is [x3, x4], and interval 3 is [x5, x6], x1≤x2≤x3≤x4≤x5≤x6. Since all intervals need to be equalized, the middle interval gray value is equalized to the original interval, that is, interval 1 is equalized to [0, x2], interval 2 is equalized to [x3, x4], and interval 3 is equalized to [x5, 255]. When K≥3, the equalization mode is the same as K = 3.

[0060] That is, when K≥3, all point values are divided into K classes, including K intervals, denoted as interval 1 to interval K. For any k (k = 1, 2, …, K) interval, its interval is represented as [x 2k-1 ,x 2k ]. Interval 1 is equalized to [0, x2], and interval K is equalized to [x 2K-1 ,255]. The middle interval gray value is equalized to the original interval, that is, for any t (t = 2, 3, …, K-1) interval in the middle, it is equalized to [x 2t-1 ,x 2t ].

[0061] As a possible implementation, PSNR is used as an image quality measurement index:

[0062]

[0063] Wherein, represents the original gray image, is the gray image image after a certain equalization mode operation of a certain level, represents the pixel gray value of the original gray image at the position of row row column, is the gray image Y at the position of row row The grayscale value of the pixel at the column position. The grayscale image size is M×N. This represents the number of bits per pixel, typically 8, meaning the pixel has 256 gray levels. When... Increasing this value indicates an improvement in image quality after the current operation.

[0064] To compare the effects, the entire image's histogram was directly equalized as follows: Figure 6 As shown in (a), the highlighted portion clearly significantly affects the balance of the low-value portion. In this embodiment of the invention, the combination result that first satisfies the threshold condition criterion index, at which point K=3, as shown... Figure 6 As shown in (b).

[0065] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

[0066] The above descriptions are merely some embodiments of the present invention. Those skilled in the art can make various modifications and improvements without departing from the inventive concept of the present invention, and these all fall within the scope of protection of the present invention.

Claims

1. A histogram adaptive equalization method based on hierarchical clustering, characterized in that, Includes the following steps: Step S1: Convert the original image to grayscale to obtain a grayscale image, and define the size of the grayscale image as M×N; The histogram of the grayscale image is statistically analyzed to obtain the grayscale histogram; Step S2: Map the grayscale histogram to one-dimensional point values ​​to obtain M×N point values; And initialize the grading precision K to 1; Step S3: Based on the current value of the grading accuracy K, divide the M×N point values ​​into K classes, and use each class as a combination element to obtain the current grading accuracy. K -1 equalization mode; Step S4: Set the equalization interval for each category in the current grading; Step S5: Iterate through each equalization mode of the current level in turn, and perform equalization processing based on the equalization interval corresponding to the category included in the current equalization mode to obtain the current equalized image. The equalization evaluation value of the current equalized image is obtained based on the preset image quality measurement index; Check whether the equalization evaluation value of the current equalized image meets the preset conditions. If so, stop traversing and obtain the final equalization result based on the current equalized image. Otherwise, when all equalization modes in the current classification have been traversed and no equalized image with an equalization evaluation value that meets the preset conditions has been obtained, the classification accuracy K = K + 1 is updated, and step S3 is executed again. In step S4, setting the equalization interval for each category in the current grading is specifically as follows: If K=1, it means that the original graph has been equalized, and the corresponding equalization interval is [0,255]. If K=2, including two categories: category 1 and category 2, based on the minimum pixel value x1 and the maximum pixel value x2 of category 1, the interval 1 is [x1, x2], and based on the minimum pixel value x3 and the maximum pixel value x4 of category 2, the interval 2 is [x3, x4], where x1≤x2≤x3≤x4; Set the equilibrium interval for category 1 to [0, x2] and the equilibrium interval for category 2 to [x3, 255]. If K≥3, there are K categories, denoted as category 1 to category K respectively; For any k-th category, the minimum pixel value x based on the k-th category 2k-1 With the maximum pixel value x 2k The interval k is obtained as [x 2k-1 ,x 2k ], where k = 1, 2, ..., K, and x1 ≤ x2 ≤ ... ≤ x K ; Set the equalization interval for category 1 to [0, x2], and set the equalization interval for category K to [x...]. 2K-1 [,255]; For any t-th category in the middle, set its equalization interval to [x]. 2t-1 ,x 2t ], where t=2,3,…,K-1.

2. The method as described in claim 1, characterized in that, In step S3, the M×N gray values ​​G are divided into K classes using a clustering algorithm; or a custom method is used to divide the image into K blocks, and the set of pixels in each block is taken as a category.

3. The method as described in claim 2, characterized in that, The clustering algorithm used is K-means, expectation-maximization, or Gaussian mixture model.

4. The method as described in claim 1, characterized in that, In step S5, equalization is performed, resulting in the current equalized image: If the interval corresponding to a certain category is subjected to equalization processing, then the corresponding equalized interval point values ​​are concatenated. If the interval corresponding to a certain category does not need to be balanced, then after the intervals corresponding to other categories are balanced, the point values ​​of that interval are directly merged.

5. The method as described in claim 1, characterized in that, In step S5, the preset image quality metric is peak signal-to-noise ratio or signal-to-noise ratio.

Citation Information

Patent Citations

  • Image enhancement method implemented through histogram equalization

    CN102930517A