An image defogging method, system, computer device, storage medium and terminal

By adopting adaptive threshold segmentation and precise segmentation technology in the image defog removal algorithm, combined with improved dark channel prior algorithm and logarithmic adaptive transformation, the problem of poor fog removal effect in the sky area in the prior art is solved, and a high-quality image defog removal effect is achieved.

CN114677289BActive Publication Date: 2025-06-27XIDIAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111124599.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-24
Publication Date
2025-06-27
Estimated Expiration
2041-09-24

AI Technical Summary

Technical Problem

When existing image defog removal algorithms deal with haze images, especially in the sky, they are prone to color shifts, details loss and halo phenomena, affecting the defog removal effect.

Method used

The cumulative distribution function is constructed by statistically stating the adjacent grayscale probability of haze images, combining adaptive threshold segmentation and dark and bright channel grayscale values ​​of the sky area, the coarse segmentation threshold of the sky area is determined, and precise segmentation of the sky area and non-sky area is achieved through guiding filtering and Otsu algorithm. The non-sky area uses an improved dark channel prior algorithm, and the sky area uses logarithmic adaptive transformation to estimate the transmittance, and the transmittances of the two are synthesized pixel-to-pixel to realize the image defog.

Benefits of technology

This method can accurately segment the sky area and the non-sky area, reduce details loss and color distortion, the image after defogging is bright and moderate, the texture details are clear, and the overall visual effect is good.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114677289B_ABST
    Figure CN114677289B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of image dehazing, and discloses an image dehazing method, system, computer device, storage medium and terminal. The image dehazing method includes constructing a cumulative distribution function by statistically calculating the adjacent gray probabilities of a hazy image, obtaining the average threshold of pixels according to the degree of concentrated distribution of pixel gray levels; obtaining the roughly segmented sky region and non-sky region according to the maximum connectivity of the sky region; strengthening the difference in pixel gray levels between the sky and non-sky regions through guided filtering, and using the Otsu algorithm to achieve accurate segmentation of the sky region and non-sky region; estimating the transmittance by logarithmic adaptive transformation in the sky region, estimating the transmittance by an improved dark channel prior algorithm in the non-sky region, and realizing image dehazing by synthesizing the transmittances of corresponding pixels in the sky and non-sky regions. The present invention can accurately obtain the atmospheric light value A<supgt;c< / supgt; of the pixel channel by calculating the gray value of the pixel point, overcoming the defect that the dark channel prior algorithm fails in bright regions such as the sky.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image dehazing, and particularly relates to an image dehazing method, system, computer device, storage medium and terminal. Background Technique

[0002] At present, the gray value of the sky area in haze images is generally higher than that of other areas, resulting in a low estimated value of atmospheric light in existing dehazing algorithms, and serious color deviation and detail loss in the sky area after dehazing, which affects the image dehazing effect.

[0003] In a haze environment, various particles suspended in the atmosphere will absorb and scatter light, resulting in the deflection of the light propagation path, the degradation of the image quality obtained by the imaging device, the loss of details, and the decrease of contrast and visibility, which seriously affects the subsequent analysis and processing of images in fields such as scene analysis, photography, computer vision, and autonomous driving vehicles.

[0004] Single-threshold segmentation uses the gray histogram method and has a good processing effect for images with approximately the same gray value and contrast. However, this method has great limitations. The gray histogram of the image must be bimodal, and there are obvious differences between the object to be extracted and the background in the image. In actual situations, the gray values and contrasts of image pixels vary greatly, and it is difficult to determine the global threshold to separate the object from the background. Directly using the Otsu algorithm to segment the image can quickly find the between-class segmentation threshold, but when the area difference between the target and the background in the image is large, the histogram has no obvious bimodality, or the sizes of the two peaks are very different, the segmentation effect is not good. The more gray levels involved in the pixel spatial distribution when processing the image, the lower the rationality of the segmentation. At the same time, it is also quite sensitive to noise.

[0005] He et al. were the first to make a breakthrough in the field of image dehazing. They proposed applying the dark channel prior to single-image dehazing, achieving image dehazing by estimating the transmission rate of the image. However, it is prone to failure when the gray value of the target pixel in the scene is close to the atmospheric light, resulting in phenomena such as the overall image being too dark and noise amplification in the dehazed image, and the restored image being prone to color distortion. Meng et al. analyzed the inherent boundary constraint conditions and used the method of context regularization to iteratively optimize and obtain the transmission rate, improving the color distortion phenomenon in the sky area. However, due to the limitations of the boundary constraint conditions, when the foggy image scene has diversity or the brightness range is uncertain, halos appear in the sky area and bright areas of the image after dehazing. Berman et al. proposed a method for estimating the transmission rate of an image based on fuzzy lines and using context regularization. Based on the hypothesis that the colors of the fog-free image can form a tight cluster in RGB, but the physical parameters are not accurate when processing a single image, and halos still appear in the bright areas of the image. Pan et al. analyzed the brightness loss and halo phenomena that are prone to occur in foggy images, and dehazed images with different exposure degrees by segmenting the sky area of the image and combining multi-scale fusion. However, there are problems such as inaccurate segmentation of local sky areas, and the dehazed images have phenomena such as too high brightness and amplified noise. Wei et al. improved the intensity dark channel of pixels in the image through a dehazing method of dark channel fusion and fog density weighting, eliminating the color projection and the sky area with distortion phenomena. However, the color saturation of some images is too high after dehazing, the overall color is too dark, there is partial distortion, and the quality of the sky area after dehazing is not high. Therefore, there is an urgent need for a new image dehazing method.

[0006] Through the above analysis, the problems and defects existing in the prior art are as follows:

[0007] (1) Since the gray value of the sky area in the haze image is generally higher than that of other areas, the estimated value of the atmospheric light in the existing dehazing algorithms is too low, resulting in serious color deviation, detail loss, etc. in the sky area after dehazing, which affects the image dehazing effect.

[0008] (2) In the existing single-threshold segmentation method using the gray histogram, the gray histogram of the image must have a bimodal shape, and there is an obvious difference between the object to be extracted and the background in the image. In actual situations, the gray values and contrast differences of the image pixels are large, and it is difficult to determine the global threshold to separate the object from the background.

[0009] (3) In the existing method of directly using the Otsu algorithm to segment the image, when the area difference between the target and the background in the image is large, the histogram has no obvious bimodal shape or the sizes of the two peaks are very different, the segmentation effect is not good. The more gray levels involved in the pixel spatial distribution when processing the image, the lower the rationality of the segmentation; at the same time, it is also quite sensitive to noise.

[0010] (4) In existing haze removal methods that apply the dark channel prior to a single image, it is prone to failure when processing target pixel grayscales within a scene that are close to the atmospheric light, resulting in phenomena such as the overall image being too dark and noise amplification in the dehazed image, and the restored image being prone to color distortion, etc.

[0011] (5) In existing methods that analyze the inherent boundary constraint conditions and iteratively optimize to obtain the transmittance using the method of context regularization, due to the limitations of the boundary constraint conditions, when the haze image scene has diversity or the brightness range is uncertain, halos appear in the sky area and bright areas of the image after haze removal.

[0012] (6) In existing methods that estimate the image transmittance based on fuzzy lines and use context regularization, the physical parameters are not accurate when processing a single image, and halos still appear in the bright areas of the image.

[0013] (7) In existing methods that perform haze removal on images with different exposure levels by segmenting the sky area of the image and combining multi-scale fusion, there are inaccuracies in segmenting local sky areas, and phenomena such as excessive brightness and amplified noise appear in the dehazed image.

[0014] (8) In existing haze removal methods that use dark channel fusion and fog density weighting, the color saturation of some images is too high after haze removal, the overall color is too dark, partial distortion occurs, and the quality of the sky area after haze removal is not high. Summary of the Invention

[0015] Aiming at the problems existing in the prior art, the present invention provides an image haze removal method, system, computer device, storage medium, and terminal, especially an image haze removal method, system, device, and terminal based on sky area segmentation of an image.

[0016] The present invention is implemented as follows. An image haze removal method, the image haze removal method includes: calculating the cumulative distribution function W(j) according to the adjacent average gray probability of the haze image, determining the average gray value of the concentrated distribution of pixels using the 3σ principle of normal distribution, and combining adaptive threshold segmentation and the dark and bright channel gray values of the sky area to determine the rough threshold for sky area segmentation. According to the maximum connectivity of the sky area, the rough segmentation results of the sky area and the non-sky area are obtained; using guided filtering operations and implementing precise segmentation of the sky area and the non-sky area through the Otsu algorithm, smoothing the edge information of the image and increasing the difference in pixel gray values between the sky and non-sky areas; the non-sky area adopts an improved dark channel prior algorithm to estimate the transmittance, and the sky area adopts logarithmic adaptive transformation to estimate the transmittance. Finally, the transmittances of the sky and non-sky areas are pixel-correspondingly synthesized to achieve haze removal of the image.

[0017] Further, the image haze removal method includes the following steps:

[0018] Step 1: Construct a cumulative distribution function by statistically analyzing the adjacent gray-scale probabilities of the haze image, and obtain the average threshold of pixels based on the degree of concentrated distribution of pixel gray-scale values.

[0019] Step 2: Combine adaptive threshold segmentation and the dark and bright channels of the sky region to determine the minimum value as the rough segmentation threshold of the sky region, and obtain the roughly segmented sky region and non-sky region according to the maximum connectivity of the sky region.

[0020] Step 3: Strengthen the difference in pixel gray-scale values between the sky and non-sky regions through guided filtering, and use the Otsu algorithm to achieve precise segmentation of the sky region and non-sky region.

[0021] Step 4: Estimate the transmittance in the sky region using logarithmic adaptive transformation, estimate the transmittance in the non-sky region using the improved dark channel prior algorithm, and realize image defogging by synthesizing the transmittances of corresponding pixels in the sky and non-sky regions.

[0022] Furthermore, the sky region segmentation includes: calculating the average gray-scale probability distribution histogram of the haze image according to the probability that the number of occurrences of a single gray-scale value in the haze image accounts for the total number of pixels, and constructing a cumulative distribution function W(j) using adjacent gray-scale probability values; locating the concentrated distribution interval of gray-scale pixel points according to the 3σ principle of normal distribution and inversely solving the corresponding average gray-scale value g3, and combining adaptive threshold segmentation and the gray-scale values of the dark and bright channels of the sky through linear weighted operation to determine the interval [a, b] where pixel gray-scale values are concentrated; taking the minimum value in the gray-scale interval as the rough segmentation threshold, selecting the largest connected domain as the segmentation result of the sky region, and using the Otsu algorithm of guided filtering to achieve fine segmentation of the sky region and non-sky region.

[0023] Furthermore, the sky region segmentation algorithm includes:

[0024] (1) Count the number of pixels a at each gray level of the original image i , 0 ≤ i < L, where L = 256 is the total number of gray levels in the image; the probability that the number of pixels with a single gray level value i accounts for the total number of pixels in the image is: a is the total number of pixels in the image, p x (i) is the result of normalizing the histogram of pixels with gray level value i;

[0025] (2) According to the concentrated distribution characteristics of the image gray scale, construct its probability distribution function W x (j) using the adjacent gray-scale probability values of the haze image:

[0026]

[0027] where j ∈ [2, k];

[0028] From the cumulative distribution function graph of the image, it can be obtained that the pixel gray values of the haze image approximately follow the normal distribution 3σ principle: P(μ - 3σ < X ≤ μ + 3σ) = 99.7%, indicating that the probability that the random variable pixel point X falls outside (μ - 3σ, μ + 3σ) is less than three-thousandths, which is considered an impossible event. Therefore, it is considered that the pixel distribution between W1(j) = 0.01 and W2(j) = 0.997 is the most, and the corresponding gray values are calculated and denoted as g1 and g2 respectively; among them, g3 is obtained through cumulative weighted operation as shown in the following formula:

[0029] g3 = (g1 + g2) / 2;

[0030] (3) Use the iterative selection threshold method and combine the dark and bright channels of the sky region to determine the atmospheric light value;

[0031] (4) Combine the gray threshold g3 determined by the cumulative distribution function, the estimated atmospheric light value A c and the iterative selection threshold T to obtain a more accurate interval [a1, b1], and take the minimum pixel value of [a1, b1] as the rough segmentation threshold between the sky region and the non-sky region; screen out the connected region with the largest number of pixels as the sky region, and the remaining connected regions are all used as non-sky regions; among them, the expressions of a1 and b1 are as shown in the following formula:

[0032]

[0033] b1 = (MAX(MAX(T, G3(j)), (A c * 255))) + 1;

[0034] Locate the sky region and non-sky region after rough segmentation. Since the gray difference at the contour edge connection between the sky region and the non-sky region is small, after guided filtering, the edges of the image are smoother, the texture information is more obvious, and the gray difference at the pixel connection between the sky region and the non-sky region increases; after guided filtering, the between-class variance ratio between the foreground and the background is the largest. According to the gray characteristics of the image and using the Otsu algorithm for final correction, the accurate segmentation of the sky region and the non-sky region is realized.

[0035] Furthermore, in step (3), the method of using the iterative selection threshold method and combining the dark and bright channels of the sky region to determine the atmospheric light value includes:

[0036] 1) Select an initial estimate value of T;

[0037] 2) Use the threshold T to divide the image into two regions R1 and R2;

[0038] 3) Calculate the average gray values μ1 and μ2 for all pixels in regions R1 and R2;

[0039] 4) Calculate the new threshold value:

[0040]

[0041] 5) Repeat steps 2) to 4) until the T value obtained by successive iterations is less than a predefined parameter T;

[0042] 6) Obtain the dark and bright channels of the hazy image by using the minimum-maximum filtering twice, obtain the dark and bright channels of the sky region through the iterative threshold, and take the first 1% of the gray value at the I max pixel point as A max , take the first 1% of the gray value at the I min pixel point as A min , and the atmospheric light value A of the pixel channel can be obtained through linear weighting c , and the expression is as shown in the following formula:

[0043] I max = max(max(I));

[0044] I min = min(min(I));

[0045]

[0046] Furthermore, the transmittance synthesis includes:

[0047] For the non-sky region, the transmittance is estimated by using the improved dark channel prior method; the initial transmittance is estimated through the dark channel prior theory, and according to the principle of maximizing the information entropy index parameter, the optimal transmittance weight parameter is iteratively obtained by using a quadratic function to weight the texture information of the image, so as to estimate the transmittance of the non-sky region.

[0048] The dark channel prior defogging theory points out that: in the RGB three channels of a fog-free image, there is always a channel with a very low pixel gray value, and the pixel intensity value of this channel approximately tends to 0. The dark channel prior mathematical model is as shown in the following formula:

[0049]

[0050] Assuming that the atmospheric light value A c is known, after transforming the formula of the dark channel prior mathematical model and performing the minimum filtering operation, the initial transmittance can be obtained according to the dark channel prior theory, as shown in the following formula:

[0051]

[0052] In the formula, ω (0 < ω ≤ 1) is a fixed value introduced to adjust the degree of defogging, is the dark channel image of the non-sky region.

[0053] Use the difference between the dark channel image and the dark channel image after edge enhancement as the texture information of the image:

[0054]

[0055] According to the maximum information entropy parameter index, use the least squares fitting method to construct a quadratic function, and substitute the maximum information entropy value σ of each image into the expression of σ1 to calculate the transmittance weight value, and Estimate the transmittance of the non-sky area by linearly weighting the expressions of, the expression of Δd, and the expression of σ1:

[0056] σ1 = 2.164·σ 2 + 2.638·σ + 0.4922;

[0057]

[0058] For the sky area, use logarithmic transformation to obtain an adaptive transmittance, which is used to smooth the brightness values with obvious fog concentration differences in the dark channel and improve the color cast phenomenon generated in the sky area. The expression is as follows:

[0059]

[0060] Among them, is the sky area part in the haze image; c is one of the RGB channels. Introduce a parameter k (k > 0) to adjust the gray dynamic range. After testing and verification, when k = 1.5, the effect of the sky area in the restored image is the best; among them, RGB min and RGB max The expressions are as follows:

[0061]

[0062] For the non-sky area, use the improved dark channel prior method to estimate the transmittance. For the sky area, use logarithmic transformation to obtain an adaptive transmittance. Use the synthesis method to calculate the transmittance functions t(x, y) of the sky area and the non-sky area, t n (x, y) and t m (x, y). The synthesized transmission function is as follows:

[0063]

[0064] Among them, t n (x, y) is the transmittance of the non-sky area, and t m (x, y) is the transmittance of the sky area; perform guided filtering on the synthesized transmittance t(x, y) to obtain a refined transmittance function.

[0065] The optimized transmittance t after synthesizing the sky and non-sky regions r and the atmospheric light value A of the combined sky region c are used to achieve the haze removal output of the image by the following formula:

[0066]

[0067] Another object of the present invention is to provide an image haze removal system applying the above-mentioned image haze removal method. The image haze removal system includes:

[0068] A haze image statistics module, which is used to construct a cumulative distribution function by statistically analyzing the adjacent gray probability of the haze image, and obtain the average threshold of the pixels according to the degree of concentrated distribution of the pixel gray levels;

[0069] A sky region rough segmentation module, which is used to determine the minimum value as the rough segmentation threshold of the sky region by combining adaptive threshold segmentation and the dark and bright channels of the sky region, and obtain the roughly segmented sky region and non-sky region according to the maximum connectivity of the sky region;

[0070] A sky region precise segmentation module, which is used to enhance the difference in pixel gray levels between the sky and non-sky regions through guided filtering, and use the Otsu algorithm to achieve precise segmentation of the sky region and non-sky region;

[0071] A transmittance synthesis module, which is used to estimate the transmittance of the sky region by logarithmic adaptive transformation, estimate the transmittance of the non-sky region by the improved dark channel prior algorithm, and realize the haze removal of the image by synthesizing the transmittances of the corresponding pixels in the sky and non-sky regions.

[0072] Another object of the present invention is to provide a computer device. The computer device includes a memory and a processor. When the computer program stored in the memory is executed by the processor, the processor performs the following steps:

[0073] According to the adjacent average gray probability of the haze image, calculate the cumulative distribution function W(j), use the 3σ principle of the normal distribution to determine the average gray value of the concentrated distribution of the pixels, and combine adaptive threshold segmentation and the dark and bright channel gray values of the sky region to determine the rough threshold for sky region segmentation. According to the maximum connectivity of the sky region, obtain the rough segmentation results of the sky region and non-sky region; use guided filtering operations and achieve precise segmentation of the sky region and non-sky region through the Otsu algorithm, smooth the edge information of the image and increase the difference in pixel gray levels between the sky and non-sky regions; adopt the improved dark channel prior algorithm to estimate the transmittance of the non-sky region, and adopt logarithmic adaptive transformation to estimate the transmittance of the sky region. Finally, perform pixel-by-pixel synthesis of the transmittances of the sky and non-sky regions to achieve haze removal of the image.

[0074] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the following steps:

[0075] According to the adjacent average gray probability of the haze image, calculate the cumulative distribution function W(j), use the 3σ principle of the normal distribution to determine the average gray value of the concentrated pixel distribution, and combine the adaptive threshold segmentation and the gray values of the dark and bright channels of the sky region to determine the rough threshold for sky region segmentation. According to the maximum connectivity of the sky region, obtain the rough segmentation result of the sky region and the non-sky region; use the guided filtering operation and achieve the accurate segmentation of the sky region and the non-sky region through the Otsu algorithm, smooth the edge information of the image and increase the difference in pixel gray levels between the sky and non-sky regions; for the non-sky region, adopt an improved dark channel prior algorithm to estimate the transmittance, and for the sky region, adopt a logarithmic adaptive transformation to estimate the transmittance. Finally, perform pixel-by-pixel synthesis of the transmittance of the sky and non-sky regions to achieve image defogging.

[0076] Another object of the present invention is to provide an information data processing terminal for implementing the image defogging system described above.

[0077] Combining all the above technical solutions, the advantages and positive effects of the present invention are as follows: The image defogging method provided by the present invention, especially an algorithm for defogging an image by synthesizing the transmittance based on sky region segmentation, accurately segments the sky region and the non-sky region, and the texture details are clear and rich. Compared with the traditional dark channel prior technology, the present invention effectively improves the defects of the traditional segmentation method such as failure in a large-area sky region. Combining the transmittance synthesis algorithm effectively reduces problems such as loss of sky region details and color distortion in the existing algorithms. The defogged image is bright and moderate, the texture details are clear and rich, and the overall visual effect of the defogged image is good.

[0078] The haze removal algorithm for transmissivity synthesis images based on sky region segmentation provided by the present invention constructs a cumulative distribution function by statistically analyzing the adjacent gray probabilities of haze images, obtains the average threshold of pixels according to the degree of concentrated distribution of pixel gray levels, and combines adaptive threshold segmentation and the dark and bright channels of the sky region to determine the minimum value as the rough segmentation threshold of the sky region. The rough segmented sky region and non-sky region are obtained according to the maximum connectivity of the sky region. Further, the difference in pixel gray levels between the sky and non-sky regions is enhanced through guided filtering, and the Otsu algorithm is used to achieve accurate segmentation of the sky region and non-sky region. The transmissivity of the sky region is estimated using logarithmic adaptive transformation, and the transmissivity of the non-sky region is estimated using an improved dark channel prior algorithm. The haze of the image is removed by synthesizing the transmissivities of the corresponding pixels in the sky and non-sky regions. The simulation results show that: this algorithm accurately segments the sky region and non-sky region, the texture details are clear and rich, the haze-removed image is bright and moderate. The experimental results show that the new algorithm effectively improves the problems such as the loss of sky region details and poor haze removal effect in the existing algorithms. Compared with other haze removal algorithms, this algorithm has an average improvement of about 8.03% in objective indicators such as signal-to-noise ratio, average gradient, structural similarity, and information entropy, and the overall visual effect of the haze-removed image is good.

[0079] Aiming at the problems such as poor haze removal effect in the sky region when the existing haze removal algorithms are dealing with bright regions such as large-area sky, strong light sources, and white objects, the present invention proposes a haze removal algorithm for transmissivity synthesis images based on sky region segmentation. Compared with the previous improved haze removal methods, after accurately segmenting the sky region, the proposed algorithm calculates and synthesizes the transmissivities according to the pixel characteristics of the sky region and non-sky region respectively, and the visual sense of the haze-removed image is clear and natural. Good optimization results have been achieved in image haze removal, and the deviation in haze removal in the sky region in the past has been corrected to a certain extent. The algorithm of the present invention obtains a relatively delicate and smooth transmissivity by synthesizing and correcting the transmissivities of the corresponding pixels in the sky and non-sky regions. The atmospheric light value A of the pixel channel can be accurately obtained by calculating the gray value of the pixel point c , overcoming the defect that the dark channel prior algorithm fails in bright regions such as the sky. After haze removal by the algorithm of the present invention, it is ensured that the target pixel points have a natural transition, and the texture contour details are more prominent, which has certain superiority. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required to be used in the embodiments of the present invention. Obviously, the following described drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0081] Figure 1 It is the overall block diagram of the haze removal algorithm provided by the embodiment of the present invention.

[0082] Figure 2 It is the schematic diagram of sky region segmentation provided by the embodiments of the present invention.

[0083] Figure 3 It is the image gray histogram provided by the embodiments of the present invention.

[0084] In the figure, (a) is the foggy image provided by the embodiments of the present invention; (b) is the schematic diagram of the pixel cumulative probability distribution function provided by the embodiments of the present invention.

[0085] Figure 4 It is the schematic diagram of sky region segmentation correction provided by the embodiments of the present invention.

[0086] In the figure, (a) is the original foggy image provided by the embodiments of the present invention; (b) is the schematic diagram of the largest connected region provided by the embodiments of the present invention; (c) is the schematic diagram of guided filtering provided by the embodiments of the present invention; (d) is the schematic diagram of maximum inter-class variance correction provided by the embodiments of the present invention.

[0087] Figure 5 It is the comparison segmentation result graph of different methods provided by the embodiments of the present invention.

[0088] In the figure, (a) is the segmentation schematic diagram of the Otsu algorithm provided by the embodiments of the present invention; (b) is the segmentation schematic diagram of the literature (Pan Jianhong, Gao Yin. Single Image Dehazing Algorithm Based on Sky Region Segmentation and Multi-scale Fusion [J]. Journal of Nanjing University of Science and Technology, 2019, 43(05): 592-599.); (c) is the segmentation schematic diagram of the literature (W. Mei and X. Li, "Single Image Dehazing Using Dark Channel Fusion and Haze Density Weight," 2019 IEEE 9th International Conference on Electronics Information and Emergency Communication (ICEIEC), 2019, pp. 579-585, doi: 10.1109 / ICEIEC.2019.8784493.); (d) is the segmentation schematic diagram of the present invention provided by the embodiments of the present invention; (e) is the original foggy image provided by the embodiments of the present invention.

[0089] Figure 6 It is the comparison schematic diagram of the defogging effect in the light fog scene provided by the embodiments of the present invention.

[0090] In the figure, (a) is the haze image provided by the embodiment of the present invention; (b) is the schematic diagram of the haze removal effect of the He algorithm provided by the embodiment of the present invention; (c) is the schematic diagram of the haze removal effect of the Meng algorithm provided by the embodiment of the present invention; (d) is the schematic diagram of the haze removal effect of the Berman algorithm provided by the embodiment of the present invention; (e) is the schematic diagram of the haze removal effect of the Pan algorithm provided by the embodiment of the present invention; (f) is the schematic diagram of the haze removal effect of the Wei algorithm provided by the embodiment of the present invention; (g) is the schematic diagram of the haze removal effect of the algorithm of the present invention provided by the embodiment of the present invention.

[0091] Figure 7 It is a schematic diagram for comparing the haze removal effects in a thick fog scene provided by the embodiment of the present invention.

[0092] In the figure, (a) is the haze image provided by the embodiment of the present invention; (b) is the schematic diagram of the haze removal effect of the He algorithm provided by the embodiment of the present invention; (c) is the schematic diagram of the haze removal effect of the Meng algorithm provided by the embodiment of the present invention; (d) is the schematic diagram of the haze removal effect of the Berman algorithm provided by the embodiment of the present invention; (e) is the schematic diagram of the haze removal effect of the Pan algorithm provided by the embodiment of the present invention; (f) is the schematic diagram of the haze removal effect of the Wei algorithm provided by the embodiment of the present invention; (g) is the schematic diagram of the haze removal effect of the algorithm of the present invention provided by the embodiment of the present invention.

[0093] Figure 8 It is a schematic diagram for comparing the haze removal effects in a scene with sudden depth of field change provided by the embodiment of the present invention.

[0094] (a) is the haze image provided by the embodiment of the present invention. (b) is the schematic diagram of the haze removal effect of the He algorithm provided by the embodiment of the present invention. (c) is the schematic diagram of the haze removal effect of the Meng algorithm provided by the embodiment of the present invention. (d) is the schematic diagram of the haze removal effect of the Berman algorithm provided by the embodiment of the present invention. (e) is the schematic diagram of the haze removal effect of the Pan algorithm provided by the embodiment of the present invention. (f) is the schematic diagram of the haze removal effect of the Wei algorithm provided by the embodiment of the present invention. (g) is the schematic diagram of the haze removal effect of the algorithm of the present invention provided by the embodiment of the present invention.

[0095] Figure 9 It is a schematic diagram for comparing the haze removal effects in a scene with a large area of sky provided by the embodiment of the present invention.

[0096] In the figure, (a) is the haze image provided by the embodiment of the present invention; (b) is the schematic diagram of the haze removal effect of the He algorithm provided by the embodiment of the present invention; (c) is the schematic diagram of the haze removal effect of the Meng algorithm provided by the embodiment of the present invention;

[0097] (d) is the schematic diagram of the haze removal effect of the Berman algorithm provided by the embodiment of the present invention; (e) is the schematic diagram of the haze removal effect of the Pan algorithm provided by the embodiment of the present invention; (f) is the schematic diagram of the haze removal effect of the Wei algorithm provided by the embodiment of the present invention; (g) is the schematic diagram of the haze removal effect of the algorithm of the present invention provided by the embodiment of the present invention.

[0098] Figure 10 is the haze removal index curve graph provided by the embodiment of the present invention when processing different outdoor scenes.

[0099] Figure 11 is the flowchart of the image haze removal method provided by the embodiment of the present invention.

[0100] Figure 12 is the structural block diagram of the image haze removal system provided by the embodiment of the present invention;

[0101] In the figure: 1. Haze image statistics module; 2. Coarse sky region segmentation module; 3. Precise sky region segmentation module; 4. Transmittance synthesis module. Detailed implementation manners

[0102] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0103] Aiming at the problems existing in the prior art, the present invention provides an image haze removal method, system, computer device, storage medium and terminal. The present invention will be described in detail below with reference to the accompanying drawings.

[0104] As Figure 11 shown, the image haze removal method provided by the embodiment of the present invention includes the following steps:

[0105] S101, constructing a cumulative distribution function by statistically analyzing the adjacent gray probability of the haze image, and obtaining the average threshold of the pixel according to the degree of concentrated distribution of the pixel gray value;

[0106] S102, combining adaptive threshold segmentation and the dark and bright channels of the sky region to determine the minimum value as the coarse segmentation threshold of the sky region, and obtaining the coarsely segmented sky region and non-sky region according to the maximum connectivity of the sky region;

[0107] S103, enhancing the difference in pixel gray values between the sky and non-sky regions through guided filtering, and realizing the precise segmentation of the sky region and non-sky region by using the Otsu algorithm;

[0108] In S104, the transmittance is estimated using logarithmic adaptive transformation for the sky region and an improved dark channel prior algorithm for the non-sky region. Image defogging is achieved by synthesizing the transmittances of corresponding pixels in the sky and non-sky regions.

[0109] As Figure 12 shown, the image defogging system provided by an embodiment of the present invention includes:

[0110] A haze image statistics module 1, configured to construct a cumulative distribution function by statistically analyzing the adjacent gray probability of the haze image, and obtain the average threshold of pixels according to the degree of concentrated distribution of pixel gray levels;

[0111] A sky region rough segmentation module 2, configured to determine the minimum value as the rough segmentation threshold of the sky region by combining adaptive threshold segmentation and the dark and bright channels of the sky region, and obtain the roughly segmented sky region and non-sky region according to the maximum connectivity of the sky region;

[0112] A sky region precise segmentation module 3, configured to enhance the difference in pixel gray levels between the sky and non-sky regions through guided filtering, and achieve precise segmentation of the sky region and non-sky region using the Otsu algorithm;

[0113] A transmittance synthesis module 4, configured to estimate the transmittance using logarithmic adaptive transformation for the sky region and an improved dark channel prior algorithm for the non-sky region, and achieve image defogging by synthesizing the transmittances of corresponding pixels in the sky and non-sky regions.

[0114] The technical solution of the present invention will be further described below in conjunction with specific embodiments.

[0115] 1. The present invention proposes a transmittance synthesis image defogging algorithm based on sky region segmentation, which accurately segments the sky region and non-sky region, and has clear and rich texture details. Compared with traditional dark channel prior technologies, the present invention effectively improves the defects of traditional segmentation methods that fail in large-area sky regions, and effectively reduces problems such as sky region detail loss and color distortion in existing algorithms by combining the transmittance synthesis algorithm. The defogged image is bright and moderate, with clear and rich texture details, and the overall visual effect of the defogged image is good.

[0116] The present invention proposes a haze removal algorithm for transmissivity composite images based on sky region segmentation. By statistically analyzing the adjacent gray probability of a haze image, a cumulative distribution function is constructed. The average threshold of pixels is obtained according to the degree of concentrated distribution of pixel gray levels. Combining adaptive threshold segmentation and the dark and bright channels of the sky region, the minimum value is determined as the rough segmentation threshold of the sky region. The roughly segmented sky region and non-sky region are obtained based on the maximum connectivity of the sky region. Further, guided filtering is used to enhance the difference in pixel gray levels between the sky and non-sky regions, and the Otsu algorithm is used to achieve accurate segmentation of the sky region and non-sky region. The transmissivity of the sky region is estimated using logarithmic adaptive transformation, and the transmissivity of the non-sky region is estimated using an improved dark channel prior algorithm. The haze of the image is removed by synthesizing the transmissivities of the corresponding pixels in the sky and non-sky regions. The simulation results show that: this algorithm accurately segments the sky region and non-sky region, with rich and clear texture details. The haze-removed image is bright and moderate. The experimental results show that the new algorithm effectively improves problems such as the loss of sky region details and poor haze removal effect in the existing algorithms. Compared with other haze removal algorithms, this algorithm on average improves by about 8.03% in objective indicators such as signal-to-noise ratio, average gradient, structural similarity, and information entropy, and the overall visual effect of the haze-removed image is good.

[0117] 2. Atmospheric Scattering Model

[0118] The atmospheric scattering model describes in detail the formation process of images under haze weather conditions. The specific mathematical model is shown in formula (1).

[0119] I(x) = J(x)·t(x) + A·(1 - t(x)) (1)

[0120] Where, I(x) is the hazy image, A is the global atmospheric light value, J(x) is the haze-free image; t(x) is the transmissivity; A(1 - t(x)) is the energy value that reaches the imaging device after attenuation.

[0121] By transforming formula (1), the haze-free image J(x) as shown in formula (2) is obtained.

[0122]

[0123] The present invention proposes a haze removal algorithm for synthetic images of transmittance based on sky region segmentation. According to the adjacent average gray probability of the haze image, the cumulative distribution function W(j) is calculated. Using the 3σ principle of the normal distribution, the average gray value of the concentrated distribution of pixels is determined. Combining adaptive threshold segmentation and the gray values of the dark and bright channels of the sky region, the rough threshold for sky region segmentation is determined. According to the maximum connectivity of the sky region, the rough segmentation results of the sky region and the non-sky region are obtained. To smooth the edge information of the image and increase the difference in pixel gray values between the sky and non-sky regions, guided filtering operations are used, and the Otsu algorithm is used to achieve the precise segmentation of the sky region and the non-sky region. The improved dark channel prior algorithm is used to estimate the transmittance of the non-sky region; the logarithmic adaptive transformation is used to estimate the transmittance of the sky region. Finally, the transmittances of the sky and non-sky regions are synthesized pixel by pixel to achieve haze removal of the image. The specific algorithm principle block diagram is as shown in Figure 1 shown.

[0124] 3. Sky Region Segmentation

[0125] According to the probability that the number of occurrences of a single gray value in the haze image accounts for the total number of pixels, the average gray probability distribution histogram of the haze image is calculated. The cumulative distribution function W(j) is constructed using adjacent gray probability values. According to the 3σ principle of the normal distribution, the concentrated distribution interval of gray pixel points is located and the corresponding average gray value g3 is solved. Combining adaptive threshold segmentation and the gray values of the dark and bright channels of the sky after linear weighted operation, the interval [a, b] where the pixel gray values are concentrated is determined. The minimum value in this gray interval is used as the rough segmentation threshold, and the largest connected domain is selected as the segmentation result of the sky region. The Otsu algorithm of guided filtering is used to achieve the fine segmentation of the sky region and the non-sky region.

[0126] The specific algorithm for sky region segmentation is as shown in Figure 2 shown.

[0127] (1) Count the number of pixels a of each gray level in the original image i , 0 ≤ i < L, where L = 256 is the total number of gray levels in the image; the probability that the pixels with a single gray value of i account for the total number of pixels in the image is: a is the total number of pixels in the image, p x (i) is the result of normalizing the histogram of pixels with a gray value of i.

[0128] (2) According to the concentrated distribution characteristics of the image gray levels, use the adjacent gray probability values of the haze image to construct its probability distribution function W x (j), where j ∈ [2, k].

[0129]

[0130] From the cumulative distribution function graph of the image, it can be obtained that the pixel gray values of the haze image approximately follow the 3σ principle of the normal distribution: P(μ - 3σ < X ≤ μ + 3σ) = 99.7%, indicating that the probability that the random variable pixel point X falls outside (μ - 3σ, μ + 3σ) is less than three-thousandths, which is considered an impossible event. Therefore, it can be considered that the pixel distribution between W1(j) = 0.01 and W2(j) = 0.997 is the largest, and the corresponding gray values are calculated and denoted as g1 and g2 respectively, as Figure 3 shown. Through the cumulative weighting operation, g3 can be obtained as shown in Equation (4).

[0131] g3 = (g1 + g2) / 2 (4)

[0132] (3) Use the iterative selection threshold method and combine the dark and bright channels of the sky region to determine the atmospheric light value. The specific algorithm is as follows:

[0133] a. Select an initial estimate value of T.

[0134] b. Use the threshold T to divide the image into two regions R1 and R2.

[0135] c. Calculate the average gray values μ1 and μ2 for all pixels in regions R1 and R2.

[0136] d. Calculate the new threshold:

[0137]

[0138] e. Repeat steps (b) to (d) until the T value obtained by successive iterations is less than a predefined parameter T.

[0139] f. Use two minimum-maximum filters to obtain the dark and bright channels of the haze image, and obtain the dark and bright channels of the sky region through iterative thresholds, as shown in Formulas (6) and (7). And take the first 1% of the gray value at the I max pixel point as A max and take the first 1% of the gray value at the I min pixel point as A min . Through linear weighting, the atmospheric light value A of the pixel channel can be obtained c . The specific expression is as shown in Equation (8).

[0140] I max = max(max(I)) (6)

[0141] I min = min(min(I)) (7)

[0142]

[0143] Further combine the gray threshold g3 and the atmospheric light estimate A determined by the cumulative distribution functionc and an iterative selection threshold T to obtain a more accurate interval [a1, b1]. The specific expressions of a1 and b1 are shown in Equations (9) and (10). The minimum pixel value of [a1, b1] is used as the rough segmentation threshold between the sky region and the non-sky region. Since the gray pixel values in the sky region are generally higher and tend to be consistent compared to the non-sky region, the connected region with the largest number of pixels is selected as the sky region, and the remaining connected regions are all regarded as non-sky regions.

[0144]

[0145] Locate the sky region and the non-sky region after rough segmentation. Since the gray difference at the contour edge connection between the sky region and the non-sky region is small, after guided filtering, the edges of the image are smoother, the texture information is more obvious, and the gray difference at the pixel connection between the sky region and the non-sky region increases, as Figure 4 shown. After guided filtering, the between-class variance ratio between the foreground and the background is the largest. The Otsu algorithm can be used for the final correction according to the gray characteristics of the image to achieve the accurate segmentation of the sky region and the non-sky region, as Figure 4 shown.

[0146] As Figure 5 shown, the original haze images selected under different scenarios are respectively the comparison results after segmentation by the Otsu algorithm, the literature (Pan Jianhong, Gao Yin. Single Image Restoration Algorithm for Hazy Days Based on Sky Region Segmentation and Multi-Scale Fusion [J]. Journal of Nanjing University of Science and Technology, 2019, 43(05): 592 - 599.), the literature (W. Mei and X. Li, "Single Image Dehazing Using DarkChannel Fusion and Haze Density Weight," 2019 IEEE 9th International Conference on Electronics Information and Emergency Communication (ICEIEC), 2019, pp. 579 - 585, doi: 10.1109 / ICEIEC.2019.8784493.), and the algorithm of the present invention. As Figure 5 can be seen, the first four segmentation algorithms will misjudge white and brighter regions as the sky region, and the segmentation is not fine, while the proposed segmentation algorithm can accurately divide the sky region. It shows that the improved segmentation algorithm of the present invention is more effective. The specific analysis is as follows:

[0147] After the Otsu algorithm is processed, in an image with a large area of interfering white non-sky regions, it is easy to cause a large error in the segmented image, as Figure 5In (a-2), the white bricks in the central square are misidentified as the sky area. The trees in the upper left corner of the image are also misidentified as the sky area. The contrast and brightness change between the sky area and the non-sky area are relatively small, and the image fails to be accurately segmented. For example, a large mountain area at the sky junction in 5(a-1) is misidentified as the sky area.

[0148] In the literature (Pan Jianhong, Gao Yin. Single foggy image restoration algorithm based on sky area segmentation and multi-scale fusion [J]. Journal of Nanjing University of Science and Technology, 2019, 43(05): 592-599.), there will be detail loss in the edge contours of some images after the algorithm processing. For example, Figure 5 In (b-2), the edge contour of the stadium is missing. The tree part in the upper left corner of the image is missegmented as the sky area. At the same time, there is a protrusion in the upper right corner of the image, and part of the sky area is segmented incorrectly. Also, in the scene with a large sky area and a large depth of field, the white area in the mountain peak image is misidentified as the sky area. For example, Figure 5 Three positions with high brightness at the mountain peak in (b-1) and Figure 5 The approximate white areas such as the snow on the mountain peak in (b-3) are all misidentified as the sky area.

[0149] In the literature (W. Mei and X. Li, "Single Image Dehazing Using Dark Channel Fusion and Haze Density Weight," 2019 IEEE 9th International Conference on Electronics Information and Emergency Communication (ICEIEC), 2019, pp. 579-585, doi: 10.1109 / ICEIEC.2019.8784493.), the processing effect of the algorithm in segmenting the sky area is significantly better than that of the Otsu algorithm and the algorithm in the literature (Pan Jianhong, Gao Yin. Single foggy image restoration algorithm based on sky area segmentation and multi-scale fusion [J]. Journal of Nanjing University of Science and Technology, 2019, 43(05): 592-599.). For example, Figure 5 In (c-3), most of the mountain peak contours are segmented correctly. However, the segmentation of some detail contours in the single image is not fine enough. For example, Figure 5 The part with high brightness of the mountain peak in (c-1) is missegmented as the sky area and Figure 5 Part of the snow area at the top of the mountain peak in (c-3) is missegmented as the sky area.

[0150] The algorithm of the present invention realizes the accurate segmentation of the sky area and the non-sky area by strengthening the difference in pixel gray levels between the sky and the non-sky areas. The texture details of the segmented image are clear and rich. For example, Figure 5(d-1) The middle sky area, the distant mountains, and Figure 5 (d-3) The white areas in the mountains are all accurately segmented to avoid being interfered by the white areas in the image. When dealing with an image containing a large area of approximately sky white areas, the algorithm of the present invention effectively avoids the situation that the Otsu algorithm and the algorithm in the literature (Pan Jianhong, Gao Yin. Single-image foggy image restoration algorithm based on sky area segmentation and multi-scale fusion [J]. Journal of Nanjing University of Science and Technology, 2019, 43(05): 592-599.) mis-segment large non-sky areas and have poor detail edge processing, such as Figure 5 (d-2) The stadium and the adjacent buildings are accurately recognized. The algorithm of the present invention accurately locates the sky area, and the detail edge contour is clear, such as Figure 5 (d-1) When segmenting the junction of the mountain and the sky area, the segmentation is accurate and the detail edge is smoothly processed. Such as Figure 5 (d-2) The edge contour of the trees in the upper left corner of the image is finely segmented and the edge contour of the building in the upper right corner is clear.

[0151] 4. Transmission rate synthesis

[0152] For the non-sky area, an improved dark channel prior method is used to estimate the transmission rate. The initial transmission rate is estimated through the dark channel prior theory. According to the principle of maximizing the information entropy index parameter, a unary quadratic function is used to iteratively obtain the optimal transmission rate weight parameter to weight the texture information of the image, so as to estimate the transmission rate of the non-sky area.

[0153] The dark channel prior defogging theory points out that: in the RGB three channels of a fog-free image, there is always a channel with a very low pixel gray value, and the pixel intensity value of this channel approximately tends to 0. The dark channel prior mathematical model is shown in formula (11).

[0154]

[0155] Assume the atmospheric light value A c is known. After transforming formula (11) and performing a minimum filtering operation, the initial transmission rate can be obtained according to the dark channel prior theory, as shown in formula (12).

[0156]

[0157] In the formula, ω(0 < ω ≤ 1) is a fixed value introduced to adjust the degree of defogging, is the dark channel image of the non-sky area.

[0158] The difference between the dark channel image and the edge-enhanced dark channel image is used as the texture information of the image.

[0159]

[0160] According to the maximum information entropy parameter index, a quadratic function was constructed by the least squares fitting method. The maximum value of information entropy σ of each image was substituted into formula (14), and the transmittance weight value could be calculated. The transmittance of the non-sky region was estimated by linearly weighting formulas (12), (13), and (14).

[0161] σ1 = 2.1464·σ 2 + 2.638·σ + 0.4922 (14)

[0162]

[0163] For the sky region, the logarithmic transformation was used to obtain the adaptive transmittance, which was used to smooth the luminance values with obvious fog concentration differences in the dark channel and improve the color deviation phenomenon in the sky region. The specific expression is shown in formula (16).

[0164]

[0165] Among them, is the sky region part of the haze image; c is one of the RGB channels, and the specific expressions of RGB min and RGB max are shown in formula (17). The parameter k (k > 0) was introduced to adjust the gray dynamic range. After testing and verification, when k = 1.5, the effect of the sky region in the restored image is the best.

[0166]

[0167] For the non-sky region, the improved dark channel prior method was used to estimate the transmittance. For the sky region, the logarithmic transformation was used to obtain the adaptive transmittance. The synthetic method was used to calculate the transmittance functions t(x, y), t n (x, y) and t m (x, y) of the sky region and the non-sky region. The synthetic transmission function is shown in formula (18).

[0168]

[0169] Among them, t n (x, y) is the transmittance of the non-sky region, and t m (x, y) is the transmittance of the sky region. The guided filtering process was performed on the synthetic transmittance t(x, y) to obtain the refined transmittance function.

[0170] After synthesizing the sky and non-sky regions, the optimized transmittance t r , and the atmospheric light value A c of the combined sky region were used to realize the defogging output of the image by using formula (19).

[0171]

[0172] The technical effects of the present invention will be described in detail below in combination with simulations.

[0173] The defogging algorithm proposed by the present invention calculates the cumulative distribution function from the hazy image, and uses the normal distribution in combination with adaptive threshold segmentation and the gray values of the dark and bright channels of the sky region, etc., to first determine the rough segmentation result of the sky region. Further, the guided filtering operation is used and the Otsu algorithm is used to achieve the accurate segmentation of the sky region and the non-sky region. By using the transmittance synthesized from the synthetic sky region and the non-sky region, the block effect between the sky region and the non-sky region can be effectively avoided. In the above transmittance synthesis, the improved dark channel prior algorithm is used to estimate the transmittance of the non-sky region, and the logarithmic adaptive transformation is used to estimate the transmittance of the sky region. Finally, the transmittance of the sky and non-sky regions is pixel-correspondingly synthesized to achieve image defogging.

[0174] To ensure the effectiveness of the algorithm proposed by the present invention, 8 commonly used real hazy images in different scenes with light fog, thick fog, drastic depth-of-field changes, and large sky regions are selected for simulation verification, and the experimental results are evaluated, analyzed, and compared with the mainstream defogging methods in the defogging field such as He, Meng, Berman, Pan, and Wei. The processing results are as Figures 6 - 9 shown. By observing Figures 6 - 9 it can be obtained that:

[0175] After defogging by He et al., the influence of haze is basically eliminated. Due to the use of minimum filtering, the transmittance map does not change with the depth of field, overestimating the thickness of haze in slightly blurred regions, and the overall image after defogging is darker, such as Figure 9 the sewer in front of the stadium, etc. At the same time, there are white halo phenomena to varying degrees at the depth-of-field edges, such as Figure 6 at the edges of the clothes worn by the two observing people in Figure 6 the contour edges of the mountain in Figure 7 the contour of the vehicle body in Figure 8 the depth-of-field connection of the ginkgo leaves in Figure 9 the outer contour edges of the buildings in Figure 9 the sky region in

[0176] Based on the dark channel prior, Meng et al. used boundary constraints for the optimization of the transmittance, eliminating the vignetting effect of the dark channel, and having a good visual processing effect on foggy images in scenes such as light fog and depth of field. Such as Figure 6 and 8This algorithm does not optimize the color fidelity of the dehazed image. Therefore, the sky and other areas have obvious color distortion after dehazing due to the small transmittance change and relatively smooth pixels, and the visual effect is poor. Figure 7 as well as Figure 9 At the same time, for scenes with high fog density, the processed image is darker, such as Figure 7 The buildings in the middle and the path in the foreground.

[0177] Berman et al. achieved defogging by clustering the original fog image. They assumed that all pixels of the foggy image were concentrated on the fog line composed of atmospheric light and fog-free pixels, which resulted in an underestimation of the transmittance at different depths and failed to effectively remove the haze in the depth of field. Figure 8 At the same time, color cast occurs in the image depth mutation area, as shown in Figure 8 Ginkgo leaves in the middle depth of the field. Figure 7 , Figure 9 The road in the foreground area is generally dark, and the image is unnatural after defogging.

[0178] Pan et al. defog images with different exposure levels by segmenting the sky area of ​​the image and combining multi-scale fusion. This method has a certain effect on dealing with the halo phenomenon of foggy images, and has a better defogging effect on images of misty scenes. However, due to the inaccurate segmentation of the local sky area, it is easy to cause image brightness loss and blurred edge details, such as Figure 6 The mountain areas in Figure 9 In addition, the restored image has problems such as excessive color brightness, such as Figure 7 The middle sky area is bright white overall.

[0179] Wei et al. used the defogging method of dark channel fusion and fog density weighting to eliminate color projection, improve the defogging effect of the sky area, restore the clarity of close-up details, and achieve good defogging effect for images in misty scenes. Figure 6 The color brightness of the outline details of the Forbidden City, such as the eaves and the railings of the characters, is moderate. However, the defogging is insufficient in the area with sudden depth of field changes, such as Figure 8 As shown in Figure 2. The defogging effect of the image after defogging in a dense fog scene is poor, as shown in Figure 2. Figure 7 In addition, the quality of the sky area after defogging is not high, the overall color is dark, and the color saturation is too high, as shown in Figure 9 shown.

[0180] The precise segmentation and defogging algorithm based on the sky region proposed by the present invention can effectively avoid the situation where the sky region is treated as a non-sky region, resulting in poor defogging effect. The algorithm of the present invention performs precise segmentation in the sky region. After defogging, the defogging effect at the junction of the sky region and the non-sky region is natural, clearly visible, and the edge processing is smooth. The algorithm of the present invention considers the particularity of the depth-of-field region. In the non-sky region, an improved dark channel prior method is adopted, and in the sky region, logarithmic transformation is used to obtain an adaptive transmittance. The transmittances of the sky region and the non-sky region are synthesized and corrected, so that the algorithm can be comparable to 5 mainstream defogging algorithms when dealing with thin fog scenes. In bright regions such as the sky and regions with sudden depth-of-field changes, the defogging effect has rich detail information, no obvious artifacts and color offsets, and the contrast is moderate, meeting people's visual experience. As Figure 8 In Figure 8 , the edge details in the depths of the woods are restored with higher degree, the residual fog is eliminated, and the sense of hierarchy is more obvious. Figure 6 In Figure 6 , the stepped walkways in the distance are clearly visible. The defogging effect in the thick fog region is also better than that of the 5 comparison algorithms, and it better suppresses the color distortion phenomenon caused by too small estimation of the transmittance in the bright region, and the restored image is clear and natural. As Figure 9 In the image of the stadium with a large area of sky region in Figure 9 , the sky region and the non-sky region are precisely segmented. The defogged image of the front square of the stadium is clearly visible, the trees in the upper left corner are restored clearly visible, the brightness is moderate, and the defogging effect of the image is good.

[0181] To objectively compare the algorithm of the present invention with defogging algorithms such as He, Meng, Berman, Pan, and Wei, objective evaluation indicators are used to Figures 6 - 9 quantitatively analyze the defogging effect. As Figure 10 shown. It can be seen from the figure that: on the premise of ensuring no defogging distortion, from the overall objective data curve, it can be observed that after defogging 8 real images by the algorithm of the present invention, compared with other defogging algorithms, the proposed algorithm has an average increase of 8.06% in signal-to-noise ratio, an average increase of 11.35% in average gradient, an average increase of 9.15% in structural similarity, and an average increase of 2.23% in information entropy, indicating that the algorithm of the present invention has a certain degree of improvement in improving image distortion, maintaining structural similarity, and image information volume, and is more in line with the actual visual effect.

[0182] Table 1 Related evaluation indicators of different algorithms

[0183]

[0184]

[0185] In summary, through the above analysis, it can be obtained that: the algorithm of the present invention synthesizes and corrects the transmittance of corresponding pixels in the sky and non-sky regions to obtain a relatively delicate and smooth transmittance. By calculating the gray value of pixel points, the atmospheric light value A of the pixel channel can be accurately obtained. c It overcomes the defect that the dark channel prior algorithm fails in bright regions such as the sky. After defogging by the algorithm of the present invention, it ensures that the target pixel points have a natural transition, and the texture contour details are more prominent, showing certain superiority.

[0186] Aiming at the problems that the existing defogging algorithms cause poor defogging effects in bright regions such as large areas of sky, strong light sources, and white objects, the present invention proposes a transmittance synthesis image defogging algorithm based on sky region segmentation. Compared with the previous improved defogging methods, after accurately segmenting the sky region, the proposed algorithm calculates and synthesizes the transmittance according to the pixel characteristics of the sky region and the non-sky region respectively. The defogged image has a clear and natural visual sense. Good optimization results have been achieved in image defogging, and to a certain extent, the deviation in sky region defogging in the past has been corrected.

[0187] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in whole or in part in the form of a computer program product, the computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access, or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state disk (SSD)).

[0188] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention shall cover any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention within the protection scope of the present invention.

Claims

1. An image defogging method, characterized in that, The image dehazing method calculates the cumulative distribution function W(j) according to the adjacent average gray probability of the hazy image, and determines the average gray value of the concentrated pixel distribution by using the 3σ principle of the normal distribution. Combining the adaptive threshold segmentation and the dark and bright channel gray values of the sky region, the rough threshold for sky region segmentation is determined, and according to the maximum connectivity of the sky region, the rough segmentation results of the sky region and the non-sky region are obtained. Using the guided filter operation and implementing the precise segmentation of the sky region and the non-sky region through the Otsu algorithm, the edge information of the image is smoothed and the difference in pixel gray values between the sky and the non-sky regions is increased. The improved dark channel prior algorithm is used to estimate the transmittance in the non-sky region, and the logarithmic adaptive transformation is used to estimate the transmittance in the sky region. Finally, the transmittances of the sky and non-sky regions are pixel-correspondingly synthesized to achieve image dehazing. The transmittance synthesis includes: the improved dark channel prior method is used to estimate the transmittance in the non-sky region; the initial transmittance is estimated through the dark channel prior theory, and according to the principle of maximizing the information entropy index parameter, the optimal transmittance weight parameter is iteratively obtained by using a quadratic function to weight the texture information of the image, and the transmittance in the non-sky region is estimated. The dark channel prior dehazing theory points out that in the RGB three channels of a fog-free image, a channel with a very low pixel gray value can always be found, and the pixel intensity value of this channel approximately tends to 0. The dark channel prior mathematical model is shown as the following formula: Assuming that the atmospheric light value Ac is known, after transforming the formula of the dark channel prior mathematical model and performing the minimum filtering operation, the initial transmittance can be obtained according to the dark channel prior theory, as shown in the following formula: where ω (0 < ω ≤ 1) is a fixed value introduced to adjust the degree of defogging, is the dark channel image of the non-sky region; The difference between the dark channel image and the edge-enhanced dark channel image is used as the texture information of the image. According to the maximum information entropy parameter index, a quadratic function is constructed by the least square fitting method, and the maximum value of information entropy σ of each image is substituted into the expression of σ1 to calculate the transmittance weight value, and the expressions of, the expression of Δd and the expression of σ1 are linearly weighted to estimate the transmittance of the non-sky region: σ1 = 2.164·σ 2 + 2.638·σ + 0.4922; The logarithmic transformation is used in the sky region to obtain an adaptive transmittance, which is used to smooth the brightness values with obvious fog concentration differences in the dark channel and improve the color cast phenomenon generated in the sky region. The expression is shown as the following formula: Among them, is the sky area part in the haze image; c is one of the RGB channels, and a parameter k (k>0) is introduced to adjust the gray-scale dynamic range. After testing and verification, when k = 1.5, the effect of the sky area in the restored image is the best; among them, RGB min and RGB max The expressions of are shown as follows: The transmittance of the non-sky region is estimated by an improved dark channel prior method, and the transmittance of the sky region is obtained by logarithmic transformation to get an adaptive transmittance. A synthesis method is used to calculate the transmittance functions t(x, y), t n (x, y) and t m (x, y). The synthesized transmission function is shown as follows: where t n (x, y) is the transmittance of the non-sky region, and t m (x, y) is the transmittance of the sky region; the guided filtering process is performed on the synthesized transmittance t(x, y) to obtain a refined transmittance function; The optimized transmittance t after synthesizing the sky and non-sky regions r , and the atmospheric light value A of the combined sky region c , the defogging output of the image is realized using the following formula:

2. The image defogging method according to claim 1, wherein, The image dehazing method includes the following steps: Step 1, construct a cumulative distribution function by statistically analyzing the adjacent gray probabilities of the hazy image, and obtain the average threshold of the pixels according to the concentrated distribution degree of the pixel gray values. Step 2, combine the adaptive threshold segmentation and the dark and bright channels of the sky region to determine the minimum value as the rough segmentation threshold of the sky region, and obtain the rough segmented sky region and non-sky region according to the maximum connectivity of the sky region. Step 3, enhance the difference in pixel gray values between the sky and non-sky regions through the guided filter, and use the Otsu algorithm to achieve the precise segmentation of the sky region and the non-sky region. Step 4, estimate the transmittance in the sky region by using the logarithmic adaptive transformation, estimate the transmittance in the non-sky region by using the improved dark channel prior algorithm, and achieve image dehazing by synthesizing the transmittances of the corresponding pixels in the sky and non-sky regions.

3. The image defogging method according to claim 1, wherein The sky region segmentation includes: calculating the average gray probability distribution histogram of the haze image according to the probability that the number of occurrences of a single gray value in the haze image accounts for the total number of pixels, and constructing a cumulative distribution function W(j) using adjacent gray probability values; locating the concentrated distribution interval of gray pixels according to the 3σ principle of normal distribution and inversely solving the corresponding average gray value g3, and determining the interval [a, b] where the pixel gray values are concentrated after linear weighted operations on the dark and bright channel gray values of the sky in combination with adaptive threshold segmentation; using the minimum value in the gray interval as the threshold for rough segmentation, selecting the largest connected domain as the segmentation result of the sky region, and realizing the fine segmentation of the sky region and the non-sky region using the Otsu algorithm of guided filtering.

4. The image defogging method according to claim 3, wherein The sky region segmentation algorithm includes: (1) Count the number of pixels a at each gray level of the original image i , 0 ≤ i < L, where L = 256 is the total number of gray levels in the image; the probability that the pixels with a single gray value i account for the total number of pixels in the image is: a is the total number of pixels in the image, p x (i) is the result of normalizing the pixel histogram with gray value i; (2) According to the concentrated distribution characteristics of the image gray level, construct its probability distribution function W using the adjacent gray level probability values of the haze image x (j): where j ∈ [2, k]; It can be obtained from the cumulative distribution function graph of the image that the pixel gray values of the haze image approximately follow the 3σ principle of normal distribution: P(μ - 3σ < X ≤ μ + 3σ) = 99.7%, indicating that the probability that the random variable pixel point X falls outside (μ - 3σ, μ + 3σ) is less than three thousandths, which is considered an impossible event. Therefore, it is considered that the pixel distribution is the most between W1(j) = 0.01 and W2(j) = 0.997, and the corresponding gray values are calculated and recorded as g1 and g2 respectively; among them, g3 is obtained through cumulative weighting operation as shown in the following formula: g3 = (g1 + g2) / 2; (3) Using the iterative selection threshold method and combining the dark and bright channels of the sky region to determine the atmospheric light value; (4) The gray threshold g3 and the estimated atmospheric light value A determined in combination with the cumulative distribution function c and the iteratively selected threshold T are used to obtain a more accurate interval [a1, b1], and the minimum pixel value of [a1, b1] is used as the rough segmentation threshold between the sky region and the non-sky region; the connected region with the largest number of pixels is selected as the sky region, and the remaining connected regions are all used as non-sky regions; wherein, the expressions of a1 and b1 are shown as follows: b1 = (MAX(MAX(T, G3(j)), (A c * 255)) + 1; Locate the sky region and non-sky region after rough segmentation. Since the gray difference at the contour edge connection between the sky region and the non-sky region is small, after guided filtering, the edges of the image are smoother, the texture information is more obvious, and the gray difference at the pixel connection between the sky region and the non-sky region increases; the between-class variance ratio of the foreground and background after guided filtering is the largest. According to the gray characteristics of the image and using the Otsu algorithm for final correction, the accurate segmentation of the sky region and the non-sky region is realized.

5. The image defogging method according to claim 4, wherein, In step (3), the method of using the iterative selection threshold method and combining the dark and bright channels of the sky region to determine the atmospheric light value includes: 1) Select an initial estimate value of T; 2) Use the threshold T to divide the image into two regions R1 and R2; 3) Calculate the average gray values μ1 and μ2 for all pixels in regions R1 and R2; 4) Calculate a new threshold: 5) Repeat steps 2) to 4) until the T value obtained by successive iterations is less than a predefined parameter T; 6) The dark and bright channels of the haze image are obtained by using the minimum-maximum filtering twice. The dark and bright channels of the sky region are obtained through iterative thresholding, and the top 1% of the gray values at the max pixel points are taken as A max , and the top 1% of the gray values at the min pixel points are taken as A min . The atmospheric light value A of the pixel channel is obtained by linear weighting c . The expression is shown as follows: I max = max(max(I)); I min = min(min(I)); 6. An image defogging system for implementing the image defogging method according to any one of claims 1 to 5, characterized in that The image dehazing system includes: A haze image statistics module for constructing a cumulative distribution function by statistically analyzing the adjacent gray probabilities of the haze image and obtaining the average threshold of the pixels according to the degree of concentrated distribution of the pixel gray values; A sky region rough segmentation module for determining the minimum value as the rough segmentation threshold of the sky region by combining adaptive threshold segmentation and the dark and bright channels of the sky region, and obtaining the rough segmented sky region and non-sky region according to the maximum connectivity of the sky region; Sky region precise segmentation module, which is used to enhance the difference in pixel grayscale between the sky and non-sky regions through guided filtering, and utilize the Otsu algorithm to achieve precise segmentation of the sky region and non-sky region; Transmittance synthesis module, which is used to estimate the transmittance of the sky region using logarithmic adaptive transformation, estimate the transmittance of the non-sky region using the improved dark channel prior algorithm, and achieve image defogging by synthesizing the transmittances of corresponding pixels in the sky and non-sky regions.

7. A computer device, characterized in that, The computer device includes a memory and a processor. When the computer program stored in the memory is executed by the processor, the processor is caused to execute the steps of the image defogging method according to any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, which when executed by a processor, causes the processor to execute the steps of the image defogging method according to any one of claims 1 to 5.

9. An information data processing terminal, characterized in that, The information data processing terminal is used to implement the image defogging system according to claim 6.