Image defogging method based on dark channel prior
Through the image defog removal method based on dark channel priors, combined with differential analysis and correction factor optimization, the problem of poor fog removal effect in large-area blank areas in the existing technology is solved, and more comprehensive defog removal and higher Quality defogging images.
Patent Information
- Application Number
- CN202411415002.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-01-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing image defog removal technology is not effective when dealing with large areas of blank space, especially images containing the sky, which are not thorough in fog removal.
The image defog removal method based on dark channel prior is adopted. By identifying the maximum grayscale value of pixels in the image, combining the dark channel prior defog removal algorithm for defog removal, and further treating defog removal through differential analysis and correction factor optimization Areas with poor results.
The image defog removal effect is significantly improved, especially in the treatment of large areas of blank areas, and more comprehensive defog removal treatment is achieved, improving the quality and effect of the defog removal image.
Smart Images

Figure CN119295353A_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 based on dark channel prior. Background Art
[0002] Image dehazing technology aims to remove fog from images and improve image clarity. It estimates parameters such as atmospheric light and transmittance by analyzing image features. Common methods include dark channel priors, etc., which can effectively restore clear scenes. This technology has important application value in photography, surveillance and other fields.
[0003] The invention patent with application number 202211188123.3 discloses an image defogging method based on dark channel prior, which is characterized in that it includes the following steps: Step 1, for a single foggy image, identify and detect the sky area. If the sky area is detected, the mean of the bright channel values of the sky area is used as the estimation of the atmospheric light A. If there is no sky area, the quadtree search algorithm is used to take the mean of the bright channel values corresponding to the last area as the estimation of the atmospheric light A: Step 2, grayscale processing is performed on a single foggy image, the dark channel map of the image is calculated, and its atmospheric transmittance is estimated, and then the transmittance is optimized based on guided filtering; Step 3, the image is restored according to the estimation of the atmospheric light A obtained in step 1 and the optimized transmittance obtained in step 2.
[0004] This application aims to solve the problem that "in existing image defogging technology, the restored image is prone to incomplete removal of fog."
[0005] However, due to the above problems, the current image defogging technology has not been updated for a long time. For images with large blank areas, such as images containing a large proportion of the sky, the defogging effect based on the existing technology is poor.
[0006] To this end, we propose an image dehazing method based on dark channel prior. Summary of the invention
[0007] In view of the above-mentioned shortcomings of the prior art, the present invention provides an image defogging method based on dark channel prior, which solves the technical problems raised in the above-mentioned background technology.
[0008] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0009] An image defogging method based on dark channel prior, comprising:
[0010] 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;
[0011] 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;
[0012] 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;
[0013] 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;
[0014] The difference between the sub-image to be processed and the defogging sub-image is obtained by the following formula:
[0015]
[0016] 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 defogging 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 defogging sub-image;
[0017] 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.
[0018] Furthermore, in the pixel value obtaining stage of the pixel after the pixels in the image to be processed are restored, the correction factor of the corresponding 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 defogging algorithm, and the pixel value of the pixel after the pixels in the image to be processed are further output based on the dark channel prior defogging algorithm;
[0019] The logical representation of the pixel value of the restored pixel output by the dark channel priori defogging algorithm is:
[0020]
[0021] 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;
[0022] The fixed parameter ω is user-defined 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.
[0023] Furthermore, 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;
[0024] The dark channel value of the pixel in the image to be processed is obtained by the following formula:
[0025]
[0026] Where: DC(x,y) is the dark channel value of pixel (x,y) in the image to be processed; (i,j) is the pixel coordinates traversed in the local area Ω(x,y) centered on pixel (x,y); Ω(x,y) is the local area centered on (x,y); D(i,j) is the relative darkness value of pixel (i,j) in the image to be processed;
[0027] 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.
[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] 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.
[0031] Furthermore, 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:
[0032] 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.
[0033] Furthermore, the color difference D between the sub-image to be processed and the defogging sub-image is color The formula is as follows:
[0034]
[0035] 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);
[0036] in,
[0037] 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.
[0038] Furthermore, in the defogging defect determination threshold [0, q], And it is customized by the user;
[0039] 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.
[0040] Furthermore, after the dehazed sub-image is picked up based on the dehazed processing defect judgment threshold, the grayscale average of the dehazed sub-image is further calculated, and the maximum grayscale value of the pixels of the dehazed image where the dehazed sub-image is located is obtained, and then the ratio of the grayscale average to the maximum grayscale value is calculated, denoted as K, and the corresponding dehazed sub-image with K>2 / 3 is used as the final target for re-execution of the dehazed processing.
[0041] Furthermore, the defogging process logic of the defogging sub-image is expressed as:
[0042]
[0043] 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;
[0044] Among them, the brightness adjustment coefficient k is the adjustment parameter; L avg is the average brightness of the dehazed image.
[0045] Furthermore, the defogging sub-image is iterated toward a corresponding position in its corresponding defogging image based on the defogging sub-image output by the second defogging process to form a final defogging image, and output it.
[0046] Compared with the known public technology, the technical solution provided by the present invention has the following beneficial effects:
[0047] The present invention provides an image defogging method based on dark channel prior. During the execution of the method, the image defogging algorithm based on dark channel prior is used as the basis, and the image defogging effect is greatly improved by adding a correction method. Further, based on the comparison between the original image and the defogged image, the area with poor defogging effect in the defogged image is further optimized for defogging, thereby achieving effective defogging processing of the original image as a whole, improving the quality of the defogged image and the actual defogging effect. The method is particularly suitable for defogging processing of foggy images in which the "blank area" accounts for a relatively large proportion of the entire image. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0049] Figure 1 Schematic diagram of the process of an image dehazing method based on dark channel prior. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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.
[0051] The present invention will be further described below in conjunction with the embodiments.
[0052] Embodiment 1:
[0053] This embodiment is an image defogging method based on dark channel prior, such as Figure 1 As shown, including:
[0054] 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;
[0055] 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;
[0056] The logical representation of the pixel value of the restored pixel output by the dark channel prior dehazing algorithm is:
[0057]
[0058] 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;
[0059] The fixed parameter ω is user-defined 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;
[0060] 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;
[0061] The dark channel value of the pixel in the image to be processed is obtained by the following formula:
[0062]
[0063] Where: DC(x,y) is the dark channel value of pixel (x,y) in the image to be processed; (i,j) is the pixel coordinates traversed in the local area Ω(x,y) centered on pixel (x,y); Ω(x,y) is the local area centered on (x,y); D(i,j) is the relative darkness value of pixel (i,j) in the image to be processed;
[0064] 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 set to a 10×10 window by default;
[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] 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;
[0068] 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;
[0069] 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;
[0070] 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;
[0071] The difference between the sub-image to be processed and the defogging sub-image is obtained by the following formula:
[0072]
[0073] 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 defogging 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 defogging sub-image;
[0074] 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 totalThe larger the value, the greater the difference between the sub-image to be processed and the defogging sub-image. Conversely, the smaller the difference between the sub-image to be processed and the defogging sub-image. The defogging defect judgment threshold is [0, q], and the q value is the maximum value among the defogging defect judgment thresholds.
[0075] The color difference D between the sub-image to be processed and the dehazed sub-image color The formula is as follows:
[0076]
[0077] 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);
[0078] in,
[0079]
[0080] 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;
[0081] In the threshold value [0, q] for judging the defect of dehazing processing, And it is customized by the user;
[0082] D total (max) is the maximum difference value between the sub-image to be processed and the dehazed sub-image;
[0083] The logic of defogging the defogging sub-image is expressed as follows:
[0084]
[0085] 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;
[0086] Among them, the brightness adjustment coefficient k is the adjustment parameter; L avg is the average brightness of the dehazed image.
[0087] In this embodiment, through the execution of the method in the above embodiment, a comprehensive defogging effect is brought about for the foggy image. In the process of defogging the foggy image, based on two different defogging processing logics, they are respectively applied to the global defogging of the foggy image and further defogging of the defogging area with poor defogging effect, so as to output a defogging image with higher quality and better defogging effect.
[0088] Embodiment 2:
[0089] In terms of specific implementation, based on Example 1, this example refers to Figure 1 The image defogging method based on dark channel prior in Example 1 is further described in detail:
[0090] The operation of setting the inspection window according to the defogging accuracy requirements is customized by the user, and the setting of the inspection window is subject to:
[0091] The higher the defogging accuracy requirement, the smaller the inspection window is set. The lower the defogging accuracy requirement, the larger the inspection window is set. The minimum inspection window is 2*2 and the maximum inspection window is M and N are the length and width of the image.
[0092] Through the above settings, the verification window setting logic of the application execution method in Example 1 is further limited, ensuring the stable execution of the method in Example 1.
[0093] like Figure 1 As shown, after the dehazed sub-image is picked up based on the dehazed processing defect judgment threshold, the grayscale average of the dehazed sub-image is further calculated, and the maximum grayscale value of the pixels of the dehazed image where the dehazed sub-image is located is obtained, and then the ratio of the grayscale average to the maximum grayscale value is calculated, denoted as K, and the corresponding dehazed sub-image with K>2 / 3 is used as the final target for re-execution of the dehazed processing.
[0094] Through the above-mentioned setting, an effective determination logic is provided for the method in Embodiment 1 to determine the target defogging sub-image for performing defogging processing again.
[0095] like Figure 1 As shown, the defogging sub-image is iterated toward the corresponding position in the corresponding defogging image based on the defogging sub-image output by the second defogging process to form the final defogging image and output it.
[0096] In summary, during the execution of the method in the above embodiment, the dark channel prior image defogging algorithm is used as the basis, and the image defogging effect is greatly improved by adding corrections. Further, based on the comparison between the original image and the defogged image, the area with poor defogging effect in the defogged image is further optimized for defogging, thereby achieving effective defogging processing of the original image as a whole, improving 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 relatively large proportion of the entire image.
[0097] The above embodiments 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 will not cause the essence of the corresponding technical solutions to 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 user-defined 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
Cited By
Exhaust gas leakage detection method for tar treatment
CN120598956A