Infrared image contrast enhancement method and apparatus
By limiting and weighting the grayscale histogram of infrared images, a grayscale mapping function is generated, which solves the problem of overexposure in the sky region of infrared images and improves image quality and target recognition effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- UNI TREND TECH (CHINA) CO LTD
- Filing Date
- 2026-05-20
- Publication Date
- 2026-07-31
AI Technical Summary
Existing infrared image enhancement algorithms tend to overexpose the sky area when there is a sky background, which affects the image quality and the target detection and recognition effect.
By statistically analyzing the grayscale histogram of infrared images, amplitude limiting and weighting processing are performed to reduce the influence of grayscale values in the sky region, and a grayscale mapping function is generated to map pixel grayscale values.
It alleviates the overexposure problem of sky areas over non-sky areas, improves the contrast enhancement effect of infrared images, and improves image quality and target detection and recognition performance.
Smart Images

Figure CN122492534A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of infrared image processing technology, and in particular to an infrared image contrast enhancement method and apparatus. Background Technology
[0002] Infrared imaging technology, with its all-weather operation, passive detection, and fog-penetrating capabilities, is widely used in security monitoring, power line inspection, and forest fire prevention. To improve the visual quality of infrared images and subsequent target recognition performance, existing technologies typically employ methods such as histogram equalization, piecewise linear transformation, local enhancement, or global-local fusion for contrast enhancement. However, traditional global histogram equalization tends to indiscriminately stretch the entire image, leading to amplified background noise, local overexposure, or detail distortion. Piecewise linear transformation, on the other hand, relies on empirical parameters and lacks adaptability. Especially in infrared images with a sky background, the sky region typically appears as a large, flat area of low grayscale. Existing enhancement algorithms tend to overstretch this area, causing the sky to occupy an excessively wide grayscale range, resulting in other target areas appearing washed out and overexposed, affecting image quality and target detection and recognition performance.
[0003] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Application content
[0004] In view of at least one of the above technical problems, this application provides an infrared image contrast enhancement method and apparatus.
[0005] In a first aspect, this application provides a method for enhancing the contrast of infrared images, the method comprising: Acquire the infrared image to be enhanced, and calculate the grayscale histogram of the infrared image to obtain the first histogram; Amplitude limiting is applied to the first histogram to obtain the second histogram; Obtain the pre-calibrated weight vector, which represents the weighting coefficients corresponding to different gray values. The weighting coefficients for gray values in the sky area are lower than those for gray values in the non-sky area. The second histogram is weighted according to the weight vector to obtain the third histogram; The cumulative histogram is obtained by summing the results of the third histogram. The cumulative histogram is normalized to obtain the gray-scale mapping function; The grayscale values of pixels in the infrared image are mapped using a grayscale mapping function to obtain an infrared image with enhanced contrast.
[0006] This invention reduces the impact of numerous gray levels on the subsequent gray-level mapping function by statistically analyzing the gray-level histogram of the infrared image to be enhanced and applying amplitude limiting to the histogram. Furthermore, this invention introduces a pre-calibrated weight vector, ensuring that the weighting coefficients for gray values corresponding to the sky region are lower than those for gray values corresponding to non-sky regions. This reduces the influence of the histogram values corresponding to the sky gray-level range during the histogram weighting process. Subsequently, by summing and normalizing the weighted third histogram, a gray-level mapping function is obtained, which is then used to map the pixel gray values in the infrared image. Thus, the gray-level mapping function can be generated based on the gray-level distribution after amplitude limiting and sky weighting, limiting the proportion of the sky region in the output gray-level space and reducing the occupation of the non-sky region's gray-level mapping space by the sky region. This alleviates the problem of whitening or overexposure of non-sky target areas in infrared images with a sky background.
[0007] In some possible implementations, the first histogram is subjected to amplitude limiting, including: traversing the histogram values corresponding to each grayscale value of the first histogram; determining whether the histogram value is greater than the amplitude limiting threshold; if the histogram value corresponding to the current grayscale value of the first histogram is greater than the amplitude limiting threshold, then updating the histogram value corresponding to the current grayscale value of the first histogram to the amplitude limiting threshold; if the histogram value corresponding to the current grayscale value of the first histogram is less than or equal to the amplitude limiting threshold, then keeping the histogram value corresponding to the current grayscale value unchanged; after completing the traversal, the second histogram is obtained.
[0008] In some possible implementations, before performing amplitude limiting on the first histogram, the following steps are also included: determining the amplitude limiting threshold based on the image width, image height, and preset empirical coefficients of the infrared image.
[0009] In some possible implementations, obtaining the pre-calibrated weight vector includes: pointing the infrared thermal imager at the sky so that the field of view of the infrared thermal imager only includes the sky region; acquiring multiple frames of sky images while the thermal imager remains stationary; averaging the multiple frames of sky images to obtain a sky template; and obtaining the weight vector based on the sky template.
[0010] In some possible implementations, the weight vector is obtained based on the sky template, including: traversing the grayscale values of each pixel in the sky template to determine the maximum grayscale value of the sky template; determining the sky grayscale range based on the maximum grayscale value of the sky template; and setting weighting coefficients for each grayscale value in the sky grayscale range to obtain the weight vector.
[0011] In some possible implementations, the second histogram is weighted according to the weight vector, including multiplying the histogram value corresponding to the gray value of the second histogram with the weight vector to obtain the third histogram.
[0012] In some possible implementations, the third histogram is summed, including: summing the histogram values corresponding to the gray values of the third histogram in ascending order of gray values, and using the summed value of the gray values of the third histogram as the histogram value corresponding to the gray values of the cumulative histogram.
[0013] In some possible implementations, the cumulative histogram is normalized, including: determining the minimum and maximum histogram values based on the cumulative histogram; mapping the minimum histogram value to 0, the maximum histogram value to 1, and mapping the histogram values of the cumulative histogram to a range of 0 to 1 to obtain a grayscale mapping function.
[0014] In some possible implementations, the pixel grayscale values in the infrared image are mapped according to the grayscale mapping function, including: traversing each pixel of the infrared image; obtaining the original grayscale value of the current pixel; obtaining the normalized mapping value based on the original grayscale value and the grayscale mapping function; determining the enhanced grayscale value of the current pixel based on the normalized mapping value and the total number of grayscale levels in the infrared image; and obtaining the contrast-enhanced infrared image after all pixels of the infrared image have been traversed.
[0015] Secondly, this application provides an infrared image contrast enhancement device, the device comprising: The histogram statistics module is used to acquire the infrared image to be enhanced, count the grayscale histogram of the infrared image, and obtain the first histogram. The amplitude limiting module is used to perform amplitude limiting on the first histogram to obtain the second histogram. The weight acquisition module is used to acquire a pre-calibrated weight vector. The weight vector represents the weighting coefficients corresponding to different gray values. The weighting coefficients for gray values in the sky area are lower than those for gray values in the non-sky area. The histogram weighting module is used to weight the second histogram according to the weight vector to obtain the third histogram; The cumulative processing module is used to sum the data from the third histogram to obtain the cumulative histogram. The normalization module is used to normalize the cumulative histogram to obtain the gray-scale mapping function; The grayscale mapping module is used to map the pixel grayscale values in an infrared image according to the grayscale mapping function to obtain an infrared image with enhanced contrast.
[0016] The present application will be further described below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a schematic flowchart of the infrared image contrast enhancement method provided in the embodiments of this application; Detailed Implementation
[0019] To make the above-mentioned objectives, features, and advantages of this application more apparent and understandable, the specific embodiments of this application are described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of this application. Therefore, this application is not limited to the specific embodiments disclosed below.
[0020] This embodiment provides an infrared image contrast enhancement method, applicable to infrared images containing a sky background. The method involves limiting the grayscale histogram of the input infrared image and weighting the histogram with a pre-calibrated weight vector. This reduces the contribution of grayscale values corresponding to the sky region to the subsequent grayscale mapping process, thereby obtaining the enhanced infrared image.
[0021] It is understood that the infrared image to be enhanced is a single-channel grayscale image output by an infrared thermal imager. If the infrared image is a 14-bit image, its grayscale value range is 0 to 16383, corresponding to a total of 16384 grayscale levels. The infrared image can also be a grayscale image with other bit depths, such as 8-bit, 10-bit, 12-bit, or 16-bit images. In this case, the total number of grayscale levels can be determined according to the actual bit depth.
[0022] like Figure 1 As shown, this embodiment provides an infrared image contrast enhancement method, including steps S100 to S700.
[0023] Step S100: Obtain the infrared image to be enhanced, and calculate the grayscale histogram of the infrared image to obtain the first histogram.
[0024] In step S100, the infrared image to be enhanced is acquired. All pixels in the infrared image are traversed, and the number of pixels exhibiting each grayscale value is counted to obtain the first histogram. The first histogram can be denoted as H1. When the input infrared image is a 14-bit image, the length of the first histogram H1 is 16384. Wherein, H1...(i) This represents the number of pixels with a grayscale value of i in the infrared image, where i ranges from 0 to 16383.
[0025] For example, when there are 500 pixels with a grayscale value of 100 in an infrared image, then H1(100) = 500.
[0026] By analyzing the first histogram, the grayscale distribution information of the infrared image to be enhanced can be obtained. Since the sky region in an infrared image typically occupies a certain number of pixels in the low grayscale range, the first histogram can reflect the difference in grayscale distribution between the sky region and the non-sky region. This step provides basic data for subsequent clipping, weighting, and grayscale mapping.
[0027] Step S200: Limit the amplitude of the first histogram to obtain the second histogram.
[0028] In step S200, after obtaining the first histogram, the first histogram is subjected to amplitude limiting to obtain the second histogram. The second histogram can be denoted as H2.
[0029] Amplitude limiting is used to truncate histogram values that are too large in the first histogram. Specifically, let the amplitude limiting threshold be T. Iterate through the histogram values corresponding to each grayscale value in the first histogram and determine whether the histogram value corresponding to the current grayscale value is greater than the amplitude limiting threshold. If the histogram value corresponding to the current grayscale value is greater than the amplitude limiting threshold, then the histogram value corresponding to the grayscale value is updated to the amplitude limiting threshold; if the histogram value corresponding to the current grayscale value is less than or equal to the amplitude limiting threshold, then the histogram value corresponding to the grayscale value remains unchanged.
[0030] In other words, the second histogram can be obtained as follows: , Among them, H1 (i) H2 represents the histogram value corresponding to grayscale value i in the first histogram. (i) This represents the histogram value corresponding to the grayscale value i in the second histogram.
[0031] In some embodiments, the limiting threshold can be determined based on the image width, image height, and a preset empirical coefficient of the infrared image.
[0032] For example, the limiting threshold can be calculated using the following formula: Where a is a preset empirical coefficient, w is the image width, and h is the image height. The preset empirical coefficient can be set according to actual image enhancement requirements, infrared thermal imager output characteristics, or experimental results.
[0033] By limiting the amplitude, the influence of gray levels with a large area in the image on the subsequent cumulative histogram can be reduced. For infrared images with a sky background, if the number of gray level pixels corresponding to the sky region is large, this gray level may cause a significant change in the cumulative distribution function during ordinary histogram equalization. Limiting the amplitude restricts the histogram values corresponding to this type of gray level to within a threshold, which helps to reduce the dominant role of a single or a few gray levels in the gray-level mapping function.
[0034] Step S300: Obtain the pre-calibrated weight vector. The weight vector is used to represent the weighting coefficients corresponding to different gray values. The weighting coefficients of gray values corresponding to the sky area are lower than the weighting coefficients of gray values corresponding to the non-sky area.
[0035] Before performing histogram weighting, a pre-calibrated weight vector is obtained. The weight vector can be denoted as W, which represents the weighting coefficient corresponding to different gray values.
[0036] When the infrared image is a 14-bit image, the length of the weight vector W can be 16384, where W (i) This represents the weighting coefficient corresponding to the grayscale value i.
[0037] In this embodiment, the weighting coefficient for grayscale values corresponding to the sky region is lower than the weighting coefficient for grayscale values corresponding to non-sky regions. That is, grayscale values identified as falling within the sky grayscale range have a smaller weighting coefficient, while grayscale values outside the sky grayscale range have a larger weighting coefficient.
[0038] The weight vector can be obtained through offline calibration. Specifically, the infrared thermal imager is pointed at the sky so that its field of view only includes the sky region. Multiple frames of sky images are acquired while the infrared thermal imager remains stationary. Let the acquired sky images be: S1, S2, ... S n , among which, S i Let i represent the sky image of the i-th frame, where i = 1, 2, ..., n.
[0039] The sky template P is obtained by averaging the multiple frames of sky images pixel by pixel. , By averaging multiple frames of sky images, the impact of single-frame acquisition noise on the sky template can be reduced, making the resulting sky template more suitable as reference data for the sky's grayscale range. Since this calibration process can be completed in advance, there is no need to repeatedly acquire sky samples during real-time image enhancement, which helps reduce the computation and acquisition requirements in the real-time processing stage.
[0040] After obtaining the sky template, iterate through the grayscale values of each pixel in the sky template to determine the maximum grayscale value. Let this maximum grayscale value be G. max.
[0041] The sky grayscale range is determined based on the maximum grayscale value of the sky template. It can be understood that values no greater than G can be used. max The grayscale range is determined to be the sky grayscale range, which is greater than G. max The grayscale range is defined as the non-sky grayscale range.
[0042] Subsequently, weighting coefficients are applied to different grayscale values based on the sky's grayscale range to obtain a weight vector. The weight coefficients corresponding to grayscale values within the sky's grayscale range are set as the first weight value, and the weight coefficients corresponding to grayscale values outside the sky's grayscale range are set as the second weight value. The first weight value is less than the second weight value. , In some embodiments, the first weight value is 1 and the second weight value is 16.
[0043] By generating a weight vector based on a sky template, the gray-level prior of the sky region can be introduced into the histogram processing. This weight vector is used to reduce the influence of the histogram values corresponding to the gray-level range of the sky in the subsequent weighting process, so that the gray-level mapping function is affected not only by the number of pixels but also by the type of the gray-level region during generation.
[0044] Step S400: Based on the weight vector, the second histogram is weighted to obtain the third histogram.
[0045] In step S400, after obtaining the second histogram H2 and the weight vector W, the second histogram is weighted according to the weight vector to obtain the third histogram, which can be denoted as H3.
[0046] Specifically, for each grayscale value, the histogram value H2 corresponding to the grayscale value in the second histogram is... (i) The weighting coefficient W corresponding to the gray value in the weight vector (i) Multiply the values and use the result as the histogram value H3 corresponding to the gray values in the third histogram. (i) In other words,
[0047] Understandably, when a grayscale value falls within the sky grayscale range, its corresponding weight coefficient is smaller, so the histogram value of this grayscale value in the third histogram is lower than the corresponding value in the second histogram. When a grayscale value falls outside the sky grayscale range, its corresponding weight coefficient is larger, so the histogram value of this grayscale value in the third histogram is relatively preserved.
[0048] By weighting the second histogram, the proportion of the sky grayscale range in the subsequent cumulative histogram can be further reduced. This step S400 works in conjunction with the aforementioned amplitude limiting process, which limits the histogram values of high-frequency grayscale levels, while the weighting process is used to differentiate the histogram values according to the sky grayscale range.
[0049] Step S500: Sum the third histogram to obtain the cumulative histogram.
[0050] In step S500, after obtaining the third histogram, the third histogram is summed to obtain the cumulative histogram, which can be denoted as H4.
[0051] Specifically, the histogram values corresponding to each gray value in the third histogram are summed in ascending order of grayscale value. For any grayscale value i, the cumulative histogram value corresponding to that grayscale value in the cumulative histogram is: , For example, when the grayscale value is 0, H4 (0) The value is 0. When the grayscale value is 1, H4 (1) =H4 (0) +H3 (1) When the grayscale value is 2, H4 (2) =H4 (1) +H3 (2) This process continues until all grayscale values have been summed.
[0052] The cumulative histogram represents the cumulative weighted histogram result from the lowest grayscale value to the current grayscale value. Since the cumulative histogram is derived from the third histogram, which incorporates platform limiting and sky weights, its growth process reflects the grayscale distribution after limiting and sky weighting. This cumulative result provides the data foundation for subsequent normalization processing and grayscale mapping function generation.
[0053] Step S600: Normalize the cumulative histogram to obtain the grayscale mapping function.
[0054] In step S600, after obtaining the cumulative histogram, the cumulative histogram is normalized to obtain the gray-scale mapping function, which can be denoted as H5.
[0055] Specifically, based on the cumulative histogram, the minimum and maximum histogram values are determined; the minimum histogram value is mapped to 0, the maximum histogram value is mapped to 1, and all histogram values are mapped to a range between 0 and 1, resulting in the grayscale mapping function. Normalization is performed according to the following formula: , Among them, H5 (i) This represents the normalized mapping value corresponding to the grayscale value i in the grayscale mapping function.
[0056] By normalizing, the cumulative histogram can be converted into a grayscale mapping function with values ranging from 0 to 1. This grayscale mapping function is used to determine the correspondence between the original grayscale values and the output grayscale values. Since this mapping function is obtained from the weighted cumulative histogram, the cumulative contribution corresponding to the sky grayscale range is limited in the mapping function, thereby reducing the proportion of the sky grayscale range in the output grayscale space.
[0057] Step S700: Map the pixel grayscale values in the infrared image according to the grayscale mapping function to obtain the contrast-enhanced infrared image.
[0058] Specifically, iterate through each pixel of the infrared image and obtain the original grayscale value of the current pixel; let the original grayscale value of the current pixel be X.
[0059] Based on the original grayscale values and the grayscale mapping function, a normalized mapping value is obtained. This normalized mapping value is H5. (X) .
[0060] Then, based on the normalized mapping value and the total number of gray levels in the infrared image, the enhanced gray value of the current pixel is determined. Let the enhanced gray value be Y, then the calculation is performed as follows: , Here, "round" means rounding to the nearest integer.
[0061] By mapping each pixel using a grayscale mapping function, the histogram processing results can be applied to the original infrared image. Since the grayscale mapping function reduces the contribution of the sky's grayscale range during generation, the grayscale range corresponding to the sky region in the output image does not easily occupy too much of the output dynamic range, while non-sky regions can obtain the corresponding grayscale mapping space.
[0062] Once all pixels of the infrared image have been traversed, the contrast-enhanced infrared image is obtained.
[0063] This invention reduces the impact of numerous gray levels on the subsequent gray-level mapping function by statistically analyzing the gray-level histogram of the infrared image to be enhanced and applying amplitude limiting to the histogram. Furthermore, this invention introduces a pre-calibrated weight vector, ensuring that the weighting coefficients for gray values corresponding to the sky region are lower than those for gray values corresponding to non-sky regions. This reduces the influence of the histogram values corresponding to the sky gray-level range during the histogram weighting process. Subsequently, by summing and normalizing the weighted third histogram, a gray-level mapping function is obtained, which is then used to map the pixel gray values in the infrared image. Thus, the gray-level mapping function can be generated based on the gray-level distribution after amplitude limiting and sky weighting, limiting the proportion of the sky region in the output gray-level space and reducing the occupation of the non-sky region's gray-level mapping space by the sky region. This alleviates the problem of whitening or overexposure of non-sky target areas in infrared images with a sky background.
[0064] The following example uses a 14-bit infrared image to illustrate the processing procedure of this method.
[0065] Assume the grayscale range of the infrared image to be enhanced is 0 to 16383. First, count the number of pixels corresponding to each grayscale value in the infrared image to obtain a first histogram H1 with a length of 16384.
[0066] Then, the limiting threshold T is determined based on the image width, image height, and a preset empirical coefficient. The histogram values corresponding to each grayscale value in the first histogram are traversed. If the histogram value corresponding to a certain grayscale value is greater than T, it is updated to T; otherwise, it remains unchanged, thus obtaining the second histogram H2.
[0067] Simultaneously, a weight vector W is obtained beforehand through a sky calibration process. During the sky calibration process, the infrared thermal imager is pointed at the sky and kept stationary, acquiring multiple frames of sky images. These multiple frames are then averaged to obtain a sky template. The maximum grayscale value G of the sky template is obtained by iterating through the pixel grayscale values within the sky template. max Subsequently, it will be no greater than G. max The grayscale range is used as the sky grayscale range, and a small weighting coefficient is applied to the grayscale values within this range; for values greater than G... max A large weighting coefficient is set for the grayscale range to obtain the weight vector W.
[0068] Next, the second histogram H2 is multiplied by the weight vector W according to the corresponding gray values to obtain the third histogram H3. That is, for each gray value i, the following is performed: .
[0069] Next, the third histogram is summed in ascending order of grayscale values to obtain the cumulative histogram H4. Then, the cumulative histogram H4 is normalized to obtain the grayscale mapping function H5.
[0070] Finally, iterate through each pixel in the original infrared image, obtain the original grayscale value X of that pixel, and find the normalized mapping value H5 corresponding to X in the grayscale mapping function. (X) And according to: The enhanced grayscale value Y is calculated. After mapping all pixels, the contrast-enhanced infrared image is obtained.
[0071] This embodiment also provides an infrared image contrast enhancement device, the device comprising: The histogram statistics module is used to acquire the infrared image to be enhanced, count the grayscale histogram of the infrared image, and obtain the first histogram. The amplitude limiting module is used to perform amplitude limiting on the first histogram to obtain the second histogram. The weight acquisition module is used to acquire a pre-calibrated weight vector. The weight vector represents the weighting coefficients corresponding to different gray values. The weighting coefficients for gray values in the sky area are lower than those for gray values in the non-sky area. The histogram weighting module is used to weight the second histogram according to the weight vector to obtain the third histogram; The cumulative processing module is used to sum the data from the third histogram to obtain the cumulative histogram. The normalization module is used to normalize the cumulative histogram to obtain the gray-scale mapping function; The grayscale mapping module is used to map the pixel grayscale values in an infrared image according to the grayscale mapping function to obtain an infrared image with enhanced contrast.
[0072] The above modules can be implemented through software programs, hardware circuits, or a combination of both. The data transfer relationships between the modules correspond to the steps in the above method implementation, and will not be repeated here.
[0073] In the description of the embodiments of this application, unless otherwise stated, " / " means "or", for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.
[0074] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0075] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0076] The terms "coupled," "connected," or "connected" in the instruction manual include both direct and indirect connections. An indirect connection is a connection made through an intermediate medium, such as a connection made through an electrically conductive medium, which may have parasitic inductance or capacitance. An indirect connection may also include connections made through other active or passive devices to achieve the same or similar functional purpose, such as connections made through circuits or components such as switches or follower circuits.
[0077] In the detailed description of this specification, reference is made to the accompanying drawings, which form a part thereof, wherein like reference numerals always denote like parts, and wherein exemplary embodiments are shown by way of example that may be implemented. It should be understood that other embodiments may be utilized, and structural or logical changes may be made, without departing from the scope of this application. Therefore, the following detailed description should not be considered limiting.
[0078] The various operations in the specification may be described sequentially as multiple discrete actions or operations in a manner most conducive to understanding the claimed subject matter. However, the order of description should not be construed as implying that these operations must be sequentially related. Specifically, these operations may not be performed in the order presented. The described operations may be performed in a different order than in the described embodiments. Various additional operations may be performed in additional embodiments and / or the described operations may be omitted.
[0079] Various components and devices may be referred to or shown in the singular (e.g., “MOS transistor”, “transistor”, “switch”, etc.) in this document, but only for the convenience of discussion, and any element referred to in the singular may include multiple such elements as taught herein.
[0080] The above are merely preferred embodiments of this application and do not constitute any limitation on this application. Any person skilled in the art can make many possible variations and modifications to the technical solution of this application, or modify it into equivalent embodiments, without departing from the scope of the technical solution of this application. Therefore, all equivalent changes made based on the shape, structure, and principle of this application without departing from the content of the technical solution of this application should be covered within the protection scope of this application.
Claims
1. A method for enhancing the contrast of infrared images, characterized in that, The method includes: Acquire the infrared image to be enhanced, and statistically analyze the grayscale histogram of the infrared image to obtain the first histogram; Amplitude limiting is applied to the first histogram to obtain the second histogram; Obtain a pre-calibrated weight vector, which represents the weighting coefficients corresponding to different gray values, wherein the weighting coefficients for gray values corresponding to the sky region are lower than the weighting coefficients for gray values corresponding to the non-sky region. The second histogram is weighted according to the weight vector to obtain the third histogram; The third histogram is summed to obtain the cumulative histogram; The cumulative histogram is normalized to obtain the gray-scale mapping function; The grayscale values of pixels in the infrared image are mapped according to the grayscale mapping function to obtain an infrared image with enhanced contrast.
2. The infrared image contrast enhancement method according to claim 1, characterized in that, The amplitude limiting process for the first histogram includes: Iterate through the histogram values corresponding to each gray value in the first histogram; Determine whether the histogram value is greater than the amplitude limiting threshold; If the histogram value corresponding to the current gray value of the first histogram is greater than the limiting threshold, then the histogram value corresponding to the current gray value of the first histogram is updated to the limiting threshold. If the histogram value corresponding to the current gray value of the first histogram is less than or equal to the limiting threshold, then the histogram value corresponding to the current gray value remains unchanged. After completing the traversal, the second histogram is obtained.
3. The infrared image contrast enhancement method according to claim 2, characterized in that, Before performing amplitude limiting on the first histogram, the method further includes: The amplitude limiting threshold is determined based on the image width, image height, and preset empirical coefficients of the infrared image.
4. The infrared image contrast enhancement method according to claim 1, characterized in that, The process of obtaining the pre-calibrated weight vector includes: Point the infrared thermal imager at the sky so that the field of view of the infrared thermal imager only includes the sky area. While the thermal imager remains stationary, it acquires multiple frames of sky images; The multiple frames of sky images are averaged to obtain a sky template; The weight vector is obtained based on the sky template.
5. The infrared image contrast enhancement method according to claim 4, characterized in that, The step of obtaining the weight vector based on the sky template includes: Iterate through the grayscale values of each pixel in the sky template to determine the maximum grayscale value of the sky template; Determine the grayscale range of the sky based on the maximum grayscale value of the sky template; Based on the grayscale range of the sky, a weighting coefficient is set for each grayscale value in the grayscale range of the sky to obtain the weight vector.
6. The infrared image contrast enhancement method according to claim 1, characterized in that, The step of weighting the second histogram according to the weight vector includes: multiplying the histogram value corresponding to the gray value of the second histogram with the weight vector to obtain a third histogram.
7. The infrared image contrast enhancement method according to claim 1, characterized in that, The step of summing the third histogram includes: summing the histogram values corresponding to the gray values of the third histogram in ascending order of gray values, and using the summed value of the gray values of the third histogram as the histogram value corresponding to the gray values of the cumulative histogram.
8. The infrared image contrast enhancement method according to claim 1, characterized in that, The normalization process for the cumulative histogram includes: Based on the cumulative histogram, determine the minimum and maximum histogram values of the cumulative histogram; The minimum histogram value of the cumulative histogram is mapped to 0, the maximum histogram value of the cumulative histogram is mapped to 1, and the histogram values of the cumulative histogram are mapped to a range between 0 and 1 to obtain the grayscale mapping function.
9. The infrared image contrast enhancement method according to claim 1, characterized in that, The step of mapping the pixel grayscale values in the infrared image according to the grayscale mapping function includes: Traverse each pixel of the infrared image; Get the original grayscale value of the current pixel; Based on the original grayscale value and the grayscale mapping function, the normalized mapping value is obtained; The enhanced grayscale value of the current pixel is determined based on the normalized mapping value and the total number of grayscale levels in the infrared image. Once all pixels of the infrared image have been traversed, an infrared image with enhanced contrast is obtained.
10. An infrared image contrast enhancement device, characterized in that, The device includes: The histogram statistics module is used to acquire the infrared image to be enhanced, and to count the grayscale histogram of the infrared image to obtain the first histogram. A limiting processing module is used to limit the amplitude of the first histogram to obtain a second histogram; The weight acquisition module is used to acquire a pre-calibrated weight vector, which represents the weighting coefficients corresponding to different gray values. The weighting coefficients for gray values in the sky area are lower than those for gray values in the non-sky area. The histogram weighting module is used to perform weighting processing on the second histogram according to the weight vector to obtain the third histogram; The cumulative processing module is used to sum the third histogram to obtain a cumulative histogram; The normalization processing module is used to normalize the cumulative histogram to obtain the gray-scale mapping function; The grayscale mapping module is used to map the pixel grayscale values in the infrared image according to the grayscale mapping function to obtain an infrared image with enhanced contrast.