Improved image defogging method and device based on atmospheric scattering model
By performing color channel balance, atmospheric light intensity calculation and segmentation defogging treatment on haze images, combined with correction and splicing technology, the problems of darker image and halo effect in the existing defogging algorithm are solved, significantly improving the accuracy and contrast of the image.
Patent Information
- Application Number
- CN202411647776.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-04-18
AI Technical Summary
When the existing fog removal algorithm processes haze images, it leads to darker and halo effects in the images after fog removal, which has low accuracy.
By performing color channel balance processing on the foggy image to be processed, the target atmospheric light intensity value is calculated, and the transmittance image and preset segmentation threshold are used for segmentation and defogging, combining correction and stitching technology to improve the accuracy of the image.
It effectively improves the image accuracy after defogging, reduces the darkness and halo effects, and improves the contrast and information volume of the image.
Smart Images

Figure CN119850465A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an image defogging method and device based on an improved atmospheric scattering model. Background Art
[0002] In haze scenes, the propagation of light will be affected by the scattering of suspended particles in the air. Since suspended particles in the air absorb and scatter light, the image quality of the deep scene area obtained by the camera device will be reduced. The reduction in image quality will cause the loss of key information of the image obtained by imaging equipment such as video surveillance, aerial photography drones, and vehicle-mounted assisted driving systems, and the contrast will be greatly reduced, making it impossible to work effectively. Therefore, it is of great practical significance to improve the amount of information contained in the image by using an improved image defogging method based on the atmospheric scattering model for haze images.
[0003] After the dehazing process is performed by the existing traditional dehazing algorithm, the dehazing image obtained is usually dark, which leads to poor accuracy of the image obtained after the dehazing process. Summary of the invention
[0004] The present invention provides an image defogging method and device based on an improved atmospheric scattering model, so as to solve the technical problem of low accuracy when defogging a foggy image to be processed.
[0005] In a first aspect, an image defogging method based on an improved atmospheric scattering model is provided, the method comprising:
[0006] Performing color channel balancing processing on the foggy image to be processed to obtain a first image;
[0007] Calculating the atmospheric light intensity value through the first image to obtain a target atmospheric light intensity value;
[0008] By using the foggy image to be processed to perform multi-scale edge smoothing filtering on the first image, a transmittance image corresponding to the foggy image to be processed is obtained;
[0009] The first image is segmented and defogged using the transmittance image, the first preset image segmentation threshold, the second preset image segmentation threshold, and the target atmospheric light intensity value to obtain a first defogged area image, a second defogged area image, and a third defogged area image, wherein the first defogged area image is a white image area and a white-like image area, the second defogged area image is a gray image area, and the third defogged area image is an image area in the first image excluding the first image area and the second image area;
[0010] Correction processing is performed on the first defogging area image, the second defogging area image, and the third defogging area image according to area ratio values of the first defogging area image and the second defogging area image to the first image, so as to obtain a first corrected defogging area image, a second corrected defogging area image, and a third corrected defogging area image;
[0011] The first corrected defogging area image, the second corrected defogging area image and the third corrected defogging area image are spliced to obtain a defogging target image.
[0012] In a second aspect, a method and device for image defogging based on an improved atmospheric scattering model is provided, the device comprising:
[0013] A first processing unit, configured to perform color channel balancing processing on the foggy image to be processed to obtain a first image;
[0014] a calculation unit, configured to calculate an atmospheric light intensity value through the first image to obtain a target atmospheric light intensity value;
[0015] A second processing unit is used to perform multi-scale edge smoothing filtering on the first image by using the foggy image to be processed to obtain a transmittance image corresponding to the foggy image to be processed;
[0016] a third processing unit, configured to perform segmentation and defogging processing on the first image by using the transmittance image, the first preset image segmentation threshold, the second preset image segmentation threshold, and the target atmospheric light intensity value, to obtain a first defogging area image, a second defogging area image, and a third defogging area image, wherein the first defogging area image is a white image area and a nearly white image area, the second defogging area image is a gray image area, and the third defogging area image is an image area in the first image excluding the first image area and the second image area;
[0017] a correction unit, configured to perform correction processing on the third defogging area image according to the first defogging area image and the area ratio value in the second defogging area image and the first image, so as to obtain a fourth defogging area image;
[0018] The stitching unit is used to stitch the first defogging area image, the second defogging area image and the fourth defogging area image to obtain a target image after defogging.
[0019] In a third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the above-mentioned image dehazing method improved based on the atmospheric scattering model are implemented.
[0020] In a fourth aspect, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps of the above-mentioned image defogging method improved based on the atmospheric scattering model are implemented.
[0021] In the scheme implemented by the above-mentioned improved image defogging method and device based on the atmospheric scattering model, the color channel balancing process can be performed on the foggy image to be processed to obtain a first image, and the atmospheric light intensity value is calculated by using the first image to obtain a target atmospheric light intensity value. The first image is subjected to multi-scale edge smoothing filtering by using the foggy image to be processed to obtain a transmittance image corresponding to the foggy image to be processed. The first image is segmented and defogged by using the transmittance image, a first preset image segmentation threshold, a second preset image segmentation threshold and the target atmospheric light intensity value to obtain a first defogging area image, a second defogging area image and a third defogging area image, wherein the first defogging area image is a white image area and a white-like image area, the second defogging area image is a gray image area, and the third defogging area image is an image area in the first image except the first image area and the second image area. , the first defog area image, the second defog area image and the third defog area image are corrected according to the area ratio value of the first defog area image and the second defog area image to the first image to obtain the first corrected defog area image, the second corrected defog area image and the third corrected defog area image, and the first corrected defog area image, the second corrected defog area image and the third corrected defog area image are spliced to obtain the target image after defogging. Therefore, the foggy image to be processed can be first balanced to obtain the first image, and the calculated target atmospheric light intensity value and transmittance image are used to perform segmentation defogging correction processing to obtain multiple corrected defogging area images, and finally the multiple corrected defog area images are spliced to obtain the target image, so that the foggy image to be processed can be defogged in combination with the defogging and correction methods, thereby improving the accuracy of the target image finally obtained. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0023] Figure 1A A schematic diagram of a flow chart of an image defogging method based on an improved atmospheric scattering model provided by an embodiment of the present invention;
[0024] Figure 1B A schematic diagram of the effect of a first image provided by an embodiment of the present invention;
[0025] Figure 1C A schematic diagram of the effect of a target image provided by an embodiment of the present invention;
[0026] Figure 1D A schematic diagram of segmentation of a first image provided by an embodiment of the present invention;
[0027] Figure 1E A schematic diagram of a transmittance image provided by an embodiment of the present invention;
[0028] Figure 1F A schematic diagram of the effect of segmentation and defogging of a first image provided by an embodiment of the present invention;
[0029] Figure 2 A schematic structural diagram of an image defogging method and device based on an improved atmospheric scattering model in an embodiment provided in the present application;
[0030] Figure 3 A schematic diagram of the structure of a computer device in an embodiment provided in the present application. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] In order to better understand the improved image defogging method based on the atmospheric scattering model provided in the embodiment of the present application, the existing improved image defogging method based on the atmospheric scattering model is briefly introduced below. In the existing scheme, a defogging algorithm based on a physical model is usually used to defog the foggy image to be processed. The defogging algorithm based on the physical model combines the dark channel prior theory and the atmospheric scattering model to defog the foggy image to be processed. The image defogged by the defogging algorithm based on the physical model is darker overall. When there are a large number of white or sky areas in the foggy image to be processed, the defogged image will also have serious halo effects and color distortion problems, resulting in low accuracy of the defogged image.
[0033] In order to solve the above problems, an embodiment of the present application provides an image defogging method based on an improved atmospheric scattering model, which can first perform a balancing process on the foggy image to be processed to obtain a first image, and then use the calculated target atmospheric light intensity value and transmittance image to perform segmentation defogging and correction processing to obtain multiple corrected defogging image area images, and finally splice the multiple corrected defogging area images to obtain the target image, so that the foggy image to be processed can be defogged in a combined manner of defogging and correction, thereby improving the accuracy of the final target image.
[0034] See also Figure 1A As shown, Figure 1A A flowchart of an improved image defogging method based on an atmospheric scattering model provided by an embodiment of the present invention. Figure 1A As shown in FIG, the image defogging method improved based on the atmospheric scattering model includes the following steps:
[0035] S101: Perform color channel balancing processing on the foggy image to be processed to obtain a first image.
[0036] Since the foggy image to be processed obtained in a foggy environment will have an overall color deviation, resulting in an imbalance in the color channel, it is necessary to perform color channel balancing processing on the foggy image to be processed so as to improve the image quality of the obtained first image.
[0037] A possible method for performing color channel balancing processing on a foggy image to be processed to obtain a first image may be: judging whether the color channels of the foggy image to be processed are balanced to obtain a judgment result; if the judgment result indicates that the foggy image to be processed has a color channel imbalance, performing color channel balancing processing on the foggy image to be processed to obtain the first image. Specifically, it may be possible to judge whether the color channels of the foggy image to be processed are balanced, and the method for obtaining the judgment result may be: obtaining the pixel intensity means of the three color channels of the foggy image to be processed, calculating the first difference between the maximum value and the minimum value of the three pixel intensity means, and comparing the first difference with a preset difference threshold value. If the first difference is greater than the preset difference threshold value, the judgment result indicates that the foggy image to be processed has a color channel imbalance; if it is less than the preset difference threshold value, the judgment result indicates that the foggy image to be processed does not have a color channel imbalance.
[0038] The first difference can be determined by the following formula:
[0039]
[0040] T is the first difference, where is the mean pixel intensity of the three color channels of the foggy image to be processed.
[0041] The color channel balance process of the foggy image to be processed can be performed by the method shown in the following formula to obtain the first image:
[0042] I o (x)=(mean(I(x) n )) 1 / n ,
[0043]
[0044] Where n is the Minkowski constant, the default value of n is 6, I out is the first image, k is the multiplication constant, is the average brightness value of the foggy image to be processed. Figure 1B A schematic diagram of the effect of a first image is provided.
[0045] S102: Calculate the atmospheric light intensity value using the first image to obtain a target atmospheric light intensity value.
[0046] The segmentation information of the first image can be determined according to the size information of the first image and the preset segmentation rate threshold, and then the first image is segmented using the segmentation information to obtain m sub-images, and the Euclidean distance between the pixel values of the pixel points of the m sub-images and the preset coordinate center is calculated to obtain the first Euclidean distance set, and the first sub-Euclidean distance set is extracted from the first Euclidean distance set according to the preset percentage, and finally the target atmospheric light intensity value is calculated according to the first sub-Euclidean distance set and the total number of pixels in the m images. Therefore, the target atmospheric light intensity value can be determined by the Euclidean distance between the pixel value of the pixel point and the preset coordinate center and the total number of pixels in the m images, which can improve the accuracy of obtaining the target atmospheric light intensity value.
[0047] The preset segmentation rate threshold may be set by empirical values or historical data, for example, the preset segmentation rate threshold may be 0.2. The preset percentage may be set by empirical values or historical data, for example, the preset percentage may be 0.1%. The coordinate value of the preset coordinate center may be (1,1).
[0048] S103 , performing multi-scale edge smoothing filtering on the first image by using the foggy image to be processed, so as to obtain a transmittance image corresponding to the foggy image to be processed.
[0049] The first image can be processed by using the general dark channel prior theory and the atmospheric scattering model to obtain a rough transmittance image, and then the average variance of the pixel values of the grayscale image of the foggy image to be processed, the filter window information and the transmittance of the rough transmittance image are used to determine two linear coefficients, and finally the two linear coefficients and the pixel values of the grayscale image are used for filtering to obtain a transmittance image. Thus, the first image can be filtered in combination with the transmittance of the rough transmittance image to obtain a transmittance image, thereby improving the accuracy of the transmittance image acquisition.
[0050] S104. Perform segmentation and defogging processing on the first image using the transmittance image, the first preset image segmentation threshold, the second preset image segmentation threshold and the target atmospheric light intensity value to obtain a first defogging area image, a second defogging area image and a third defogging area image, wherein the first defogging area image is a white image area and a white-like image area, the second defogging area image is a gray image area, and the third defogging area image is an image area in the first image excluding the first image area and the second image area.
[0051] The first image can be segmented using the transmittance of the transmittance image, the first preset image segmentation threshold, and the second preset image segmentation threshold to obtain a first defogging area image, a second area image, and a third area image, and then the second image area is enhanced using a general image enhancement method to obtain a second defogging area image, and the third image area is restored using the target atmospheric light intensity value, the transmittance of the transmittance image, etc. to obtain a third defogging area image. Therefore, different optimization processing methods can be used for different area images, which can improve the accuracy and adaptability of subsequent processing.
[0052] S105. Correct the first defogging area image, the second defogging area image and the third defogging area image according to the area ratio values of the first defogging area image and the second defogging area image to the first image to obtain a first corrected defogging area image, a second corrected defogging area image and a third corrected defogging area image.
[0053] The correction parameter can be determined according to the area ratio value and the preset correction constant, and the correction parameter is used to perform correction processing on the first defogging area image, the second defogging area image and the third defogging area image to obtain the first corrected defogging area image, the second corrected defogging area image and the third corrected defogging area image. The preset correction constant can be set by an empirical value or historical data, for example, the preset correction constant is 0.8.
[0054] S106: performing splicing processing on the first corrected defogging area image, the second corrected defogging area image and the third corrected defogging area image to obtain a target image after defogging processing.
[0055] Specifically, the second corrected defogging area image and the third corrected defogging area image may be spliced to obtain the first sub-target image using the method shown in the following formula:
[0056] J out =(1-F k×k *M gray )·J other +(F k×k *M gray )·J gray ,
[0057] Among them, * is the convolution operator, F k×k represents the kernel of the mean filter of size k×k, M gray is the mask of the second region image after segmentation processing by the first preset image segmentation threshold and the second preset image segmentation threshold, J other is the third corrected dehazed area image, J gray The second corrected defogging area image is then stitched together with the corresponding first corrected defogging area image in the second corrected defogging area image in the first sub-target image to obtain the target image after defogging. The method for stitching together the second corrected defogging area image in the first sub-target image with the corresponding first corrected defogging area image to obtain the target image after defogging can refer to the method for stitching together the second corrected defogging area image and the third corrected defogging area image to obtain the first sub-target image, which will not be repeated here. The schematic diagram of the effect of the final target image can be shown as follows Figure 1C shown.
[0058] In this example, a color channel balancing process can be performed on the foggy image to be processed to obtain a first image, an atmospheric light intensity value is calculated by using the first image to obtain a target atmospheric light intensity value, a multi-scale edge smoothing filtering process is performed on the first image by using the foggy image to be processed to obtain a transmittance image corresponding to the foggy image to be processed, and the first image is segmented and defogged by using the transmittance image, a first preset image segmentation threshold, a second preset image segmentation threshold and the target atmospheric light intensity value to obtain a first defogged area image, a second defogged area image and a third defogged area image, wherein the first defogged area image is a white image area and a white-like image area, the second defogged area image is a gray image area, and the third defogged area image is an image area in the first image except the first image area and the second image area. The first defog area image, the second defog area image and the third defog area image are corrected by the area ratio value in the second defog area image and the first image to obtain the first corrected defog area image, the second corrected defog area image and the third corrected defog area image, and the first corrected defog area image, the second corrected defog area image and the third corrected defog area image are spliced to obtain the target image after defogging. Therefore, the foggy image to be processed can be first balanced to obtain the first image, and the calculated target atmospheric intensity value and transmittance image are used to perform segmentation defogging correction processing to obtain multiple corrected defog area images, and finally the multiple corrected defog area images are spliced to obtain the target image, so that the foggy image to be processed can be defogged in combination with the defogging and correction methods, thereby improving the accuracy of the target image finally obtained.
[0059] In a possible implementation, a method for calculating an atmospheric light intensity value through the first image to obtain a target atmospheric light intensity value includes:
[0060] A1. Determine segmentation information of the first image according to size information of the first image and a preset segmentation rate threshold;
[0061] A2. Using the segmentation information to segment the first image to obtain a target sub-image;
[0062] A3, obtaining the Euclidean distance between the pixel value of the pixel point in the target sub-image and the preset coordinate center to obtain a first Euclidean distance set;
[0063] A4. extracting a first sub-Euclidean distance set from the first Euclidean distance set, wherein the Euclidean distances in the first sub-Euclidean distance set are Euclidean distances of a first preset percentage after sorting the Euclidean distances in the first Euclidean distance set in ascending order;
[0064] A5. Perform forced calculation of atmospheric light according to the total number of pixels in the target sub-image and the Euclidean distance in the first sub-Euclidean distance set to obtain the target atmospheric light intensity value.
[0065] The segmentation information of the first image may be determined according to the size information of the first image and a preset segmentation rate threshold by the method shown in the following formula, specifically:
[0066]
[0067] Where h is the length of the first image, w is the width of the first image, and h c is the length of the sub-image, w c is the width value of the sub-image, and γ is the segmentation rate. When γ is less than the preset segmentation rate threshold, the length value of the sub-image and the width value of the sub-image at this time are determined as the segmentation information of the first image. The preset segmentation rate threshold is set by empirical value or historical data, for example, it can be 0.2. When it is greater than the preset segmentation rate threshold, the segmentation is stopped, and the smaller the segmentation rate, the fewer the number of segmentations.
[0068] The first image can be segmented using a quadrisection method based on the segmentation information to obtain a target sub-image. Figure 1D The target sub-image is obtained by dividing it into Figure 1D The upper left sub-image.
[0069] The Euclidean distance between the pixel value and the preset coordinate center can be determined by the method shown in the following formula:
[0070]
[0071] Wherein, d(x) is the Euclidean distance between the pixel value of the pixel point in the sub-image and the pixel value of the preset coordinate center (11), is the first image, is an image obtained by filtering the first image.
[0072] The first sub-Euclidean distance set may be extracted from the first Euclidean distance set by the method shown in the following formula, specifically:
[0073] d i (x)=Sort(d(x)),i∈[1,k],
[0074] Among them, Sort() is an algorithm that sorts all Euclidean distances in the first Euclidean distance set from small to large and takes out the first preset percentage, where the preset percentage is 0.1%, and k is the number of elements in the first sub-Euclidean distance set.
[0075] The target atmospheric light intensity value can be obtained by performing forced atmospheric light calculation according to the total number of pixels in the m images and the Euclidean distance in the first sub-Euclidean distance set using the method shown in the following formula, specifically:
[0076]
[0077] Among them, k is the number of elements in the first sub-Euclidean distance set corresponding to the total number of pixels in the m images, and A(r, g, b) is the target atmospheric light intensity value.
[0078] In this example, the target atmospheric light intensity value can be determined by the Euclidean distance between the pixel value of the pixel point and the preset coordinate center and the total number of pixels in the m images, which can improve the accuracy of obtaining the target atmospheric light intensity value.
[0079] In a possible implementation, a method for obtaining a transmittance image corresponding to the foggy image to be processed by performing multi-scale edge smoothing filtering on the first image using the foggy image to be processed includes:
[0080] B1. Processing the first image by a first preset transmittance processing method to obtain a first rough transmittance image;
[0081] B2. Obtaining a grayscale image of the foggy image to be processed;
[0082] B3, determining a first linear coefficient and a second linear coefficient when filtering the first rough transmittance image according to the average variance of the pixel values of the grayscale image, the filtering window information and the transmittance of the first rough transmittance image;
[0083] B4. Perform filtering processing according to the pixel values of the grayscale image, the first linear coefficient and the second linear coefficient to obtain a transmittance image corresponding to the foggy image to be processed.
[0084] Among them, the first preset transmittance processing method can be a general dark channel priori theory and a method combined with an atmospheric scattering model.
[0085] The rough transmittance of the first rough transmittance image can be specifically characterized by the following formula:
[0086]
[0087] Among them, t(x) is the rough transmittance, ω is the correction coefficient, which can be 0.9 in this application, Ω is the minimum filter window, c represents three color channels, and A is the atmospheric light intensity value.
[0088] The first linear coefficient and the second linear coefficient can be determined by the method shown in the following formula, specifically:
[0089]
[0090] Among them, E(a x′,y′ , b x′,y′ ) is the cost function, and the first reference linear coefficient a can be determined by minimizing the cost function x′,y′ and the second reference linear coefficient b x′,y′ , where is the filter kernel of the improved multi-scale edge smoothing filter. In the embodiment of the present application, the weight is smoothed by using a two-dimensional Gaussian filter. x′,y′ is the edge-aware smoothing parameter, the first linear coefficient With the second linear coefficient The windows are Middle x′,y′ With b x′,y′ The mean of the window radius is 60. is the product of the square root of the local variance in the window ω and the square root of the local variance in the window with radius 1, is the average variance of the pixel values of the grayscale image.
[0091] The transmittance of the transmittance image corresponding to the foggy image to be processed can be represented by the method shown in the following formula, specifically:
[0092]
[0093] in, is the transmittance image corresponding to the final output foggy image to be processed, G(x,y) is the pixel value of the grayscale image, is the first linear coefficient, is the second linear coefficient. The transmittance image can be Figure 1E shown.
[0094] In this example, the first image may be filtered in combination with information such as the transmittance of the preliminary transmittance image to obtain a transmittance image, thereby improving the accuracy of acquiring the transmittance image.
[0095] In a possible implementation, a method for segmenting and defogging the first image using the transmittance image, the first preset image segmentation threshold, the second preset image segmentation threshold, and the target atmospheric light intensity value to obtain a first defogging area image, a second defogging area image, and a third defogging area image, wherein the first defogging area image is a white image area and a white-like image area, the second defogging area image is a gray image area, and the third defogging area image is an image area in the first image other than the first image area and the second image area, includes:
[0096] C1. Segmenting the first image using the transmittance of the transmittance image, the first preset image segmentation threshold, and the second preset image segmentation threshold to obtain a first defogging area image, a second area image, and a third area image;
[0097] C2. Performing enhancement processing on the second region image by using a preset first image enhancement method to obtain the second defogging region image;
[0098] C3. Performing a rough restoration process on the third region image by using the target atmospheric light intensity value and the transmittance of the transmittance image to obtain a third defogging region image.
[0099] The first image can be segmented by the method shown in the following formula to obtain the first defogging area image, the second area image and the third area image, specifically:
[0100]
[0101] Wherein, L is the label image of the region mask, a mask of 1 can represent the first defogging region image, a mask of 2 can represent the second region image, and a mask of 3 can represent the third region image. t1 is the first preset image segmentation threshold, and t2 is the second preset image segmentation threshold. is the transmittance of the transmittance image. The first preset image segmentation threshold can be 0.72, and the second preset image segmentation threshold can be 0.97. The segmentation effect of the defogging diagram is as follows: Figure 1E shown.
[0102] The preset first image enhancement method may be a CLAHE algorithm, and therefore, the CLAHE algorithm may be used to perform enhancement processing on the second region image to obtain a second defogging region image.
[0103] The third region image can be roughly restored by the method shown in the following formula to obtain the third defogging region image, specifically:
[0104]
[0105] Wherein, J is the third defogging area image, A is the target atmospheric light intensity value, I(x, y) is the third area image, and t0 is a constant value of 0.1.
[0106] In this example, different optimization processing methods can be used for images in different regions, which can improve the accuracy and adaptability of subsequent processing.
[0107] In a possible implementation, a method for performing correction processing on the first defogging area image, the second defogging area image, and the third defogging area image according to area ratio values of the first defogging area image and the second defogging area image to the first image to obtain a first corrected defogging area image, a second corrected defogging area image, and a third corrected defogging area image includes:
[0108] D1. Determine a correction parameter according to the area ratio value and a preset correction constant;
[0109] D2. Correct the first defogging area image, the second defogging area image and the third defogging area image according to the correction parameters to obtain a first corrected defogging area image, a second corrected defogging area image and a third corrected defogging area image.
[0110] The preset calibration constant is set by empirical value or historical data, for example, may be 0.8.
[0111] The correction parameters can be characterized by the following formula:
[0112] η=(count1+count2) / (w×h),
[0113] γ=1+α(1-η),
[0114] Wherein, γ is the correction parameter, α is the preset correction constant, η is the area ratio value, h is the length value of the first image, w is the width value of the first image, count1 is the number of pixels in the first defogging area image, and count2 is the number of pixels in the second defogging area image.
[0115] The correction process can be performed by the method shown in the following formula to obtain the corrected image, specifically:
[0116] G(J)=J γ =J 1+α(1-η) 0<α<1,
[0117] Wherein, G is the output image, J is the input image, and the input image may be the first defogging area image, the second defogging area image, and the third defogging area image.
[0118] In this example, the correction parameters can be determined based on the area ratio value and the preset correction constant, and the correction parameters can be used to perform correction processing on the first defogging area image, the second defogging area image and the third defogging area image to obtain the first corrected defogging area image, the second corrected defogging area image and the third corrected defogging area image, thereby improving the accuracy of acquiring the first corrected defogging area image, the second corrected defogging area image and the third corrected defogging area image.
[0119] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0120] In one embodiment, a method and apparatus for image defogging based on an improved atmospheric scattering model is provided, and the method and apparatus for image defogging based on an improved atmospheric scattering model corresponds one-to-one to an improved image defogging method based on an improved atmospheric scattering model in the above embodiment. Figure 2 As shown, the image defogging method device based on the improved atmospheric scattering model includes:
[0121] The first processing unit 201 is used to perform color channel balancing processing on the foggy image to be processed to obtain a first image;
[0122] A calculation unit 202 is used to calculate the atmospheric light intensity value through the first image to obtain a target atmospheric light intensity value;
[0123] The second processing unit 203 is used to perform multi-scale edge smoothing filtering on the first image by using the foggy image to be processed to obtain a transmittance image corresponding to the foggy image to be processed;
[0124] The third processing unit 204 is used to perform segmentation and defogging processing on the first image by using the transmittance image, the first preset image segmentation threshold, the second preset image segmentation threshold and the target atmospheric light intensity value to obtain a first defogging area image, a second defogging area image and a third defogging area image, wherein the first defogging area image is a white image area and a white-like image area, the second defogging area image is a gray image area, and the third defogging area image is an image area in the first image except the first image area and the second image area;
[0125] A correction unit 205 is used to perform correction processing on the third defogging area image according to the area ratio values in the first defogging area image and the second defogging area image and the first image to obtain a fourth defogging area image;
[0126] The stitching unit 206 is used to stitch the first defogging area image, the second defogging area image and the fourth defogging area image to obtain a target image after defogging.
[0127] In a possible implementation, the computing unit 202 is specifically configured to:
[0128] Determining segmentation information of the first image according to size information of the first image and a preset segmentation rate threshold;
[0129] Using the segmentation information to perform segmentation processing on the first image to obtain a target sub-image;
[0130] Obtaining the Euclidean distance between the pixel value of the pixel point in the target sub-image and the preset coordinate center to obtain a first Euclidean distance set;
[0131] Extracting a first sub-Euclidean distance set from the first Euclidean distance set, wherein the Euclidean distances in the first sub-Euclidean distance set are the first preset percentage of the Euclidean distances after sorting the Euclidean distances in the first Euclidean distance set in ascending order;
[0132] An atmospheric light forced calculation is performed according to the total number of pixels in the target sub-image and the Euclidean distance in the first sub-Euclidean distance set to obtain the target atmospheric light intensity value.
[0133] In a possible implementation, the second processing unit 203 is specifically configured to:
[0134] Processing the first image by a first preset transmittance processing method to obtain a first rough transmittance image;
[0135] Obtaining a grayscale image of the foggy image to be processed;
[0136] Determining a first linear coefficient and a second linear coefficient when filtering the first rough transmittance image according to an average variance of pixel values of the grayscale image, filtering window information, and the transmittance of the first rough transmittance image;
[0137] A filtering process is performed according to the pixel values of the grayscale image, the first linear coefficient, and the second linear coefficient to obtain a transmittance image corresponding to the foggy image to be processed.
[0138] In a possible implementation, the third processing unit 204 is specifically configured to:
[0139] The first image is segmented by using the transmittance of the transmittance image, the first preset image segmentation threshold, and the second preset image segmentation threshold to obtain a first defogging area image, a second area image, and a third area image;
[0140] Performing enhancement processing on the second region image by using a preset first image enhancement method to obtain the second defogging region image;
[0141] The third region image is roughly restored using the target atmospheric light intensity value and the transmittance of the transmittance image to obtain a third defogging region image.
[0142] In a possible implementation, the correction unit 205 is specifically configured to:
[0143] Determining a correction parameter according to the area ratio value and a preset correction constant;
[0144] Correction processing is performed on the first defogging area image, the second defogging area image and the third defogging area image according to the correction parameters to obtain a first corrected defogging area image, a second corrected defogging area image and a third corrected defogging area image.
[0145] In a possible implementation, the splicing unit 206 is specifically configured to:
[0146] The second corrected defogging area image and the third corrected defogging area image are spliced using the method shown in the following formula to obtain the first sub-target image:
[0147] J out =(1-F k×k *M gray )·J other +(F k×k *M gray )·J gray ,
[0148] Among them, * is the convolution operator, F k×k represents the kernel of the mean filter of size k×k, M gray is the mask of the second region image after segmentation processing by the first preset image segmentation threshold and the second preset image segmentation threshold, J other is the third corrected dehazed area image, J gray is a second corrected defogging area image;
[0149] The target image after defogging is obtained by splicing the area of the second corrected defogging area image in the first sub-target image with the corresponding first corrected defogging area image.
[0150] For the specific definition of the image defogging method device based on the improved atmospheric scattering model, please refer to the definition of an image defogging method based on the improved atmospheric scattering model mentioned above, which will not be repeated here. Each module in the above-mentioned image defogging method device based on the improved atmospheric scattering model can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0151] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client via a network connection. When the computer program is executed by the processor, the functions or steps on the server side of an improved image defogging method based on an atmospheric scattering model are implemented.
[0152] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0153] Performing color channel balancing processing on the foggy image to be processed to obtain a first image;
[0154] Calculating the atmospheric light intensity value through the first image to obtain a target atmospheric light intensity value;
[0155] By using the foggy image to be processed to perform multi-scale edge smoothing filtering on the first image, a transmittance image corresponding to the foggy image to be processed is obtained;
[0156] The first image is segmented and defogged using the transmittance image, the first preset image segmentation threshold, the second preset image segmentation threshold, and the target atmospheric light intensity value to obtain a first defogged area image, a second defogged area image, and a third defogged area image, wherein the first defogged area image is a white image area and a white-like image area, the second defogged area image is a gray image area, and the third defogged area image is an image area in the first image excluding the first image area and the second image area;
[0157] Correction processing is performed on the first defogging area image, the second defogging area image, and the third defogging area image according to area ratio values of the first defogging area image and the second defogging area image to the first image, so as to obtain a first corrected defogging area image, a second corrected defogging area image, and a third corrected defogging area image;
[0158] The first corrected defogging area image, the second corrected defogging area image and the third corrected defogging area image are spliced to obtain a defogging target image.
[0159] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0160] Performing color channel balancing processing on the foggy image to be processed to obtain a first image;
[0161] Calculating the atmospheric light intensity value through the first image to obtain a target atmospheric light intensity value;
[0162] By using the foggy image to be processed to perform multi-scale edge smoothing filtering on the first image, a transmittance image corresponding to the foggy image to be processed is obtained;
[0163] The first image is segmented and defogged using the transmittance image, the first preset image segmentation threshold, the second preset image segmentation threshold, and the target atmospheric light intensity value to obtain a first defogged area image, a second defogged area image, and a third defogged area image, wherein the first defogged area image is a white image area and a white-like image area, the second defogged area image is a gray image area, and the third defogged area image is an image area in the first image excluding the first image area and the second image area;
[0164] Correction processing is performed on the first defogging area image, the second defogging area image, and the third defogging area image according to area ratio values of the first defogging area image and the second defogging area image to the first image, so as to obtain a first corrected defogging area image, a second corrected defogging area image, and a third corrected defogging area image;
[0165] The first corrected defogging area image, the second corrected defogging area image and the third corrected defogging area image are spliced to obtain a defogging target image.
[0166] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant description in the aforementioned method embodiment. In order to avoid repetition, they will not be described one by one here.
[0167] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0168] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0169] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. An image defogging method based on an improved atmospheric scattering model, characterized in that: The method comprises: Performing color channel balancing processing on the foggy image to be processed to obtain a first image; Calculating the atmospheric light intensity value through the first image to obtain a target atmospheric light intensity value; By using the foggy image to be processed to perform multi-scale edge smoothing filtering on the first image, a transmittance image corresponding to the foggy image to be processed is obtained; The first image is segmented and defogged using the transmittance image, the first preset image segmentation threshold, the second preset image segmentation threshold, and the target atmospheric light intensity value to obtain a first defogged area image, a second defogged area image, and a third defogged area image, wherein the first defogged area image is a white image area and a white-like image area, the second defogged area image is a gray image area, and the third defogged area image is an image area in the first image excluding the first image area and the second image area; Correction processing is performed on the first defogging area image, the second defogging area image, and the third defogging area image according to area ratio values of the first defogging area image and the second defogging area image to the first image, so as to obtain a first corrected defogging area image, a second corrected defogging area image, and a third corrected defogging area image; The first corrected defogging area image, the second corrected defogging area image and the third corrected defogging area image are spliced to obtain a defogging target image.
2. The image defogging method based on an improved atmospheric scattering model according to claim 1, characterized in that: The calculating the atmospheric light intensity value through the first image to obtain the target atmospheric light intensity value includes: Determining segmentation information of the first image according to size information of the first image and a preset segmentation rate threshold; Using the segmentation information to perform segmentation processing on the first image to obtain a target sub-image; Obtaining the Euclidean distance between the pixel value of the pixel point in the target sub-image and the preset coordinate center to obtain a first Euclidean distance set; Extracting a first sub-Euclidean distance set from the first Euclidean distance set, wherein the Euclidean distances in the first sub-Euclidean distance set are the first preset percentage of the Euclidean distances after sorting the Euclidean distances in the first Euclidean distance set in ascending order; An atmospheric light forced calculation is performed according to the total number of pixels in the target sub-image and the Euclidean distance in the first sub-Euclidean distance set to obtain the target atmospheric light intensity value.
3. The image defogging method based on an improved atmospheric scattering model according to claim 2, characterized in that: The method of performing multi-scale edge smoothing filtering on the first image by using the foggy image to be processed to obtain a transmittance image corresponding to the foggy image to be processed includes: Processing the first image by a first preset transmittance processing method to obtain a first rough transmittance image; Obtaining a grayscale image of the foggy image to be processed; Determining a first linear coefficient and a second linear coefficient when filtering the first rough transmittance image according to an average variance of pixel values of the grayscale image, filtering window information, and the transmittance of the first rough transmittance image; A filtering process is performed according to the pixel values of the grayscale image, the first linear coefficient, and the second linear coefficient to obtain a transmittance image corresponding to the foggy image to be processed.
4. The image defogging method based on an improved atmospheric scattering model according to any one of claims 1 to 3, characterized in that: The first image is segmented and defogged by using the transmittance image, the first preset image segmentation threshold, the second preset image segmentation threshold and the target atmospheric light intensity value to obtain a first defogged area image, a second defogged area image and a third defogged area image, wherein the first defogged area image is a white image area and a white-like image area, the second defogged area image is a gray image area, and the third defogged area image is an image area in the first image except the first image area and the second image area, including: The first image is segmented by using the transmittance of the transmittance image, the first preset image segmentation threshold, and the second preset image segmentation threshold to obtain a first defogging area image, a second area image, and a third area image; Performing enhancement processing on the second region image by using a preset first image enhancement method to obtain the second defogging region image; The third region image is roughly restored using the target atmospheric light intensity value and the transmittance of the transmittance image to obtain a third defogging region image.
5. The image defogging method based on the improved atmospheric scattering model according to claim 4 is characterized in that: The first defogging area image, the second defogging area image and the third defogging area image are corrected according to the area ratio values in the first defogging area image and the second defogging area image and the first image to obtain a first corrected defogging area image, a second corrected defogging area image and a third corrected defogging area image, including: Determining a correction parameter according to the area ratio value and a preset correction constant; Correction processing is performed on the first defogging area image, the second defogging area image and the third defogging area image according to the correction parameters to obtain a first corrected defogging area image, a second corrected defogging area image and a third corrected defogging area image.
6. The image defogging method based on an improved atmospheric scattering model according to claim 5, characterized in that: The step of performing splicing processing on the first corrected defogging area image, the second corrected defogging area image and the third corrected defogging area image to obtain a defogging target image includes: The second corrected defogging area image and the third corrected defogging area image are spliced using the method shown in the following formula to obtain the first sub-target image: J out =(1-F k×k *M gray )·J other +(F k×k *M gray )·J gray , Among them, * is the convolution operator, F k×k represents the kernel of the mean filter of size k×k, M gray is the mask of the second region image after segmentation processing by the first preset image segmentation threshold and the second preset image segmentation threshold, J other is the third corrected dehazed area image, J gray is the second corrected defogging area image; The target image after defogging is obtained by splicing the area of the second corrected defogging area image in the first sub-target image with the corresponding first corrected defogging area image.
7. An image defogging method and device based on an improved atmospheric scattering model, characterized in that: The device comprises: A first processing unit, configured to perform color channel balancing processing on the foggy image to be processed to obtain a first image; a calculation unit, configured to calculate an atmospheric light intensity value through the first image to obtain a target atmospheric light intensity value; A second processing unit is used to perform multi-scale edge smoothing filtering on the first image by using the foggy image to be processed to obtain a transmittance image corresponding to the foggy image to be processed; a third processing unit, configured to perform segmentation and defogging processing on the first image by using the transmittance image, the first preset image segmentation threshold, the second preset image segmentation threshold, and the target atmospheric light intensity value, to obtain a first defogging area image, a second defogging area image, and a third defogging area image, wherein the first defogging area image is a white image area and a nearly white image area, the second defogging area image is a gray image area, and the third defogging area image is an image area in the first image excluding the first image area and the second image area; a correction unit, configured to perform correction processing on the third defogging area image according to the first defogging area image and the area ratio value in the second defogging area image and the first image, so as to obtain a fourth defogging area image; The stitching unit is used to stitch the first defogging area image, the second defogging area image and the fourth defogging area image to obtain a target image after defogging.
8. The image defogging method and device based on the improved atmospheric scattering model according to claim 7 is characterized in that: The computing unit is specifically used for: Determining segmentation information of the first image according to size information of the first image and a preset segmentation rate threshold; Using the segmentation information to perform segmentation processing on the first image to obtain a target sub-image; Obtaining the Euclidean distance between the pixel value of the pixel point in the target sub-image and the preset coordinate center to obtain a first Euclidean distance set; Extracting a first sub-Euclidean distance set from the first Euclidean distance set, wherein the Euclidean distances in the first sub-Euclidean distance set are the first preset percentage of the Euclidean distances after sorting the Euclidean distances in the first Euclidean distance set in ascending order; An atmospheric light forced calculation is performed according to the total number of pixels in the target sub-image and the Euclidean distance in the first sub-Euclidean distance set to obtain the target atmospheric light intensity value.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the improved image defogging method based on the atmospheric scattering model as claimed in any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the improved image defogging method based on an atmospheric scattering model as claimed in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Method for judging quality effect of defogged and enhanced image
CN101901482A
Method and system for color image defogging treatment
CN101908210A
Rapid defogging method
CN102063706A
Single image defogging method based on joint mean shift
CN103578083A
Dark channel prior image dehazing method based on multiscale fusion
CN103942758A
Cited By
Method, device and equipment for reducing image degradation of ice and snow sports scene
CN121639498A