Image glare removal method, electronic device and computer storage medium
By calculating the minimum and maximum channel differences of the image in the RGB color space, combined with the brightness channel characteristics, the problem of poor glare removal effect of multiple colors in the existing technology is solved, and effective removal of all colors in the image is achieved, improving Improve image visibility and processing efficiency.
Patent Information
- Application Number
- PCT/CN2024/072605
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-28
- Filing Date
- 2024-01-16
- Publication Date
- 2024-10-03
AI Technical Summary
The existing technology is ineffective in processing multi-color glare in images and cannot effectively remove all color glare in images, affecting the visibility and quality of the image.
By calculating the difference between the minimum channel and the maximum channel in the RGB color space, combined with the brightness channel, using the dark channel and transmittance characteristics, the image is adjusted to achieve the removal of multi-color glare, and the image restoration formula is used to further remove white glare.
It achieves glare removal for all colors in the image, improves the visibility and processing efficiency of the image, avoids the problems of overexposure and overdarkness, has wider applicability, is simpler and has better generalization effect than other methods.
Smart Images

Figure CN2024072605_03102024_PF_FP_ABST
Abstract
Description
Image glare removal method, electronic device and computer storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This disclosure is based on and claims the priority of Chinese patent application No. 202310355352.8 filed on March 28, 2023, and all the disclosed contents thereof are incorporated into this disclosure by reference. Technical Field
[0003] The present disclosure relates to the field of communication technology, and in particular to an image glare removal method, an electronic device, and a computer storage medium. Background Art
[0004] With the increasing prevalence of electronic devices, more and more people are using them to take photos. However, in certain lighting conditions, RGB color images captured by these devices can experience glare, reducing the visibility of objects. To ensure a clear view of the subject, glare removal is necessary. However, current glare removal methods can only address glare of one color at a time and are ineffective for multi-color glare in images.
[0005] Summary of the Invention
[0006] The main purpose of the present disclosure is to provide an image glare removal method, an electronic device and a computer storage medium, aiming to solve the technical problem of how to improve the processing effect of removing multiple colors of glare in an image.
[0007] To achieve the above objectives, the present disclosure provides an image glare removal system, comprising:
[0008] Determine a minimum channel image and a maximum channel image corresponding to a frame of image with glare;
[0009] A frame of image is adjusted according to the minimum channel image and the maximum channel image to obtain an adjusted image after colored glare is removed.
[0010] To achieve the above objectives, the present disclosure also provides an electronic device, which includes: a memory, a processor, and an image glare removal program stored in the memory and runnable on the processor. When the image glare removal program is executed by the processor, the steps of the image glare removal method as described above are implemented.
[0011] To achieve the above objectives, the present disclosure further provides a computer storage medium, on which an image glare removal program is stored. When the image glare removal program is executed by a processor, the steps of the image glare removal method as described above are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] FIG1 is a flow chart of a first embodiment of a method for removing image glare according to an embodiment of the present disclosure;
[0013] FIG2 is a schematic diagram of a process scenario for removing image glare in a method for removing image glare in an embodiment of the present disclosure;
[0014] FIG3 is a flow chart of a second embodiment of a method for removing image glare according to an embodiment of the present disclosure;
[0015] FIG4 is a flow chart of a third embodiment of a method for removing image glare according to an embodiment of the present disclosure;
[0016] FIG5 is a schematic diagram of the device structure of the hardware operating environment involved in the image glare removal method in the embodiment of the present disclosure.
[0017] The purpose, features and advantages of the present disclosure will be further described with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION
[0018] It should be understood that the specific embodiments described herein are only used to illustrate the present disclosure and are not intended to limit the present disclosure.
[0019] After light passes through a lens, some of it is reflected back. A lens is composed of multiple lens elements, and a typical lens has at least ten reflective surfaces. The more reflective surfaces there are, the more times light will be reflected and diffused upon entering the lens. The more complex the lens, the more image quality will be affected. This is especially true when shooting in backlight or side-backlighting, where high-intensity light enters the lens, causing interference between the multiple reflective surfaces, which can easily create glare. This stray light from glare can cast a haze over the image, creating patches of light and even altering the perspective of the image. This haze can also reduce contrast and saturation, making dark areas appear abnormally bright.
[0020] When performing anti-glare in digital image processing, it is performed based on the HSV color space removal, but it can only process colored glare of one color. The dark channel prior dehazing algorithm is used to remove white and red glare, but this method can only process one type of glare at a time, and can only process white or red glare. It is not effective for processing multiple colored glares in the image. Therefore, in order to avoid the above defects, it is achieved to remove glare of all colors in the image at the same time. In the embodiment of the present disclosure, based on the RGB color space, the difference between the minimum channel and the maximum channel is calculated to remove the colored glare in the image, and the characteristics of the largely non-glare area of the brightness channel are used. At the same time, the dark channel and transmittance are calculated based on the minimum channel, and the atmospheric light value is calculated using the image after the colored glare has been removed. The image restoration formula is used to remove the white glare, thereby achieving glare removal of all colors in the image.
[0021] Compared with directly replacing the channel with the least glare component in the three RGB channels, the embodiment of the present disclosure directly uses the minimum channel and the maximum channel to calculate the difference channel, which can simultaneously remove glare of multiple colors; compared with other methods that use the Retinex algorithm for brightness optimization, the embodiment of the present disclosure uses the brightness channel combined with the difference to obtain a weight map, which can better ensure the original characteristics of the non-glare area, and has a wider applicability and will not cause overexposure; compared with the defect that other methods cannot simultaneously remove white glare, the embodiment of the present disclosure calculates the dark channel and transmittance based on the minimum channel, and uses the image after the colored glare has been removed to calculate the atmospheric light value, and then uses the image restoration formula to remove the white glare, thereby achieving glare removal of all colors in the image; compared with the deep learning algorithm, the mathematical model of the embodiment of the present disclosure is simple and the generalization effect is better.
[0022] The following is further described with reference to the accompanying drawings.
[0023] The present disclosure provides a method for removing glare from an image. Referring to FIG. 1 , in a first embodiment of the method for removing glare from an image, the method includes:
[0024] Step S10, determining a minimum channel image and a maximum channel image corresponding to a frame of image with glare;
[0025] In the disclosed embodiments, the technology can be applied to chips involved in digital image processing, supporting basic digital image operations such as image reading, convolution, and display. It can also be applied to mobile electronic imaging devices such as mobile phones and in-vehicle cameras to remove glare and improve image visibility. It can also be applied to images containing glare captured by visual perception devices in automated assisted driving, improving the reliability of automated assisted driving.
[0026] In an embodiment of the present disclosure, after obtaining an image video input by other terminals, or an image video actively input by a user, or an image video stored in advance by the device itself, image glare detection is performed on each frame of the image video to determine whether there is one or more frames of image with image glare, and then image glare removal processing is performed on the one or more frames of image with image glare. Exemplarily, when performing image glare removal processing on one or more frames of image with image glare, a multi-threaded parallel processing method can be used, such as performing image glare removal processing on multiple frames of image with image glare at the same time. It can also be performed in a single-threaded processing method, such as performing image glare removal processing on one frame of image with image glare at a time, until the image glare removal processing is completed for each frame of image with image glare.
[0027] For example, the method of performing image glare detection on each frame of the image video may be to detect it by means of OpenCV, or to detect it by a glare tester set in advance, which is not limited here.
[0028] For example, if there is glare in a frame image, and there is glare of a certain color at a certain pixel position in this frame image, such as blue glare, it can be determined that the pixel value of a certain channel in the RGB three-channel image corresponding to this frame image must reach the maximum at this pixel position. For example, if there is blue glare at pixel position A in a frame image, it is determined that the pixel value in the B channel image corresponding to pixel position A is much larger than the pixel value in the R channel and G channel images. Therefore, in order to facilitate the subsequent simultaneous elimination of all colored glare, a minimum channel image and a maximum channel image can be constructed based on the pixel points at each pixel position in the RGB three-channel image. Among them, the pixel point at each pixel position in the minimum channel image is the minimum pixel point at each pixel position in the RGB three-channel image. The pixel point at each pixel position in the maximum channel image is the maximum pixel point at each pixel position in the RGB three-channel image. Among them, the RGB three-channel image includes an R channel image, a G channel image, and a B channel image.
[0029] Furthermore, determining the minimum channel image and the maximum channel image corresponding to a frame of image with glare includes:
[0030] Step x, selecting the minimum value among the R, G, and B pixel values of the frame image at each pixel position to construct a minimum channel image;
[0031] Step y: Select the maximum value among the R, G, and B pixel values of the frame image at each pixel position to construct a maximum channel image.
[0032] When constructing a minimum channel image corresponding to a frame of image, the R pixel value in the R channel image, the G pixel value in the G channel image, and the B pixel value in the B channel image can be obtained for each pixel position, and then the minimum value among the R pixel value, the G pixel value, and the B pixel value is selected to construct the minimum channel image. That is, the pixel value at each pixel position in the minimum channel image is equal to the minimum pixel value at the same pixel position in the RGB three-channel image. Exemplarily, any two channel images among the R channel image, the G channel image, and the B channel image can be determined first, and then the minimum pixel value is selected for each pixel position in these two channel images to construct the minimum channel image. For example, if the G channel image and the B channel image are selected, the G pixel value in the G channel image and the B pixel value in the B channel image can be obtained for each pixel position, and then the minimum value among the G pixel value and the B pixel value is selected to construct the minimum channel image.
[0033] When constructing a maximum channel image corresponding to a frame of image, the R pixel value in the R channel image, the G pixel value in the G channel image, and the B pixel value in the B channel image can be obtained for each pixel position, and then the maximum value among the R, G, and B pixel values can be selected to construct the maximum channel image. In other words, the pixel value at each pixel position in the maximum channel image is equal to the maximum pixel value at the same pixel position in the RGB three-channel image. For example, any two channel images from the R channel image, the G channel image, and the B channel image can be first determined, and then the maximum pixel value at each pixel position in these two channel images can be selected to construct the maximum channel image. For example, if a G channel image and a B channel image are selected, the G pixel value in the G channel image and the B pixel value in the B channel image can be obtained for each pixel position, and then the maximum value among the G pixel value and the B pixel value can be selected to construct the maximum channel image. It should be noted that if only two channel images are selected to construct the minimum channel image and the maximum channel image, the construction needs to be based on the same channel images. For example, if a minimum channel image is constructed based on the R channel image and the G channel image, a maximum channel image must also be constructed based on the R channel image and the G channel image. This ensures a one-to-one correspondence between the constructed maximum channel image and the minimum channel image, facilitating the subsequent validity of the difference channel image constructed based on the maximum channel image and the minimum channel image.
[0034] Step S20 , adjusting the frame of image according to the minimum channel image and the maximum channel image to obtain an adjusted image after removing colored glare.
[0035] In the disclosed embodiment, since the constructed minimum channel image has removed the glare in a frame of image, directly adjusting and generating the final image based on the minimum channel image will cause the generated image to be darker and cause greater interference to the non-glare area (such as interference to the brightness and texture of the non-glare area, etc.), wherein the non-glare area can be an area in a frame of image where no glare exists. Therefore, in the present embodiment, the minimum channel image and the maximum channel image are comprehensively considered to adjust the frame of image to generate an adjusted image after removing the colored glare, thereby ensuring that all colored glare in a frame of image is removed at the same time, while avoiding causing greater interference to the non-glare area in a frame of image, and avoiding the phenomenon of the final generated image being too dark or too bright. For example, in the present embodiment, the colored glare can be removed in the same manner for each frame of image.
[0036] For example, after removing colored glare from a frame of image, an adjusted image can be obtained, which can then be processed accordingly to obtain a final processed image, which can be used as the target image. For example, the adjusted image can be adjusted based on the target transmittance corresponding to the minimum channel image to obtain a target image after removing white glare, where the target image includes the adjusted image after removing white glare. Furthermore, the same operation can be applied to each frame of image, i.e., first removing colored glare, then removing white glare.
[0037] In addition, to assist in understanding the image glare removal process in the embodiment of the present disclosure, an example is given below.
[0038] For example, as shown in FIG2 , after the input frame is detected, each frame image of the input frame is detected to determine whether there is glare. If not, it is detected whether this frame image is the last frame image. If not, the next frame is detected to determine whether there is glare. If so, the minimum channel is calculated for the frame image. Among them, the minimum channel image of the frame image can be constructed to determine the minimum channel. And after calculating the minimum channel, the maximum channel (combined with the minimum channel to obtain the difference channel) and the brightness channel can be calculated. Among them, the maximum channel image of the frame image can be constructed to determine the maximum channel. And the difference channel image between the maximum channel image and the minimum channel image is calculated to determine the difference channel. When calculating the brightness channel, the RGB channel image corresponding to the frame image can be adjusted according to the preset weight to generate a brightness channel image, which contains brightness channel information. A weight map (also known as a weight image) is then calculated based on the difference channel and the brightness channel. This weight map is then used to adjust the three RGB channels to remove colored glare. Furthermore, after calculating the minimum channel, the dark channel, the atmospheric light value, and the transmittance are calculated. The adjusted RGB channels are then used to remove white glare according to a formula, thereby completing glare removal for all colors in this frame. This formula can be a pre-set image formula for removing white glare. The image is then checked to see if it is the last frame. If so, the image glare removal process ends. If not, the next frame in the input is tested to determine if glare is present, and this continues until the last frame has been tested.
[0039] In the disclosed embodiments, a frame of image is adjusted to an adjusted image after colored glare removal based on the maximum and minimum channel images corresponding to the frame of image, thereby removing multiple colored glare from the frame of image. This avoids the problem of only processing one color of glare at a time, resulting in poor processing effects for multiple colors in the image. It achieves simultaneous glare removal for all colors in the frame of image, improving the effect of removing multiple colors from the image and increasing image processing efficiency.
[0040] Furthermore, based on the first embodiment of the image glare removal method described above, a second embodiment of the image glare removal method disclosed herein is proposed. Referring to FIG. 3 , in the second embodiment of the image glare removal method disclosed herein, step S20 of adjusting the one frame of image according to the minimum channel image and the maximum channel image to obtain an adjusted image after removing colored glare includes:
[0041] Step a, determining a difference channel image between the maximum value channel image and the minimum value channel image;
[0042] Step b: determining a brightness channel image corresponding to the frame image, and adjusting the frame image according to the difference channel image and the brightness channel image to obtain an adjusted image.
[0043] In the disclosed embodiment, after determining and constructing the maximum value channel image and the minimum value channel image corresponding to a frame of image, it is also necessary to determine the difference channel image between the maximum value channel image and the minimum value channel image, and then adjust the frame of image based on the difference channel image, so as to avoid the phenomenon that the brightness of the adjusted image is too high when the frame of image is adjusted based on the maximum value channel image alone, and to avoid the phenomenon that the adjusted image is too dark when the frame of image is adjusted based on the minimum value channel image alone.
[0044] For example, when constructing and determining a difference channel image, the pixel value of the maximum channel image may be subtracted from the pixel value of the minimum channel image to obtain the difference channel image. Specifically, for the same pixel location, the pixel value in the maximum channel image may be subtracted from the pixel value in the minimum channel image, and the pixel value subtraction operation may be performed for all pixel locations to obtain the difference channel image. For example, if the maximum channel image is Max and the minimum channel image is Min, then the difference channel image Delta may be: Delta = Max - Min.
[0045] In the disclosed embodiment, it is also necessary to determine the brightness channel image corresponding to a frame of image. That is, it is necessary to determine the brightness channel image and difference channel image corresponding to a frame of image, and then adjust the frame of image based on the difference channel image and the brightness channel image to obtain an adjusted image after removing the colored glare.
[0046] In an embodiment of the present disclosure, a frame of image is adjusted based on a difference channel image and a brightness channel image between a maximum value channel image and a minimum value channel image to obtain an adjusted image after removing colored glare, thereby avoiding the phenomenon that the adjusted image is too bright or too dark.
[0047] Furthermore, determining the brightness channel image corresponding to the frame of image includes:
[0048] Step b1, determining an RGB channel image corresponding to the frame of image, wherein the RGB channel image includes an R channel image, a G channel image, and a B channel image;
[0049] Step b2: adjusting the R channel image, the G channel image, and the B channel image according to preset weights, and summarizing the adjusted R channel image, the G channel image, and the B channel image to obtain a brightness channel image.
[0050] In the disclosed embodiment, when determining the luminance channel image, it is necessary to first determine the RGB channel images corresponding to a frame of image, that is, the RGB three-channel image, including the R channel image, the G channel image, and the B channel image. Then, it is necessary to determine the pre-set weights, including the first weight corresponding to the R channel image, the second weight corresponding to the G channel image, and the third weight corresponding to the B channel image. The luminance channel image is determined based on the first weight, the second weight, and the third weight, as well as the R channel image, the G channel image, and the B channel image.
[0051] For example, a luminance channel image can be constructed based on an RGB three-channel image. For example, first determine the first weight w1 corresponding to the R channel image, the second weight w2 corresponding to the G channel image, and the third weight w3 corresponding to the B channel image. The first weight w1, the second weight w2, and the third weight w3 can be set to a value whose sum is 100%. For example, the first weight w1, the second weight w2, and the third weight w3 can all be set to 1 / 3. That is, Y = w1*R+w2*G+w3*B, where Y is the luminance channel image.
[0052] In this embodiment, the R channel image, G channel image and B channel image corresponding to a frame image are adjusted according to the pre-set weights, and the brightness channel image is obtained by summarizing them, thereby ensuring the validity of the obtained brightness channel image.
[0053] Furthermore, adjusting the frame of image according to the difference channel image and the brightness channel image to obtain an adjusted image includes:
[0054] Step b3: normalize the difference channel image and the brightness channel image based on a preset weight formula to obtain a weighted image.
[0055] Step b4: adjusting the RGB channel image corresponding to the frame image according to the weight image, and using the adjusted RGB channel image as the adjusted image.
[0056] For example, when adjusting a frame of image using the difference channel image and the brightness channel image, the difference channel image and the brightness channel image can be normalized according to a pre-set weight formula to obtain a weighted image. For example, if the difference channel image is Delta, the brightness channel image is Y, and the weight image is Weight, then the weight formula can be:
[0057] Here, bit is the bit depth of the image.
[0058] Then, the weight image is used to determine the new RGB three-channel image, and the synthesis adjustment process is performed to obtain the adjusted image. The new RGB three-channel image can be: R new =Weight*R;G new =Weight*G;B new =Weight*B. That is, the R, G, and B channel images are adjusted using the weight image, and then the adjusted R, G, and B channel images are merged to obtain an adjusted image. For example, adjusting the RGB three-channel image using the weight image constructed using the difference channel image and the luminance channel image can prevent the generated adjusted image from being too dark or too bright.
[0059] In this embodiment, a weight image is obtained by normalizing the difference channel image and the brightness channel image, and each pixel position of the RGB channel image is adjusted according to the weight image, and the adjusted RGB channel image is used as the adjustment image.
[0060] Furthermore, based on the first or second embodiment of the image glare removal method described above, a third embodiment of the image glare removal method of the present disclosure is proposed. Referring to FIG. 4 , in the third embodiment of the image glare removal method of the present disclosure, step S20, after adjusting the frame of image according to the minimum channel image and the maximum channel image to obtain an adjusted image after removing colored glare, includes:
[0061] Step e: adjusting the adjustment image according to the target transmittance corresponding to the minimum channel image to obtain a target image after removing white glare.
[0062] In the embodiment of the present disclosure, after obtaining the adjusted image after removing the colored glare, the adjusted image can be processed again according to the target transmittance corresponding to the minimum channel image to remove the white glare in the adjusted image, obtain the image after removing all glare, and use it as the target image.
[0063] Furthermore, adjusting the adjustment image according to the target transmittance corresponding to the minimum channel image includes:
[0064] Step e1, performing minimum filtering on the minimum channel image based on a preset filtering radius to obtain a dark channel image;
[0065] Step e2, determining the atmospheric light value corresponding to the adjusted image, and determining the target transmittance based on the atmospheric light value and the dark channel image;
[0066] For example, when adjusting the adjustment image, the filter radius set in advance can be determined first, and the minimum value channel image can be subjected to minimum value filtering to obtain a dark channel image. For example, when determining the filter radius, the filter radius can be determined by the window size corresponding to a frame of image, for example:
[0067] in, Represents the minimum channel image. J dark (x) represents the dark channel image of white glare. Ω(x) represents a window centered at pixel x, min() represents a minimization operation, and y represents a subregion of Ω(x).
[0068] After determining the dark channel image, we also need to determine the atmospheric light value corresponding to the adjusted image. This allows us to describe the ambient light in the scene corresponding to a frame of image based on the atmospheric light value. We then construct a transmittance matrix based on the atmospheric light value and the dark channel image, and use this transmittance matrix as the target transmittance.
[0069] Furthermore, the step of determining the atmospheric light value corresponding to the adjusted image includes:
[0070] Step e21, sorting all grayscale values corresponding to the dark channel image to obtain a grayscale value sequence;
[0071] Step e22, determining pixel value positions corresponding to grayscale values within a preset range in the grayscale value sequence;
[0072] Step e23: determining all brightness values corresponding to the pixel value positions in the adjusted image, and taking the maximum brightness value among all the brightness values as the atmospheric light value.
[0073] In an embodiment of the present disclosure, when determining the atmospheric light value corresponding to the adjusted image, all grayscale values corresponding to the dark channel image can be sorted to obtain a grayscale value sequence, and the pixel values corresponding to the grayscale values in a preset range in the grayscale value sequence can be determined. For example, the top 0.1% of the pixel value positions are found from the dark channel image according to the size of the grayscale values, and the brightness value corresponding to the pixel value position is found in the adjusted image from which the colored glare has been eliminated, and the maximum value among the found brightness values, that is, the maximum brightness value, is selected as the atmospheric light value.
[0074] Further, determining the target transmittance according to the atmospheric light value and the dark channel image includes:
[0075] Step e24, constructing a transmittance matrix based on the dark channel image, preset adjustment parameters and the atmospheric light value;
[0076] Step e25 , determining a target transmittance corresponding to each pixel value position in the adjusted image, wherein the target transmittance is the larger of the transmittance corresponding to the pixel value position in the transmittance matrix and a preset threshold.
[0077] After determining the atmospheric light value, the transmittance matrix can be constructed based on the dark channel image, the pre-set adjustment parameter w, and the atmospheric light value. Specifically, it can be:
[0078] Where t(x) represents the transmittance matrix. c (y) represents the input image. w represents the adjustment parameter, which can be set to 0.9 or any value between 0.9 and 0.95. c represents the image channel. A represents the atmospheric light value. Ω(x) represents a window centered on pixel x, and min() represents the minimization operation. y represents a subregion of Ω(x).
[0079] After determining the transmittance matrix, the target transmittance corresponding to each pixel value position in the adjusted image after removing the colored glare can be determined based on the transmittance matrix. Specifically, the target transmittance corresponding to each pixel value position in the adjusted image can be calculated by inputting the atmospheric light value and the transmittance matrix into a pre-set image formula. The image formula can be:
[0080] Where J(x) represents the image after removing the white glare, that is, the target image. new represents the adjusted image after removing colored glare. t0 represents the threshold value, which can be set to 0.1 (or any value between 0.05 and 0.15). max() represents the maximization operation. t(x) represents the transmittance matrix. A represents the atmospheric light value.
[0081] And when the value of the transmittance matrix t(x) is very small, it will cause the restored target image to be white, so a threshold t0 will be set. For the pixel point at each pixel position of the threshold t0 and t(x), the larger value is selected as the final transmittance at the pixel position. That is, the larger one will be selected between the transmittance corresponding to the pixel value position in the transmittance matrix and the preset threshold, and the larger value will be used as the target transmittance. For example, when the transmittance corresponding to the pixel value position in the transmittance matrix is greater than the preset threshold, the transmittance corresponding to the pixel value position in the transmittance matrix is selected, and the transmittance corresponding to the pixel value position is used as the target transmittance. When the transmittance corresponding to the pixel value position in the transmittance matrix is less than the preset threshold, the preset threshold is selected, and the preset threshold is used as the target transmittance. Exemplarily, the preset threshold can be a threshold set in advance, or it can be a range interval set in advance.
[0082] Step g: adjusting the adjustment image according to the atmospheric light value and the target transmittance to obtain the target image.
[0083] After determining the atmospheric light value and the target transmittance at each pixel position, the pixel at each pixel position in the adjustment image can be adjusted based on the atmospheric light value and the target transmittance at each pixel position to obtain the target image. The adjustment can be performed using the above-mentioned image formula.
[0084] In this embodiment, a dark channel image is obtained by performing minimum filtering on the minimum channel image according to a filter radius. All grayscale values corresponding to the dark channel image are then sorted to obtain a grayscale value sequence. Pixel positions corresponding to grayscale values within a preset range within the grayscale value sequence are determined, and the maximum brightness value among all brightness values corresponding to the pixel positions in the adjusted image is used as the atmospheric light value. A transmittance matrix is then constructed based on the dark channel image, adjustment parameters, and atmospheric light values to determine the target transmittance corresponding to each pixel position in the adjusted image. The adjusted image is then adjusted based on the atmospheric light value and the target transmittance to obtain a target image. This removes both colored and white glare from a single image frame, resulting in a target image free of all colored glare.
[0085] In addition, the present disclosure also provides an electronic device, which includes a memory, a processor, and an image glare removal program stored in the memory and runnable on the processor. When the image glare removal program is executed by the processor, the steps of the image glare removal method described above are implemented.
[0086] [Corrected 11.03.2024 according to Rule 91] In addition, in one embodiment, FIG5 is a schematic diagram of the structure of an electronic device according to one embodiment of the present disclosure. As shown in FIG5 , at the hardware level, the electronic device includes a processor and, illustratively, also includes an internal bus, a network interface, and memory. The memory may include internal memory, such as high-speed random-access memory (RAM), and may also include non-volatile memory, such as at least one disk storage device. Of course, the electronic device may also include hardware required for other services. The processor, network interface, and memory may be interconnected via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, FIG5 uses only one bidirectional arrow, but this does not mean that there is only one bus or one type of bus. The memory is used to store programs. Specifically, the program may include program code, which includes computer operating instructions. The processor reads the corresponding computer program from the non-volatile memory, stores it in the memory, and then runs it, forming a shared resource access control device at a logical level. The processor executes the program stored in the memory and is specifically configured to perform the steps of the above-described image glare removal method.
[0087] The specific implementation of the electronic device disclosed herein is substantially the same as the above-mentioned embodiments of the image glare removal method, and will not be described in detail here.
[0088] In addition, to achieve the above-mentioned purpose, the present disclosure also provides a computer storage medium, which may include a computer-readable storage medium, on which an image glare removal program is stored. When the image glare removal program is executed by a processor, the steps of the image glare removal method as described above are implemented.
[0089] The specific implementation of the computer-readable storage medium disclosed herein is substantially the same as the above-mentioned embodiments of the image glare removal method, and will not be described in detail here.
[0090] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As is well known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable, and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media generally embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0091] The above are merely exemplary embodiments of the present disclosure and are not intended to limit the patent scope of the present disclosure. Any equivalent structure or equivalent process transformation made using the contents of the present disclosure and the drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present disclosure.
Claims
1. A method for removing glare from an image, comprising: Determine a minimum channel image and a maximum channel image corresponding to a frame image with glare; The one frame of image is adjusted according to the minimum value channel image and the maximum value channel image to obtain an adjusted image after colored glare is removed.
2. The image glare removal method according to claim 1, wherein: The step of adjusting the frame of image according to the minimum channel image and the maximum channel image to obtain an adjusted image after colored glare is removed includes: Determine a difference channel image between the maximum value channel image and the minimum value channel image; A brightness channel image corresponding to the frame of image is determined, and the frame of image is adjusted according to the difference channel image and the brightness channel image to obtain an adjusted image.
3. The image glare removal method according to claim 2, wherein: The determining of the brightness channel image corresponding to the frame of image includes: Determine an RGB channel image corresponding to the frame of image, wherein the RGB channel image includes an R channel image, a G channel image, and a B channel image; The R channel image, the G channel image and the B channel image are adjusted according to preset weights, and the adjusted R channel image, the G channel image and the B channel image are summarized to obtain a brightness channel image.
4. The image glare removal method according to claim 2, wherein: The step of adjusting the frame of image according to the difference channel image and the brightness channel image to obtain an adjusted image includes: The difference channel image and the brightness channel image are normalized based on a preset weight formula to obtain a weight image. The RGB channel image corresponding to the frame image is adjusted according to the weight image, and the adjusted RGB channel image is used as the adjusted image.
5. The image glare removal method according to claim 1, wherein: After adjusting the one frame of image according to the minimum channel image and the maximum channel image to obtain an adjusted image after removing colored glare, the method includes: The adjusted image is adjusted according to the target transmittance corresponding to the minimum channel image to obtain a target image after removing white glare.
6. The image glare removal method according to claim 5, wherein: The adjusting the adjustment image according to the target transmittance corresponding to the minimum channel image comprises: Performing minimum value filtering on the minimum value channel image based on a preset filtering radius to obtain a dark channel image; Determining an atmospheric light value corresponding to the adjusted image, and determining the target transmittance according to the atmospheric light value and the dark channel image; The adjustment image is adjusted according to the atmospheric light value and the target transmittance to obtain the target image.
7. The image glare removal method according to claim 6, wherein: The determining the atmospheric light value corresponding to the adjusted image includes: Sorting all grayscale values corresponding to the dark channel image to obtain a grayscale value sequence; Determine pixel value positions corresponding to grayscale values within a preset range in the grayscale value sequence; All brightness values corresponding to the pixel value position in the adjusted image are determined, and the maximum brightness value among all the brightness values is used as the atmospheric light value.
8. The image glare removal method according to claim 6, wherein: The determining the target transmittance according to the atmospheric light value and the dark channel image comprises: Constructing a transmittance matrix according to the dark channel image, preset adjustment parameters and the atmospheric light value; A target transmittance corresponding to each pixel value position in the adjusted image is determined, wherein the target transmittance is the larger of the transmittance corresponding to the pixel value position in the transmittance matrix and a preset threshold.
9. The image glare removal method according to claim 1, wherein: The step of determining a minimum channel image and a maximum channel image corresponding to a frame of image having glare includes: At each pixel position, a minimum value among the R, G, and B pixel values of the frame image is selected to construct a minimum channel image; At each pixel position, the maximum value among the R, G, and B pixel values of the frame image is selected to construct a maximum channel image.
10. An electronic device, comprising: A memory, a processor, and an image glare removal program stored in the memory and executable on the processor, wherein the image glare removal program implements the steps of the image glare removal method according to any one of claims 1 to 9 when executed by the processor.
11. A computer storage medium having an image glare removal program stored thereon, wherein the image glare removal program, when executed by a processor, implements the steps of the image glare removal method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method for removing colored glare
CN109993714A
Color image glare removal method and system based on HSV color space
CN110087051A
Image definition determination method and apparatus, and device and storage medium
WO2022183902A1
