Image processing methods, apparatus and electronic equipment

By converting images from the RGB color space to the CIELAB space, and combining convolutional neural networks and multi-scale analysis, the problem of edge detail loss and color distortion in traditional dark channel dehazing algorithms under complex environments is solved, achieving higher quality image dehazing processing.

CN120746893BActive Publication Date: 2026-03-10CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-03
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Traditional dark channel dehazing algorithms suffer from edge detail loss, color distortion, and insufficient adaptability in complex environments, especially when dense fog or a large area of ​​sky is present.

Method used

A convolutional neural network model is used to convert images from the RGB color space to the CIELAB color space. Through multi-scale analysis and local weight coefficient optimization, combined with dark channel maps and edge intensity maps, transmittance and color correction parameters are adjusted to achieve accurate image dehazing.

Benefits of technology

It improves image dehazing quality, preserves more edge details and accurately corrects colors, significantly improving image processing performance in complex environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120746893B_ABST
    Figure CN120746893B_ABST
Patent Text Reader

Abstract

This application discloses an image processing method, apparatus, and electronic device. The method includes: acquiring an original image to be processed, wherein the original image contains fog; converting the original image from a first color space to a second color space to obtain color components and determining the corresponding feature map of the original image; processing the feature map and color components using a convolutional neural network model to obtain a transmittance correction value and color correction parameters; correcting the color components according to the color correction parameters to obtain a target color component, and converting the target color component back to the first color space to obtain a corrected foggy image; adjusting the initial transmittance according to the transmittance correction value to obtain a target transmittance, and performing dehazing processing on the corrected foggy image based on the target transmittance. This application solves the technical problems of traditional dark channel dehazing algorithms in complex environments, such as loss of edge details, color distortion, and insufficient adaptability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing, and more specifically, to an image processing method, apparatus, and electronic device. Background Technology

[0002] Traditional dark channel dehazing algorithms, widely used in image dehazing, can effectively improve image clarity under light fog conditions. However, their performance degrades significantly in complex environments such as dense fog, large areas of sky, or uneven fog distribution, resulting in issues like loss of edge details, color distortion, and insufficient adaptability.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This application provides an image processing method, apparatus, and electronic device to at least solve the technical problems of traditional dark channel dehazing algorithms in complex environments, such as loss of edge details, color distortion, and insufficient adaptability.

[0005] According to one aspect of the embodiments of this application, an image processing method is provided, comprising: acquiring an original image to be processed, wherein the original image is an image containing fog; converting the original image from a first color space to a second color space to obtain color components, and determining a feature map corresponding to the original image, wherein the second color space is a CIELAB space; processing the feature map and color components using a convolutional neural network model to obtain a transmittance correction value and a color correction parameter; correcting the color components according to the color correction parameter to obtain a target color component, and converting the target color component back to the first color space to obtain a corrected foggy image; adjusting the initial transmittance according to the transmittance correction value to obtain a target transmittance, and performing dehazing processing on the corrected foggy image according to the target transmittance.

[0006] Optionally, determining the feature map corresponding to the original image includes: obtaining local neighborhoods at different scales centered on each pixel in the original image; determining the minimum values ​​of each pixel in the target local neighborhood in the red, green, and blue channels respectively, to obtain a set of minimum channel values, wherein the target local neighborhood is any local neighborhood at a different scale, and the set of minimum channel values ​​contains the minimum brightness value of each channel; determining the minimum value in the set of minimum channel values ​​as the dark channel value of the pixel in the dark channel map with the same coordinates as the original image, wherein the original image and the dark channel map have the same size; determining the dark channel value of each pixel in the dark channel map to obtain the dark channel map of the original image, wherein the dark channel value of each pixel in the dark channel map is obtained by weighting the dark channel values ​​corresponding to local neighborhoods at different scales, and the feature map includes the dark channel map.

[0007] Optionally, the method further includes: identifying the sky region of the original image, and determining the non-sky region in the original image based on the sky region; sorting the dark channel images of the non-sky region, and determining the highest brightness value in the original image corresponding to the first preset number of brightest pixels as the atmospheric light value; determining the ratio of the brightness value of each pixel in the target local neighborhood to the atmospheric light value in the red, green, and blue channels, and determining the minimum value of the ratio in each channel as the ratio set; and determining the initial transmittance based on the minimum value in the ratio set and the adjustment parameter.

[0008] Optionally, determining the feature map corresponding to the original image includes: determining a first convolution factor and a second convolution factor, wherein the first convolution factor is used to extract the edge features of the original image horizontally, and the second convolution factor is used to extract the edge features of the original image vertically; determining a first edge image based on the first convolution factor and the original image, determining a second edge image based on the second convolution factor and the original image; and determining an edge intensity map of the original image based on the first edge image and the second edge image, wherein the feature map includes the edge intensity map.

[0009] Optionally, the method further includes: determining a first edge intensity map in the red channel, determining a second edge intensity map in the green channel, and determining a third edge intensity map in the blue channel; determining a grayscale image based on the first, second, and third edge intensity maps; and determining a first transmittance based on the grayscale image, initial transmittance, window size, and regularization parameters.

[0010] Optionally, the method further includes: when the mean values ​​of different color channels in the original image in the first color space meet preset conditions, adjusting the color components to obtain the adjusted first color components, wherein the color components include a luminance component and a chromatic difference component, and the first color components include a first luminance component and a first chromatic difference component.

[0011] Optionally, the corrected hazy image is dehazed based on the target transmittance, including: determining the difference between the pixel value and the atmospheric light value in the corrected hazy image as a first value; determining the maximum value between the target transmittance and the initial transmittance as a second value; and determining the dehazed target image based on the first value, the second value, and the atmospheric light value.

[0012] According to another aspect of the embodiments of this application, an image processing apparatus is also provided, comprising: an acquisition module for acquiring an original image to be processed, wherein the original image is an image containing fog; a determination module for converting the original image from a first color space to a second color space to obtain color components, and determining a feature map corresponding to the original image, wherein the second color space is a CIELAB space; a processing module for processing the feature map and color components using a convolutional neural network model to obtain a transmittance correction value and a color correction parameter; a correction module for correcting the color components according to the color correction parameter to obtain a target color component, and converting the target color component back to the first color space to obtain a corrected foggy image; and a defogging module for adjusting the initial transmittance according to the transmittance correction value to obtain a target transmittance, and performing defogging processing on the corrected foggy image according to the target transmittance.

[0013] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory for storing program instructions; and a processor connected to the memory for executing program instructions to perform the following functions: acquiring an original image to be processed, wherein the original image is an image containing fog; converting the original image from a first color space to a second color space to obtain color components, and determining a feature map corresponding to the original image, wherein the second color space is a CIELAB space; processing the feature map and color components using a convolutional neural network model to obtain a transmittance correction value and a color correction parameter; correcting the color components according to the color correction parameter to obtain a target color component, and converting the target color component back to the first color space to obtain a corrected foggy image; adjusting the initial transmittance according to the transmittance correction value to obtain a target transmittance, and performing defogging processing on the corrected foggy image according to the target transmittance.

[0014] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored computer program, wherein the device on which the non-volatile storage medium is located executes the above-described image processing method by running the computer program.

[0015] According to another aspect of the embodiments of this application, a computer program product is also provided, including computer instructions that, when executed by a processor, implement the above-described image processing method.

[0016] In this embodiment, the process involves acquiring an original image containing fog; converting the original image from a first color space to a second color space to obtain color components; determining the feature map corresponding to the original image, where the second color space is the CIELAB space; processing the feature map and color components using a convolutional neural network model to obtain transmittance correction values ​​and color correction parameters; correcting the color components according to the color correction parameters to obtain target color components; converting the target color components back to the first color space to obtain a corrected foggy image; adjusting the initial transmittance according to the transmittance correction values ​​to obtain the target transmittance; and performing dehazing processing on the corrected foggy image based on the target transmittance, thereby achieving accurate color correction and improving the image dehazing quality. This solves the technical problems of traditional dark channel dehazing algorithms in complex environments, such as loss of edge details, color distortion, and insufficient adaptability. Attached Figure Description

[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0018] Figure 1 This is a hardware structure block diagram of a computer terminal for implementing an image processing method according to an embodiment of this application;

[0019] Figure 2 This is a flowchart of an image processing method according to an embodiment of this application;

[0020] Figure 3a These are comparison images of the first set of defogging before and after, according to embodiments of this application;

[0021] Figure 3b These are the second set of before-and-after defogging comparison images according to embodiments of this application;

[0022] Figure 4 This is a structural diagram of an image processing apparatus according to an embodiment of this application. Detailed Implementation

[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0025] The information collected in this application embodiment is information and data authorized by the user or fully authorized by all parties. The collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data all comply with the relevant laws, regulations and standards of the relevant regions, and necessary confidentiality measures have been taken. It does not violate public order and good morals, and provides corresponding operation entry points for users to choose to authorize or reject the automated decision results. If the user chooses to reject, the process will proceed to the expert decision-making process.

[0026] First, some nouns or terms that appear in the explanation of the embodiments of this application shall be interpreted as follows:

[0027] Sobel operator: A discrete differential operator for edge detection that determines edge location by calculating the rate of change of gray level in the neighborhood of each pixel in an image.

[0028] Guided filter: An edge-preserving filtering algorithm that uses the structural information of the guide graph to smooth the target image, filtering out noise while preserving edge details.

[0029] CIELAB color space: A device-independent color space that includes luminance ( ). ), red-green difference ( ) and the difference between yellow and blue ( The three components can describe color in a way that better matches human visual perception.

[0030] Multi-scale analysis: Local feature extraction is performed on the image using sliding windows of different sizes to capture detailed information at different scales in the image.

[0031] Convolutional Neural Network (CNN): A deep learning model that automatically extracts hierarchical features of images through multi-layer convolution operations, suitable for tasks such as image enhancement and dehazing.

[0032] Traditional dark channel dehazing algorithms suffer from significant performance degradation in complex environments, exhibiting issues such as loss of edge details, color distortion, and insufficient adaptability. Specifically:

[0033] 1. Loss of edge details: Over-smoothing by guided filtering leads to blurred edges, and soft matting algorithms have high computational complexity;

[0034] 2. Color distortion: Simple RGB channel adjustments cannot accurately match human visual perception, resulting in color deviation;

[0035] 3. Poor adaptability to complex scenes: Atmospheric light estimation is affected by high-brightness pixels in the sky region, and transmittance calculation does not consider multi-scale features;

[0036] 4. Among the related technologies, the Canny operator is mainly used to assist in guided filtering, and color correction is performed by the difference in the mean of RGB channels. However, none of these technologies have solved the problems of multi-scale feature extraction, adaptive parameter adjustment, and robustness in complex scenes.

[0037] The aforementioned problems limit the effectiveness of traditional dark channel dehazing algorithms in practical applications, especially in scenarios requiring high-precision recognition, such as license plate recognition and security monitoring. To address these issues, particularly for image enhancement in complex environments, this application provides an image processing method that can operate on... Figure 1 The computer terminal shown is described below.

[0038] The image processing method embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal for implementing an image processing method is shown. Figure 1 As shown, the computer terminal 10 may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions connected via wired and / or wireless networks. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1The different configurations shown.

[0039] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10. As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0040] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the image processing method in this embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the image processing method described above. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0041] The transmission module 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission module 106 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission module 106 may be a radio frequency (RF) module, used for wireless communication with the Internet.

[0042] The display can be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10.

[0043] It should be noted here that, in some optional embodiments, the above... Figure 1 The computer terminal shown may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that... Figure 1This is only one instance of a specific particular instance, and is intended to illustrate the types of components that may exist in the aforementioned computer terminal.

[0044] In the above operating environment, this application provides an embodiment of an image processing method. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0045] Figure 2 This is a flowchart of an image processing method according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:

[0046] Step S202: Obtain the original image to be processed, wherein the original image is an image containing fog.

[0047] Step S204: Convert the original image from the first color space to the second color space to obtain color components and determine the feature map corresponding to the original image, wherein the second color space is the CIELAB space.

[0048] In step S204 above, the first color space is RGB color space, and the second color space is CIELAB space, which is used to transform the original (hazy) image. Converting from the RGB color space to the CIELAB color space yields color components, which include the luminance component. Color difference component and Determine the feature map corresponding to the original image, where the feature map includes the dark channel map and the edge intensity map.

[0049] Step S206: The feature map and color components are processed using a convolutional neural network model to obtain the transmittance correction value and color correction parameters.

[0050] In step S206 above, the input layer of the convolutional neural network model (such as a CNN) receives feature maps and color components as input, and automatically learns and extracts higher-level abstract features through a series of convolutional layers, activation functions, pooling layers, and fully connected layers. During the training phase, the CNN learns from pairs of foggy and fog-free images, aiming to minimize the difference between the predicted dehazing effect and the actual fog-free image, thus optimizing the network parameters. The CNN model outputs transmittance correction values ​​and color correction parameters. Transmittance reflects the sharpness of each pixel in the image, i.e., the degree to which pixel values ​​are affected by fog. The color correction parameters are used to adjust color components in the CIELAB color space, and include luminance correction parameters and chromatic aberration correction parameters.

[0051] Step S208: Correct the color components according to the color correction parameters to obtain the target color components, and convert the target color components back to the first color space to obtain the corrected hazy image.

[0052] In step S208 above, the color components are corrected according to the color correction parameters. That is, for each pixel in the image, the L*, a*, and b* values ​​are adjusted using the parameters output by the CNN to more closely approximate the true colors when the image is hazy. This adjustment ensures that the image not only has improved clarity after dehazing, but also retains as natural and realistic colors as possible, avoiding possible color shifts or oversaturation. After correction, the target color components are converted back to the first color space, i.e., converted to the RGB color space, to obtain the corrected hazy image.

[0053] Step S210: Adjust the initial transmittance according to the transmittance correction value to obtain the target transmittance, and perform dehazing processing on the corrected hazy image according to the target transmittance.

[0054] In step S210 above, in the image dehazing algorithm, transmittance represents the original sharpness information of objects in the image, or the portion unaffected by atmospheric scattering. When an image is covered by fog, the observed image is actually an attenuated version of the light from the real scene reaching the camera sensor through the atmospheric scattering layer. The initial transmittance map is calculated based on the dark channel prior or other dehazing algorithms, used to estimate how much light should originally penetrate the fog to reach the sensor at each pixel in the image. The transmittance correction value is the result of the CNN model output, used to more accurately adjust the transmittance value of each pixel in the initial transmittance map, making it closer to the actual scene transmittance. Adjusting the initial transmittance based on the transmittance correction value is essentially fine-tuning the transmittance estimate of each pixel, thereby obtaining the optimized target transmittance, and combining the atmospheric light (estimated) value and other parameters to perform dehazing processing on the corrected foggy image.

[0055] Through steps S202 to S210, accurate color correction is achieved, thereby improving the image dehazing quality and solving the technical problems of traditional dark channel dehazing algorithms in complex environments, such as loss of edge details, color distortion, and insufficient adaptability. The following is a further explanation.

[0056] In step S204 of the above image processing method, determining the feature map corresponding to the original image includes: obtaining local neighborhoods of different scales centered on each pixel in the original image; determining the minimum value of each pixel in the target local neighborhood in the red, green, and blue channels respectively, to obtain a minimum channel value set, wherein the target local neighborhood is any local neighborhood of different scales, and the minimum channel value set contains the minimum brightness value of each channel; determining the minimum value in the minimum channel value set as the dark channel value of the pixel in the dark channel map with the same coordinates as the original image, wherein the original image and the dark channel map have the same size; determining the dark channel value of each pixel in the dark channel map to obtain the dark channel map of the original image, wherein the dark channel value of each pixel in the dark channel map is obtained by weighting the dark channel values ​​corresponding to local neighborhoods of different scales, and the feature map includes the dark channel map.

[0057] In some embodiments of this application, the dark channel map can reflect the darkest pixel value (i.e., the least affected by fog) in the local area surrounding each pixel in the image. The specific implementation process is as follows:

[0058] For each pixel in the original image A local neighborhood centered on a given pixel can be defined. This neighborhood can have various sizes, i.e., windows of different scales. For example, the neighborhood can be 3×3, 5×5, 7×7 pixels, etc., and the specific size depends on the image resolution and the desired scale of detail. Within each local neighborhood (i.e., the target local neighborhood mentioned above), the minimum values ​​of the red, green, and blue color channels are calculated, resulting in a set of minimum channel values. If the blue pixel values ​​are generally low within this local neighborhood, then the minimum value of the blue channel will be recorded in the minimum channel value set. The minimum value in the set of minimum channel values ​​is assigned to the corresponding pixel in the dark channel map. In other words, the value of each pixel in the dark channel map is the value of the pixel with the lowest brightness among the three color channels within the local neighborhood centered on that pixel in the original image. After the above steps, a dark channel map can be generated for the original image. To integrate local information at different scales, the dark channel value of each pixel in the dark channel map is obtained by weighted fusion of the dark channel values ​​corresponding to local neighborhoods at different scales. The weighted fusion process ensures that the dark channel image captures not only large-scale structural features in the image but also preserves small-scale details.

[0059] Calculate the dark channel plot The formula is as follows:

[0060]

[0061] in, Representing an image In color channels The value on, Therefore It is a local neighborhood centered on the center.

[0062] In the above image processing method, the method further includes: identifying the sky region of the original image, and determining the non-sky region in the original image based on the sky region; sorting the dark channel images of the non-sky region, and determining the highest brightness value in the original image corresponding to the first preset number of brightest pixels as the atmospheric light value; determining the ratio of the brightness value of each pixel in the target local neighborhood to the atmospheric light value in the red, green, and blue channels, and determining the minimum value of the ratio in each channel as the ratio set; and determining the initial transmittance based on the minimum value in the ratio set and the adjustment parameter.

[0063] In some embodiments of this application, sky regions are identified using image segmentation algorithms (such as thresholding based on the HSV color space). For non-sky areas Sort the dark channel images, select the top preset number (e.g., 0.1%) of the brightest pixels, and then select the top... The highest brightness value in the original image corresponding to the brightest pixel is used as the atmospheric light value for color channel c. To avoid interference from high-brightness pixels in the sky, the formula is as follows:

[0064]

[0065] in, It is a pre-set quantity (e.g.) The minimum value of the brightest pixel.

[0066] Initial transmittance map It can be obtained through the following formula:

[0067]

[0068] Where A is the atmospheric light value mentioned above (determined by the highest brightness value in the original image corresponding to the first preset number of brightest pixels in all color channels). It is an adjustment parameter, typically with a value between 0 and 1. A value of 1 indicates complete defogging, while a value of 0 indicates no defogging. A value of 0.95 is generally used.

[0069] In step S204 of the above image processing method, determining the feature map corresponding to the original image includes: determining a first convolution factor and a second convolution factor, wherein the first convolution factor is used to extract the edge features of the original image horizontally, and the second convolution factor is used to extract the edge features of the original image vertically; determining a first edge image based on the first convolution factor and the original image, determining a second edge image based on the second convolution factor and the original image; and determining an edge intensity map of the original image based on the first edge image and the second edge image, wherein the feature map includes the edge intensity map.

[0070] In some embodiments of this application, the Sobel operator is used to calculate the edge intensity map of the original image. Convert to grayscale As a guiding graph, the Sobel operator contains two sets of 3×3 convolution factors. and ,in, The first convolution factor, For the second convolution factor:

[0071]

[0072]

[0073] use and Extract the original image horizontally and vertically respectively. The edge features are defined by the following formula:

[0074]

[0075]

[0076] in, Represents the first edge image. This represents the second edge image.

[0077] By combining the edge images, we obtain the edge intensity map E after edge enhancement of the original image:

[0078]

[0079] In the above image processing method, the method further includes: determining a first edge intensity map in the red channel, determining a second edge intensity map in the green channel, and determining a third edge intensity map in the blue channel; determining a grayscale image based on the first edge intensity map, the second edge intensity map, and the third edge intensity map; and determining a first transmittance based on the grayscale image, the initial transmittance, the window size, and the regularization parameter.

[0080] In some embodiments of this application, grayscale images The calculation formula is as follows:

[0081]

[0082] in, This represents the first edge intensity map. This represents the second edge intensity map. This represents the intensity map of the third edge.

[0083] Dynamically adjust the guided filter parameters (window size) based on edge strength. and regularization parameters ), to obtain the first transmittance :

[0084]

[0085] in, and It decreases as edge strength increases; in high edge regions, it decreases. and small To ensure edge details are not over-smoothed, enhance the filtering effect in edge areas; in low edge areas, large Heda This allows for effective noise reduction by fully utilizing neighboring pixel information, thereby improving the overall smoothness of the image.

[0086] In the above image processing method, the method further includes: when the mean values ​​of different color channels in the original image in the first color space meet the preset conditions, adjusting the color components to obtain the adjusted first color component, wherein the color component includes a luminance component and a color difference component, and the first color component includes a first luminance component and a first color difference component.

[0087] In some embodiments of this application, after color space conversion, channel difference analysis is required, specifically by calculating the mean values ​​of the original image in the RGB three channels. and coefficient of variation Combined with the standard deviation of CIELAB components Determine color deviation.

[0088] If the mean of a certain channel is significantly lower than that of other channels (e.g.) and If the preset conditions are met, then the corresponding color difference components need to be weighted and adjusted in the CIELAB color space. This involves introducing local weighting coefficients based on pixel location. This coefficient is based on the pixel point Monochrome channel in the local area numerical values Compared with the average of the monochrome channels in this region The difference is used to adjust the color correction amplitude. The specific formula is as follows:

[0089]

[0090] in, For adaptive coefficients, For channel differences, This represents the red-green difference in the first color difference component. This represents the yellow-blue difference in the first color difference component. This represents the red-green difference in the color difference component. This represents the yellow-blue difference in the color difference component. The calculation method is illustrated below:

[0091]

[0092] in, This represents the maximum value of the monochrome channel mean. This represents the minimum value of the monochrome channel mean.

[0093] The above formula is implemented in a monochrome channel. severely missing areas , making Increase the adjustment range of the components; and in areas where blue was originally more abundant. , Reduce the adjustment range appropriately.

[0094] In some embodiments of this application, a lightweight CNN network is designed with feature maps (including dark channel maps) as input. And edge intensity map (E) and color components (i.e., CIELAB features), output transmittance correction value and color correction parameters .

[0095] By comparing foggy and fog-free images ( The convolutional neural network model is trained with a loss function that includes mean squared error of transmittance (MSE) and CIELAB color space distance. ):

[0096]

[0097] in, Represents the loss function. and Indicates parameters, This indicates the transmittance when there is fog.

[0098] The preliminary correction components obtained above ,according to The formula is adjusted a second time and is as follows:

[0099]

[0100]

[0101]

[0102] in, , , Indicates the target color component.

[0103] The target transmittance is obtained by optimizing the first transmittance t. :

[0104]

[0105] The final CIELAB component obtained above, i.e. the target color component, is then... Converting back to the RGB color space yields a corrected RGB three-channel hazy image. (i.e., the foggy image after the above correction).

[0106] In step S210 of the above image processing method, the corrected hazy image is dehazed based on the target transmittance, including: determining the difference between the pixel value and the atmospheric light value in the corrected hazy image as a first value; determining the maximum value between the target transmittance and the initial transmittance as a second value; and determining the target image after dehazing based on the first value, the second value, and the atmospheric light value.

[0107] In some embodiments of this application, for the converted RGB image, i.e., the above-mentioned corrected hazy image, the optimized target transmittance is used. The formula for defogging is:

[0108]

[0109] in, The first value mentioned above, The second value mentioned above. This refers to the target image mentioned above. Too small an image will cause it to be overexposed, so a constant is introduced. It is usually taken as 0.1.

[0110] The image processing method provided in this application combines multi-scale analysis, CIELAB color space, and deep learning into a dark channel dehazing framework to form a hybrid enhancement model. Simultaneously, it introduces local weight coefficients to optimize the color distribution within each channel, thus addressing multiple shortcomings of related technologies in edge preservation, color correction, and adaptability to complex scenes. It possesses the following beneficial effects:

[0111] 1. Significantly improved adaptability to complex scenes: Multi-scale analysis and sky region detection significantly improve the dehazing effect of the algorithm in dense fog and high sky coverage scenes, and its edge preservation ability is better than that of traditional guided filtering.

[0112] 2. Breakthrough in color correction accuracy: Combining color difference adjustment with CIELAB space The parameters and local weight coefficients effectively reduce color distortion, achieving not only accurate overall color correction but also optimizing the color distribution within the channels, which is superior to the traditional method of adjusting RGB channels individually.

[0113] 3. Enhanced intelligence and robustness: The deep learning module automatically learns the optimal transmittance and color parameters, effectively improving the processing effect of non-uniform fog distribution, and also improving the computational efficiency compared with the soft matting algorithm.

[0114] To better understand the image processing method provided in the embodiments of this application, the above process will be described below with reference to specific examples.

[0115] 1. Multi-scale dark channel calculation: for a resolution of For a 68-pixel dense fog image, the dark channel was calculated using three window sizes: 3×3, 5×5, and 7×7, with weighting coefficients of 0.3, 0.5, and 0.2, respectively.

[0116] 2. Sky region detection: Sky regions are identified by HSV threshold segmentation, and atmospheric light values ​​are calculated by selecting the brightest 0.1% of pixels in non-sky regions.

[0117] 3. Adaptive Guided Filtering: Dynamically adjusts the window size (maximum 11×11) and regularization parameter (range 0.01 - 0.1) based on edge strength.

[0118] 4. CNN-assisted optimization: A CNN model with 5 convolutional layers is used. The input is the dark channel map and the edge intensity map, and the output is the transmittance correction value. The training data consists of 1000 pairs of foggy and fog-free images.

[0119] In CIELAB color correction and The data and steps used to verify the effect of parameter optimization are as follows:

[0120] For an image where the sky occupies 60%, the original image has a mean value of 180 for the blue channel, 200 for the green channel, and 190 for the red channel, with a coefficient of variation of 10.2%.

[0121] 1. Traditional CIELAB correction: Convert the image to CIELAB space, determine if the blue channel has a low proportion, and then... The components are initially adjusted, and local weighting coefficients are introduced. back, In the lower left corner of the image, where the blue area is severely lacking, =1.3, significantly enhancing the blue color in that area; in the upper right corner, where there was originally more blue, =0.8, the blue adjustment range has been appropriately reduced.

[0122] 2. Deep learning optimization: CNN model output Further adjustments .

[0123] 3. Final result: The average value of the blue channel was increased from 180 to 198, approaching the true value of 200, reducing color distortion. The value decreased from 6.8 to 4.2, and the blue color distribution in the image became more even and natural, avoiding situations where the local color was too strong or too weak.

[0124] Figure 3a and Figure 3b These are before-and-after comparison images of two sets of images processed using the image processing method provided in the embodiments of this application. The left image is before dehazing, and the right image is after dehazing. Figure 3a and Figure 3b The comparison between the two images, one with fog and the other after defogging, shows that the image enhancement process not only preserves more edge information, making the image clearer, but also corrects the color of the image, avoiding color distortion. This effectively proves the effectiveness of the image processing method proposed in the embodiments of this application.

[0125] Figure 4 This is a structural diagram of an image processing apparatus according to an embodiment of this application, such as... Figure 4 As shown, the device includes:

[0126] The acquisition module 40 is used to acquire the original image to be processed, wherein the original image is an image containing fog;

[0127] The determination module 42 is used to convert the original image from the first color space to the second color space, obtain the color components, and determine the feature map corresponding to the original image, wherein the second color space is the CIELAB space;

[0128] Processing module 44 is used to process the feature map and color components using a convolutional neural network model to obtain the transmittance correction value and color correction parameters;

[0129] The correction module 46 is used to correct the color components according to the color correction parameters, obtain the target color components, and convert the target color components back to the first color space to obtain the corrected hazy image.

[0130] The dehazing module 48 is used to adjust the initial transmittance according to the transmittance correction value to obtain the target transmittance, and to perform dehazing processing on the corrected hazy image according to the target transmittance.

[0131] Through the acquisition module, determination module, processing module, correction module, and dehazing module in the above-mentioned image processing device, the purpose of accurate color correction is achieved, thereby realizing the technical effect of improving the image dehazing quality. This solves the technical problems of traditional dark channel dehazing algorithms in complex environments, such as loss of edge details, color distortion, and insufficient adaptability.

[0132] In the determining module of the aforementioned image processing apparatus, the determining module is further configured to acquire local neighborhoods of different scales centered on each pixel in the original image; determine the minimum values ​​of each pixel in the target local neighborhood in the red, green, and blue channels respectively, to obtain a minimum channel value set, wherein the target local neighborhood is any local neighborhood of different scales, and the minimum channel value set contains the minimum brightness value of each channel; determine the minimum value in the minimum channel value set as the dark channel value of the pixel in the dark channel map with the same coordinates as the original image, wherein the original image and the dark channel map have the same size; determine the dark channel value of each pixel in the dark channel map to obtain the dark channel map of the original image, wherein the dark channel value of each pixel in the dark channel map is obtained by weighting the dark channel values ​​corresponding to local neighborhoods of different scales, and the feature map includes the dark channel map.

[0133] In the determination module of the aforementioned image processing apparatus, the determination module is further used to identify the sky region of the original image, and based on the sky region, determine the non-sky region in the original image; sort the dark channel images of the non-sky region, and determine the highest brightness value in the original image corresponding to the first preset number of brightest pixels as the atmospheric light value; determine the ratio of the brightness value of each pixel in the target local neighborhood to the atmospheric light value in the red, green, and blue channels, respectively, and determine the minimum value of the ratio in each channel as the ratio set; and determine the initial transmittance based on the minimum value in the ratio set and the adjustment parameter.

[0134] In the determining module of the image processing apparatus described above, the determining module is further configured to determine a first convolution factor and a second convolution factor, wherein the first convolution factor is used to extract edge features of the original image horizontally, and the second convolution factor is used to extract edge features of the original image vertically; a first edge image is determined based on the first convolution factor and the original image, and a second edge image is determined based on the second convolution factor and the original image; an edge intensity map of the original image is determined based on the first edge image and the second edge image, wherein the feature map includes the edge intensity map.

[0135] In the determination module of the image processing apparatus described above, the determination module is further configured to determine a first edge intensity map of the edge intensity map in the red channel, a second edge intensity map of the edge intensity map in the green channel, and a third edge intensity map of the edge intensity map in the blue channel; determine a grayscale image based on the first edge intensity map, the second edge intensity map, and the third edge intensity map; and determine a first transmittance based on the grayscale image, the initial transmittance, the window size, and the regularization parameter.

[0136] In the correction module of the image processing device described above, the correction module is further used to adjust the color components when the mean values ​​of different color channels of the original image in the first color space meet preset conditions, so as to obtain the adjusted first color component, wherein the color component includes a luminance component and a color difference component, and the first color component includes a first luminance component and a first color difference component.

[0137] In the dehazing module of the aforementioned image processing apparatus, the dehazing module is further configured to determine the difference between the pixel value and the atmospheric light value in the corrected hazy image as a first value; determine the maximum value between the target transmittance and the initial transmittance as a second value; and determine the target image after dehazing based on the first value, the second value, and the atmospheric light value.

[0138] It should be noted that, Figure 4 The image processing apparatus shown is used to perform Figure 2 The image processing method shown above is also applicable to the image processing apparatus, and will not be repeated here.

[0139] This application also provides an electronic device, which includes a memory and a processor. The memory stores program instructions, and the processor is connected to the memory to execute program instructions that perform the following functions: acquiring an original image to be processed, wherein the original image is an image containing fog; converting the original image from a first color space to a second color space to obtain color components, and determining the feature map corresponding to the original image, wherein the second color space is the CIELAB space; processing the feature map and color components using a convolutional neural network model to obtain a transmittance correction value and a color correction parameter; correcting the color components according to the color correction parameter to obtain a target color component, and converting the target color component back to the first color space to obtain a corrected foggy image; adjusting the initial transmittance according to the transmittance correction value to obtain a target transmittance, and performing dehazing processing on the corrected foggy image according to the target transmittance.

[0140] It should be noted that the aforementioned electronic equipment is used to perform Figure 2 The image processing method shown above is also applicable to this electronic device, and will not be repeated here.

[0141] This application embodiment also provides a non-volatile storage medium, which includes a stored computer program. The device containing the non-volatile storage medium executes the following image processing method by running the computer program: acquiring an original image to be processed, wherein the original image is an image containing fog; converting the original image from a first color space to a second color space to obtain color components, and determining the feature map corresponding to the original image, wherein the second color space is the CIELAB space; processing the feature map and color components using a convolutional neural network model to obtain a transmittance correction value and color correction parameters; correcting the color components according to the color correction parameters to obtain a target color component, and converting the target color component back to the first color space to obtain a corrected foggy image; adjusting the initial transmittance according to the transmittance correction value to obtain a target transmittance, and performing dehazing processing on the corrected foggy image according to the target transmittance.

[0142] It should be noted that the aforementioned non-volatile storage media is used for execution. Figure 2 The image processing method shown above is also applicable to this non-volatile storage medium, and will not be repeated here.

[0143] This application also provides a computer program product, including computer instructions that, when executed by a processor, implement the steps of the image processing methods in various embodiments of this application.

[0144] This application also provides a computer program that, when executed by a processor, implements the steps of the image processing methods in various embodiments of this application.

[0145] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0146] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0147] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0148] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0149] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0150] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0151] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method of image processing, characterized by, The method comprises: obtaining an original image to be processed, wherein the original image is a foggy image; converting the original image from a first color space to a second color space to obtain color components and determine a feature map corresponding to the original image, wherein the second color space is a CIELAB space; processing the feature map and the color components by using a convolutional neural network model to obtain a transmittance correction value and a color correction parameter, wherein the convolutional neural network model is learned by using foggy and non-foggy image pairs in a training stage, network parameters of the convolutional neural network model are optimized by minimizing the difference between a predicted de-fogging effect and a real non-foggy image, and a predicted transmittance correction value and a predicted color correction parameter are output; correcting the color components according to the color correction parameter to obtain target color components, and converting the target color components back to the first color space to obtain a corrected foggy image; adjusting an initial transmittance according to the transmittance correction value to obtain a target transmittance, and performing de-fogging processing on the corrected foggy image according to the target transmittance.

2. The method of claim 1, wherein, The method further comprises: identifying a sky region of the original image, and determining a non-sky region in the original image according to the sky region; sorting the dark channel map of the non-sky region, and determining a highest luminance value in the original image corresponding to a preset number of brightest pixels as an atmospheric light value; determining a ratio of a luminance value of each pixel of the target local neighborhood to the atmospheric light value in red, green and blue channels, and determining a minimum value of the ratio of each channel as a ratio set; determining an initial transmittance according to a minimum value in the ratio set and an adjustment parameter.

3. The method of claim 2, wherein, The method further comprises: determining a first convolution factor and a second convolution factor, wherein the first convolution factor is used to extract edge features of the original image horizontally, and the second convolution factor is used to extract edge features of the original image vertically; determining a first edge image according to the first convolution factor and the original image, and determining a second edge image according to the second convolution factor and the original image; ​ ​ 4. The method of claim 1, wherein, ​ ​ ​ According to the first edge image and the second edge image, an edge intensity map of the original image is determined, and the feature map includes the edge intensity map.

5. The method of claim 4, wherein, The method further includes: determining a first edge intensity map of the edge intensity map in a red channel, determining a second edge intensity map of the edge intensity map in a green channel, and determining a third edge intensity map of the edge intensity map in a blue channel; according to the first edge intensity map, the second edge intensity map, and the third edge intensity map, a gray scale map is determined; according to the gray scale map, an initial transmittance, a window size, and a regularization parameter, a first transmittance is determined.

6. The method of claim 1, wherein, The method further includes: when the mean values of different color channels of the original image in the first color space satisfy a preset condition, adjusting the color components to obtain adjusted first color components, wherein the color components include a luminance component and a color difference component, and the first color components include a first luminance component and a first color difference component.

7. The method of claim 1, wherein, According to the target transmittance, the corrected foggy image is de-fogged, including: determining the difference between the pixel value and the atmospheric light value in the corrected foggy image as a first value; determining the maximum value between the target transmittance and the initial transmittance as a second value; according to the first value, the second value, and the atmospheric light value, a target image after de-fogging processing is determined.

8. An apparatus for image processing, characterized by including: an acquisition module configured to acquire an original image to be processed, wherein the original image is a foggy image; a determination module configured to convert the original image from a first color space to a second color space to obtain color components and determine a feature map corresponding to the original image, wherein the second color space is a CIELAB space; a processing module configured to process the feature map and the color components by using a convolutional neural network model to obtain a transmittance correction value and a color correction parameter, wherein the convolutional neural network model is learned by using foggy and non-foggy image pairs in a training stage, the network parameters of the convolutional neural network model are optimized by minimizing the difference between a predicted de-fogging effect and a real non-foggy image, and a predicted transmittance correction value and a predicted color correction parameter are outputted; a correction module configured to correct the color components according to the color correction parameter to obtain target color components, and convert the target color components back to the first color space to obtain a corrected foggy image; a de-fogging module configured to adjust an initial transmittance according to the transmittance correction value to obtain a target transmittance, and de-fog the corrected foggy image according to the target transmittance.

9. An electronic device, comprising: including: a memory configured to store program instructions; The processor is connected with the memory and used for executing program instructions to realize the following functions: obtaining an original image to be processed, wherein the original image is a foggy image; converting the original image from a first color space to a second color space to obtain color components and determine a feature map corresponding to the original image, wherein the second color space is a CIELAB space; processing the feature map and the color components by using a convolutional neural network model to obtain a transmittance correction value and a color correction parameter, wherein the convolutional neural network model is learned by using foggy and non-foggy image pairs in a training stage, network parameters of the convolutional neural network model are optimized by minimizing the difference between a predicted defogging effect and a real non-foggy image, and a predicted transmittance correction value and a predicted color correction parameter are output; correcting the color components according to the color correction parameter to obtain target color components, converting the target color components back to the first color space to obtain a corrected foggy image; adjusting an initial transmittance according to the transmittance correction value to obtain a target transmittance, and performing defogging processing on the corrected foggy image according to the target transmittance.

10. A non-volatile storage medium, comprising: The non-volatile storage medium comprises a stored computer program, wherein a device in which the non-volatile storage medium is located executes the method of image processing according to any one of claims 1 to 7 by running the computer program.

11. A computer program product comprising computer instructions, characterized in that, The computer instructions are executed by the processor to realize the method of image processing according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image defogging method

    CN105118027A