Dazzle light removing method, computer equipment and storage medium

By establishing a radiative transfer model and unsupervised label generation technology, combined with Uformer network and exposure-guided mask attention mechanism, the technical challenges of glare removal and light source restoration at night were solved, achieving high-precision glare removal and light source preservation, adapting to complex nighttime lighting environments.

CN121169769APending Publication Date: 2025-12-19WUHAN UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511300420.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-11
Publication Date
2025-12-19

AI Technical Summary

Technical Problem

Existing technologies for dealing with nighttime glare suffer from high hardware costs, insufficient accuracy of traditional algorithms, and reliance on manual annotation for deep learning, making it difficult to effectively remove glare artifacts while preserving the integrity of the light source structure.

Method used

By establishing a radiative transfer model to distinguish between dominant and non-dominant light sources, an unsupervised exposure-guided label generation method is adopted, combined with Uformer network and exposure-guided mask attention mechanism, to decompose and reconstruct glare and background, and finally guide the light source recovery through pseudo-labels.

Benefits of technology

It achieves high-precision removal of glare artifacts while preserving the light source structure without manual annotation, improving the visual quality and generalization ability of images and adapting to complex nighttime lighting environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121169769A_ABST
    Figure CN121169769A_ABST
Patent Text Reader

Abstract

The invention provides a dazzle light removing method. The method comprises the steps that a night light emitting model containing a dominant light source and a non-dominant light source is established through radiation transmission analysis; the method comprises the following steps: acquiring HDR night scene dazzle light damaged image data, and preprocessing and normalizing the data to obtain standardized data; aiming at input data, an unsupervised exposure guide label generation method is adopted, and a dazzle light area around a dominant light source and a non-dominant light source is positioned based on modulus imaging constraint; introducing a Uform network guided by an exposure label, combining with an exposure guide mask attention mechanism, and jointly optimizing a dazzle light and background decomposition and reconstruction process through exposure guide loss; based on a pseudo-label guided light source recovery method, decoupling a dominant overlapped light source under the constraint of exposure and connectivity, and retaining a non-dominant light source; and fusing the non-glare background reconstruction result and the light source reconstruction result to obtain output image data which is free of glare and contains an ideal light source. The method has the advantages of breaking through light source and dazzle light marking dependence, improving the reconstruction precision of the overlapped light source and the weak light source, enhancing the supervised learning ability and effectively removing night dazzle light artifacts.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer vision and image processing, and particularly relates to a glare removal method, a computer device and a storage medium. BACKGROUND

[0002] With the wide application of intelligent photography technology in the field of consumer electronics, the improvement of night image quality has become the focus of the industry. Traditional cameras are limited by their inherent insufficient dynamic range. When shooting high dynamic range (HDR) night scenes, due to the complex light refraction and scattering phenomena in the lens system, local overexposure artifacts often occur in the imaging, which is manifested as night glare. The appearance characteristics of such glare are influenced by multiple factors such as light source intensity, scene complexity and optical system characteristics, and often present diversified shapes and color distributions, which not only significantly reduce the subjective visual quality of the image, but also adversely affect the accuracy of advanced computer vision tasks such as semantic segmentation and depth estimation. Specifically, night glare mainly includes two types of optical effects: scattering glare and reflection glare. The scattering glare is manifested as a fog-like glare area and a radial radiation stripe area, while the reflection glare is manifested as irregular shape artifacts distributed near the light source. In the field of intelligent mobile devices, with the increasing demand of users for night imaging quality, how to effectively eliminate large-area or even full-image range glare artifacts while maintaining the semantic coherence and visual consistency of the image, and at the same time ensuring the integrity of the light source structure, has become a technical problem to be solved in the field. The existing solutions have the following shortcomings:

[0003] (1) Hardware solutions have inherent limitations and low cost-effectiveness: Physical anti-glare methods based on optical components (such as anti-reflection coatings, special lens designs, etc.) can reduce glare to some extent, but significantly increase the complexity and cost of the optical system. At the same time, it is difficult to balance the relationship between glare removal effect and image quality maintenance in the technical aspect, especially when dealing with complex and variable lighting environments at night, its performance is unstable and cannot adapt to the dynamic changes of glare characteristics under different lighting conditions.

[0004] (2) Traditional algorithm solutions rely on artificial priori, resulting in insufficient recognition accuracy: The calculation method based on manually designed intensity priori and geometric priori does not require a large amount of labeled data, but its core defect is that it is difficult to accurately distinguish between real glare and inherent bright areas in the scene, and lacks the ability to identify multiple types of glare (such as scattering glare and reflection glare) in real scenes. When dealing with composite glare produced by both main light sources and non-main light sources, due to the lack of effective separation mechanism, it often leads to the failure of processing the overlapping area of overexposed dominant light source and glare artifact, which seriously affects the removal accuracy.

[0005] (3) Deep learning solutions rely too much on manual annotation and have limited generalization ability: Although existing deep learning-based methods have improved the effect of glare removal to some extent, their training process requires a large number of accurately labeled light sources / glare labels, which not only has high labeling cost and long cycle, but also is difficult to cover the multiple glare variations caused by dominant light sources and non-dominant light sources in complex lighting environments at night. In particular, when dealing with non-dominant light sources with low brightness and lack of obvious overexposure features, existing models often cannot accurately detect the glare area generated by them, resulting in important background information being lost or mistakenly eliminated during the removal process. At the same time, existing light source recovery methods after glare removal cannot take into account the cases of glare and light source being unable to be distinguished due to overexposure, and smile light source being unable to be recovered. This seriously affects the processing effect of subsequent advanced vision tasks. SUMMARY

[0006] Current glare removal methods usually rely on manually annotated light source / glare labels, and two challenges are encountered when accurately reconstructing the light source. One is the main light source that is overlapped by glare artifacts and overexposed, and the other is the non-main light source that has almost no overexposure.

[0007] To solve these problems, the present application provides a glare removal method, comprising the following steps:

[0008] S1, a night lighting model containing dominant light sources and non-dominant light sources is established by radiation transfer analysis;

[0009] S2, HDR night scene glare-damaged image data is obtained, and the data is preprocessed and normalized to obtain standardized data;

[0010] S3, for the input data, an unsupervised exposure guide label generation method is used to locate the glare area around the dominant light source and the non-dominant light source based on analog imaging constraints;

[0011] S4, an exposure label guided Uformer network is introduced, combined with an exposure guide mask attention mechanism, and the glare and background decomposition and reconstruction process is jointly optimized through an exposure guide loss;

[0012] S5, based on a pseudo-label guided light source recovery method, the dominant overlapping light source is decoupled under the constraints of exposure and connectivity, and the non-dominant light source is preserved;

[0013] S6, the non-glare background reconstruction result generated in step S4 is fused with the light source reconstruction result generated in step S5 to obtain output image data without glare and containing ideal light sources.

[0014] Further, step S1 specifically comprises:

[0015] A basic glare degradation model is established based on a Fourier optics model, and the glare output without background illumination is expressed as:

[0016] I f =C(h*x+η)

[0017] where x is the real scene irradiance, h is the optical system point spread function, * denotes convolution operation, η is noise, and C(·) is the camera response function;

[0018] The Fresnel diffraction model is introduced to further refine the formation process of glare, and the glare output is expressed as:

[0019]

[0020] where E U (x) is the radiation distribution of the dominant light source, The point spread function PSF λ is Fourier transformed to degrade, and β is a normalization constant;

[0021] The extended model includes ambient light of non-dominant light sources, and establishes a night lighting model that includes both dominant and non-dominant light sources:

[0022] I F (x,λ,ω)∝E(ω,x)=E U (x)+k w (x)·E O (ω)

[0023] I F (x,λ,ω)=I f (x,λ)+k w (x)·I O (ω)

[0024] where E U (x) is the dominant light source of the above equation modeling the matte surface, I f (x,λ) is only valid for the dominant light source and its main glare area; k w is the transparency map, with a value range of (0, 1], set to 1 on a clear night; E O (ω) is the radiation emission map of ambient light, and ω is the incident angle of non-dominant light sources;

[0025] Simplify the representation of non-dominant light sources, and simplify I O (ω) to the remaining brightness outside the optical modeling light source and glare:

[0026] I O (ω)=I F ·1 Ω

[0027] where

[0028] Further, in step S2, the pixel value is linearly mapped to the interval [0, 1] by using the minimum-maximum normalization method, and the mathematical expression is:

[0029]

[0030] Further, step S3 specifically includes:

[0031] The real image sensor overexposure model is established, the overexposure formation process is described based on the image sensor model of a traditional camera, and the mathematical expression is:

[0032]

[0033] Wherein φ(x) = τ × QE × (θ(x) + μ dark ), containing scene flux, quantum efficiency and dark current parameters;

[0034] The non-overexposed image is restored by using the principle of an analog-digital camera, and the N-bit analog-digital image I m The ideal image is restored:

[0035]

[0036] Wherein M (k) The number of pixel flips is recorded;

[0037] The relationship between the glare-damaged image and the analog-digital image I is established, and the relationship between the glare-damaged image I F and the analog-digital image is:

[0038]

[0039] Wherein K is the number of folds, is the intermediate value after exposure;

[0040] Finally, the exposure guide label is generated by iterative updating, and the iterative relationship is:

[0041] K i+1 = K i -M i ,M i+1 = I F (M i+1 > 0)

[0042] Wherein, M0 is selected as the glare area positioning label.

[0043] Further, step S4 specifically includes:

[0044] The glare area positioning label M0 obtained in step S3 is binarized and the glare-damaged image I FThe image restoration network Uformer is introduced, and the W-MSA initial attention mechanism of the Uformer is as follows:

[0045]

[0046] M is in {0, 1} H×W The attention score is adjusted to improve the attention mechanism; for the invalid region with a value of 0, the corresponding attention score is set to a negative value less than the preset threshold; and the adjusted W-MSA attention mechanism is as follows:

[0047]

[0048] The adjusted attention mechanism is used for each LeWinTransformer block of the Uformer model, each layer of which is composed of two LeWinTransformer blocks; and the model is composed of 4 layers of encoders, 4 layers of decoders and a bottleneck module in total; is input into the input projection layer module, which is composed of a convolution layer and an activation layer:

[0049] F k,enc =↓2 k (F k-1,enc ) k )

[0050] F bottleneck =LeWin(F 4,enc ,M 4 )

[0051] F k,dec =LeWin(↑2 k (F k-1,enc )+F 4-k,dec ,M 4-k )

[0052] Wherein,↓2 k and↑2 k are down-sampling and up-sampling operations, and F k,enc / dec is the feature output of the kth layer.

[0053] Through supervised training based on the non-glare image I GT , the network outputs the predicted non-glare image I DF and the predicted only glare image I flare , and after gamma correction, the two values are combined into I merged by simple addition.

[0054] Further, step S5 specifically comprises:

[0055] According to a simple threshold-based binary representation, the connectedness label L in the input I is obtained by sorting the diameters of the connectedness domains with the segmented regions {P0, P1, …, P i} to obtain the connectedness label L F in the input I P ;

[0056] The region P0 with a large spatial scale is taken as the dominant light source, and the spatial connectedness is maximized. The exposure adjustment module is used for processing, and the other regions {P1, …, P i} are taken as non-dominant light sources of background brightness, and exposure adjustment is performed without light source rendering.

[0057] In the processing of the exposure adjustment module, a blur kernel with random noise as a starting point is used to convolve the dominant light source P0 in the four-layer CNN to obtain the adjusted exposure distribution P′0, and the connectedness is improved. The formula of the adjustment process is:

[0058]

[0059] Where G k (e k ) is a rendering generator with four convolutional layers, and an exposure kernel e k with smoothness is used as input to render the latent light source in the brightness channel; L(·) is the obtained brightness channel, and is clipped to the P0 region.

[0060] All the adjusted connectedness partitions {P′0, P′1, P′2, …, P′ i} constitute the final pseudo-connectedness label L p ′, and the disc convolution kernel can be adjusted to the connectedness domain.

[0061] Further, step S6 specifically comprises:

[0062] The input I F is combined with the non-glare image I DF output by step S4 and the final pseudo-connectedness label L p ′ obtained by S5 to obtain the final output I B :

[0063] I B = L p ′×I F +(1-L p ′)×I DF .

[0064] The application also provides a computer device comprising a memory and a processor, wherein the memory stores a computer program configured to be executed by the processor, and the computer program comprises instructions for executing any of the above methods.

[0065] The application further provides a storage medium comprising computer programs / instructions, which, when executed by a processor, implement the glare removal method of any one of the above.

[0066] Compared with the prior art, the glare removal method disclosed by the application has the following beneficial effects:

[0067] The glare removal method disclosed by the application proposes a new method for night glare elimination and light source recovery based on exposure guidance. By establishing a light radiation analysis model to distinguish between main and non-main light sources, an unsupervised label generation is used to automatically locate the glare area, a mask attention mechanism is combined to optimize the decomposition and recovery process, and finally light source separation and fusion are realized through pseudo-label guidance. The method has the advantages of breaking the dependence on light source and glare annotation, improving the reconstruction accuracy of overlapping light sources and weak light sources, enhancing the supervised learning ability, and effectively removing night glare artifacts. Specifically:

[0068] 1) The glare removal method disclosed by the application, by establishing a radiation transmission model based on Fourier optics and Fresnel diffraction theory, first realizes effective differentiation and characterization of the main light source and the non-main light source in the night image at the physical level. By introducing the main light source radiation term E U (x) and the non-main light source-environment light composite term k w (x)·I O (ω), the model can separate different light source components from the formation mechanism, overcoming the defect that traditional methods cannot trace the processing of glare as a whole noise, and providing a key theoretical basis for subsequent differentiated recovery processing.

[0069] 2) The application innovatively integrates the physical characteristics of the camera sensor into the optical model, especially considering the overexposure response and analog-to-digital conversion (ADC) process, which can more realistically simulate complex overexposure phenomena including glare, reflection and highlights. This design significantly improves the characterization ability of the degradation process of photoelectric signals in real shooting scenes, making the model have both physical correctness and system practicality.

[0070] 3)The unsupervised exposure guide label generation method proposed by the present application does not require any light source or artificial annotation of glare, effectively overcoming the overexposure problem caused by the limited dynamic range of traditional image sensors. The method draws on the principle of analog-digital cameras, restores the ideal high dynamic range image without saturation from the conventional 8-bit image by modeling the discharge and signal rotation process of the capacitor, and automatically generates an accurate binary mask of the glare area using a multi-exposure iteration mechanism. By correlating analog images with different exposure levels and overexposed degraded images, the method of the present application can automatically and accurately locate the glare area around the dominant and non-dominant light sources, providing reliable physical guide labels for subsequent deep network training. This process significantly reduces data labeling costs and subjective errors, and improves the generalization ability and recovery accuracy of the model in real complex night scenes.

[0071] 4)The Uformer network guided by exposure labels is introduced in the present application, combined with innovative mask attention mechanism and multi-scale encoding-decoding structure, which effectively realizes high-precision removal of glare and high-quality reconstruction of background in night images. The network uses the unsupervised generated binary exposure label as a guide to dynamically adjust the self-attention calculation process, enabling the model to accurately focus on the glare-related area, significantly improving the decomposition ability of the glare formed by the dominant and non-dominant light sources. In addition, the method uses a joint loss function to optimize the glare removal effect and background preservation performance from multiple dimensions such as pixel-level recovery, structural consistency and perceptual similarity, effectively suppressing glare residues while maximizing the preservation of original image details and naturalness. The entire process does not require manual annotation of the glare area, reducing data dependence and subjective bias, and has strong generalization ability and practicality, providing a reliable and efficient solution for night image enhancement and backlight processing.

[0072] 5)The pseudo-label guided light source recovery method proposed by the present application can effectively distinguish and process the dominant and non-dominant light sources, achieving accurate removal of glare and high-quality preservation of real light sources. The method automatically identifies the dominant light source area based on connected component analysis, and uses an exposure adjustment module to optimize its brightness distribution and spatial continuity, reducing overexposed areas while maintaining detail authenticity; the non-dominant light source is preserved as background brightness to avoid over-processing. Through a learnable rendering generator and an adaptive convolution kernel, the method can flexibly adapt to different lighting conditions, ultimately generating more accurate light source pseudo-labels. The entire process does not require human intervention, significantly enhancing the practicality and generalization ability of the algorithm while improving the visual effect of the image.

[0073] 6)The present application realizes high-quality and natural image restoration effect by fusing the non-glare background and the optimized light source reconstruction result. This method clearly distinguishes the dominant and non-dominant light sources in the final output, which not only significantly eliminates the glare artifacts, but also accurately preserves the subtle light source details in the scene. Through the adaptive fusion mechanism, the spatial structure accurate and brightness distribution reasonable light source can be recovered while suppressing the overexposed area, and finally the visually realistic, distortion-free and detailed image is generated. BRIEF DESCRIPTION OF DRAWINGS

[0074] Figure 1 The technical implementation flowchart of the glare removal method embodiment one of the present application;

[0075] Figure 2 The comparison diagram of the effect of the glare removal method of the present application and the existing glare suppression method and the downstream semantic segmentation task;

[0076] Figure 3 The comparison of the analog-digital camera and the traditional image sensor model in the glare removal method of the present application and the exposure guide label generation process schematic diagram;

[0077] Figure 4 The technical implementation schematic diagram of the Uformer network of the glare removal method step S4 of the present application introducing exposure label guidance, combining exposure guide mask attention mechanism, and jointly optimizing the glare and background decomposition and reconstruction process through exposure guide loss. DETAILED DESCRIPTION

[0078] In order to make the purpose, technical scheme and advantages of the present application more clear, the present application will be further described in detail below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the present application, and should not be used to limit the present application.

[0079] The embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms, and should not be interpreted as being limited to the embodiments described herein. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete. It should be understood that the drawings and examples of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of protection of the present disclosure.

[0080] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the specification of the present application is only for the purpose of describing specific embodiments and is not intended to limit the present application. The term "or / and" used herein includes any and all combinations of one or more related listed items.

[0081] Embodiment one

[0082] One of the glare removal methods of the embodiment, as shown, at least includes the following steps: Figure 1

[0083] Step S1, the camera sensor physical characteristics are integrated into the optical model, and the overexposure response and analog-to-digital conversion (ADC) process are particularly considered to more realistically simulate complex overexposure phenomena including glare, reflection and highlights. A night lighting physical model considering the dominant light source and the non-dominant light source is established by radiation transmission analysis, and the modeling process is as follows:

[0084] First, the basic optical degradation process is constructed based on the Fourier optical model. In the ideal condition without background illumination, the glare degradation image can be represented as:

[0085] I f =C(h*x+η)

[0086] Where x is the real scene irradiance, h represents the point spread function (PSF) of the optical system, * represents the convolution operation, η is the noise term, and C(·) is the camera response function. To further accurately describe the physical formation mechanism of glare, the Fresnel diffraction theory is introduced, and the glare output is further modeled as:

[0087]

[0088] In the formula, E U (x) represents the radiation distribution of the dominant light source, represents the Fourier transform, A total (x,y) is the aperture function, λ is the wavelength of light, d is the propagation distance, β is the normalization coefficient, and p is the energy attenuation index.

[0089] Considering that the above model does not consider the non-dominant light source (such as ambient light, secondary point light source) existing in the actual night environment and the transparency change under different depth of field, it has limitations in the actual scene where multiple depth light sources and complex background illumination coexist. To simultaneously fuse the contributions of the dominant and non-dominant light sources, the present application proposes an extended night lighting model:

[0090] I F (x,λ,ω)∝E(ω,x)=E U (x)+k w (x)·E O (ω)

[0091] I F (x,λ,ω)=I f (x,λ)+k w (x)·I O (ω)​

[0092] Among them, E U (x) still represents the radiation of the dominant light source, and its effective area is limited to the dominant light source and its main flare area, i.e., {x | x ∈ dominant light source ∪ main flare}; k w (x) is a transparency graph with values ​​ranging from (0,1], simulating the effect of airborne particles, fog, and other media on light transmission. It can be set to 1 on clear nights. O (ω) represents the radiation emission pattern composed of the non-dominant light source and ambient light, where ω is the incident angle. Since the depth and energy of the non-dominant light source are usually unknown, it cannot be analyzed like E... U The same explicit parsing expression, therefore I O (ω) is simplified to the retained brightness excluding the dominant light source and the main glare area:

[0093]

[0094] Step S2 involves acquiring glare-damped image data from night scenes and performing systematic preprocessing and normalization. Normalization eliminates brightness differences between images, significantly improving the algorithm's adaptability and robustness under different lighting conditions. Constraining pixel values ​​to a fixed range not only improves training stability and avoids gradient anomalies but also accelerates model convergence. Simultaneously, normalized data provides a unified benchmark for subsequent modules such as glare segmentation and light source restoration, eliminating the need to adjust parameters for different images and reducing computational complexity. This method is compatible with multiple image formats and possesses good practicality and scalability. The implementation process and technical advantages of this method are detailed below:

[0095] First, scene images are captured using HDR imaging equipment or multiple exposure fusion technology to fully preserve detail information in both highlight and shadow areas, resulting in raw glare-damped image data I. F Subsequently, the image undergoes normalization preprocessing, employing a minimum-maximum normalization method to linearly map pixel values ​​to the [0,1] interval. Its mathematical expression is as follows:

[0096]

[0097] Among them, I min and I max These represent the minimum and maximum pixel values ​​in the current image, respectively. This operation effectively eliminates overall brightness deviations caused by differences in shooting equipment, exposure time, or ambient lighting, providing numerically consistent and well-distributed input data for subsequent algorithms.

[0098] Step S3, as follows Figure 3As shown, the unsupervised exposure guide label is generated. This step is based on the analog-digital imaging constraint, can automatically locate the glare area around the dominant and non-dominant light source, and completely does not need any artificial annotated light source or glare label, and the implementation process and technical advantages of the process are described in detail as follows:

[0099] Firstly, the process is established on the basis of a real image sensor imaging model. Due to the limited dynamic range, a conventional image sensor is prone to overexposure under high light conditions, and the imaging process can be described as signal photoelectric conversion, noise addition, limiting processing, and finally quantization to a digital signal through an analog-digital converter. Although this process can better reflect the scene under conventional lighting conditions, it is easy to cause information loss in high light areas and aggravate the glare phenomenon under night complex lighting, especially in the presence of multiple light sources of different intensities. The implementation process of the real image sensor imaging model is as follows:

[0100]

[0101] φ(x)=τ×QE×(θ(x)+μ dark )

[0102] Wherein, the scene light flux is θ(x) (corresponding to the irradiance x), QE represents the conversion efficiency from photons to electrons, τ is the exposure time, μ dark is the dark current, is the Poisson noise distribution, Clip represents the full well limit operation, and α is the conversion gain, and ADC is the analog-digital converter. The conventional model quantizes the signal to N bits (usually N = 8), thereby causing overexposure.

[0103] In order to overcome the limitations of the conventional sensor, the working mechanism of the modulo camera is introduced. The modulo camera can effectively expand the dynamic range by recording the "rotation" number of the saturated pixels, avoid information truncation, and thereby capture more rich high light details. Based on the modulo image restoration theory, an ideal image without overexposure can be restored from the obtained modulo image, and the image is closer to the irradiance distribution of the real scene. According to the modulo image restoration theory, an ideal image I m without overexposure can be restored from the 8-bit modulo image I ideal , which is consistent with the scene irradiance x:

[0104]

[0105]

[0106] Wherein, M (k) is a binary rotation mask recording the rotation (zeroing) number of each pixel, is the initial modulo image.

[0107] Specifically, this method constructs a series of intermediate images with different brightness levels by simulating the image acquisition process under different exposure ratios. Combining the pixel rotation information in analog-to-digital camera imaging, the illumination intensity and potential overexposure in each region of the image can be gradually inferred. By analyzing the differences and brightness distribution characteristics between these images, the algorithm can automatically identify potential overexposed areas, which often correspond to glare and light flare around the light source. For light sources without glare, the overexposure can be approximated by the second-to-last version of the analog-to-digital image. Perform recovery:

[0108] I ideal =I m,light +2 N ·M (m+1)

[0109]

[0110] To locate glare, this embodiment overexposes the scene by continuously controlling the exposure ratio, capturing the damaged image I. F This image is larger than image I containing only a light source. light It contains more degradation information, so it can be compared with the p-th (p∈(0,m)) modulus image. Connecting them:

[0111]

[0112] in, Normalized image I F With exposure ratio e f The intermediate result obtained by multiplying ∈[0,1]. Exposure ratio e f Based on the reference, a calculation method based on parameter v is introduced: Image with progressive overexposure modulus

[0113] Furthermore, by designing a reasonable iterative optimization strategy, the binary mask is continuously updated to identify suspicious glare areas. An exposure-guided binary mask is generated through iterative update relationships:

[0114] K i+1 =K i -M i M i+1 =I F (M i+1 >0)

[0115] The initial mask M0 is the required exposure guide label, which roughly locates the glare region including the glare around the dominant light source and the non-dominant light source through the continuous brightness distribution. This mask serves as an exposure guide label, providing the region positioning information required for training the subsequent deep learning network, thereby realizing automatic annotation of the glare region under completely unsupervised conditions.

[0116] The whole process fully combines the physical characteristics of optical imaging and the algorithm advantages of digital image processing, not only avoiding the dependence on a large amount of manually annotated data, but also improving the adaptability to different scenes and lighting conditions. In addition, due to the introduction of the high dynamic range imaging idea of analog-digital cameras, the present application can still maintain good annotation performance under extreme lighting conditions, providing a reliable and scalable solution for night image processing tasks.

[0117] Step S4, as shown in Figure 4 , the Uformer network guided by the exposure label is introduced, combined with the exposure guide mask attention mechanism, and the implementation process of the glare and background decomposition and reconstruction is jointly optimized by the exposure guide loss as follows:

[0118] Firstly, the network adopts a double-path input strategy to simultaneously receive the glare-damaged image and the unsupervised generated binary exposure guide label M. This design enables the network to simultaneously utilize the texture information of the original image and the spatial prior provided by the exposure label, providing strong guidance for subsequent glare separation. It is worth emphasizing that the generation of the exposure label M is completely independent of the network architecture, which makes it have excellent cross-architecture compatibility, not only suitable for the Uformer backbone adopted in this paper, but also can be seamlessly integrated into other mainstream network structures such as CNN, Vision Transformer, etc.

[0119] Subsequently, the input data I F is subjected to preliminary feature extraction through an input projection module containing convolution and activation layers; in the feature extraction stage, the input image is first subjected to a lightweight input projection module composed of multiple convolution layers and activation functions, which is responsible for extracting low-level visual features and preliminarily suppressing noise interference. Subsequently, the features are sent to the Uformer encoder-decoder structure based on the window attention mechanism.

[0120] The network adopts Uformer as the main architecture, and introduces the exposure guide label M in the core LeWinTransformer block to adjust the attention mechanism, the specific process is as follows: the features are divided into a plurality of non-overlapping local windows with a size of W s × W s , and the query matrix Q, the key matrix K and the value matrix V are obtained through linear transformation in each window; based on the standard window multi-head self-attention calculation formula:

[0121]

[0122] To focus attention on the glare-related regions, the present application introduces an exposure guidance mask M to spatially modulate the attention distribution. Specifically, the attention scores of the non-key regions marked in M are set to negative infinity, so that the attention weights of these regions tend to zero after the SoftMax operation. The modulated attention mechanism is denoted as:

[0123]

[0124] The network focuses attention on the glare-related regions guided by the mask M. Then multi-scale feature encoding and decoding are performed: in the encoding process, the down-sampling operation of F k,enc =↓2 k (LeWin(F k-1,enc ,M k )) is performed, and the bottleneck layer is processed as F bottleneck =LeWin(F 4,enc ,M 4 ), and in the decoding process, the up-sampling operation of F k,doc =LeWin(↑2 k (F k-1,enc )+F 4-k,dec ,M 4-k ) is performed, where↓2 k and↑2 k represent the down-sampling and up-sampling operations respectively, and F k,enc / dec is the k-th layer feature output.

[0125] The network is supervised trained based on the ground truth I GT , and outputs the de-glared result I DF and the glare component I flare , which are fused into I merged after gamma correction by simple addition; finally, the minimization of the total loss L is achieved by jointly optimizing the exposure guidance mask loss L and the main loss L , where the mask loss L Based on the evaluation of glare formation and decomposition, the main loss is as follows:

[0126]

[0127] The de-glaring effect is evaluated from the perspectives of structure and perceptual similarity.

[0128] The exposure label guided Uformer network of the present example realizes efficient processing of night glare images by combining physical priori with deep learning. Experimental results show that the method can effectively remove glare artifacts while well maintaining image detail information and visual authenticity, providing a reliable technical solution for night image enhancement.

[0129] Step S5, a pseudo-label guided light source recovery method is proposed to decouple the dominant overlapping light source under the constraints of exposure and connectivity, and to retain the non-dominant light source. The implementation process is as follows:

[0130] First, based on the simple threshold binarization method, the connected domain label L F is extracted from the input image I P , where each region represents a possible light source or glare component. These regions are sorted by the diameter size of their connected domains. The region P0 with larger diameter usually corresponds to the dominant light source, while the region with smaller diameter may be a non-dominant light source or noise. The segmented regions are sorted by the diameter size of the connected domain as {P0, P1,…, P i}. After sorting, the region P0 with the largest spatial proportion is identified as the dominant light source region. This region usually contains the strongest illumination and is prone to severe overexposure, so special processing is needed:

[0131] First, the spatial connectivity constraint is used to maximize it, enhancing its regional consistency and suppressing discontinuous noise; then it is sent to the exposure adjustment module for further optimization. The remaining regions {P1,…, P t} are considered as non-dominant light sources. These regions usually contribute to the background brightness and do not need complex light source rendering, so only exposure adjustment is performed to maintain their natural appearance.

[0132] In the processing of the dominant light source region P0, the folding number K max is introduced, which is a key parameter related to the parameter p in the modulus image I F of the input image I Fm and is always less than p. In the case of high exposure, the pixels near the dominant light source are more likely to reach the brightness upper limit of the traditional sensor, so a smaller K max value should be taken to avoid over-rendering. The exposure analysis module dynamically determines whether exposure adjustment is needed, ensuring that the processing process is adaptive to different lighting conditions.

[0133] In the exposure adjustment module, a four-layer convolution structure is used to process P0 to generate the adjusted exposure distribution P′0. The optimization objective of this module is:

[0134]

[0135] where Gk (e k This is a render generator with four convolutional layers, whose input is an exposure kernel e with smoothness. k ω is used to render latent light sources in the luminance channel; k To be consistent with the input image I F Overall brightness-related exposure weights are used to normalize the results to the range [0,1]; L(·) is the brightness channel extracted and cropped to the P0 region; this process ensures that the dominant light source mask P′0 has a smaller and more accurate region mask than the original input P0. All adjusted connected components are divided into {P′0, P′1, P′2, ..., P′}. t The combination forms the final pseudo-connected component label L. P The label further optimizes the transition and consistency between different connected components through adjustable disk-shaped convolution kernels, ultimately guiding light source rendering and image fusion. This method not only significantly improves the restoration quality of dominant light sources but also effectively preserves the details of non-dominant light sources, providing a reliable foundation for subsequent image reconstruction.

[0136] Step S6: The glare-free background reconstruction result generated in step S4 is fused with the light source reconstruction result generated in step S5 to obtain glare-free output image data containing an ideal light source. The implementation process is as follows:

[0137] A pseudo-label-guided fusion strategy is adopted to integrate the pseudo-connected component labels L generated in the previous step. P ′ with the original input image I F and the anti-glare results of the Uformer network output guided by the exposure label I DF Adaptive fusion is performed to ultimately generate a high-quality output image I. B The fusion process is based on the following mathematical expression:

[0138] This formula embodies the region-adaptive fusion mechanism: in the pseudo-label L P The light source area marked with a '' (including the dominant light source and non-dominant light sources that need to be retained) should preferentially use the original input I. F The pixel information is used to preserve the brightness distribution and detail features of the real light source to the greatest extent possible; while in non-light source areas and areas where glare is significant, the glare removal result I is used. DF Fill in the background to ensure the naturalness and consistency of the content.

[0139] This fusion method has several advantages. First, it can effectively distinguish and process dominant and non-dominant light sources separately: it accurately reconstructs dominant light sources with a large spatial proportion and high brightness, while preserving non-dominant light sources as part of the background brightness, avoiding the loss of detail caused by over-processing. Second, through the final output I... BThe method restores the fine light source and significantly suppresses the spatial glare, improves the visual quality of the image, and maintains the lighting authenticity and physical rationality of the scene. B Not only is the consistency with the real scene maintained in structure, but also a more natural and clearer night image effect is presented in perception.

[0140] It should be noted that the Uformer network introduced with exposure label guidance needs to be pre-trained to determine the optimal weight parameter. In this embodiment, the optimal weight parameter is loaded into the network, and PSNR, SSIM and LPIPS are used as evaluation indexes. Moreover, the method of the present application does not rely on glare and light source labels during model training. Other methods add glare labels, and the light source recovery results use an unsupervised light source recovery mode. The results are as follows Figure 2 As shown in Table 1 and Table 2, the input is an RGB image, and the glare removal method of this embodiment achieves the best performance in the three indexes of PSNR, SSIM and LPIPS.

[0141] Table 1. Quantitative comparison of the glare removal method of this embodiment with other methods on the Flare7K real dataset

[0142]

[0143]

[0144] Table 2. Quantitative comparison of the glare removal method of this embodiment with other methods on the Flare7K synthetic dataset

[0145]

[0146] Embodiment Two

[0147] The embodiment also provides a computer device including a memory and a processor, the memory storing a computer program, the computer program being configured to be executed by the processor, and the computer program including instructions for executing any of the above methods.

[0148] The embodiment also provides a storage medium including a computer program / instructions, which, when executed by a processor, implements a glare removal method as described in any of the above.

[0149] In summary, the above only describes the preferred embodiments of the present application and does not limit the present application. Any modification, equivalent replacement and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method of flare removal, characterized by, The method comprises the following steps: S1, establishing a night light emission model containing a dominant light source and a non-dominant light source through radiation transmission analysis; S2, obtaining HDR night scene glare damaged image data, and pre-processing and normalizing the data to obtain standardized data; S3, for the input data, an unsupervised exposure guide label generation method is used to locate the glare area around the dominant light source and the non-dominant light source based on analog imaging constraints; S4, introducing an exposure label guided Uformer network, combining an exposure guide mask attention mechanism, and jointly optimizing the glare and background decomposition and reconstruction process through an exposure guide loss; S5, based on a pseudo-label guided light source restoration method, decoupling the dominant overlapping light source under the constraints of exposure and connectivity, and retaining the non-dominant light source; S6, fusing the non-glare background reconstruction result generated in step S4 with the light source reconstruction result generated in step S5 to obtain an output image data without glare and containing ideal light sources.

2. The flare removal method according to claim 1, characterized by, Step S1 specifically comprises: A basic glare degradation model is established based on a Fourier optical model, and the glare output without background illumination is expressed as: I f = C(h * x + η) Where x is the real scene irradiance, h is the optical system point spread function, * represents convolution operation, η is noise, and C(·) is the camera response function; A Fresnel diffraction model is introduced to further refine the glare formation process, and the glare output is expressed as: where E U (x) is the radiation distribution of the dominant light source, by a point spread function PSF λ a Fourier transform degradation, β is a normalization constant; The model is extended to include non-dominant light sources in the environment light, and a night light emission model containing both dominant light sources and non-dominant light sources is established: I F (x, λ, ω) ∝ E(ω, x) = E U (x) + k w (x) · E O (ω) I F (x, λ, ω) = I f (x, λ) + k w (x) · I O (ω) where E U (x) is the dominant light source of the matte surface modeled by the above equation, I f (x, λ) is only valid for the dominant light source and its main glare area; k w is the transparency map, with a value range of (0, 1], set to 1 on a clear night; E O (ω) is the radiance emission map of the ambient light, ω is the incident angle of the non-dominant light source; Simplify the characterization of non-dominant light sources, reducing I O (ω) to a remaining luminance outside the optical modeling of the light source and glare: I O (ω) = I F ·1 Ω wherein 3. The flare removal method according to claim 1, characterized by, In step S2, the minimum-maximum normalization method is used to linearly map the pixel value to the [0, 1] interval, and the mathematical expression is:

4. The flare removal method of claim 1, wherein Step S3 specifically comprises: A real image sensor overexposure model is established, and the overexposure formation process is expressed based on the image sensor model of a traditional camera: where φ(x) = τ x QE x (θ(x) + μ dark , including scene flux, quantum efficiency, and dark current parameters; Recovering an unoverexposed image using the principle of a digital camera from an N-bit digital image I m Recovering an ideal image: wherein M (k) record the number of pixel flips; Establishing a glare-damaged image and a modulus image glare-damaged image I F relationship with the modulus image is: where K is the number of folds, is the post-exposure intermediate value; Finally, the exposure guide label is generated by iterative update, and the iterative relationship is: K i+1 = K i - M i , M i+1 = I F (M i+1 > 0) Where M0 is selected as the glare area positioning label.

5. The flare removal method of claim 4, wherein Step S4 specifically comprises: binarizing the glare region positioning label M0 obtained in step S3 and the glare damaged image I F The image restoration network Uformer is introduced, and the W-MSA initial attention mechanism of the Uformer is: M∈{0,1} H×W The attention score is adjusted to improve the attention mechanism. For an invalid region with a value of 0, the corresponding attention score is set to a negative value less than a preset threshold. The adjusted W-MSA attention mechanism is: An adjusted attention mechanism is used for each LeWinTransformer block of the Uformer model, and each layer is composed of two LeWinTransformer blocks; the model is composed of a total of 4 layers of encoders, 4 layers of decoders, and a bottleneck module; is input into an input projection layer module composed of a convolution layer and an activation layer: F k,enc = 2 k (LeWin(F k-1,enc , M k )) F bottleneck = LeWin(F 4,enc , M 4 ) F k,dec = LeWin(↑2 k (F k-1,enc )+F 4-k,dec ,M 4-k ) where, ↓2 k and ↑2 k are down-sampling and up-sampling operations, F k,enc / dec is the feature output of the k-th layer; By supervised training based on non-glare images I GT the network outputs predicted non-glare images I DF and predicted glare-only images I flare , which are combined after gamma correction by simple addition to I merged .

6. The flare removal method of claim 1, wherein Step S5 specifically comprises: According to a simple threshold-based binary representation, the connectedness labels L in the input I are obtained by ordering the diameters of the connected components and assigning to each pixel P the label of the connected component in which it is contained, i.e. L = {P0, P1,..., P i} F} P ; The region P0 with a large spatial ratio is taken as a dominant light source, spatial connectivity is maximized, and an exposure adjustment module is used for processing, while other regions {P1,..., P i} are taken as non-dominant light sources of background brightness, and exposure adjustment is performed without light source rendering. In the exposure adjustment module processing process, a blur kernel starting from random noise is used to convolve the dominant light source P0 in the four-layer CNN to obtain the adjusted exposure distribution P′0, and the connectivity is improved; The formula of the adjustment process is: where G k (e k ) is a rendering generator with four convolutional layers using exposure kernels e k with smoothness as input to render latent light sources in the luminance channel; L(·) is the resulting luminance channel, clipped to the P0 region; All adjusted connectivity partitions {P'0, P'1, P'2,..., P'N} constitute the final pseudo-connectivity label L i} constitute the final pseudo-connectivity label L p ' whose disc convolution kernel can be adjusted to a connectivity domain.

7. The flare removal method of claim 1, wherein Step S6 specifically comprises: Input I F Combining the non-glare image I output in step S4 DF Final pseudo-connectivity label L obtained in S5 p Mixing, obtaining final output I B : I B = L p ' x I F + (1 - L p ') x I DF .

8. A computer device, comprising: A memory and a processor, the memory stores a computer program, the computer program is configured to be executed by the processor, the computer program comprises instructions for executing the method of any one of claims 1-7.

9. A storage medium comprising computer programs / instructions, characterized in that, The computer program / instructions are executed by the processor to realize the method of any one of claims 1-7, and finally realize the removal of glare.