Image processing method, electronic device and computer readable medium

By filtering and defogging the grayscale image of the imaging device, the contrast of the image is improved, the problem of low contrast in the prior art is solved, and the clarity and usability of the image is improved.

CN118710573BActive Publication Date: 2024-11-01CHINA OPTICS (HANGZHOU) INTELLIGENT OPTOELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411217332.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2024-11-01
Estimated Expiration
2044-09-02

AI Technical Summary

Technical Problem

Images captured by existing camera equipment generally have the problem of low contrast, especially when sensor performance is low or visibility in the actual environment is low.

Method used

By filtering the grayscale image to be processed based on a preset filter, a dark channel image is obtained, and processed according to the brightness values ​​of the image to be processed and the defogging image is performed, so as to improve the contrast of the image.

Benefits of technology

Effectively improves image clarity and contrast, improves image availability under low sensor performance or low visibility conditions, and reduces image acquisition cost and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118710573B_ABST
    Figure CN118710573B_ABST
Patent Text Reader

Abstract

The present application discloses an image processing method, an electronic device and a computer-readable medium. A dark channel image is obtained by filtering a grayscale image to be processed based on a preset filter, and a defogging image is determined according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dark channel image. By performing a defogging operation on the grayscale image to be processed, the clarity and contrast of the image can be improved to a certain extent. According to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogging image, the brightness value of each pixel in the defogging image is processed to obtain a target grayscale image. By performing brightness value processing on the defogging image, the contrast of the image can be further improved while improving the brightness of the image. Even for images captured by a camera device when the sensor performance is low or the visibility in the actual environment is low, its usability can be improved by improving its contrast, thereby reducing the cost and efficiency of image acquisition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular, to an image processing method, an electronic device and a computer-readable medium. Background Art

[0002] Currently, due to the influence of sensor performance and environment, images taken by camera equipment generally have the problem of low contrast. For example, the color image presented by the image sensor has low contrast when the sensor performance is low or the visibility in the actual environment is low, and the grayscale image presented by the infrared sensor has low contrast due to the limitations of its image imaging principle, and so on.

[0003] Therefore, there is an urgent need for a method that can effectively improve image contrast. Summary of the invention

[0004] The present application aims to solve one of the technical problems in the related art to a certain extent. To this end, the present application provides an image processing method, an electronic device and a computer readable medium.

[0005] As a first aspect of the present application, an image processing method is provided, wherein the method comprises:

[0006] Performing filtering on the grayscale image to be processed based on a preset filter to obtain a dark channel image;

[0007] Determine a defogging image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dark channel image;

[0008] According to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogging image, the brightness value of each pixel in the defogging image is processed to obtain a target grayscale image.

[0009] Optionally, the step of processing the brightness value of each pixel in the defogged image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogged image to obtain the target grayscale image includes:

[0010] Determine a first mean and a second mean, wherein the first mean is the mean of the brightness values ​​of each pixel in the grayscale image to be processed, and the second mean is the mean of the brightness values ​​of each pixel in the defogging image;

[0011] According to the first mean value and the second mean value, linear stretching processing is performed on the brightness value of each pixel in the defogging image to obtain the target grayscale image.

[0012] Optionally, in the step of performing linear stretching processing on the brightness value of each pixel in the defogging image according to the first mean value and the second mean value to obtain the target grayscale image, linear stretching processing is performed on the brightness value of any pixel in the defogging image by using the following formula:

[0013] (1);

[0014] In formula (1), The pixel coordinates obtained after linear stretching are ( ), represents the first mean, represents the second mean, Indicates that the pixel coordinates in the dehazed image are ( )’s brightness value.

[0015] Optionally, the step of processing the brightness value of each pixel in the defogged image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogged image to obtain the target grayscale image includes:

[0016] For any pixel in the defogging image, a weighted processing is performed on the brightness value of the pixel according to the brightness value of the matching pixel having the same pixel coordinates as the pixel in the grayscale image to be processed, so as to obtain the target grayscale image.

[0017] Optionally, in the step of performing weighted processing on the brightness value of any pixel in the dehazed image according to the brightness value of a matching pixel having the same pixel coordinates as the pixel in the grayscale image to be processed to obtain the target grayscale image, the brightness value of any pixel in the dehazed image is weighted by the following formula:

[0018] (2);

[0019] In formula (2), It means that the pixel coordinates obtained after weighted processing are ( ), Indicates that the pixel coordinates in the dehazed image are ( ), Indicates that the pixel coordinates in the grayscale image to be processed are ( )’s brightness value.

[0020] Optionally, the step of determining the defogging image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dark channel image includes:

[0021] Determine the average of the brightness values ​​of the reference pixels as the global atmospheric light value, wherein the reference pixels are pixels in the dark channel image whose brightness values ​​are greater than a preset threshold;

[0022] For any pixel in the dark channel image, defogging is performed on the brightness value of the pixel according to the global atmospheric light value and the brightness value of the matching pixel having the same pixel coordinates as the pixel in the grayscale image to be processed, so as to obtain the defogging image.

[0023] Optionally, in the step of performing defogging processing on the brightness value of any pixel in the dark channel image according to the global atmospheric light value and the brightness value of a matching pixel having the same pixel coordinates as the pixel in the grayscale image to be processed to obtain the defogged image, the brightness value of any pixel in the dark channel image is defogged using the following formula:

[0024] (3);

[0025] In formula (3), It means that the pixel coordinates obtained after defogging are ( ), Indicates that the pixel coordinates in the grayscale image to be processed are ( ), Indicates that the pixel coordinates in the dark channel image are ( ), Represents the global atmospheric light value.

[0026] Optionally, before the step of filtering the grayscale image to be processed based on a preset filter to obtain a dark channel image, the method further comprises: performing color separation processing on the color image to obtain a color value array and the grayscale image to be processed;

[0027] After the step of processing the brightness value of each pixel in the dehazed image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dehazed image to obtain the target grayscale image, the method further includes: fusing the target grayscale image and the color value array according to pixel coordinates to obtain a target color image.

[0028] As a third aspect of the present application, an electronic device is provided, wherein the electronic device includes:

[0029] one or more processors;

[0030] A memory having one or more computer programs stored thereon, wherein when the one or more computer programs are executed by the one or more processors, the one or more processors implement the image processing method according to the first aspect of the present application.

[0031] As a third aspect of the present application, a computer-readable medium is provided, on which a computer program is stored, wherein when the computer program is executed by a processor, the image processing method according to the first aspect of the present application is implemented.

[0032] In the image processing method provided in the embodiment of the present application, the grayscale image to be processed is filtered based on a preset filter to obtain a dark channel image, and the defogging image is determined according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dark channel image. In this way, by performing a defogging operation on the grayscale image to be processed, the clarity and contrast of the image can be improved to a certain extent. According to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogging image, the brightness value of each pixel in the defogging image is processed to obtain a target grayscale image. In this way, by performing brightness value processing on the defogging image, the contrast of the image can be further improved while improving the brightness of the image. Even for images captured by a camera device with low sensor performance or low visibility in the actual environment, such as images captured by a seaside device, or images captured by a camera device with a low sensor signal-to-noise ratio, its usability can be improved by improving its contrast, thereby reducing the cost and efficiency of image acquisition. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The present application is further described below in conjunction with the accompanying drawings:

[0034] Figure 1 is a flowchart of an implementation of the image processing method provided in an embodiment of the present application;

[0035] Figure 2 is a flowchart of another implementation of the image processing method provided in the embodiment of the present application;

[0036] Figure 3 is a flowchart of another implementation of the image processing method provided in the embodiment of the present application;

[0037] Figure 4 is a flowchart of another implementation of the image processing method provided in an embodiment of the present application;

[0038] Figure 5 is a flowchart of another implementation of the image processing method provided in the embodiment of the present application;

[0039] Figure 6is a schematic diagram of an implementation of an electronic device provided in an embodiment of the present application;

[0040] Figure 7 It is a schematic diagram of a computer-readable medium provided in an embodiment of the present application.

[0041] Description of Reference Numerals

[0042] 101: Processor 102: Memory

[0043] 103: I / O interface 104: bus DETAILED DESCRIPTION

[0044] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements with the same or similar functions. The embodiments based on the embodiments are intended to be used to explain the present application and cannot be understood as limiting the present application.

[0045] References to "one embodiment" or "an example" or "an example" in this specification mean that a particular feature, structure, or characteristic described in conjunction with the embodiment itself may be included in at least one embodiment disclosed in the present application. The appearance of the phrase "in one embodiment" in various places in the specification does not necessarily refer to the same embodiment.

[0046] Currently, due to the influence of sensor performance and environment, images taken by camera equipment generally have the problem of low contrast. For example, the color image presented by the image sensor has low contrast when the sensor performance is low or the visibility in the actual environment is low, and the grayscale image presented by the infrared sensor has low contrast due to the limitations of its image imaging principle, and so on.

[0047] In view of this, the applicant of the present application proposes that, for a grayscale image, its brightness can affect its contrast, and by processing the brightness of the grayscale image, a better contrast enhancement effect can be obtained. As a first aspect of the embodiment of the present application, Figure 1 As shown, an image processing method is provided, wherein the method may include the following steps:

[0048] In step S110, filtering is performed on the grayscale image to be processed based on a preset filter to obtain a dark channel image;

[0049] In step S120, a defogging image is determined according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dark channel image;

[0050] In step S130, the brightness value of each pixel in the defogged image is processed according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogged image to obtain a target grayscale image.

[0051] Among them, the embodiment of the present application does not make any special limitation on the preset filter, and any image filter that can blur the image / smooth the image can be used. For example, a Gaussian filter can be used as the preset filter. The embodiment of the present application does not make any specific limitation on the blur radius of the preset filter, and can be set according to the resolution of the grayscale image to be processed. For example, when the resolution of the grayscale image to be processed is 1080P, the blur radius of the preset filter can be set to 5 pixels.

[0052] The target grayscale image is a grayscale image obtained after the contrast of the grayscale image to be processed is enhanced.

[0053] The contrast of images collected by camera equipment when the sensor performance is low or the visibility in the actual environment is low is generally low. For example, when seaside equipment collects images, the visibility in the actual environment is lower than that of collecting images on land due to the influence of many factors such as sea breeze, humidity, temperature difference, and seawater corrosion. Therefore, the contrast of the collected images is low. For another example, the contrast of images collected by camera equipment with low sensor signal-to-noise ratio is low. However, for images collected by these camera equipment when the sensor performance is low or the visibility in the actual environment is low, the image processing method provided in the embodiment of the present application can also improve its usability by improving its contrast, thereby reducing the cost and efficiency of image collection.

[0054] It can be seen that the image processing method provided in the embodiment of the present application is performed on the basis of a grayscale image. However, it is understandable that for a color image, it is reasonable and feasible to first process it into a grayscale image and then perform the image processing method provided in the embodiment of the present application to finally restore the color of the target grayscale image, and a color image with improved contrast can also be obtained. In other words, the image processing method provided in the embodiment of the present application is also applicable to improving the contrast of a color image.

[0055] In the image processing method provided in the embodiment of the present application, the grayscale image to be processed is filtered based on a preset filter to obtain a dark channel image, and the defogging image is determined according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dark channel image. In this way, by performing a defogging operation on the grayscale image to be processed, the clarity and contrast of the image can be improved to a certain extent. According to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogging image, the brightness value of each pixel in the defogging image is processed to obtain a target grayscale image. In this way, by performing brightness value processing on the defogging image, the contrast of the image can be further improved while improving the brightness of the image. Even for images captured by a camera device when the sensor performance is low or the visibility in the actual environment is low, its usability can be improved by improving its contrast, thereby reducing the cost and efficiency of image acquisition.

[0056] The applicant of the present application proposes that the brightness value of each pixel in the defogging image may be processed by linearly stretching the brightness value. Figure 2 As shown, the step of processing the brightness value of each pixel in the defogged image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogged image to obtain the target grayscale image (i.e., step S130) may include the following steps:

[0057] In step S131a, a first mean and a second mean are determined, wherein the first mean is the mean of the brightness values ​​of each pixel in the grayscale image to be processed, and the second mean is the mean of the brightness values ​​of each pixel in the defogging image;

[0058] In step S132a, linear stretching processing is performed on the brightness value of each pixel in the defogging image according to the first mean value and the second mean value to obtain the target grayscale image.

[0059] The first mean value and the second mean value are used to perform linear stretching processing on the brightness value of each pixel in the defogging image, so that the mean value of the brightness value of the defogging image remains substantially unchanged after the linear stretching processing.

[0060] Accordingly, in some embodiments, in the step of performing linear stretching processing on the brightness value of each pixel in the defogging image according to the first mean value and the second mean value to obtain the target grayscale image, the brightness value of any pixel in the defogging image is linearly stretched using the following formula:

[0061] (1);

[0062] In formula (1), The pixel coordinates obtained after linear stretching are ( ), represents the first mean, represents the second mean, Indicates that the pixel coordinates in the dehazed image are ( )’s brightness value.

[0063] The applicant of the present application proposes that the brightness value of each pixel in the defogging image may be processed, or the brightness value of each pixel in the defogging image may be weighted. Figure 3 As shown, the step of processing the brightness value of each pixel in the defogged image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogged image to obtain the target grayscale image (i.e., step S130) may include the following steps:

[0064] In step S131b, for any pixel in the dehazed image, a weighted processing is performed on the brightness value of the pixel according to the brightness values ​​of matching pixels having the same pixel coordinates as the pixel in the grayscale image to be processed, so as to obtain the target grayscale image.

[0065] The brightness values ​​of the pixels of the grayscale image to be processed are used to perform weighted processing on the brightness values ​​of the pixels of the defogging image, so that the brightness values ​​of the pixels of the target grayscale image are between the brightness values ​​of the pixels of the grayscale image to be processed and the brightness values ​​of the pixels of the defogging image.

[0066] Accordingly, in some embodiments, in the step of performing weighted processing on the brightness value of any pixel in the dehazed image according to the brightness value of the matching pixel having the same pixel coordinates as the pixel in the grayscale image to be processed to obtain the target grayscale image, the brightness value of any pixel in the dehazed image is weighted by the following formula:

[0067] (2);

[0068] In formula (2), It means that the pixel coordinates obtained after weighted processing are ( ), Indicates that the pixel coordinates in the dehazed image are ( ), Indicates that the pixel coordinates in the grayscale image to be processed are ( )’s brightness value.

[0069] Accordingly, in some embodiments, Figure 4As shown, the step of determining the defogging image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dark channel image (i.e., step S120) may include the following steps:

[0070] In step S121, the average brightness value of the reference pixels is determined as the global atmospheric light value, wherein the reference pixels are pixels in the dark channel image whose brightness value is greater than a preset threshold;

[0071] In step S122, for any pixel in the dark channel image, defogging is performed on the brightness value of the pixel according to the global atmospheric light value and the brightness value of the matching pixel having the same pixel coordinates as the pixel in the grayscale image to be processed, so as to obtain the defogging image.

[0072] Among them, the global atmospheric light value can be calculated by the following formula: , represents the global atmospheric light value, Indicates that the pixel coordinates in the dark channel image are ( ), Indicates the preset threshold value, Represents the mean brightness value of pixels in the dark channel image whose brightness values ​​are greater than the preset threshold.

[0073] The embodiment of the present application does not impose any specific limitation on the preset threshold for determining the reference pixel, which may be determined according to actual conditions. For example, the preset threshold may be set to 200.

[0074] In some embodiments, in the step of performing defogging on the brightness value of any pixel in the dark channel image according to the global atmospheric light value and the brightness value of the matching pixel having the same pixel coordinates as the pixel in the grayscale image to be processed to obtain the defogged image, the brightness value of any pixel in the dark channel image is defogged using the following formula:

[0075] (3);

[0076] In formula (3), It means that the pixel coordinates obtained after defogging are ( ), Indicates that the pixel coordinates in the grayscale image to be processed are ( ), Indicates that the pixel coordinates in the dark channel image are ( ), Represents the global atmospheric light value.

[0077] As described above, for a color image, firstly processing it into a grayscale image and then executing the image processing method provided in the embodiment of the present application to finally restore the color of the target grayscale image can also achieve contrast enhancement of the color image. Figure 5 As shown, before the step of filtering the grayscale image to be processed based on the preset filter to obtain the dark channel image (i.e., step S110), the method may further include the following steps: in step S110', performing color separation processing on the color image to obtain a color value array and the grayscale image to be processed;

[0078] After the step of processing the brightness value of each pixel in the dehazed image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dehazed image to obtain the target grayscale image (i.e., step S130), the method may further include the following steps: in step S140, the target grayscale image and the color value array are fused according to pixel coordinates to obtain a target color image.

[0079] Among them, there are many implementation methods in the art for how to perform color separation processing on a color image to obtain a color value array and the grayscale image to be processed, and how to fuse the grayscale image and the color value array according to pixel coordinates, and the embodiments of the present application do not make specific limitations on this.

[0080] The contrast of images collected by camera equipment when the sensor performance is low or the visibility in the actual environment is low is generally low. For example, when seaside equipment collects images, the visibility in the actual environment is lower than that of collecting images on land due to the influence of many factors such as sea breeze, humidity, temperature difference, and seawater corrosion. Therefore, the contrast of the collected images is low. For another example, the contrast of images collected by camera equipment with low sensor signal-to-noise ratio is low. However, for images collected by these camera equipment when the sensor performance is low or the visibility in the actual environment is low, the image processing method provided in the embodiment of the present application can also improve its usability by improving its contrast, thereby reducing the cost and efficiency of image collection.

[0081] In the image processing method provided in the embodiment of the present application, the color image is first subjected to color separation processing to obtain a color value array and a grayscale image to be processed, and then the grayscale image to be processed is filtered based on a preset filter to obtain a dark channel image, and the defogging image is determined according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dark channel image. In this way, by performing a defogging operation on the grayscale image to be processed, the clarity and contrast of the image can be improved to a certain extent, and then according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogging image, the brightness value of each pixel in the defogging image is processed to obtain a target grayscale image, so that by performing brightness value processing on the defogging image, the contrast of the image can be further improved while the brightness of the image is improved. Finally, the target grayscale image and the color value array are fused according to the pixel coordinates to obtain the target color image. Even for images captured by the camera device when the sensor performance is low or the visibility in the actual environment is low, and whether it is a grayscale image or a color image, its usability can be improved by improving its contrast, thereby reducing the cost and efficiency of image acquisition.

[0082] As a second aspect of the embodiments of the present application, an electronic device is provided, wherein: Figure 6 As shown, the electronic device includes:

[0083] One or more processors 101;

[0084] The memory 102 stores one or more computer programs. When the one or more computer programs are executed by the one or more processors 101, the one or more processors 101 implement the image processing method provided in the first aspect of the embodiment of the present application.

[0085] The electronic device may further include one or more I / O interfaces 103 connected between the processor 101 and the memory 102 and configured to implement information interaction between the processor 101 and the memory 102 .

[0086] Among them, the processor 101 is a device with data processing capabilities, including but not limited to a central processing unit (CPU), etc.; the memory 102 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the I / O interface (read-write interface) is connected between the processor and the memory, and can realize information exchange between the processor and the memory, including but not limited to a data bus (Bus), etc.

[0087] In some embodiments, the processor 101 , the memory 102 , and the I / O interface 103 are connected to each other via a bus 104 , and further connected to other components of the computing device.

[0088] As a third aspect of the embodiment of the present application, Figure 7 As shown, a computer-readable medium is provided, on which a computer program is stored, wherein when the computer program is executed by a processor, the image processing method provided in the first aspect of the embodiment of the present application is implemented.

[0089] It will be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. Accordingly, the computer program can be stored in a non-volatile computer-readable storage medium, and the computer program can implement the method of any of the above-mentioned embodiments when executed. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the embodiments of the present application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), transactional SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0090] The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Those skilled in the art should understand that the present application includes but is not limited to the contents described in the drawings and the above specific embodiments. Any modification that does not deviate from the functional and structural principles of the present application will be included in the scope of the claims.

Claims

1. An image processing method, characterized in that: The method comprises: Performing filtering on the grayscale image to be processed based on a preset filter to obtain a dark channel image; Determine a defogging image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dark channel image; According to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogging image, the brightness value of each pixel in the defogging image is processed to obtain a target grayscale image; The step of processing the brightness value of each pixel in the defogged image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogged image to obtain the target grayscale image comprises: for any pixel in the defogged image, performing weighted processing on the brightness value of the pixel according to the brightness value of the matching pixel having the same pixel coordinates as the pixel in the grayscale image to be processed to obtain the target grayscale image; Wherein, in the step of performing weighted processing on the brightness value of any pixel in the defogging image according to the brightness value of the matching pixel having the same pixel coordinates as the pixel in the grayscale image to be processed to obtain the target grayscale image, the brightness value of any pixel in the defogging image is weighted by the following formula: (2); In formula (2), The pixel coordinates obtained after weighted processing are The brightness value of the pixel, Indicates that the pixel coordinates in the dehazed image are The brightness value of the pixel, Indicates that the pixel coordinates in the grayscale image to be processed are The brightness value of the pixel.

2. The method according to claim 1, characterized in that The step of processing the brightness value of each pixel in the defogging image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the defogging image to obtain the target grayscale image also includes: Determine a first mean and a second mean, wherein the first mean is the mean of the brightness values ​​of each pixel in the grayscale image to be processed, and the second mean is the mean of the brightness values ​​of each pixel in the defogging image; According to the first mean value and the second mean value, linear stretching processing is performed on the brightness value of each pixel in the defogging image to obtain the target grayscale image.

3. The method according to claim 2, characterized in that In the step of performing linear stretching processing on the brightness value of each pixel in the defogging image according to the first mean value and the second mean value to obtain the target grayscale image, the brightness value of any pixel in the defogging image is linearly stretched using the following formula: (1); In formula (1), The pixel coordinates obtained after linear stretching are The brightness value of the pixel, represents the first mean, represents the second mean, Indicates that the pixel coordinates in the dehazed image are The brightness value of the pixel.

4. The method according to any one of claims 1 to 3, characterized in that The step of determining the defogging image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dark channel image comprises: Determine the average of the brightness values ​​of the reference pixels as the global atmospheric light value, wherein the reference pixels are pixels in the dark channel image whose brightness values ​​are greater than a preset threshold; For any pixel in the dark channel image, defogging is performed on the brightness value of the pixel according to the global atmospheric light value and the brightness value of the matching pixel having the same pixel coordinates as the pixel in the grayscale image to be processed, so as to obtain the defogging image.

5. The method according to claim 4, characterized in that In the step of performing defogging on the brightness value of any pixel in the dark channel image according to the global atmospheric light value and the brightness value of the matching pixel having the same pixel coordinates as the pixel in the grayscale image to be processed to obtain the defogged image, the brightness value of any pixel in the dark channel image is defogged by the following formula: (3); In formula (3), It means that the pixel coordinates obtained after defogging are The brightness value of the pixel, Indicates that the pixel coordinates in the grayscale image to be processed are The brightness value of the pixel, Indicates that the pixel coordinates in the dark channel image are The brightness value of the pixel, Represents the global atmospheric light value.

6. The method according to any one of claims 1 to 3, characterized in that Before the step of filtering the grayscale image to be processed based on the preset filter to obtain the dark channel image, the method further includes: performing color separation processing on the color image to obtain a color value array and the grayscale image to be processed; After the step of processing the brightness value of each pixel in the dehazed image according to the brightness value of each pixel in the grayscale image to be processed and the brightness value of each pixel in the dehazed image to obtain the target grayscale image, the method further includes: fusing the target grayscale image and the color value array according to pixel coordinates to obtain a target color image.

7. An electronic device, characterized in that: The electronic device comprises: one or more processors; A memory having one or more computer programs stored thereon, wherein when the one or more computer programs are executed by the one or more processors, the one or more processors implement the image processing method according to any one of claims 1-6.

8. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 6 is implemented.