An infrared histogram equalization method and processing system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-14
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]直方图均衡是利用图像直方图对图像对比度进行调整的方法,通常用来增加图像的全局对比度,但由于红外图像自身的特点,直方图均衡方法虽然增强了图像对比度,但易存在图像细节问题,而且该方法在变化的目标场景下效果不佳
[0040] This infrared histogram equalization method and processing system improves image distortion, ensures image details, and enhances the overall and local characteristics of the image.
Smart Images

Figure CN117911256B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of infrared image processing technology, and specifically relates to an infrared histogram equalization method and processing system. Background Technology
[0002] Uncooled infrared detectors are increasingly used in military and civilian fields due to their low cost and ease of miniaturization. However, due to factors such as manufacturing process, hardware circuitry, and external working environment, the directly output images suffer from problems such as low spatial resolution, low contrast, high noise, blurred edge details, large dynamic range, and low information content.
[0003] To address the problems with infrared images, specialized image algorithms are needed for processing and correction to improve the output quality of infrared images, resulting in images suitable for human observation or machine recognition, thereby improving the efficiency of subsequent feature extraction, recognition, or tracking.
[0004] Histogram equalization is a method that adjusts the contrast of an image using its histogram. It is usually used to increase the global contrast of an image. However, due to the characteristics of infrared images, although histogram equalization enhances the contrast of an image, it is prone to image detail problems. Moreover, this method is not effective in changing target scenes. Summary of the Invention
[0005] To address the above problems, this invention provides an infrared histogram equalization algorithm that enables infrared images to maintain high real-time performance while minimizing detail loss.
[0006] The specific technical solution is as follows:
[0007] An infrared histogram equalization method, the method comprising:
[0008] Count the number of histograms;
[0009] The minimum and maximum values of the histogram are determined based on the left and right boundary thresholds of the histogram, and the effective grayscale range of the image is obtained.
[0010] Calculate the histogram gain and histogram upper limit based on the effective grayscale range and minimum grayscale range limit of the histogram;
[0011] The total number of pixels in the histogram that exceed the upper limit is counted, and the portion exceeding the upper limit is evenly distributed among all valid gray levels. The resulting increase in the overall height of the histogram is calculated. The histogram height is then adjusted based on the increase in histogram height and the upper limit.
[0012] Calculate the cumulative histogram and generate a grayscale mapping table;
[0013] Generate the output image based on the grayscale mapping table;
[0014] By adjusting the grayscale mapping table through interpolation, grayscale levels can be compressed or amplified to generate different grayscale adjustment tables. The grayscale adjustment of the image is then achieved by using a grayscale lookup table method.
[0015] Preferably, the histogram gain value is calculated according to formula (1):
[0016] (1)
[0017] in This represents the effective grayscale range of the histogram. ; , These are the minimum and maximum values of the histogram, respectively. This is the minimum grayscale range limit for the histogram.
[0018] Preferably, the upper limit value of the histogram is calculated according to formula (2). :
[0019] (2)
[0020] in The height of the input image; The width of the input image; K is a positive integer less than 16, and is an adjustable coefficient; This represents the minimum grayscale range limit for the histogram. This represents the effective grayscale range of the histogram.
[0021] Preferably, the histogram height is adjusted according to formula (3):
[0022] (3)
[0023] Where m is the gray value of the image, and hist(m) is the statistical value of the corresponding gray value in the histogram; The upper limit of the histogram is given by 'upper'; the overall rise of the histogram is given by 'm'; and M is 2. n , where n is a positive integer.
[0024] Preferably, the cumulative histogram is calculated according to formulas (4) and (5), and a grayscale mapping table table(m) is generated:
[0025] (4) (5)
[0026] Where gain is the histogram gain value; m is the gray value of the image. This is a cumulative histogram of gray values not greater than m; The total number of effective pixels, and ; , These are the minimum and maximum values of the histogram, respectively. This is the maximum effective gray level in the output image; This is the minimum effective gray level in the output image.
[0027] Preferably, the method further includes the steps of: calculating the image mean and filtering the image mean of the previous frame and the current frame before calculating the histogram.
[0028] Another object of the present invention is to provide an infrared histogram equalization processing system, the system being based on an FPGA processor and applying the above-mentioned infrared histogram equalization method, the system comprising:
[0029] The histogram statistics module counts the number of histograms.
[0030] The effective histogram range calculation module determines the minimum and maximum values of the histogram based on the left and right boundary thresholds of the histogram, and obtains the effective grayscale range of the image;
[0031] The histogram limit / gain value calculation module calculates the histogram gain value and histogram upper limit value based on the effective grayscale range and minimum grayscale range limit value of the histogram.
[0032] The histogram adjustment module calculates the total number of pixels in the histogram that exceed the upper limit and distributes the portion exceeding the upper limit equally among all valid gray levels; it calculates the resulting overall increase in the histogram height; and it adjusts the histogram height based on the calculated increase in the image histogram height and the upper limit value.
[0033] The cumulative histogram calculation and grayscale mapping table generation module calculates the cumulative histogram and generates a grayscale mapping table.
[0034] The grayscale lookup table image generation module generates the output image based on the grayscale mapping table.
[0035] The grayscale adjustment output module adjusts the grayscale mapping table through interpolation, compresses or amplifies some grayscale levels, generates different grayscale adjustment tables, and uses the grayscale lookup table method to achieve image grayscale adjustment.
[0036] Preferably, the system further includes a histogram mean calculation and filtering module, which calculates the image mean and filters the image mean of the previous frame and the current frame.
[0037] Preferably, the histogram statistics module adjusts the data based on the image mean and then applies histogram constraints; it uses RAM to statistically analyze the histogram distribution, where the depth is the histogram length and the bit width is the upper limit of the histogram statistics. The constrained data is used as the address, and the statistics are used as the data. When the data is valid, the statistics are accumulated and written.
[0038] Preferably, the histogram adjustment module performs histogram adjustment during frame blanking, including calculating the upper limit of the histogram and calculating the histogram gain value; during the last frame blanking, the histogram is accumulated and written into RAM; the cumulative histogram calculation and grayscale mapping table generation module reads RAM based on the data after mean calculation and filtering of the current frame image as the address, accumulates the histogram and generates a grayscale mapping table.
[0039] Compared with the prior art, one or more of the above technical solutions can achieve at least one of the following beneficial effects:
[0040] This infrared histogram equalization method and processing system improves image distortion, ensures image details, and enhances the overall and local characteristics of the image. Attached Figure Description
[0041] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 This is a flowchart illustrating the infrared histogram equalization method in Example 1.
[0043] Figure 2 This is a schematic diagram of grayscale adjustment in Example 1.
[0044] Figure 3 This is a flowchart of the infrared histogram equalization processing system in Example 1.
[0045] Figure 4 This is a comparison image of scene 1 before and after grayscale adjustment in Example 1, where... Figure 4 Image 'a' shows the effect of scene 1 before grayscale adjustment. Figure 4 b is the effect image of scene 1 after grayscale adjustment.
[0046] Figure 5 This is a comparison image of scene 2 before and after grayscale adjustment in Example 1, where... Figure 5 Image 'a' shows the effect of scene 2 before grayscale adjustment. Figure 5 b is the effect image of scene 2 after grayscale adjustment. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] Example 1
[0049] like Figure 1 As shown, this embodiment provides an infrared histogram equalization method, including the following steps:
[0050] S1. Count the number of histograms.
[0051] Histogram statistics were performed on the collected infrared images.
[0052] S2. Calculate the effective histogram range, determine the minimum and maximum values of the histogram based on the left and right boundary thresholds, and obtain the effective grayscale range of the image.
[0053] In the specific implementation process, the left and right boundary thresholds of the histogram can be adjusted as required. In this embodiment, the left and right boundary thresholds of the histogram are set to 0.1% of the total number of image pixels, and the minimum value of the histogram is determined based on the threshold. and maximum value .
[0054] S3. Calculate the histogram gain and histogram upper limit based on the effective grayscale range and minimum grayscale range limit of the histogram. .
[0055] Calculate the histogram gain value gain according to formula (1):
[0056] (1)
[0057] in This represents the effective grayscale range of the histogram. ; This is the minimum grayscale range limit for the histogram.
[0058] Calculate the upper limit of the histogram according to formula (2). :
[0059] (2)
[0060] in The height of the input image; The width of the input image; K is a positive integer less than 16, and is an adjustable coefficient. Additionally, in actual use... It can also be set to a fixed value for ease of calculation.
[0061] S4. Adjust the histogram: Calculate the total number of pixels in the histogram that are above the upper limit, and distribute the portion above the upper limit equally among all valid gray levels. Calculate the height of the overall histogram increase caused by this. Adjust the histogram height based on the calculated histogram increase height and the upper limit value.
[0062] Adjust the height of the histogram according to formula (3):
[0063] (3)
[0064] Where m is the gray value of the image, and hist(m) is the statistical value of the corresponding gray value in the histogram; The upper limit is the maximum value; upper is the overall rise of the histogram; M is 2. n n is a positive integer. In this embodiment, M is 32, which means n is 5.
[0065] S5. Calculate the cumulative histogram and generate a grayscale mapping table.
[0066] Calculate the cumulative histogram according to formulas (4) and (5) and generate the grayscale mapping table table(m);
[0067] (4)
[0068] (5)
[0069] Wherein, gain is the histogram gain value; This is a cumulative histogram of gray values not greater than m; The total number of effective pixels, and ; , These are the minimum and maximum values of the histogram, respectively. This is the maximum effective gray level in the output image; This is the minimum effective gray level in the output image.
[0070] S6. Generate the output image based on the grayscale map. .
[0071] in, To output the data in the i-th row and j-th column of the image, The input image contains data in the i-th row and j-th column.
[0072] S7. For example Figure 2 As shown, the grayscale mapping table is adjusted by interpolation to compress or enlarge the grayscale levels, generating different grayscale adjustment tables. The grayscale adjustment of the image is achieved by using the grayscale lookup table method.
[0073]
[0074] This represents the data in the i-th row and j-th column of the image after grayscale adjustment. This represents the data in the i-th row and j-th column of the image before grayscale adjustment.
[0075] As a preferred implementation, before calculating the histogram, the image mean is calculated and the image mean of the previous frame and the current frame is filtered.
[0076] like Figure 3 As shown, this embodiment also provides an infrared histogram equalization processing system, which implements the above-mentioned infrared histogram equalization method in engineering. The infrared histogram equalization processing system is based on an FPGA platform, such as the SmartFusion2 series FPGA. For infrared image acquisition, an uncooled long-wave infrared detector with metal packaging technology, a pixel size of 640x512, and a pixel pitch of 17μm can be selected.
[0077] The infrared histogram equalization processing system includes:
[0078] The histogram mean calculation and filtering module calculates the image mean and filters the mean values of the previous and current frames to reduce the impact of white noise on the image.
[0079] The histogram statistics module counts the number of histograms. The data is adjusted based on the mean and then constrained by a histogram limit of 4096. To ensure image data stability during histogram statistics, the data is paused periodically, and data with the same value are accumulated. The histogram distribution is calculated using RAM: the depth is the histogram length of 4096, and the bit width is the upper limit of histogram statistics (512). The constrained data is used as the address, and the count is used as the data. Accumulated statistics are written when the data is valid.
[0080] The effective histogram range calculation module determines the minimum and maximum values of the histogram based on the left and right boundary thresholds. During frame blanking, the effective range of the effective histogram is calculated, and the left and right boundary thresholds are set to 0.1% of the total number of image pixels.
[0081] The histogram adjustment module performs histogram adjustments during frame blanking, including calculating the upper limit of the histogram and the histogram gain. Finally, during frame blanking, the histogram is accumulated and written into RAM.
[0082] The histogram limit / gain calculation module calculates the histogram gain value and the histogram upper limit value.
[0083] The histogram adjustment module calculates the total number of pixels in the histogram that exceed the upper limit and distributes the portion exceeding the upper limit equally among all valid gray levels; it calculates the resulting overall increase in the histogram height; and it adjusts the histogram height based on the calculated increase in the image histogram height and the upper limit value.
[0084] The cumulative histogram calculation and grayscale table generation module calculates the cumulative histogram and generates a grayscale table. It reads the cumulative histogram from RAM using the data after averaging and filtering the current frame image as an address and generates the grayscale table.
[0085] The grayscale lookup table image generation module generates the output image based on the grayscale mapping table.
[0086] The grayscale adjustment output module adjusts the grayscale mapping table through interpolation, compresses or amplifies the grayscale levels, generates different grayscale adjustment tables, and uses the grayscale lookup table method to adjust the image grayscale, thereby achieving the purpose of highlighting different temperature targets; for example, highlighting high-temperature targets, low-temperature targets, and normal-temperature targets.
[0087] like Figure 4 , Figure 5 As shown, comparing the original image with the scene effect image after processing by this equalization method and processing system, it can be seen that the image contrast is more distinct, the details are more obvious, the image distortion problem is improved, and the overall and local characteristics of the image are enhanced.
[0088] Obviously, the above embodiments are merely examples to clearly illustrate the technical solutions of the present invention, and are not intended to limit the implementation of the present invention. Those skilled in the art can make other variations or modifications based on the above description. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the claims of the present invention.
Claims
1. An infrared histogram equalization method, characterized in that, The method includes: Count the number of histograms; The minimum and maximum values of the histogram are determined based on the left and right boundary thresholds of the histogram, and the effective grayscale range of the image is obtained. Calculate the histogram gain and histogram upper limit based on the effective grayscale range and minimum grayscale range limit of the histogram; Calculate the histogram gain value gain according to formula (1): (1) in This represents the effective grayscale range of the histogram. ; , These are the minimum and maximum values of the histogram, respectively. This represents the minimum grayscale range limit for the histogram. Calculate the upper limit of the histogram according to formula (2). : (2) in The height of the input image; The width of the input image; K is a positive integer less than 16, and is an adjustable coefficient; This represents the minimum grayscale range limit for the histogram. This represents the effective grayscale range of the histogram. The total number of pixels in the histogram that exceed the upper limit is counted, and the portion exceeding the upper limit is evenly distributed among all valid gray levels. The resulting increase in the overall height of the histogram is calculated. The histogram height is then adjusted based on the increase in histogram height and the upper limit. Adjust the height of the histogram according to formula (3): (3) Where m is the gray value of the image, and hist(m) is the statistical value of the corresponding gray value in the histogram; The upper limit of the histogram is given by 'upper'; the overall rise of the histogram is given by 'm'; and M is 2. n n is a positive integer; Calculate the cumulative histogram and generate a grayscale mapping table; Generate the output image based on the grayscale mapping table; The grayscale mapping table is adjusted by interpolation to compress or amplify the grayscale levels, generating different grayscale adjustment tables; the grayscale lookup table method is used to adjust the image grayscale.
2. The infrared histogram equalization processing method according to claim 1, characterized in that, Calculate the cumulative histogram according to formulas (4) and (5) and generate the grayscale mapping table table(m): (4) (5) Where gain is the histogram gain value; m is the gray value of the image. This is a cumulative histogram of gray values not greater than m; This represents the total number of valid pixels in the histogram, and ; , These are the minimum and maximum values of the histogram, respectively. This is the maximum effective gray level in the output image; This is the minimum effective gray level in the output image.
3. The infrared histogram equalization processing method according to claim 1, characterized in that, The method further includes the steps of: calculating the image mean and filtering the image mean of the previous frame and the current frame before calculating the histogram.
4. An infrared histogram equalization processing system, characterized in that, The system is based on an FPGA platform and applies the infrared histogram equalization method according to any one of claims 1 to 3. The system includes: The histogram statistics module counts the number of histograms. The effective histogram range calculation module determines the minimum and maximum values of the histogram based on the left and right boundary thresholds of the histogram, and obtains the effective grayscale range of the image; The histogram limit / gain value calculation module calculates the histogram gain value and histogram upper limit value based on the effective grayscale range and minimum grayscale range limit value of the histogram. The histogram adjustment module counts the total number of pixels in the histogram that exceed the upper limit value, and distributes the portion exceeding the upper limit value equally among all valid gray levels; calculates the resulting overall increase in the histogram height; and adjusts the histogram height based on the calculated increase in the image histogram height and the upper limit value. The cumulative histogram calculation and grayscale mapping table generation module calculates the cumulative histogram and generates a grayscale mapping table. The grayscale lookup table image generation module generates the output image based on the grayscale mapping table. The grayscale adjustment output module adjusts the grayscale mapping table through interpolation, compresses or amplifies some grayscale levels, generates different grayscale adjustment tables, and uses the grayscale lookup table method to achieve image grayscale adjustment.
5. The infrared histogram equalization processing system according to claim 4, characterized in that, The system also includes a histogram mean calculation and filtering module, which calculates the image mean and filters the image mean of the previous frame and the current frame.
6. The infrared histogram equalization processing system according to claim 4, characterized in that, The histogram statistics module adjusts the data based on the image mean and then applies histogram constraints. It uses RAM to statistically analyze the histogram distribution, where the depth is the histogram length and the bit width is the upper limit of the histogram statistics. The constrained data is used as the address and the statistics are used as the data. When the data is valid, the statistics are accumulated and written.
7. The infrared histogram equalization processing system according to claim 6, characterized in that, The histogram adjustment module performs histogram adjustment during frame blanking, including calculating the upper limit value of the histogram and calculating the histogram gain value; during the final frame blanking, the histogram is accumulated and written into RAM; the cumulative histogram calculation and grayscale mapping table generation module reads RAM based on the data after mean calculation and filtering of the current frame image as the address, accumulates the histogram and generates a grayscale mapping table.
Citation Information
Patent Citations
Infrared-thermometer self-adaption three platform histogram equalization system and method thereof
CN103353349A
Method for enhancing infrared image histogram redundancy elimination and gray level equal interval mapping
CN104268840A