Infrared image contrast adjustment method and device and storage medium
By acquiring the scene contrast value and transmittance threshold of the infrared image, the transmission rate of the infrared image is adjusted and the fog removal algorithm is used to process it, the problem of insufficient contrast in infrared image is solved, contrast enhancement and detail recovery are achieved, and the adaptability and quality of the image are improved.
Patent Information
- Application Number
- CN202510327452.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2045-03-19
AI Technical Summary
Infrared images are prone to insufficient contrast, resulting in insufficient target details and graying of the overall picture, affecting the usability and user experience of the image.
By obtaining the scene contrast value of the original infrared image, the transmittance threshold matching the scene contrast value is determined, and the transmittance of different pixel points is adjusted. Finally, the original infrared image is defogged and processed to obtain the target infrared image after contrast adjustment.
It achieves enhanced contrast, while recovering more detailed information, improving adaptability to different infrared scenarios, without requiring a large amount of data training, low requirements for equipment performance, and easy to implement.
Smart Images

Figure CN119850501A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method, device and storage medium for adjusting contrast of an infrared image. Background Art
[0002] In the current process of scientific and technological development, infrared equipment has been widely used in many fields due to its unique functional characteristics.
[0003] However, due to the limitations of the imaging principle of infrared detectors and the level of equipment production technology, there are obvious defects in the quality of infrared images. Infrared detectors rely on lenses to receive radiation from objects and use hardware circuits to convert radiation signals to form images, but the performance of detectors and other hardware devices varies. As a result, in actual scenes, infrared images are prone to abnormal contrast problems. Either the contrast is too low, the picture is gray, and the target details are blurred and difficult to distinguish; or the contrast between light and dark is too strong, which also affects the effective interpretation of the image content. These problems seriously reduce the usability of infrared images, greatly affect the user experience, and hinder the in-depth application and further development of infrared equipment in various fields. Summary of the invention
[0004] In order to solve the above technical problems, the technical solution adopted in this application is: to provide a contrast adjustment method, device and storage medium for infrared images, so as to at least solve the problem that infrared images in related technologies are prone to insufficient contrast, resulting in unclear target details and gray overall picture.
[0005] According to an embodiment of the present invention, a method for adjusting contrast of an infrared image is provided, comprising: Acquiring a scene contrast value of the original infrared image and determining a transmittance threshold matching the scene contrast value; and, Obtaining the transmittance of different pixels in the original infrared image; Using the transmittance threshold to adjust the transmittance of the different pixel points; The defogging algorithm and the adjusted transmittance are used to perform defogging processing on the original infrared image to obtain a target infrared image after contrast adjustment.
[0006] In order to solve the above technical problems, a technical solution adopted in the present application is: to provide an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it is used to implement the infrared image contrast adjustment method in the above technical solution.
[0007] In order to solve the above technical problems, a technical solution adopted in the present application is: providing a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, it is used to implement the infrared image contrast adjustment method in the above technical solution.
[0008] Through the above scheme, the beneficial effect of the present application is: the infrared image contrast adjustment method provided by the present application obtains the scene contrast value of the original infrared image, determines the transmittance threshold matching the scene contrast value and the transmittance of different pixels in the original infrared image, uses the transmittance threshold to adjust the transmittance of different pixels, and finally uses the defogging algorithm and the adjusted transmittance to defog the original infrared image to obtain the target infrared image after contrast adjustment; in this way, the infrared image is defogged using the defogging algorithm and based on the adjusted transmittance, that is, the contrast adjustment of the infrared image is achieved based on the defogging algorithm. Compared with contrast adjustment using histogram equalization, linear or nonlinear transformation, the present application can not only enhance the contrast, but also restore more detail information; in addition, for different scene contrast values, different transmittance thresholds are used to adjust the transmittance of the image, which can improve the adaptability to different infrared scenes. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them: Figure 1 It is a flow chart of an embodiment of a method for adjusting contrast of infrared images provided by the present application; Figure 2 It is a flowchart of a specific embodiment of a method for adjusting the contrast of an infrared image provided by the present application; Figure 3 It is a structural schematic diagram of an embodiment of an electronic device provided by the present application; Figure 4 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present application. DETAILED DESCRIPTION
[0010] The present application is further described in detail below in conjunction with the accompanying drawings and examples. It is particularly noted that the following examples are only used to illustrate the present application, but are not intended to limit the scope of the present application. Similarly, the following examples are only some embodiments of the present application rather than all embodiments, and all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0011] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0012] It should be noted that the terms "first", "second", etc. in this application are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first", "second", etc. can explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.
[0013] In actual usage scenarios, infrared devices are limited by the performance of infrared detectors and other hardware devices, and are prone to problems such as low screen contrast (gray screen or no obvious detail contrast) or high contrast (strong contrast between light and dark, too black or too white with no details).
[0014] At present, infrared contrast adjustment methods are mainly divided into two categories: contrast enhancement based on traditional image processing technology and contrast enhancement based on deep learning. Traditional image processing methods generally use histogram equalization, linear transformation (such as piecewise linear transformation) and nonlinear changes (such as gamma correction, logarithmic change). However, histogram equalization may over-enhance the contrast for images with high peak histograms, and the image effect is unnatural; the linear transformation enhancement effect is limited by the transformation function and cannot be adaptively adjusted according to the image, and if the slope of the transformation function is too small, it will also lead to the loss of detail information; nonlinear transformation may also over-enhance or suppress certain contrast areas in the image, resulting in the loss of details, and the parameters also have a more drastic impact on the image effect.
[0015] In recent years, there are also infrared contrast adjustment methods based on deep learning. However, such deep learning-based methods often rely on the quality and quantity of data. The generalization ability and robustness of the model need to be guaranteed through a large amount of data training. At the same time, the model complexity is high, which requires high computing resources for training, reasoning and deployment equipment, increasing the cost of use.
[0016] Therefore, the present application provides a method for adjusting the contrast of infrared images, by obtaining the scene contrast value of the original infrared image, determining the transmittance threshold matching the scene contrast value and the transmittance of different pixels in the original infrared image, adjusting the transmittance of different pixels using the transmittance threshold, and finally using the defogging algorithm and the adjusted transmittance to defog the original infrared image, and obtaining the target infrared image after contrast adjustment. In the technical solution provided by the present application, the defogging algorithm and the adjusted transmittance are used to defog the infrared image, that is, the contrast adjustment of the infrared image is achieved based on the defogging algorithm. Compared with the contrast adjustment using histogram equalization, linear or nonlinear transformation, the present application can not only enhance the contrast, but also restore more detail information; in addition, for different scene contrast values, different transmittance thresholds are used to adjust the transmittance of the image, which can also improve the adaptability to different infrared scenes. Moreover, the contrast adjustment scheme of the present scheme realizes higher quality infrared image contrast adjustment through an algorithm, does not require a large amount of data training, does not require high performance of the device, and is easy to implement.
[0017] See also Figure 1 , Figure 1 FIG. 1 is a flow chart of an embodiment of a method for adjusting the contrast of an infrared image provided by the present application. It should be noted that if there are substantially the same results, this embodiment does not necessarily use Figure 1 The process sequence shown is limited. Figure 1 As shown, this embodiment includes: S110: Acquire a scene contrast value of the original infrared image, and determine a transmittance threshold matching the scene contrast value.
[0018] In the field of infrared images, the scene contrast value is used to measure the degree of brightness difference between different areas in an infrared image, reflecting the contrast between the bright and dark parts of the image. A high scene contrast value indicates that the brightness difference between the bright and dark areas in the image is obvious, the image is rich in details, and the distinction between the target and the background is high, which helps to quickly and accurately identify and analyze objects and features in the image. On the contrary, a low scene contrast value means that the difference between the bright and dark areas of the image is small, the overall picture may be gray, and the target details are difficult to distinguish, which may affect the understanding and analysis of the image content.
[0019] The image data of the original infrared image is obtained, and the scene contrast value of the original infrared image is calculated. In one embodiment, the representative pixel value of the original infrared image is first obtained. Preferably, the median of the pixel values of each pixel point in the original infrared image is used as the representative pixel value. The median can represent the middle level of the image pixel value to a certain extent. Compared with the traditional use of the average value as the representative pixel value, the median has stronger robustness to abnormal values in the image (such as excessively high or low pixel values caused by noise points), and can more stably reflect the overall distribution of the image pixel value.
[0020] Then, a first representative pixel and a second representative pixel are selected from the original infrared image so as to calculate the scene contrast value based on the representative pixel. In one example, before selecting the representative pixel, the abnormal pixel is excluded. For example, the second number of first pixel with the lowest pixel value and the third number of second pixel with the highest pixel value in the original infrared image are determined. These pixel points may be abnormal pixel points caused by noise, interference or other abnormal factors in the imaging process. Excluding them can reduce the impact of abnormal values on subsequent calculations.
[0021] After excluding abnormal pixels, several pixels other than the second number of first pixels and the third number of second pixels in the original infrared image are determined as candidate pixels, and then a first representative pixel and a second representative pixel are selected from the candidate pixels. Exemplarily, several candidate pixels are sorted from high to low according to pixel values, and the Mth pixel is selected as the first representative pixel. At the same time, several candidate pixels are sorted from low to high according to pixel values, and the Mth pixel is selected as the second representative pixel. The two representative pixels selected by the example method are selected from brighter and darker pixel areas, respectively, which can effectively reflect the characteristics of the bright and dark parts of the image.
[0022] The scene contrast value is determined based on the pixel value difference between the selected first representative pixel point and the second representative pixel point and the representative pixel value. In one example, the scene contrast value is obtained by subtracting the sum of the representative pixel value and the fourth constant from the pixel value difference.
[0023] Furthermore, the corresponding scene contrast intensity is determined based on the calculated scene contrast value, and a transmittance threshold matching the scene contrast value is calculated according to different scene contrast intensities.
[0024] In one example, several preset contrast scenes in this embodiment are preset to include a high contrast scene, a normal contrast scene, and a low contrast scene. The current contrast scene is determined by comparing the calculated scene contrast value with a preset contrast threshold. Exemplarily, the preset first contrast threshold and the second contrast threshold correspond to the high contrast threshold and the low contrast threshold, respectively, and the second contrast threshold is less than the first contrast threshold. From several preset contrast scenes, a preset contrast scene matching the scene contrast value is selected as the current contrast scene, specifically including the following situations: ① In response to the scene contrast value being greater than the first contrast threshold corresponding to the high contrast scene, the current contrast scene is determined to be a high contrast scene; ② In response to the scene contrast value being greater than the second contrast threshold corresponding to the low contrast scene and less than the first contrast threshold, the current contrast scene is determined to be a normal contrast scene; ③ In response to the scene contrast value being less than the second contrast threshold, the current contrast scene is determined to be a low contrast scene.
[0025] The current scene threshold of the original infrared image is obtained, wherein the current scene threshold represents the pixel value segmentation boundary of the foreground and background in the original infrared image, that is, the pixels in the image are divided into the foreground part and the background part according to their pixel values. In one example, the maximum inter-class variance method is used to calculate the current scene threshold. The inter-class variance measures the degree of separation between the two classes. The larger the inter-class variance, the more obvious the difference between the two classes. The specific steps are as follows: the number of pixels appearing at each gray level in the image is counted to obtain the grayscale histogram of the image; all possible thresholds are traversed, for example, from the minimum grayscale value to the maximum grayscale value, and each grayscale value is selected as a candidate threshold in turn; for each candidate threshold, the image pixels are divided into two categories, the foreground and the background, and the pixel probabilities and grayscale means of the two categories are calculated respectively; the inter-class variance is calculated according to the pixel probabilities and grayscale means of the foreground and the background; and finally the candidate threshold that maximizes the inter-class variance is selected as the final scene threshold.
[0026] After the current scene threshold is obtained as described above, the transmittance threshold is calculated using the current scene threshold and the mapping relationship between the current scene threshold and the transmittance threshold corresponding to the current contrast scene.
[0027] In one embodiment, the preset contrast scenes in this embodiment are preset to include a high contrast scene, a normal contrast scene, and a low contrast scene. Then, different contrast scenes and transmittance thresholds have the following mapping relationship: (1) The mapping relationship corresponding to the high contrast scene is: the current scene threshold is calculated and divided by the product of the first constant and the second constant to obtain a first ratio, and then the transmittance threshold corresponding to the high contrast scene is obtained by calculating the difference between the first transmittance threshold and the first ratio.
[0028] (2) The mapping relationship corresponding to the normal contrast scene is: the first difference is obtained by calculating the difference between the scene contrast value and the second contrast threshold corresponding to the low contrast scene, and the second difference is obtained by calculating the difference between the first contrast threshold and the second contrast threshold corresponding to the high contrast scene. Then, the second ratio is obtained by calculating the product of the first difference and the current scene threshold and dividing it by the product of the first constant and the second difference. Then, the transmittance threshold corresponding to the normal contrast scene is obtained by calculating the difference between the second transmittance threshold and the second ratio.
[0029] (3) The mapping relationship corresponding to the low contrast scene is: the difference between the second contrast threshold and the scene contrast value is calculated to obtain a third difference, and then the product of the third difference and the current scene threshold is calculated and divided by the product of the first constant and the second contrast threshold to obtain a third ratio, so that the transmittance threshold corresponding to the low contrast scene is obtained by calculating the difference between the third transmittance threshold and the third ratio.
[0030] In the infrared image contrast adjustment method provided in the present application, the transmittance threshold is used for subsequent adjustment of the infrared image to optimize the quality of the infrared image. For example, the transmittance threshold can guide the algorithm to make corresponding adjustments to the pixels in different areas of the image to ensure that the processed image can highlight the target object, improve the clarity of details, and achieve better visual presentation and analysis effects.
[0031] S120: Obtain the transmittance of different pixel points in the original infrared image.
[0032] In the context of infrared image processing, transmittance is used to describe the proportion of infrared light that can pass through the medium (such as atmosphere, smoke, etc.) in the imaging scene and reach the infrared detector. For each pixel in the image, its transmittance reflects the light transmission of the scene area corresponding to the pixel. A higher transmittance means that the light in this area can pass through the medium more smoothly, and the image may show that the area is relatively clear; a lower transmittance means that the light in this area is greatly obstructed by the medium, and the image may show that the area is relatively blurred.
[0033] In the process of infrared imaging, the medium in the scene will scatter and absorb infrared light, resulting in reduced image contrast and blurred details. By obtaining the transmittance of different pixels, the image can be defogged and the brightness and contrast of each pixel can be adjusted according to the transmittance of each pixel, thereby restoring the clarity and detail information of the image and improving the quality and usability of the image.
[0034] Based on the dark channel image of the original infrared image and the atmospheric light value of the original infrared image, the transmittance of different pixels in the original infrared image is determined. In one embodiment, the dark channel image of the original infrared image is obtained, and the atmospheric light value of the original infrared image is calculated, and the dark channel image is normalized by using the atmospheric light value to obtain a normalized image, and the transmittance of different pixels in the original infrared image is determined by using the normalized image.
[0035] In one embodiment, a dark channel image of the original infrared image is obtained to reflect the characteristics of the darker areas in the image. These dark areas usually have low transmittance and are an important basis for subsequent calculations. Exemplarily, the original infrared image is traversed with a window of a preset size, and for each pixel value in the window, a pixel value that meets the dark channel requirement is selected as the pixel value of the corresponding pixel point of the dark channel image, wherein the dark channel requirement is usually the minimum value of the pixel values of each channel in the window.
[0036] In one embodiment, the atmospheric light value of the original infrared image is calculated to represent the intensity of the ambient light in the entire scene. Exemplarily, a first number of pixels with the largest pixel values are found from the dark channel image as reference pixels, and the central tendency values of the pixel values of the reference pixels are counted as the atmospheric light value, wherein, in order to avoid the influence of abnormal pixels, the central tendency value is preferably the median of the first number of pixels.
[0037] In one embodiment, the dark channel image is normalized using the atmospheric light value to obtain a normalized image, and the pixel value range of the dark channel image is adjusted to a suitable interval to facilitate the subsequent calculation of the transmittance. Exemplarily, each pixel point in the dark channel image is divided by the atmospheric light value to obtain the pixel value corresponding to each pixel point in the normalized image.
[0038] In one embodiment, the normalized image is used to determine the transmittance of different pixels in the original infrared image to obtain a relatively accurate transmittance of each pixel. Exemplarily, the product of the pixel value of each pixel of the normalized image and the third constant is subtracted from the preset transmittance to obtain the transmittance of the corresponding pixel in the original infrared image.
[0039] S130: adjusting the transmittance of different pixels using the transmittance threshold.
[0040] Since the transmittance calculated above may contain noise or discontinuity, which will affect the effect of subsequent contrast adjustment, before using the transmittance threshold calculated above to adjust the transmittance of different pixels, a filtering algorithm is first used to correct the transmittance to make the transmittance image smoother while retaining the edge information of the target object in the image, avoiding problems such as edge blur during the adjustment process, and improving the accuracy of subsequent adjustments and image quality.
[0041] In one embodiment, the transmittance is corrected using a filtering algorithm, and the corrected transmittance is used for adjustment. Exemplarily, guided filtering is adopted, and the original infrared image is used as a guide map to perform guided filtering on the transmittance, that is, the transmittance is smoothed according to the similarity between pixels in the guide map. Specifically, in the filtering process, for each pixel point, the pixel information in its neighborhood is considered, and the pixel value at the corresponding position in the guide map is combined to calculate the corrected transmittance of the pixel point by weighted average, so that the corrected transmittance can reflect the overall structure of the image and retain the detail information.
[0042] After the transmittance correction is completed, the transmittance of different pixels is adjusted using the transmittance threshold. Exemplarily, the transmittance of each pixel in the original infrared image is traversed, and the transmittance greater than the transmittance threshold is adjusted to the transmittance threshold.
[0043] In this way, the excessive transmittance in the image is limited to avoid the phenomenon of over-brightness or distortion of the image due to excessive transmittance of some pixels in the subsequent image defogging or contrast adjustment process. By uniformly adjusting the transmittance above the threshold to the threshold, the transmittance distribution of the image can be made more reasonable, thereby ensuring that the overall contrast and brightness of the image after subsequent processing are more uniform, and improving the visual effect and quality of the image.
[0044] S140: Defogging the original infrared image using a defogging algorithm and the adjusted transmittance to obtain a target infrared image after contrast adjustment.
[0045] Dehazing algorithms are used to eliminate the effects of fog in images and restore image clarity and true colors. In a foggy environment, tiny particles in the fog scatter and absorb light, which reduces the image contrast, distorts colors, and blurs details. Dehazing algorithms process images to restore the true features of images in a fog-free state as much as possible.
[0046] In infrared imaging, even slight fog or other interference factors may cause the contrast of the image to decrease, making the details of the target object difficult to distinguish. Defogging can significantly improve the clarity and contrast of the image, making the target object more clearly distinguishable and convenient for subsequent analysis and processing.
[0047] In the present application, the original infrared image is defogged in combination with the adjusted transmittance and the defogging algorithm to obtain a target infrared image after contrast adjustment.
[0048] In one embodiment, for each pixel of the original infrared image, based on the atmospheric scattering model, the image is defogged by using the known original image pixel value, the adjusted transmittance, and the atmospheric light value. Exemplarily, the difference between the pixel value of the pixel in the original infrared image and the atmospheric light value is calculated and divided by the difference between the adjusted transmittance corresponding to the pixel and the fifth constant to obtain a fourth ratio. The sum of the fourth ratio corresponding to the pixel and the atmospheric light value of the original infrared image is used as the pixel value corresponding to the pixel in the target infrared image.
[0049] To better explain the contrast adjustment method of infrared images in this application, please refer to Figure 2 , Figure 2 The following infrared image contrast adjustment method is provided as an example. It should be noted that if there are substantially the same results, this embodiment is not used. Figure 2 The process sequence shown is limited. Figure 2 As shown, this embodiment includes: S201: Input image.
[0050] In a continuous infrared image sequence, obtain the original image data I .
[0051] S202: Calculate the image scene contrast value.
[0052] First get the entire image I Median pixel value I m , based on formula (1), the lowest and highest pixel values are discarded N The pixel value of the number of pixels, where Values Represents the pixel value after interception, pixelValues represents the image pixel value, Size Indicates the number of image pixels.
[0053] Values = pixelValues [ N , Size - N ] (1) In the intercepted pixel values, the first M The pixel value of pixels and calculate the absolute value of the difference between the two Diff The scene contrast value C is calculated based on formula (2), where ε is a constant.
[0054] C= Diff / ( I m +ε)(2) S203: Determine the scene contrast intensity.
[0055] According to the scene contrast value calculated in step S202, the scene contrast intensity corresponding to the scene contrast value is determined.
[0056] If it is greater than the high contrast threshold Th h , it is determined to be a high contrast scene S h , if it is less than the low contrast threshold Th l , it is judged to be a low contrast scene S l , if the scene contrast value is greater than Th l and less than Th h (Regulation Th l < Th h ), it is considered to be a normal contrast scene S n .
[0057] S204: Determine the current scene threshold.
[0058] In this embodiment, the maximum inter-class variance method is used to calculate the current scene threshold Th Otsu The specific calculation method refers to the relevant content in the aforementioned step S110, which will not be repeated here.
[0059] S205: adaptively calculating the transmittance threshold.
[0060] According to the scene contrast value calculated in step S202, the scene contrast intensity determined in step S203 and the current scene threshold calculated in step S204, the transmittance threshold Th is adaptively calculated by formula (3): t0 ,in, l 0 , n 0 , h 0 、α and β is a constant.
[0061] (3) S206: Calculate the atmospheric light value.
[0062] First, traverse the image with a window of size R, and take the minimum value in the window as the pixel value of the point to obtain the dark channel image I dark . Get the largest K pixels in the dark channel image pixel value sorting, and calculate the median of the K pixels as the atmospheric light value A.
[0063] S207: Calculate transmittance.
[0064] The original infrared image is normalized using the atmospheric light value A calculated in step S206 and formula (4), where (i, j) represents the pixel value of the current point.
[0065] (4) The normalized dark channel image norm is further calculated using the method in step S206. dark , and calculate the transmittance matrix t based on formula (5) 0 (i,j), where T and μ are constants.
[0066] (5) S208: Transmittance correction.
[0067] The transmittance is corrected by using a filtering algorithm. In this embodiment, guided filtering is used, and the original image is used as a guide map. After filtering, the corrected transmittance matrix t is obtained. 1 .
[0068] S209: Obtain transmittance.
[0069] According to the transmittance threshold Th calculated in step S205 t0 The transmittance matrix t calculated in step S208 1 Use formula (6) to perform the limiting operation, where t 2 (i, j) represents the transmittance of the current pixel after limiting, and max (*) represents the maximum value of the two values.
[0070] (6) S210: Calculate and obtain an adjusted image.
[0071] According to the atmospheric scattering model formula, the adjusted target infrared image is output by inversely solving formula (7), where O represents the output adjusted image and δ is a constant.
[0072] (7) See also Figure 3 , Figure 3 It is a structural diagram of an embodiment of an electronic device provided in the present application. The electronic device 60 includes a memory 61 and a processor 62 connected to each other. The memory 61 is used to store a computer program. When the computer program is executed by the processor 62, it is used to implement the infrared image contrast adjustment method in the above embodiment.
[0073] The method of the above embodiment may exist in the form of a computer program, so the present application proposes a computer readable storage medium, see Figure 4 , Figure 4 It is a structural diagram of an embodiment of a computer-readable storage medium provided in the present application. The computer-readable storage medium 80 is used to store a computer program 81, which can be executed to implement the infrared image contrast adjustment method in the above embodiment.
[0074] The computer-readable storage medium 80 may be a server, a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., which may store program codes.
[0075] The above description is only an embodiment of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for adjusting the contrast of an infrared image, characterized in that: The method comprises: Acquiring a scene contrast value of the original infrared image and determining a transmittance threshold value matching the scene contrast value; and, Obtaining the transmittance of different pixels in the original infrared image; Using the transmittance threshold to adjust the transmittance of the different pixel points; The defogging algorithm and the adjusted transmittance are used to perform defogging processing on the original infrared image to obtain a target infrared image after contrast adjustment.
2. The method according to claim 1, characterized in that The determining of a transmittance threshold value matching the scene contrast value comprises: Selecting a preset contrast scene that matches the scene contrast value from a plurality of preset contrast scenes as a current contrast scene; and obtaining a current scene threshold of the original infrared image, wherein the current scene threshold represents a pixel value segmentation boundary between the foreground and the background in the original infrared image; The transmittance threshold is calculated by using the current scene threshold and a mapping relationship between the current scene threshold and a transmittance threshold corresponding to the current contrast scene.
3. The method according to claim 2, characterized in that The plurality of preset contrast scenes include a high contrast scene, a normal contrast scene, and a low contrast scene; and selecting a preset contrast scene matching the scene contrast value from the plurality of preset contrast scenes as the current contrast scene includes: In response to the scene contrast value being greater than a first contrast threshold corresponding to the high contrast scene, determining that the current contrast scene is the high contrast scene; In response to the scene contrast value being greater than a second contrast threshold corresponding to the low contrast scene and less than the first contrast threshold, determining that the current contrast scene is a normal contrast scene, wherein the second contrast threshold is less than the first contrast threshold; In response to the scene contrast value being less than the second contrast threshold, determining that the current contrast scene is the low contrast scene; And / or, the plurality of preset contrast scenes include a high contrast scene, a normal contrast scene and a low contrast scene; the mapping relationship corresponding to the high contrast scene is: the transmittance threshold is equal to the difference between the first transmittance threshold and the first ratio, and the first ratio is the current scene threshold divided by the product of a first constant and a second constant; the mapping relationship corresponding to the normal contrast scene is: the transmittance threshold is equal to the difference between the second transmittance threshold and the second ratio, the second ratio is the product of the first difference and the current scene threshold divided by the product of the first constant and the second difference, the first difference is the difference between the scene contrast value and the second contrast threshold corresponding to the low contrast scene, and the second difference is the difference between the first contrast threshold corresponding to the high contrast scene and the second contrast threshold; the mapping relationship corresponding to the low contrast scene is: the transmittance threshold is equal to the difference between the third transmittance threshold and the third ratio, the third ratio is the product of the third difference and the current scene threshold divided by the product of the first constant and the second contrast threshold, and the third difference is the difference between the second contrast threshold and the scene contrast value.
4. The method according to claim 1, characterized in that: The obtaining the transmittance of different pixel points in the original infrared image includes: Acquire a dark channel image of the original infrared image, and calculate an atmospheric light value of the original infrared image; Normalizing the dark channel image using the atmospheric light value to obtain a normalized image; The normalized image is used to determine the transmittance of different pixels in the original infrared image.
5. The method according to claim 4, characterized in that The step of acquiring a dark channel image of the original infrared image comprises: Traversing the original infrared image with a window of a preset size, and taking the pixel values in the window that meet the dark channel requirements as the pixel values of the corresponding pixel points of the dark channel image; And / or, the calculating the atmospheric light value of the original infrared image comprises: Finding a number of reference pixel points from the dark channel image, and counting the central tendency values of the pixel values of the reference pixel points as the atmospheric light values, wherein the number of reference pixel points are a first number of pixel points with the largest pixel values in the dark channel image; And / or, the step of normalizing the dark channel image by using the atmospheric light value to obtain a normalized image comprises: Dividing each pixel point in the dark channel image by the atmospheric light value to obtain a pixel value corresponding to each pixel point in the normalized image; And / or, using the normalized image to determine the transmittance of different pixels in the original infrared image includes: The preset transmittance is respectively subtracted from the product of the pixel value of each pixel point of the normalized image and the third constant to obtain the transmittance of the corresponding pixel point in the original infrared image.
6. The method according to claim 1, characterized in that Before adjusting the transmittance of the different pixel points by using the transmittance threshold, the method further includes: The transmittance is corrected by using a filtering algorithm, wherein the corrected transmittance is used for the adjustment.
7. The method according to claim 6, characterized in that The method of modifying the transmittance by using a filtering algorithm includes: The original infrared image is used as a guide map to perform guided filtering on the transmittance.
8. The method according to claim 1, characterized in that The step of obtaining the scene contrast value of the original infrared image includes: Acquire a representative pixel value of the original infrared image, and select a first representative pixel point and a second representative pixel point from the original infrared image; The scene contrast value is determined based on a pixel value difference between the first representative pixel point and the second representative pixel point, and the representative pixel value.
9. The method according to claim 8, characterized in that The representative pixel value is the median value of the pixel values of each pixel point in the original infrared image; And / or, selecting a first representative pixel point and a second representative pixel point from the original infrared image includes: Determine a number of candidate pixel points other than a second number of first pixel points and a third number of second pixel points in the original infrared image, wherein the second number of first pixel points are the second number of pixel points with the lowest pixel values, and the third number of second pixel points are the third number of pixel points with the highest pixel values; Selecting the first representative pixel and the second representative pixel from the candidate pixel points, wherein the first representative pixel is the Mth pixel of the candidate pixel points sorted from high to low in terms of pixel value, and the second representative pixel is the Mth pixel of the candidate pixel points sorted from low to high in terms of pixel value; And / or, determining the scene contrast value based on a pixel value difference between the first representative pixel point and the second representative pixel point and the representative pixel value includes: The scene contrast value is obtained by subtracting the sum of the representative pixel value and a fourth constant from the pixel value difference.
10. The method according to claim 1, characterized in that The using the transmittance threshold to adjust the transmittance of different pixels in the original infrared image includes: Among the transmittances of different pixel points in the original infrared image, the transmittances greater than the transmittance threshold are adjusted to the transmittance threshold.
11. The method according to claim 1, characterized in that: The defogging algorithm and the adjusted transmittance are used to defog the original infrared image to obtain a contrast-adjusted target infrared image, including: For each pixel of the original infrared image, the sum of the fourth ratio corresponding to the pixel and the atmospheric light value of the original infrared image is used as the pixel value corresponding to the pixel in the target infrared image, wherein the fourth ratio is: the difference between the pixel value of the pixel in the original infrared image and the atmospheric light value divided by the difference between the adjusted transmittance corresponding to the pixel and the fifth constant.
12. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the processor is coupled to the memory, and the processor is configured to execute one or more steps of the infrared image contrast adjustment method according to any one of claims 1 to 11 based on instructions stored in the memory.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the infrared image contrast adjustment method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Image defogging method based on restoration and fusion of images on foggy days
CN102254313A
Image processing method and device
CN104463816A
Image defogging method and system of optimized contrast enhancement
CN107993198A
Image processing device and defogging method in image
KR1020140017776A
Image processing apparatus and image processing method
US20240085317A1
Cited By
Contrast enhancement method of remote sensing image
CN121391694A