Image penetration method and system
Through the Retinex algorithm and two-dimensional wavelet transformation technology, the problem of limited effects of image defog removal technology under complex lighting conditions is solved, and efficient defog removal and image natural retention in the case of heavy fog are achieved.
Patent Information
- Application Number
- CN202411238326.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-09-05
AI Technical Summary
The existing image defogging technology has limited effects under complex lighting conditions, especially when the fog is heavy, it is easy to introduce artifacts or excessive enhancement, resulting in unnatural images.
The Retinex algorithm is used for global enhancement processing, combined with two-dimensional wavelet transformation to decompose the image, enhance the high-frequency subband coefficient through nonlinear function mapping, and weighted fusion is performed to ensure the optimization of image quality.
Effectively remove the influence of mist and maintain the natural feeling of the image. It is suitable for a variety of lighting conditions, avoiding the problems of excessive enhancement or insufficient enhancement, and ensuring the overall quality of the image.
Smart Images

Figure CN118761933B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an image fog penetration method and a fog penetration system. Background Art
[0002] In the field of image processing, images are often affected by fog, which leads to a decrease in image quality and affects the accuracy of subsequent image analysis and understanding.
[0003] Traditional image dehazing techniques mainly rely on physical models, such as Dark Channel Prior and Atmospheric Scattering Model. Although these methods can improve image quality to a certain extent, they have limited effects under complex lighting conditions, especially in heavy fog, which will introduce artifacts or over-enhance certain parts of the image, resulting in unnatural images.
[0004] Therefore, it is necessary to provide an image fog penetration method and fog penetration system to solve the above technical problems. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides an image defogging method, which can not only effectively remove the influence of fog, but also maintain the naturalness of the image, and is suitable for image defogging needs under various lighting conditions.
[0006] The present invention provides an image fog penetration method, which comprises the following steps:
[0007] S1: Treat fog-penetrating images with Retinex The algorithm performs global enhancement processing to obtain a first image;
[0008] S2: Decomposing the first image by using two-dimensional wavelet transform to obtain high-frequency sub-bands and high-frequency sub-band coefficients and low-frequency sub-bands and low-frequency sub-band coefficients, and performing edge calculation on all high-frequency sub-bands to obtain edge strength values of all high-frequency sub-bands;
[0009] S3: Based on the edge strength values of all the high-frequency sub-bands, obtaining the enhancement factor corresponding to each high-frequency sub-band through nonlinear function mapping;
[0010] S4: enhancing the corresponding high-frequency sub-band coefficients by using the enhancement factor, and reconstructing all low-frequency sub-bands and the high-frequency sub-bands whose high-frequency sub-band coefficients have been enhanced by using a two-dimensional wavelet inverse transform to obtain a second image;
[0011] S5: Perform weighted fusion on the first image and the second image to obtain a defogging image.
[0012] Preferably, step S1 comprises the following steps:
[0013] S101: The pre-processed image to be penetrated by fog is RGB Color space conversion to YCbCr color space, and obtain the brightness information of the image to be penetrated by fog Y Component, blue chromaticity information Cb Component, red chromaticity information Cr Quantity;
[0014] S102: Y The components are processed at multiple scales to obtain enhanced Y Quantity;
[0015] S103: The enhanced Y Quantity and Cb Quantity and Cr The components are reorganized to obtain YCbCr Enhanced images in color space;
[0016] S104: YCbCr The enhanced image in color space is restored to RGB Color space, using the color restoration factor to restore to RGB The enhanced image in the color space is subjected to color restoration and contrast enhancement processing to obtain a first image.
[0017] Preferably, step S2 comprises the following steps:
[0018] S201: Exploit Daubechies The wavelet basis function performs a two-dimensional wavelet transform on the first image to decompose it into at least one low-frequency sub-band and a plurality of high-frequency sub-bands, each of the high-frequency sub-band and the low-frequency sub-band respectively comprising a high-frequency sub-band coefficient and a low-frequency sub-band coefficient;
[0019] S202: Calculate the value of each pixel point in each high frequency sub-band. The first-order difference in the a and y directions is used to obtain the gradient value of each pixel;
[0020] S203: Combine Direction and y The total gradient amplitude of each pixel is calculated using the Euclidean distance formula, and the total gradient amplitude is used as the edge intensity value of the corresponding high-frequency sub-band.
[0021] Preferably, in step S3, the nonlinear function is Sigmoid Function, the formula is:
[0022]
[0023] in, is the edge strength value, is the gain parameter, is the offset, yes Sigmoid function.
[0024] Preferably, in step S3, Sigmoid The function performs threshold processing.
[0025] Preferably, step S4 comprises the following steps:
[0026] S401: Apply the enhancement factor to the corresponding high frequency sub-band coefficient, and perform enhancement processing on the high frequency sub-band coefficient by a dot multiplication operation;
[0027] S402: combining the enhanced high-frequency sub-band coefficients with the low-frequency sub-band coefficients to form a complete enhanced sub-band coefficient set;
[0028] S403: Perform inverse transformation on the obtained enhanced subband coefficient set using two-dimensional wavelet inverse transformation to reconstruct an enhanced image, that is, a second image.
[0029] Preferably, step S5 comprises the following steps:
[0030] S501: performing quality assessment on the first image and the second image respectively based on preset image quality assessment indicators to obtain scores of each image quality assessment indicator in the first image and scores of each image quality assessment indicator in the second image, wherein the image quality assessment indicators are clarity, contrast, edge intensity, color reproduction, and overall brightness;
[0031] S502: Based on a preset weight factor, weighted processing is performed on the scores of each image quality assessment indicator in the first image and the scores of each image quality assessment indicator in the second image to obtain a comprehensive quality score of the first image and a comprehensive quality score of the second image;
[0032] S503: Exploit softma The x function performs weight calculation on the comprehensive quality score of the first image and the comprehensive quality score of the second image to obtain the fusion weight of the first image and the fusion weight of the second image. softmax The function formula is:
[0033]
[0034] in:
[0035] is a -dimensional real vector, where each element Indicates i Unnormalized scores of classes;
[0036] yes Softmax Function pair s No. i The result of applying the elements;
[0037] is the natural exponential function applied to each unnormalized fraction Result;
[0038] Yes all and all The sum of is equal to 1;
[0039] S504: Perform weighted fusion on the first image and the second image based on the fusion weight of the first image and the fusion weight of the second image to obtain a final defogging image.
[0040] An image through-fog system is applied to an image through-fog method, and the through-fog system comprises:
[0041] Retinex The global enhancement module is used to treat fog-penetrating images. Retinex The algorithm performs global enhancement processing to obtain a first image;
[0042] A wavelet transform module is used to decompose the first image by using a two-dimensional wavelet transform to obtain high-frequency sub-bands and high-frequency sub-band coefficients and low-frequency sub-bands and low-frequency sub-band coefficients, and to perform edge calculation on all high-frequency sub-bands to obtain edge strength values of all high-frequency sub-bands;
[0043] An enhancement factor generation module is used for edge strength values of all high-frequency sub-bands to obtain enhancement factors corresponding to each high-frequency sub-band through nonlinear function mapping;
[0044] A detail enhanced image generation module, used to enhance the corresponding high frequency sub-band coefficients by using the enhancement factor, and reconstruct all low frequency sub-bands and the high frequency sub-bands whose high frequency sub-band coefficients have been enhanced by using a two-dimensional wavelet inverse transform to obtain a second image;
[0045] The image weighted fusion module is used to perform weighted fusion on the first image and the second image to obtain a defogging image.
[0046] Compared with the related art, the image defogging method and defogging system provided by the present invention have the following beneficial effects:
[0047] The present invention is achieved by RetinexThe algorithm globally enhances the image, effectively improves the image contrast, and makes blurred image details more clearly visible. It uses two-dimensional wavelet transform to decompose the image and perform targeted edge enhancement on the high-frequency sub-band, which can remove the fog while retaining the important details and structural information of the image. The use of nonlinear functions allows the degree of enhancement of the high-frequency sub-band to be dynamically adjusted according to the edge strength, avoiding the problem of over-enhancement or under-enhancement. Sigmoid The threshold processing function is used to further optimize the defogging effect of the image and prevent noise amplification or detail loss. The final defogging image is obtained by weighted fusion of the first image and the enhanced second image, combining image quality evaluation and weight factors to ensure the best overall image quality. This method is not only suitable for image defogging under different lighting conditions, but also can flexibly cope with various fog concentrations and scene changes by adjusting gain parameters, offsets, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 A flowchart of an image fog penetration method of the present invention;
[0049] Figure 2 This is a module structure diagram of an image fog penetration system of the present invention; DETAILED DESCRIPTION
[0050] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only the parts related to the present invention, rather than all structures, are shown in the accompanying drawings. In addition, the embodiments of the present invention and the features in the embodiments may be combined with each other without conflict.
[0051] It should also be noted that, for ease of description, only the parts related to the present invention, but not all of the contents, are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the various operations (or steps) as being processed sequentially, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the various operations can be rearranged. The processing can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The processing can correspond to methods, functions, procedures, subroutines, subprograms, etc.
[0052] Embodiment 1
[0053] The present invention provides an image fog penetration method. In a specific implementation process, Figure 1 As shown, it shows a flow chart of an image fog penetration method provided by the present invention, including:
[0054] Step S1: Treat the fog-penetrating image using Retinex The algorithm performs global enhancement processing to obtain the first image.
[0055] Specifically, step S1 includes:
[0056] Step S101: The pre-processed fog-penetrating image is RGB Color space conversion to YCbCr color space, and obtain the brightness information in the fog-penetrating image Y Component, blue chromaticity information Cb Component, red chromaticity information Cr Quantity.
[0057] Step S102: Y The components are processed at multiple scales to obtain enhanced Y Quantity.
[0058] Step S103: Y Quantity and Cb Quantity and Cr The components are recombined to obtain an enhanced image in the YCbCr color space.
[0059] S104, YCbCr The enhanced image in color space is restored to RGB Color space, using the color restoration factor to restore to RGB The enhanced image in the color space is subjected to color restoration and contrast enhancement processing to obtain a first image.
[0060] The working process of step S1 is as follows:
[0061] First, the fog-penetrating image is preprocessed by performing preliminary denoising and image size adjustment. RGB Color space conversion to YCbCr color space, and obtain the brightness information in the fog-penetrating image Y Component, blue chromaticity information Cb Component, red chromaticity information Cr Quantity, YCbCr The color space separates color information from brightness information, and can adjust brightness independently without affecting color. RGB arrive YCbCr Color space conversion formula, RGB Image conversion to YCbCr Format, the conversion formula is:
[0062]
[0063] In the formulaR, G, B It is original RGB The channel values of the image, Y, Cb, Cr are the values of each channel after conversion.
[0064] Secondly, apply multi-scale Retinex algorithm( MSR ) to enhance the brightness information Y Components, multi-scale Retinex algorithm( MSR ) includes calculating Gaussian filters at different scales, generating Gaussian filters at different scales, Y The components are applied with multiple Gaussian filters of different scales to smooth the image and reduce high-frequency noise. At the same time, it also simulates the human visual system's perception of the environment at different scales. The filtering results at each scale represent the components of the illumination at that scale. These results are then used to construct an illumination model, which is then used in subsequent steps. Y The light component is removed Y The contrast of the image is enhanced by contrast enhancement.
[0065] Again, the enhanced Y Quantity and original Cb component and Cr Components are reorganized to form an enhanced YCbCr Image, this step preserves the color information of the original image while enhancing the contrast.
[0066] Finally, use YCbCr arrive RGB The inverse transformation formula will enhance the YCbCr Image inverse conversion back RGB Color space, the inverse conversion formula is:
[0067]
[0068] After the inverse conversion, a color restoration factor is applied to adjust the color saturation to ensure the naturalness and accuracy of the color, and the contrast can be further enhanced to ensure that the image is more vivid and clear visually, thereby finally generating the first image.
[0069] Step S2, decomposing the first image by two-dimensional wavelet transform to obtain high-frequency sub-bands and high-frequency sub-band coefficients and low-frequency sub-bands and low-frequency sub-band coefficients, and performing edge calculation on all high-frequency sub-bands to obtain edge strength values of all high-frequency sub-bands.
[0070] Specifically, step S2 includes:
[0071] Step S201, using DaubechiesThe wavelet basis function performs a two-dimensional wavelet transform on the first image to decompose it into at least one low-frequency sub-band and a plurality of high-frequency sub-bands, each of the high-frequency sub-band and the low-frequency sub-band respectively comprising a high-frequency sub-band coefficient and a low-frequency sub-band coefficient.
[0072] Step S202, calculate each pixel point in each high frequency sub-band Direction and y The first-order difference in the direction is used to obtain the gradient value of each pixel.
[0073] Step S203, combining Direction and y The total gradient amplitude of each pixel is calculated using the Euclidean distance formula, and the total gradient amplitude is used as the edge intensity value of the corresponding high-frequency sub-band.
[0074] The working process of step S2 is as follows:
[0075] First, use Daubechies The wavelet basis function performs a two-dimensional wavelet transform on the first image, and the image is decomposed into a low-frequency sub-band and three high-frequency sub-bands. The coefficient of each sub-band represents the information of the original image in different frequency ranges.
[0076] Second, for each high frequency subband, we calculate the x and y The first-order difference in direction is achieved through convolution operation using the following two filters:
[0077] Horizontal difference filter:
[0078] Vertical difference filter:
[0079] Applying these filters to each high frequency subband, we obtain for each pixel x and y The gradient value in the direction.
[0080] Finally, combine Direction and y The total gradient amplitude of each pixel is calculated using the Euclidean distance formula, and the total gradient amplitude is used as the edge strength value of the corresponding high-frequency sub-band. The specific formula is as follows:
[0081]
[0082] Here and Respectively represent x Direction and y The change in pixel intensity in the direction, is the total gradient magnitude.
[0083] Step S3: Based on the edge strength values of all high-frequency sub-bands, an enhancement factor corresponding to each high-frequency sub-band is obtained through nonlinear function mapping.
[0084] The nonlinear function is Sigmoid Function, the formula is:
[0085]
[0086] in, is the edge strength value, is the gain parameter, is the offset, yes Sigmoid function. In order to avoid over-enhancement or under-enhancement, Sigmoid Set a threshold on the output of the function. For example, define a threshold T , lower than T The enhancement factor value is set to 0, and the value above T This prevents very weak edges from being enhanced incorrectly while ensuring that significant edges are enhanced sufficiently.
[0087] Step S4, enhancing the corresponding high-frequency sub-band coefficients by using the enhancement factor, and reconstructing all low-frequency sub-bands and the high-frequency sub-bands whose high-frequency sub-band coefficients have been enhanced by using a two-dimensional wavelet inverse transform to obtain a second image.
[0088] Specifically, step S4 includes:
[0089] Step S401 : applying enhancement factors to corresponding high frequency sub-band coefficients, and performing enhancement processing on the high frequency sub-band coefficients by a dot multiplication operation.
[0090] Step S402: Combine the enhanced high-frequency sub-band coefficients with the low-frequency sub-band coefficients to form a complete enhanced sub-band coefficient set.
[0091] Step S403: perform inverse transformation on the obtained enhanced subband coefficient set using two-dimensional wavelet inverse transformation to reconstruct an enhanced image, that is, a second image.
[0092] The working process of step S4 is as follows:
[0093] First, for each matrix composed of high-frequency sub-band coefficients, a matrix composed of corresponding enhancement factors is applied to perform a dot multiplication operation to obtain enhanced high-frequency sub-band coefficients.
[0094] Secondly, the enhanced high-frequency subband coefficients are combined with the unchanged low-frequency subband coefficients to form a complete set of enhanced subband coefficients.
[0095] Finally, using DaubechiesThe wavelet basis function performs a two-dimensional wavelet inverse transform to reconstruct the enhanced subband coefficient set back into the image space, thereby obtaining an image with detail enhancement, i.e., the second image. In this way, the edge details in the original image will be enhanced to varying degrees according to their intensity, weak edges will become less obvious, and strong edges will become more prominent, thereby improving the overall visual detail effect of the image.
[0096] Step S5, performing weighted fusion on the first image and the second image to obtain a defogging image.
[0097] Specifically, step S5 includes:
[0098] Step S501, based on preset image quality assessment indicators, respectively perform quality assessment on the first image and the second image to obtain scores of each image quality assessment indicator in the first image and scores of each image quality assessment indicator in the second image, wherein the image quality assessment indicators are clarity, contrast, edge intensity, color reproduction, and overall brightness.
[0099] Step S502, based on a preset weight factor, weighted processing is performed on the scores of each image quality assessment indicator in the first image and the scores of each image quality assessment indicator in the second image to obtain a comprehensive quality score of the first image and a comprehensive quality score of the second image.
[0100] Step S503, using softma The x function performs weight calculation on the comprehensive quality score of the first image and the comprehensive quality score of the second image to obtain the fusion weight of the first image and the fusion weight of the second image. softmax The function formula is:
[0101]
[0102] in:
[0103] is a K -dimensional real vector, where each element Indicates i Unnormalized scores of classes;
[0104] yes Softmax Function pair s No. i The result of applying the elements;
[0105] is the natural exponential function applied to each unnormalized fraction Result;
[0106] Yes all and all The sum of is equal to 1.
[0107] Step S504 , weighted fusion is performed on the first image and the second image based on the fusion weight of the first image and the fusion weight of the second image to obtain a final defogging image.
[0108] The working process of step S5 is as follows:
[0109] First, the first image and the second image are evaluated based on preset image quality evaluation indicators, including clarity, contrast, edge strength, color reproduction and overall brightness.
[0110] Secondly, the quality score of each image is weighted according to the preset weight factor. The weight factor reflects the importance of each indicator in the overall quality assessment. For example, the preset weight factors corresponding to clarity, contrast, edge strength, color reproduction and overall brightness are , , , , ,and , , , , The sum of all additions is 1. The scores of the first image and the second image for clarity, contrast, edge strength, color reproduction, and overall brightness are , , , , and , , , , , the comprehensive quality scores of the first image and the second image are and ,but and The calculation method is:
[0111] = + + + +
[0112] = + + + +
[0113] Secondly, usesoftma The x function performs weight calculation on the comprehensive quality score of the first image and the comprehensive quality score of the second image to obtain the fusion weight of the first image and the fusion weight of the second image. softmax The function formula is:
[0114]
[0115] Exemplarily, assuming that the fusion weight of the first image is , the fusion weight of the second image is ,but , The calculation method is:
[0116]
[0117]
[0118] Finally, based on the calculated fusion weight of the first image and the fusion weight of the second image , weighted fusion is performed on the first image and the second image to obtain the final dehazed image.
[0119] The working principle of an image fog penetration method provided by the present invention is:
[0120] First, the image to be defogged is RGB Color space conversion to YCbCr Color space, separate the brightness information Y Component, blue chromaticity information Cb Component, red chromaticity information Cr Quantity, quantity Y Multi-scale Retinex Processing to enhance contrast, then Y Quantity and original Cb Quantity, Cr Component reorganization, and then converted back RGB Color space, and perform color restoration to obtain a first image.
[0121] Then, use Daubechies The wavelet basis function performs two-dimensional wavelet transform on the first image to obtain multiple high-frequency sub-bands containing detail information and a low-frequency sub-band containing background information, performs edge detection on each high-frequency sub-band, and calculates the edge strength value.
[0122] Secondly, through Sigmoid The function maps the edge strength value to an enhancement factor. The function controls the degree of enhancement by adjusting the gain parameter and the offset. Sigmoid The function result is thresholded to avoid over-enhancement.
[0123] Again, the calculated enhancement factor is multiplied with the corresponding high-frequency subband coefficient to enhance the details, and then the enhanced high-frequency subband coefficient is combined with the low-frequency subband coefficient, using Daubechies The wavelet basis function is reconstructed through two-dimensional wavelet inverse transform to obtain a second image with enhanced details.
[0124] Finally, a weight factor for fusing the first image and the second image is generated based on the image features of the first image and the second image, and the first image and the second image are weightedly fused based on the generated weight factor, thereby generating a final dehazed image.
[0125] Embodiment 2
[0126] The present invention also provides an image defogging system applied to an image defogging method. In a specific implementation process, Figure 2 As shown, it shows a schematic diagram of the module structure of an image fog penetration system provided by the present invention, including:
[0127] Retinex The global enhancement module 100 is used to treat the fog-penetrating image using Retinex The algorithm performs global enhancement processing to obtain the first image.
[0128] The wavelet transform module 200 is used to decompose the first image using two-dimensional wavelet transform to obtain high-frequency sub-bands and high-frequency sub-band coefficients and low-frequency sub-bands and low-frequency sub-band coefficients, and perform edge calculation on all high-frequency sub-bands to obtain edge strength values of all high-frequency sub-bands.
[0129] The enhancement factor generation module 300 is used for obtaining the enhancement factor corresponding to each high frequency sub-band by mapping the edge strength values of all the high frequency sub-bands through a nonlinear function.
[0130] The detail enhanced image generation module 400 is used to enhance the corresponding high frequency subband coefficients by the enhancement factor, and reconstruct all low frequency subbands and high frequency subbands whose high frequency subband coefficients have been enhanced by two-dimensional wavelet inverse transform to obtain a second image.
[0131] The image weighted fusion module 500 is used to perform weighted fusion on the first image and the second image to obtain a defogging image.
[0132] The working principle of an image fog penetration system provided by the present invention is:
[0133] first , Retinex The global enhancement module is responsible for performing global enhancement processing on the fog-penetrating image. RGB Color space conversion to YCbCr Color space, yes YMulti-scale Retinex Processing, enhancing the contrast of the image, Y Quantity and original Cb Quantity, Cr The components are reassembled and converted back RGB The color space is enhanced, and the color restoration factor is applied to restore the image color to obtain a preliminarily enhanced first image.
[0134] Then, the wavelet transform module is responsible for using Daubechies The wavelet basis function decomposes the first image into low-frequency sub-bands and high-frequency sub-bands through two-dimensional wavelet transform, and calculates the edge intensity value of the high-frequency sub-band through an edge algorithm.
[0135] Secondly, based on the edge strength values of all high-frequency sub-bands obtained by the wavelet transform module, these edge strength values are used as input and the nonlinear function Sigmoid Function mapping is used to obtain the enhancement factors corresponding to each high-frequency sub-band. These enhancement factors are used to control the degree of enhancement of subsequent high-frequency sub-band coefficients to highlight the edges and details of the image.
[0136] Thirdly, the detail enhancement image generation module is responsible for applying the enhancement factor generated by the wavelet transform module to enhance the high frequency sub-band coefficients, and then using Daubechies The wavelet basis function reconstructs the enhanced high-frequency subband and the original low-frequency subband through a two-dimensional wavelet inverse transform to generate a second image with enhanced details.
[0137] Finally, based on the preset image quality evaluation indicators, clarity, contrast, edge intensity, color reproduction, and overall brightness, the quality of the first image and the second image is evaluated to obtain their respective image comprehensive quality scores. softmax The function calculates the fusion weights of the two images. Finally, the two images are weighted fused according to these weights to obtain the final dehazed image.
[0138] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0139] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, the storage medium including a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically-erasable programmable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0140] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
Claims
1. An image fog penetration method, characterized in that: The image fog penetration method comprises the following steps: S1: Treat fog-penetrating images with Retinex The algorithm performs global enhancement processing to obtain a first image; S2: Decomposing the first image by using two-dimensional wavelet transform to obtain high-frequency sub-bands and high-frequency sub-band coefficients and low-frequency sub-bands and low-frequency sub-band coefficients, and performing edge calculation on all high-frequency sub-bands to obtain edge strength values of all high-frequency sub-bands; S3: Based on the edge strength values of all high-frequency sub-bands, the enhancement factor corresponding to each high-frequency sub-band is obtained through nonlinear function mapping; S4: enhancing the corresponding high-frequency sub-band coefficients by using the enhancement factor, and reconstructing all low-frequency sub-bands and the high-frequency sub-bands whose high-frequency sub-band coefficients have been enhanced by using a two-dimensional wavelet inverse transform to obtain a second image; S5: performing weighted fusion of the first image and the second image to obtain a defogging image; Among them, the nonlinear function is the Sigmoid function; The edge strength value of the high-frequency sub-band is calculated by The first-order difference in the direction and y direction is used to obtain the gradient value of each pixel; combined with Direction and y The total gradient amplitude of each pixel is calculated using the Euclidean distance formula, and the total gradient amplitude is used as the edge intensity value of the corresponding high-frequency sub-band.
2. The image defogging method according to claim 1, characterized in that: Step S1 includes the following steps: S101: The pre-processed image to be penetrated by fog is RGB Color space conversion to YCbCr color space, and obtain the brightness information of the image to be penetrated by fog Y Component, blue chromaticity information Cb Component, red chromaticity information Cr Quantity; S102: Y The components are processed at multiple scales to obtain enhanced Y Quantity; S103: The enhanced Y Quantity and Cb Quantity and Cr The components are reorganized to obtain YCbCr Enhanced images in color space; S104: YCbCr The enhanced image in color space is restored to RGB Color space, using the color restoration factor to restore to RGB The enhanced image in the color space is subjected to color restoration and contrast enhancement processing to obtain a first image.
3. The image defogging method according to claim 2, characterized in that: Step S2 uses Daubechies The wavelet basis function performs a two-dimensional wavelet transform on the first image to decompose it into at least one low-frequency sub-band and a plurality of high-frequency sub-bands, each of the high-frequency sub-band and the low-frequency sub-band respectively comprising a high-frequency sub-band coefficient and a low-frequency sub-band coefficient.
4. The image defogging method according to claim 3, characterized in that: In step S3, Sigmoid The function performs threshold processing.
5. The image defogging method according to claim 4, characterized in that: Step S4 includes the following steps: S401: Apply the enhancement factor to the corresponding high frequency sub-band coefficient, and perform enhancement processing on the high frequency sub-band coefficient by a dot multiplication operation; S402: combining the enhanced high-frequency sub-band coefficients with the low-frequency sub-band coefficients to form a complete enhanced sub-band coefficient set; S403: Perform inverse transformation on the obtained enhanced subband coefficient set using two-dimensional wavelet inverse transformation to reconstruct an enhanced image, that is, a second image.
6. The image defogging method according to claim 5, characterized in that: Step S5 includes the following steps: S501: performing quality assessment on the first image and the second image respectively based on preset image quality assessment indicators to obtain scores of each image quality assessment indicator in the first image and scores of each image quality assessment indicator in the second image, wherein the image quality assessment indicators are clarity, contrast, edge intensity, color reproduction, and overall brightness; S502: Based on a preset weight factor, weighted processing is performed on the scores of each image quality assessment indicator in the first image and the scores of each image quality assessment indicator in the second image to obtain a comprehensive quality score of the first image and a comprehensive quality score of the second image; S503: Exploit softma The x function performs weight calculation on the comprehensive quality score of the first image and the comprehensive quality score of the second image to obtain the fusion weight of the first image and the fusion weight of the second image. softmax The function formula is: in: is a -dimensional real vector, where each element Indicates i Unnormalized scores of classes; yes Softmax Function pair s No. i The result of applying the elements; is the natural exponential function applied to each unnormalized fraction Result; Yes all and all The sum of is equal to 1; S504: Perform weighted fusion on the first image and the second image based on the fusion weight of the first image and the fusion weight of the second image to obtain a final defogging image.
7. An image fog penetration system, characterized in that: The method for penetrating fog of an image according to any one of claims 1 to 6, wherein the penetrating fog system comprises: Retinex The global enhancement module is used to treat fog-penetrating images. Retinex The algorithm performs global enhancement processing to obtain a first image; A wavelet transform module is used to decompose the first image by using a two-dimensional wavelet transform to obtain high-frequency sub-bands and high-frequency sub-band coefficients and low-frequency sub-bands and low-frequency sub-band coefficients, and to perform edge calculation on all high-frequency sub-bands to obtain edge strength values of all high-frequency sub-bands; The enhancement factor generation module is used for the edge strength values of all high-frequency sub-bands, and obtains the enhancement factor corresponding to each high-frequency sub-band through nonlinear function mapping; A detail enhanced image generation module, used to enhance the corresponding high frequency sub-band coefficients by using the enhancement factor, and reconstruct all low frequency sub-bands and the high frequency sub-bands whose high frequency sub-band coefficients have been enhanced by using a two-dimensional wavelet inverse transform to obtain a second image; The image weighted fusion module is used to perform weighted fusion on the first image and the second image to obtain a defogging image.
