An Image Dehazing Method Based on Dark Channel Prior
Through the image defog removal method based on dark channel prior, combined with the maximum gray value and dark channel prior fog removal algorithm, the image is defog treatment and differential optimization is carried out, which solves the problem of poor fog removal effect in large areas in the existing technology, and achieves a more efficient image defog removal effect.
Patent Information
- Application Number
- CN202411415002.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2044-10-11
AI Technical Summary
The existing image defog removal technology is poor when processing images in large areas of blank areas, resulting in incomplete removal of fog.
The image defog method based on dark channel prior is adopted. By identifying the maximum grayscale value in the image, combining the dark channel prior defog algorithm, the image is defog-defog processing, and the difference between the original image and the defog-defog image is optimized again.
The image defog removal effect is significantly improved, especially in the processing of large areas of blank areas, which improves the quality of the defog removal image and the actual defog removal effect.
Smart Images

Figure CN119295353B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and particularly to an image defogging method based on dark channel prior. Background Art
[0002] Image defogging technology aims to remove fog in images and improve image clarity. By analyzing image features and estimating parameters such as atmospheric light and transmittance, common methods include those based on dark channel prior, etc., which can effectively restore clear scenes. This technology has important application value in fields such as photography and monitoring.
[0003] A patent for invention with application number 202211188123.3 discloses an image defogging method based on dark channel prior, which is characterized by the following steps: Step 1, for a single foggy image, identify and detect the sky area. If the sky area is detected, the average value of the bright channel values of the sky area is used as the estimate of atmospheric light A. If there is no sky area, the average value of the bright channel values corresponding to the final area is used as the estimate of atmospheric light A by using the quadtree search algorithm; Step 2, perform grayscale processing on a single foggy image, calculate the dark channel map of the image, estimate its atmospheric transmittance, and then optimize the transmittance based on guided filtering; Step 3, perform image restoration according to the estimate of atmospheric light A obtained in Step 1 and the optimized transmittance obtained in Step 2.
[0004] This application aims to solve the problem of "in the existing image defogging technology, it is easy to have an incomplete fog removal situation in the restored image".
[0005] However, based on the above problems, the current image defogging technology has not been updated for a long time. For images with a large area of blank, such as images containing a large proportion of sky, defogging processing based on the existing technology has poor effects;
[0006] Therefore, we propose an image defogging method based on dark channel prior. Summary of the Invention
[0007] In view of the above-mentioned drawbacks of the existing technology, the present invention provides an image defogging method based on dark channel prior, which solves the technical problems raised in the above background art.
[0008] To achieve the above objectives, the present invention is realized through the following technical solutions:
[0009] An image defogging method based on dark channel prior, comprising:
[0010] Receive the image to be processed, traverse each pixel in the image to be processed, identify the gray value of each pixel, determine the maximum gray value of the pixels in the image to be processed, and based on the dark channel prior dehazing algorithm combined with the maximum gray value of the pixels in the image to be processed, calculate the pixel value of each pixel after restoration in the image to be processed. Iterate the pixel value of the original pixel with the pixel value of the restored pixel to output the image after dehazing processing based on the dark channel prior dehazing algorithm;
[0011] Obtain the image to be processed and the dehazed image corresponding to the image to be processed, set the inspection window according to the dehazing accuracy requirement, and perform segmentation processing on the image to be processed and the dehazed image corresponding to the image to be processed based on the inspection window to obtain several groups of equal amounts of sub-images of the image to be processed and sub-images of the dehazed image;
[0012] The sub-image of the image to be processed is denoted as the sub-image to be processed, and the sub-image of the dehazed image is denoted as the dehazed sub-image;
[0013] Analyze the differences between each group of sub-images to be processed and dehazed sub-images, set the dehazing processing defect determination threshold, pick the dehazed sub-images that meet the dehazing processing defect determination threshold, use the picked dehazed sub-images as the reprocessing target, and perform dehazing processing again;
[0014] The difference between the sub-image to be processed and the dehazed sub-image is calculated by the following formula:
[0015]
[0016] In the formula: D total is the difference between the sub-image to be processed and the dehazed sub-image; α and β are weights; D color is the color difference between the sub-image to be processed and the dehazed sub-image; sim(L) is the brightness similarity between the sub-image to be processed and the dehazed sub-image; sim(C) is the contrast pixel value between the sub-image to be processed and the dehazed sub-image; sim(P) is the structural similarity between the sub-image to be processed and the dehazed sub-image;
[0017] Among them, the values of the weights α and β are user-defined, and α is always greater than β. Based on the above formula, the difference D total between each group of corresponding sub-images to be processed and dehazed sub-images is calculated. The larger the value of D total , the greater the difference between the sub-image to be processed and the dehazed sub-image. On the contrary, the smaller the value of D indicates the smaller the difference between the sub-image to be processed and the dehazed sub-image. The dehazing processing defect determination threshold is [0, q], and the q value is the maximum value in the dehazing processing defect determination threshold.
[0018] Further, in the stage of obtaining the pixel value of the restored pixel for each pixel in the image to be processed, a correction factor corresponding to the pixel is obtained according to the maximum gray value of the pixel in the image to be processed, and the correction factor is added to the dark channel prior dehazing algorithm, and further, based on the dark channel prior dehazing algorithm, the pixel value of the restored pixel in the image to be processed is output;
[0019] The logical expression for the dark channel prior dehazing algorithm to output the pixel value of the restored pixel is:
[0020]
[0021] In the formula: χ i is the correction factor; G i is the gray value of the i-th pixel in the image to be processed; G max is the maximum gray value in the image to be processed; J(i) is the pixel value after dehazing processing of the i-th pixel in the image to be processed; I(i) is the pixel value of the i-th pixel in the image to be processed; A is the atmospheric light value; ω is a fixed parameter; J dark (i) is the value of the i-th pixel point in the dark channel image of the image to be processed; A(0) is the value of the atmospheric light value in the first color channel among the three color channels; t 0 is the lower limit value of the transmittance;
[0022] Among them, the value of the fixed parameter ω is user-defined, and the initial value of the fixed parameter ω is defaulted to 0.95. Based on the above formula, J(i) corresponding to each pixel in the image to be processed is obtained. means taking the maximum value within the brackets. means based on the transmittance of the i-th pixel in the image to be processed.
[0023] Further, when obtaining the dark channel image of the image to be processed, based on the image to be processed, the dark channel value of each pixel in the image to be processed when determining the output dark channel image is determined, and the dark channel image of the image to be processed is obtained according to the dark channel values of the pixels in the image to be processed;
[0024] The dark channel value of the pixel in the image to be processed is obtained through the following formula, and the formula is:
[0025]
[0026] In the formula: DC(x, y) is the dark channel value of the pixel (x, y) in the image to be processed; (i, j) is the pixel coordinate traversed within the local area Ω(x, y) centered on the pixel (x, y); Ω(x, y) is the local area centered on (x, y); D(i, j) is the relative darkness value of the pixel (i, j) in the image to be processed;
[0027] Among them, the local area centered at (x, y) defined by Ω(x, y) is user-defined, and the local area centered at (x, y) defined by Ω(x, y) is initially defaulted to a 10×10 window.
[0028] Furthermore, the relative darkness value D(i, j) of the pixel (i, j) in the image to be processed is obtained by the following formula:
[0029]
[0030] In the formula: I R (i, j), I G (i, j), I B (i, j) are the values of the pixel (i, j) in the image to be processed in the R, G, and B color channels.
[0031] Furthermore, the operation of setting the inspection window according to the defogging accuracy requirement is user-defined, and the setting of the inspection window follows:
[0032] The higher the defogging accuracy requirement, the smaller the set inspection window; the lower the defogging accuracy requirement, the larger the set inspection window. The minimum size of the inspection window is 2*2, and the maximum size of the inspection window is M and N are the length and width of the image.
[0033] Furthermore, the color difference D color between the sub-image to be processed and the defogged sub-image is obtained by the following formula:
[0034]
[0035] In the formula: M and N are the length and width of the image; d color (x, y) is the color distance between the pixels in the sub-image to be processed and the defogged sub-image at the position (x, y);
[0036] Among them,
[0037] I de R (x, y), I or R (x, y) are the values of the pixels at the position (x, y) in the defogged sub-image and the sub-image to be processed in the R color channel; I de G (x, y), I or G(x, y) are the values of the pixels at the position (x, y) in the defogged sub-image and the sub-image to be processed in the G color channel; I de B (x, y), I or B(x, y) is the value of the pixel at the position (x, y) in the dehazed sub-image and the sub-image to be processed in the B color channel.
[0038] Furthermore, in the dehazing processing defect determination threshold [0, q], and it is user-defined;
[0039] The D total (max) is the maximum difference value in the difference calculation result between the sub-image to be processed and the dehazed sub-image.
[0040] Furthermore, after picking up the dehazed sub-image based on the dehazing processing defect determination threshold, further calculate the grayscale average value of the dehazed sub-image, obtain the maximum grayscale value of the pixels in the dehazed image where the dehazed sub-image is located, then calculate the ratio of the grayscale average value to the maximum grayscale value, denoted as K, and use the dehazed sub-image corresponding to K > 2 / 3 as the target for the final re-dehazing processing.
[0041] Furthermore, the re-dehazing processing logic of the dehazed sub-image is expressed as:
[0042]
[0043] In the formula: J(x, y) is the dehazed sub-image after re-dehazing processing; G x (x, y) is the horizontal gradient of the dehazed sub-image; G y (x, y) is the vertical gradient of the dehazed sub-image; M, N are the length and width of the dehazed sub-image; B is the brightness adjustment coefficient; I(x, y) is the dehazed sub-image;
[0044] Among them, the brightness adjustment coefficient k is the adjustment parameter; L avg is the average brightness of the dehazed sub-image.
[0045] Furthermore, the dehazed sub-image iterates to the corresponding position in its corresponding dehazed image based on the dehazed sub-image output by the re-dehazing processing to form the final dehazed image and output it.
[0046] Adopting the technical solution provided by the present invention, compared with the known public technology, it has the following beneficial effects:
[0047] The present invention provides an image defogging method based on dark channel prior. During the execution of this method, based on the dark channel prior image defogging algorithm, the defogging effect of the image is greatly improved by adding a correction method. Further, based on the comparison between the original image and the defogged image, further defogging optimization is performed on the areas with poor defogging effect in the defogged image, so as to achieve effective defogging processing of the entire original image, improve the quality of the defogged image and the actual defogging effect, and is particularly suitable for defogging processing of foggy images in which the "blank area" accounts for a large proportion of the entire image. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.
[0049] Figure 1 It is a schematic flowchart of an image defogging method based on dark channel prior. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0050] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.
[0051] The present invention will be further described below with reference to the embodiments.
[0052] Embodiment 1:
[0053] A method for defogging an image based on dark channel prior in this embodiment, as Figure 1 shown, includes:
[0054] Receiving the image to be processed, traversing each pixel in the image to be processed, identifying the gray value of each pixel, determining the maximum gray value of the pixels in the image to be processed, and based on the dark channel prior defogging algorithm and the maximum gray value of the pixels in the image to be processed, calculating the pixel value of the restored pixel for each pixel in the image to be processed, and iterating the pixel value of the original pixel with the pixel value of the restored pixel to output the image after defogging processing based on the dark channel prior defogging algorithm;
[0055] In the stage of obtaining the pixel values of the restored pixels for each pixel in the image to be processed, the correction factor corresponding to the pixel is obtained according to the maximum gray value of the pixel in the image to be processed, and the correction factor is added to the dark channel prior dehazing algorithm, and further, based on the dark channel prior dehazing algorithm, the pixel values of the restored pixels in the image to be processed are output;
[0056] The logical expression for the dark channel prior dehazing algorithm to output the pixel values of the restored pixels is:
[0057]
[0058] In the formula: χ i is the correction factor; G i is the gray value of the i-th pixel in the image to be processed; G max is the maximum gray value in the image to be processed; J(i) is the pixel value after dehazing the i-th pixel in the image to be processed; I(i) is the pixel value of the i-th pixel in the image to be processed; A is the atmospheric light value; ω is a fixed parameter; J dark (i) is the value of the i-th pixel point in the dark channel image of the image to be processed; A(0) is the value of the atmospheric light value in the first color channel among the three color channels; t 0 is the lower limit value of the transmittance;
[0059] Among them, the value of the fixed parameter ω is user-defined, and the initial value of the fixed parameter ω is defaulted to 0.95. Based on the above formula, the corresponding J(i) is obtained for each pixel in the image to be processed, means taking the maximum value within the brackets, means based on the transmittance of the i-th pixel in the image to be processed;
[0060] When obtaining the dark channel image of the image to be processed, based on the image to be processed, the dark channel value of each pixel in the image to be processed is determined when outputting the dark channel image, and the dark channel image of the image to be processed is obtained according to the dark channel values of the pixels in the image to be processed;
[0061] The dark channel value of the pixel in the image to be processed is obtained through the following formula, and the formula is:
[0062]
[0063] In the formula: DC(x, y) is the dark channel value of the pixel (x, y) in the image to be processed; (i, j) is the pixel coordinate traversed within the local area Ω(x, y) centered on the pixel (x, y); Ω(x, y) is the local area centered on (x, y); D(i, j) is the relative darkness value of the pixel (i, j) in the image to be processed;
[0064] Among them, the local area centered on (x, y) defined by Ω(x, y) is user-defined, and the local area centered on (x, y) defined by Ω(x, y) is initially defaulted to a 10×10 window;
[0065] The relative darkness value D(i, j) of the pixel (i, j) in the image to be processed is obtained by the following formula:
[0066]
[0067] In the formula: I R (i, j), I G (i, j), I B (i, j) are the values of the pixel (i, j) in the image to be processed in the R, G, and B color channels;
[0068] Obtain the image to be processed and the dehazed image corresponding to the image to be processed, set the inspection window according to the dehazing accuracy requirement, and perform segmentation processing on the image to be processed and the dehazed image corresponding to the image to be processed based on the inspection window to obtain several groups of equal amounts of sub-images of the image to be processed and sub-images of the dehazed image;
[0069] The sub-image of the image to be processed is denoted as the sub-image to be processed, and the sub-image of the dehazed image is denoted as the dehazed sub-image;
[0070] Analyze the differences between each group of sub-images to be processed and dehazed sub-images, set the dehazing processing defect determination threshold, pick up the dehazed sub-images that meet the dehazing processing defect determination threshold, and use the picked dehazed sub-images as the reprocessing target to perform dehazing processing again;
[0071] The difference between the sub-image to be processed and the dehazed sub-image is obtained by the following formula:
[0072]
[0073] In the formula: D total is the difference between the sub-image to be processed and the dehazed sub-image; α and β are weights; D color is the color difference between the sub-image to be processed and the dehazed sub-image; sim(L) is the brightness similarity between the sub-image to be processed and the dehazed sub-image; sim(C) is the contrast pixel value between the sub-image to be processed and the dehazed sub-image; sim(P) is the structural similarity between the sub-image to be processed and the dehazed sub-image;
[0074] Among them, the values of the weights α and β are user-defined, and α is always greater than β. Based on the above formula, the difference D total between each group of corresponding sub-images to be processed and dehazed sub-images is obtained, D totalThe larger the value, the greater the difference between the sub-image to be processed and the defogged sub-image. Conversely, the smaller the value, the smaller the difference between the sub-image to be processed and the defogged sub-image. The defogging processing defect determination threshold is [0, q], and the q value is the maximum value in the defogging processing defect determination threshold;
[0075] The color difference D between the sub-image to be processed and the defogged sub-image color is obtained by the following formula:
[0076]
[0077] In the formula: M and N are the length and width of the image; d color (x, y) is the color distance between the pixels of the sub-image to be processed and the defogged sub-image at the position (x, y);
[0078] Among them,
[0079] I de R I(x, y), I or R I(x, y) is the value of the pixel at the position (x, y) of the defogged sub-image and the sub-image to be processed in the R color channel; I de G I(x, y), I or G I(x, y) is the value of the pixel at the position (x, y) of the defogged sub-image and the sub-image to be processed in the G color channel; I de B I(x, y), I or B I(x, y) is the value of the pixel at the position (x, y) of the defogged sub-image and the sub-image to be processed in the B color channel;
[0080] In the defogging processing defect determination threshold [0, q], and it is user-defined;
[0081] D total (max) is the maximum difference value in the difference calculation result between the sub-image to be processed and the defogged sub-image;
[0082] The logic of re-defogging the defogged sub-image is expressed as:
[0083]
[0084] In the formula: J(x, y) is the defogged sub-image after re-defogging; G x (x, y) is the horizontal gradient of the defogged sub-image; G y(x, y) is the vertical gradient of the dehazed sub-image; M and N are the length and width of the dehazed sub-image; B is the brightness adjustment coefficient; I(x, y) is the dehazed sub-image;
[0085] Among them, the brightness adjustment coefficient k is the adjustment parameter; L avg is the average brightness of the dehazed sub-image.
[0086] In this embodiment, through the execution of the method in the above embodiment, a comprehensive dehazing effect is brought to the hazy image. During the dehazing process of the hazy image, based on two different dehazing processing logics, they are respectively applied to the global dehazing of the hazy image and the further dehazing processing of the dehazing area with poor dehazing effect, so as to output a dehazed image with higher quality and better dehazing effect.
[0087] Embodiment 2:
[0088] At the specific implementation level, on the basis of Embodiment 1, this embodiment refers to Figure 1 to further specifically describe a method for image dehazing based on dark channel prior in Embodiment 1:
[0089] Set the operation of the inspection window according to the dehazing accuracy requirement, which is customized by the user side, and the setting of the inspection window follows:
[0090] The higher the dehazing accuracy requirement, the smaller the set inspection window; the lower the dehazing accuracy requirement, the larger the set inspection window. The minimum size of the inspection window is 2*2, and the maximum size of the inspection window is M and N are the length and width of the image.
[0091] Through the above settings, the setting logic of the inspection window applied in the method of Embodiment 1 is further limited, ensuring the stable execution of the method in Embodiment 1.
[0092] As Figure 1 shown, after picking up the dehazed sub-image based on the dehazing processing defect determination threshold, further calculate the gray average value of the dehazed sub-image, obtain the maximum gray value of the pixels of the dehazed image where the dehazed sub-image is located, and then calculate the ratio of the gray average value to the maximum gray value, denoted as K. The dehazed sub-image corresponding to K>2 / 3 is used as the target for the final re-execution of the dehazing process.
[0093] Through the above settings, an effective determination logic is provided for the method in Embodiment 1 to determine the target dehazed sub-image for re-executing the dehazing process.
[0094] As Figure 1 shown, the dehazed sub-image iterates to the corresponding position in the corresponding dehazed image based on the dehazed sub-image output by the re-dehazing process to form the final dehazed image and output it.
[0095] In summary, during the execution of the method in the above embodiments, based on the dark channel prior image dehazing algorithm, the image dehazing effect is greatly improved by adding a correction method. Further, based on the comparison between the original image and the dehazed image, further dehazing optimization is performed on the regions with poor dehazing effect in the dehazed image, so as to achieve effective global dehazing processing of the original image, improve the quality of the dehazed image and the actual dehazing effect, and is particularly suitable for dehazing processing of foggy images in which the "blank area" accounts for a large proportion of the whole image.
[0096] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements will not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An image defogging method based on dark channel prior, characterized in that: include: Receive an image to be processed, traverse each pixel in the image to be processed, identify the grayscale value of each pixel, determine the maximum grayscale value of the pixels in the image to be processed, obtain the pixel value of the restored pixel of each pixel in the image to be processed based on the dark channel priori defogging algorithm combined with the maximum grayscale value of the pixels in the image to be processed, iterate the pixel value of the original pixel with the pixel value of the restored pixel, and output the image after defogging based on the dark channel priori defogging algorithm; Obtaining an image to be processed and a defogging image corresponding to the image to be processed, setting a test window according to the defogging accuracy requirement, and performing segmentation processing on the image to be processed and the defogging image corresponding to the image to be processed based on the test window to obtain a plurality of groups of equal sub-images of the image to be processed and sub-images of the defogging image; The sub-image of the image to be processed is recorded as the sub-image to be processed, and the sub-image of the defogging image is recorded as the defogging sub-image; Analyze the differences between each group of sub-images to be processed and the defogging sub-images, set the threshold for judging the defects of defogging, pick up the defogging sub-images that meet the threshold for judging the defects of defogging, take the picked up defogging sub-images as the reprocessing targets, and perform defogging again; The difference between the sub-image to be processed and the defogging sub-image is obtained by the following formula: Where: D total is the difference between the sub-image to be processed and the defogging sub-image; α and β are weights; D color is the color difference between the sub-image to be processed and the dehazed sub-image; sim(L) is the brightness similarity between the sub-image to be processed and the defogging sub-image; sim(C) is the contrast pixel value between the sub-image to be processed and the defogging sub-image; sim(P) is the structural similarity between the sub-image to be processed and the dehazed sub-image; Among them, the weights α and β are customized by the user, and α is always greater than β. Based on the above formula, the difference D between each group of corresponding sub-images to be processed and the defogging sub-image is total To obtain, D total The larger the value, the greater the difference between the sub-image to be processed and the defogged sub-image. Conversely, the smaller the difference between the sub-image to be processed and the defogged sub-image. The defogging defect judgment threshold is [0, q], and the q value is the maximum value among the defogging defect judgment thresholds.
2. The image defogging method based on dark channel prior according to claim 1, characterized in that: In the pixel value obtaining stage of the restored pixels in the image to be processed, the correction factor of the corresponding pixel is obtained according to the maximum grayscale value of the pixel in the image to be processed, and the correction factor is added to the dark channel prior defogging algorithm, and the pixel value of the pixel after the restored pixels in the image to be processed are further output based on the dark channel prior defogging algorithm; The logical representation of the pixel value of the restored pixel output by the dark channel priori defogging algorithm is: Where: i is the correction factor; G i is the gray value of the i-th pixel in the image to be processed; G max is the maximum grayscale value in the image to be processed; J(i) is the pixel value of the i-th pixel in the image to be processed after defogging; I(i) is the pixel value of the i-th pixel in the image to be processed; A is the atmospheric light value; ω is a fixed parameter; J dark (i) is the value of the i-th pixel in the dark channel image of the image to be processed; A(0) is the first channel value of the atmospheric light value in the three color channels; t0 is the lower limit of the transmittance; The fixed parameter ω is set by the user, and the initial default value of the fixed parameter ω is 0.
95. Based on the above formula, the corresponding J(i) is obtained for each pixel in the image to be processed. Indicates that the maximum value in brackets is taken. Represents the transmittance based on the i-th pixel in the image to be processed.
3. The image defogging method based on dark channel prior according to claim 2, characterized in that: When obtaining the dark channel image of the image to be processed, the dark channel value of each pixel in the image to be processed when outputting the dark channel image is determined based on the image to be processed, and the dark channel image of the image to be processed is obtained according to the dark channel value of each pixel in the image to be processed; The dark channel value of the pixel in the image to be processed is obtained by the following formula: Where: DC(x,y) is the dark channel value of pixel (x,y) in the image to be processed; (i, j) is the pixel coordinate traversed in the local area Ω(x, y) centered at the pixel (x, y); Ω(x, y) is the local area centered at (x, y); D(i, j) is the relative darkness value of the pixel (i, j) in the image to be processed; The local area centered at (x, y) defined by Ω(x, y) is customized by the user, and the local area centered at (x, y) defined by Ω(x, y) is initially a 10×10 window by default.
4. The image defogging method based on dark channel prior according to claim 3, characterized in that: The relative darkness value D(i, j) of the pixel (i, j) in the image to be processed is obtained by the following formula: Where: I R (i,j),I G (i,j),I B (i, j) is the value of pixel (i, j) in the image to be processed in the three color channels of R, G, and B.
5. The image defogging method based on dark channel prior according to claim 1, characterized in that: The operation of setting the inspection window according to the defogging accuracy requirement is customized by the user, and the setting of the inspection window is subject to: The higher the defogging accuracy requirement, the smaller the set inspection window is; the lower the defogging accuracy requirement, the larger the set inspection window is. The minimum inspection window is 2*2, and the maximum inspection window is M and N are the length and width of the image.
6. The image defogging method based on dark channel prior according to claim 1, characterized in that: The color difference D between the sub-image to be processed and the defogging sub-image color The formula is as follows: Where: M, N are the length and width of the image; d color (x, y) is the color distance between the pixel in the sub-image to be processed and the dehazed sub-image at the position (x, y); in, I de R (x,y),I or R (x, y) is the value of the pixel at position (x, y) in the defogging sub-image and the sub-image to be processed in the R color channel; I de G (x,y),I or G (x, y) is the value of the pixel at position (x, y) in the G color channel of the dehazed sub-image and the sub-image to be processed; I de B (x,y),I or B (x, y) is the value of the pixel at position (x, y) in the dehazed sub-image and the sub-image to be processed in the B color channel.
7. The image defogging method based on dark channel prior according to claim 1, characterized in that: In the defogging defect determination threshold [0, q], And it is customized by the user; The D total (max) is the maximum difference value in the difference calculation results between the sub-image to be processed and the dehazed sub-image.
8. The image defogging method based on dark channel prior according to claim 1, characterized in that: After picking up the defogging sub-image based on the defogging defect judgment threshold, the grayscale average of the defogging sub-image is further calculated, and the maximum grayscale value of the pixels of the defogging image where the defogging sub-image is located is obtained. The ratio of the grayscale average to the maximum grayscale value is calculated, denoted as K, and the corresponding defogging sub-image with K>2 / 3 is used as the final target for re-execution of the defogging process.
9. The image defogging method based on dark channel prior according to claim 1, characterized in that: The defogging logic of the defogging sub-image is expressed as follows: Where: J(x, y) is the defogging sub-image after the second defogging process; G x (x, y) is the horizontal gradient of the dehazed image; G y (x, y) is the vertical gradient of the defogging image; M and N are the length and width of the defogging image; B is the brightness adjustment coefficient; I(x, y) is the defogging image; Among them, the brightness adjustment coefficient k is the adjustment parameter; L avg is the average brightness of the dehazed image.
10. The image defogging method based on dark channel prior according to claim 1, characterized in that: The defogging sub-image is iterated toward a corresponding position in the corresponding defogging image based on the defogging sub-image output by the second defogging process to form a final defogging image, and output it.
Citation Information
Patent Citations
Image defogging method based on dark channel prior
CN115619662A
Image defogging transmittivity optimization method based on dark channel prior
CN106157267A
Image defogging method and system
US20130071043A1