A low-illumination environment night vision image histogram optimization method, system, product and medium
Patent Information
- Application Number
- CN202611140967.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-30
- Publication Date
- 2026-10-20
AI Technical Summary
[0004]然而,当面对夜间对向车辆远光灯这类处于极暗背景下的强动态移动光源时,由于光源高能像素在画面中快速移动并频繁跨越固定的网格边界,会导致相邻网格内统计的局部光照特征在短时间内发生瞬态突变,进而使得各自网格的处理参数发生抖动
1、本申请通过用遮罩边界内外侧的信息熵差值来量化评估图像灰度断层情况,并在判定存在边界撕裂时,向外扩张遮罩范围并同步降低局部直方图拉伸权重进行迭代映射。使得亮度压制范围能够根据光晕分布动态延展,且压制强度由中心向外沿逐步衰减;避免了固定区域压制所产生的灰阶截断与人工伪轮廓,保障了高光压制区域与暗部背景之间的平滑过渡,提高了低照度环境夜视图像的连贯性。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This application relates to the fields of computer vision and digital image processing, and in particular to a method, system, product, and medium for optimizing the histogram of night view images in low-light environments. Background Technology
[0002] Currently, with the rapid development of intelligent transportation and driver assistance systems, intelligent vehicle vision systems are playing an increasingly important role in ensuring driving safety. Especially in complex lighting environments such as nighttime driving, the visual quality of the video footage captured by the vehicle's onboard camera, as the core sensor for perceiving the external environment, determines the reliability of advanced perception tasks such as target detection and obstacle avoidance.
[0003] In related technologies, grid-based local histogram equalization or local tone mapping methods are commonly used to process high-contrast images at night. First, the entire input image is divided into multiple fixed-size rectangular sub-grids. Then, for each individual grid, its local grayscale histogram and mapping curve are calculated, and glare is suppressed by limiting the local gain in bright areas. After completing the mapping processing of each individual grid, the algorithm finally uses smoothing filtering techniques such as bilinear interpolation to perform transition calculations on pixels at the boundaries of adjacent grids, thereby synthesizing a single-frame output image with balanced brightness and detail.
[0004] However, when facing high-dynamic moving light sources such as oncoming vehicle headlights at night against an extremely dark background, the rapid movement of high-energy pixels within the light source and its frequent crossing of fixed grid boundaries causes transient changes in the statistical local illumination characteristics within adjacent grids, resulting in jitter in the processing parameters of each grid. In this situation, the boundary interpolation step struggles to compensate for the high-frequency parameter drops, ultimately leading to halo boundary tearing and flickering phenomena in the video image, failing to meet the visual stability requirements in dynamic, high-light-source scenes. Summary of the Invention
[0005] This application provides a method, system, product, and medium for optimizing the histogram of night view images in low-light environments to improve the coherence of night view images in low-light environments.
[0006] The first aspect of this application provides a method for optimizing the histogram of night view images in low-light environments, the method comprising: The process involves acquiring the current frame image, extracting pixels with brightness values greater than a preset brightness threshold, extracting consecutive adjacent pixels as bright connected regions, and determining the light source center point of each bright connected region as the origin of the bright pixels. Using the origin of the bright pixels as the center, the energy value of each peripheral pixel is determined based on the distance distribution characteristics of the peripheral pixels in the current frame image. Continuous pixel regions with energy values greater than a preset energy threshold are extracted, and the edge contours of these continuous pixel regions are used as boundaries to generate an initial irregular mask enclosing the origin of the bright pixels. Based on the energy values of each pixel within the initial irregular mask, the corresponding local histogram stretching weights are calculated, and these weights are used to perform histogram suppression mapping on the pixels within the initial irregular mask to obtain the image to be verified. In the image to be verified, along the boundary of the initial irregular mask, a preset pixel distance is extended towards the inside and outside of the initial irregular mask to extract the internal sampling... The system calculates the internal information entropy of the internal sampled pixel set and the external information entropy of the external sampled pixel set, and calculates the absolute value of the difference between the internal and external information entropies as the information entropy difference. It then determines whether the information entropy difference is greater than a preset boundary tearing threshold. If the information entropy difference is greater than the boundary tearing threshold, the boundary of the initial irregular mask is expanded outwards to update the initial irregular mask, while simultaneously reducing the local histogram stretching weights corresponding to the expanded region. The system then returns to execute the step of using the local histogram stretching weights to perform histogram suppression mapping on the pixels within the initial irregular mask, until the recalculated information entropy difference is less than or equal to the boundary tearing threshold, or the preset maximum expansion iteration count is reached. If the information entropy difference is less than or equal to the boundary tearing threshold or the preset maximum expansion iteration count is reached, the boundary transition is determined to be smooth, and the current image to be verified is used as the target image for rendering output.
[0007] In the above embodiments, the grayscale tortuosity of the image is quantitatively evaluated by using the information entropy difference between the inner and outer sides of the mask boundary. When boundary tearing is detected, the mask range is expanded outward and the local histogram stretching weight is reduced simultaneously for iterative mapping. This allows the brightness suppression range to dynamically extend according to the halo distribution, and the suppression intensity gradually decreases from the center to the outer edge. This avoids grayscale truncation and artificial pseudo-contours caused by fixed-area suppression, ensures a smooth transition between the highlight suppression area and the dark background, and improves the coherence of night view images in low-light environments.
[0008] In conjunction with some embodiments of the first aspect, in some embodiments, if the information entropy difference is greater than the boundary tearing threshold, the boundary of the initial irregular mask is expanded outward to update the initial irregular mask, and the local histogram stretching weight corresponding to the expanded region is reduced simultaneously, specifically including: If the information entropy difference is greater than the boundary tearing threshold, extract the image features on the boundary of the initial irregular mask and calculate the local mutation feature values at each position on the boundary. The boundary positions where the local mutation feature values are greater than the preset physical blocking threshold are classified as physical occlusion hard boundaries, and the remaining boundary positions are classified as optical halo soft boundaries. The path of the physical occlusion hard boundaries expanding outward is blocked. The optical halo soft boundaries are driven to expand outward, and the initial irregular mask with asymmetric updates is reconstructed. According to the expansion distance of the optical halo soft boundaries, the local histogram stretching weights corresponding to the expansion area are reduced synchronously.
[0009] In the above embodiments, by utilizing local mutation feature values to divide the mask boundary into a physical occlusion hard boundary and an optical halo soft boundary, and implementing expansion blocking for the physical occlusion hard boundary, the spatial evolution of brightness suppression only occurs in the direction of the soft boundary where light freely diverges, limiting the blind smoothing compensation caused by the algorithm crossing physical obstacles; since reasonable grayscale truncation caused by real object occlusion is retained while suppressing diffuse halo, the destruction of the geometric contours of environmental entities is avoided, improving the realism and logical rationality of the image spatial structure in complex occlusion scenes.
[0010] In conjunction with some embodiments of the first aspect, in some embodiments, the center point of the light source in the bright connected region is determined as the origin of the bright pixel, specifically including: Extract the initial light source center point of the bright connected region; calculate the spatial position difference between the initial light source center point and the corresponding historical bright pixel origin in the previous frame image, as the centroid offset; determine whether the centroid offset is greater than the preset occlusion detachment threshold; if the centroid offset is greater than the occlusion detachment threshold, extract the spatial distribution center of the optical halo soft boundary in the previous frame image in an expanded state, and calculate the direction vector from the historical bright pixel origin to the spatial distribution center, as the reference motion trend vector; based on the reference motion trend vector, perform coordinate position smoothing correction on the initial light source center point, and determine the coordinates after the coordinate position smoothing correction as the final bright pixel origin; if the centroid offset is less than or equal to the occlusion detachment threshold, directly determine the initial light source center point as the final bright pixel origin.
[0011] In the above embodiments, when an abnormal jump in the centroid of the light source is detected, the reference motion trend vector is calculated using the soft boundary of the optical halo in the previous frame, and the coordinates of the origin of the bright pixels in the current frame are smoothed and corrected. A historical trajectory that conforms to the laws of physical motion is introduced as a priori reference, and cross-frame constraint compensation is performed for the sudden change in positioning coordinates caused by the light source suddenly leaving the physical occlusion. This isolates the interference of the transient change in occlusion state on the reference point positioning logic, avoids disordered jumps in the histogram suppression area, eliminates the transient jitter phenomenon of local highlight suppression in the image, and improves the temporal stability of the image sequence in dynamic scenes.
[0012] In conjunction with some embodiments of the first aspect, in some embodiments, taking the origin of the bright pixel as the center, the energy value of each peripheral pixel is determined based on the distance distribution characteristics of peripheral pixels from the origin of the bright pixel in the current frame image, specifically including: Extract the two-dimensional spatial coordinate set of all pixels within the highlighted connected region; calculate the second-order spatial distribution feature parameter of the two-dimensional spatial coordinate set, and obtain the principal extension direction vector and secondary extension direction vector of the highlighted connected region based on the second-order spatial distribution feature parameter; calculate the trailing distortion coefficient characterizing the relative motion of the highlighted connected region based on the scale difference characteristics between the principal extension direction vector and the secondary extension direction vector; construct an anisotropic distance metric function based on the principal extension direction vector, the secondary extension direction vector, and the trailing distortion coefficient; substitute the coordinates of each peripheral pixel into the anisotropic distance metric function to calculate the anisotropic distance of each peripheral pixel relative to the origin of the highlighted pixel; use the anisotropic distance as the distance distribution feature to calculate and determine the energy value of each peripheral pixel.
[0013] In the above embodiments, an anisotropic distance metric function is constructed by combining the extension direction of the bright area and the shadow deformation coefficient to calculate the energy value of the peripheral pixels. This enables the distance evaluation model to adapt to the geometric blurring characteristics caused by the relative motion of the luminous target, maintaining a low attenuation rate in the main direction of the shadow and a high attenuation rate in the lateral direction. Since the generated suppression energy field distribution matches the asymmetric diffusion profile of the physical light spot, the problems of insufficient glare suppression in the trailing direction and excessive suppression of the side background area caused by the use of an isotropic model are avoided, thus improving the shape adaptation capability and dark detail retention of histogram optimization in dynamic scenes.
[0014] In conjunction with some embodiments of the first aspect, in some embodiments, an anisotropic distance metric function is constructed based on the principal extension direction vector, the secondary extension direction vector, and the trailing deformation coefficient, specifically including: Extract the geometric distribution center of the bright connected region and calculate the energy concentration centroid of the bright connected region by combining the pixel brightness value; calculate the centroid eccentric vector pointing from the geometric distribution center to the energy concentration centroid; based on the directional component of the centroid eccentric vector on the main extension direction vector, decompose the main extension direction vector into a leading motion half-axis and a lag trailing half-axis; construct an asymmetric anisotropic distance metric function based on the leading motion half-axis, the lag trailing half-axis, the secondary extension direction vector, and the trailing deformation coefficient; configure the asymmetric anisotropic distance metric function so that the distance attenuation rate on the lag trailing half-axis is lower than the distance attenuation rate on the leading motion half-axis, and the distance attenuation rate on the leading motion half-axis is lower than the distance attenuation rate on the secondary extension direction vector.
[0015] In the above embodiments, an asymmetric anisotropic distance metric function is constructed using an eccentric vector formed by the geometric center and the energy centroid, and differentiated attenuation rates are configured for the front and rear half-axis. This allows the distance model to adapt to the unidirectional motion trend of the luminescent body, maintaining a lower attenuation rate in the lag direction of the long trail to extend the suppression range, and maintaining a higher attenuation rate in front of the movement to converge the suppression boundary. Since the generated energy distribution matches the asymmetric optical blurring morphology of the luminescent body, the problems of background missuppression caused by the symmetric model in front of the movement and insufficient suppression of the trailing halo at the rear are avoided, thus improving the spatial adaptability of the histogram optimization model in motion blur scenes.
[0016] In conjunction with some embodiments of the first aspect, in some embodiments, based on the energy values of each pixel within the initial irregular mask, the corresponding local histogram stretching weights are calculated, and the local histogram stretching weights are used to perform histogram suppression mapping on the pixels within the initial irregular mask to obtain the image to be verified, specifically including: Based on the energy values of each pixel within the initial irregular mask, the baseline histogram stretching weight of each pixel in the current frame is calculated; the historical actual histogram stretching weight of the corresponding position in the previous time sequence is obtained; the temporal difference change of the baseline histogram stretching weight relative to the historical actual histogram stretching weight is calculated; the trend and magnitude of the change represented by the temporal difference change are determined. If the trend is that the histogram suppression intensity is decreasing and the magnitude of the change is greater than the preset release jump threshold, the corresponding pixel is classified as the light source departure transient region; for pixels in the light source departure transient region, the baseline histogram stretching weight is asymmetrically damped smoothing calculation is performed on the baseline histogram stretching weight based on the historical actual histogram stretching weight to generate the actual local histogram stretching weight; for pixels not in the light source departure transient region, the baseline histogram stretching weight is directly used as the actual local histogram stretching weight, and histogram suppression mapping is performed using the actual local histogram stretching weights of all pixels to obtain the image to be verified.
[0017] In the above embodiments, when a significant attenuation trend in the histogram suppression intensity is detected, asymmetric damping smoothing is applied to the local histogram stretching weights in conjunction with historical temporal weights. This allows the brightness suppression parameters to exhibit a slow release hysteresis characteristic when a strong light source rapidly moves away or suddenly turns off. By mitigating the severe rebound of the local mapping curve caused by the removal of highlights, instantaneous brightness jumps and visual flickering phenomena in local image areas are avoided, thus improving the temporal stability and visual transition smoothness of video sequences in dynamic lighting scenarios.
[0018] In conjunction with some embodiments of the first aspect, in some embodiments, the internal information entropy of the internal sampled pixel set and the external information entropy of the external sampled pixel set are calculated respectively, and the absolute value of the difference between the internal information entropy and the external information entropy is calculated as the information entropy difference, specifically including: The internal and external sampled pixel sets are extracted and arranged along the boundary contour trajectory of the initial irregular mask to construct an internal one-dimensional spatial sequence and an external one-dimensional spatial sequence. A preset smoothing filtering algorithm is used to perform spatial domain denoising on the internal and external one-dimensional spatial sequences to obtain a denoised internal sequence and a denoised external sequence. The internal information entropy of the denoised internal sequence and the external information entropy of the denoised external sequence are calculated respectively. The absolute value of the difference between the internal information entropy and the external information entropy is calculated as the information entropy difference.
[0019] In the above embodiments, by constructing the boundary sampling pixels into a one-dimensional spatial sequence and performing smoothing filtering to remove noise before calculating the information entropy, random noise and high-frequency interference components in the image are filtered out. Since the additional increment generated by isolated noise fluctuations in the information entropy calculation is eliminated, the obtained information entropy difference can truly reflect the difference in macroscopic grayscale distribution inside and outside the mask boundary. This avoids the misjudgment of boundary tearing caused by local noise and improves the robustness and reliability of the boundary fault assessment mechanism in complex and noisy environments.
[0020] Secondly, embodiments of this application provide a low-light environment night view image histogram optimization system, the low-light environment night view image histogram optimization system comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code including computer instructions, the one or more processors calling the computer instructions to cause the low-light environment night view image histogram optimization system to perform the method as described in the first aspect and any possible implementation thereof.
[0021] Thirdly, embodiments of this application provide a computer program product containing instructions that, when the computer program product is run on a low-light environment night view image histogram optimization system, cause the low-light environment night view image histogram optimization system to perform the method described in the first aspect and any possible implementation thereof.
[0022] Fourthly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a low-light environment night view image histogram optimization system, cause the low-light environment night view image histogram optimization system to perform the method described in the first aspect and any possible implementation thereof.
[0023] Understandably, the low-light environment night view image histogram optimization system provided in the second aspect, the computer program product provided in the third aspect, and the computer storage medium provided in the fourth aspect are all used to execute the low-light environment night view image histogram optimization method provided in the embodiments of this application. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods, and will not be repeated here.
[0024] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: 1. This application quantifies and evaluates image grayscale tortuosity by using the information entropy difference between the inner and outer sides of the mask boundary. When boundary tearing is detected, the mask range is expanded outward while simultaneously reducing the local histogram stretching weight for iterative mapping. This allows the brightness suppression range to dynamically extend according to the halo distribution, and the suppression intensity gradually decreases from the center to the outer edge. It avoids grayscale truncation and artificial false contours caused by fixed-area suppression, ensures a smooth transition between the highlight suppression area and the dark background, and improves the coherence of night view images in low-light environments.
[0025] 2. This application divides the mask boundary into a physical occlusion hard boundary and an optical halo soft boundary by utilizing local mutation feature values, and implements expansion blocking for the physical occlusion hard boundary, so that the spatial evolution of brightness suppression only takes place in the direction of the free divergence of light in the soft boundary, which limits the blind smoothing compensation caused by the algorithm crossing physical obstacles; since reasonable gray level truncation caused by real object occlusion is retained while suppressing diffuse halo, the destruction of the geometric contour of environmental entities is avoided, and the realism and logical rationality of the image spatial structure in complex occlusion scenes are improved.
[0026] 3. This application calculates the reference motion trend vector using the soft boundary of the optical halo in the previous frame when an abnormal jump in the centroid of the light source is detected, and performs coordinate smoothing correction on the origin of the bright pixels in the current frame. It introduces a historical trajectory that conforms to the laws of physical motion as a priori reference, and performs cross-frame constraint compensation for the sudden change in positioning coordinates caused by the light source suddenly detaching from the physical occlusion. It isolates the interference of the transient change in occlusion state on the reference point positioning logic, avoids disordered jumps in the histogram suppression area, eliminates the transient jitter phenomenon of local highlight suppression in the image, and improves the temporal stability of the image sequence in dynamic scenes. Attached Figure Description
[0027] Figure 1 This is a flowchart illustrating a method for optimizing the histogram of night view images in low-light environments, as described in this application. Figure 2 This is another flowchart illustrating the low-light environment night view image histogram optimization method in the embodiments of this application; Figure 3 This is a schematic diagram of an exemplary hardware structure of a low-light environment night view image histogram optimization system in this application embodiment. Detailed Implementation
[0028] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this application refers to and includes any or all possible combinations of one or more of the listed items.
[0029] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0030] In related technologies, a grid-based local histogram equalization method is commonly used to process high-contrast images. The entire image is divided into a fixed-size rectangular grid, and the local histogram and mapping curve are calculated for each grid. Finally, interpolation techniques are used to smooth the transition between adjacent grid boundaries. However, because strong nighttime light sources are often accompanied by continuous, divergent, and irregularly shaped halos, fixed mechanical grid divisions can disrupt natural halo regions with continuous physical illumination gradients. This results in significant numerical discrepancies in the calculated local mapping parameters between adjacent grids due to the vastly different proportions of bright and dark pixels. At these extreme bright-dark boundaries, conventional boundary mathematical interpolation struggles to bridge the parameter abrupt changes, ultimately leading to noticeable grayscale breaks and artificial contours at grid boundaries when implementing local highlight suppression. This disrupts the visual continuity between the halo and the dark background.
[0031] In this embodiment, an initial irregular mask enveloping the highlight region is dynamically generated based on the distance distribution of peripheral pixels, with the center of the physical light source as the origin, to implement histogram suppression. To address the boundary discontinuity defects easily caused by strong local suppression, an information entropy difference evaluation mechanism is introduced. This mechanism calculates the information entropy difference by extracting sampled pixels inside and outside the mask boundary, objectively quantifying the degree of tearing in the image transition. Once the information entropy difference is determined to exceed the limit and cause boundary tearing, the algorithm drives the mask boundary to adaptively expand outwards, simultaneously reducing the local stretching weight of the expanded area. Through iterative expansion and suppression mapping, the boundary information entropy difference falls back to within the smoothing threshold. This allows the suppression range to flexibly extend according to the halo shape and the suppression intensity to decrease gradually, eliminating the harsh sense of regional discontinuity.
[0032] Figure 1This is a flowchart illustrating the low-light environment night view image histogram optimization method used in the embodiments of this application, including the following steps: S101. Obtain the current frame image, extract the pixels in the current frame image whose brightness value is greater than the preset brightness threshold, extract consecutive adjacent pixels as bright connected regions, and determine the center point of the light source of the bright connected region as the origin of the bright pixels.
[0033] Here, the current frame image refers to the two-dimensional digital matrix acquired by the image sensor of the intelligent vehicle vision system at the current moment, such as a frame of nighttime road test footage; the preset brightness threshold refers to the grayscale truncation benchmark value pre-set by those skilled in the art based on the common physical illuminance of strong light sources such as car headlights at night, through statistical analysis and experimental calibration of the image grayscale distribution range; the bright connected region refers to a set of connected pixels in the image whose brightness values exceed the aforementioned threshold and are adjacent to each other in spatial topology, such as the light spot formed by the light-emitting entity of the car headlight in the image; the center point of the light source refers to the core coordinate position of the bright connected region in geometric distribution or photometric quality distribution; the origin of the bright pixel refers to the benchmark coordinate point used to construct the halo attenuation model later.
[0034] Specifically, the current frame image is converted to grayscale and segmented using a global or local thresholding method to extract all candidate pixels with grayscale levels greater than a preset brightness threshold. A connected component labeling algorithm is then applied to these candidate pixels, merging adjacent pixels under four- or eight-connectivity rules into independent bright connected regions. For each extracted bright connected region, the ratio of its first-order spatial moment to its zero-order spatial moment is calculated using the image moment calculation formula to obtain the centroid coordinates of that region. These centroid coordinates are then configured as the light source center point of the bright connected region and set as the origin of the bright pixels for subsequent system processing. It is understood that in actual nighttime driving scenarios (e.g., with opposing headlights or multiple streetlights), multiple independent bright connected regions may be extracted from the current frame image. In this case, the system will execute the above steps of determining the origin of the bright pixels and subsequent mask generation and histogram suppression in parallel or sequentially for each extracted bright connected region; this application does not impose any restrictions on this.
[0035] In some embodiments, the extraction of bright connected regions and the determination of the light source center point can be achieved in several ways: Optionally, a region growing algorithm is used, with the pixel with the highest brightness as the seed point, and a brightness similarity criterion is set for neighborhood diffusion to generate connected regions; the outer contour boundary of the connected region is extracted, and the geometric center point of the boundary polygon is calculated as the origin of the bright pixel. Optionally, a morphological processing method is used to perform a closing operation on the binarized over-threshold image to fill internal holes and extract closed connected components; the brightness values of each pixel in the connected component are combined as weighting coefficients to calculate the brightness-weighted centroid coordinates to determine the origin of the bright pixel. It is understood that other methods can also be used to extract bright connected regions and determine the light source center point, which are not limited here.
[0036] In some embodiments, when rain or snow causes water droplets to adhere to the lens glass surface, and oncoming vehicle headlights are refracted and scattered by the water droplets, forming multiple scattered bright speckle patterns in the image, an optical speckle removal step can be performed. After extracting all bright connected regions, the low-light environment night view image histogram optimization system calculates the ratio of luminance concentration to area for each connected region; irregular connected regions with ratios below a preset scattering discrimination threshold are identified as optical scattering artifacts and removed from the candidate queue; only the main light source connected regions with ratios meeting the threshold are retained, and their light source center point is calculated as the origin of the bright pixels. This step avoids the system's meaningless tracking and suppression of raindrop speckle patterns that are not the main light source, improving the coherence of low-light environment night view images.
[0037] In some embodiments, when a strong dynamic moving light source suddenly breaks away from the physical occlusion structure during its movement at night, causing an instantaneous spatial jump in the centroid of the light spot, the motion direction of the unoccluded soft boundary in the previous frame can be introduced as a trend prior to perform cross-frame smoothing correction on the current origin, thereby eliminating transient jitter in the light source positioning and stabilizing the reference point.
[0038] After extracting the bright connected regions, the system first applies the spatial moment operator or pixel brightness weighted average algorithm to calculate and extract the geometric or photometric convergence center of the current bright connected region at this moment, defining it as the initial light source center point. Then, the system reads the historical bright pixel origin coordinates corresponding to the previous frame image stored in the cache module, calculates the spatial position difference between the current initial light source center point and the historical bright pixel origin using the two-dimensional Euclidean distance formula or the Manhattan distance formula, and quantizes this difference distance as a centroid offset. Next, the system sends this centroid offset to a numerical comparator to determine whether it exceeds a preset occlusion detachment threshold. This preset occlusion detachment threshold is a limit boundary value for reasonable light source displacement between two adjacent frames, derived by those skilled in the art using kinematic formulas based on the sampling frame rate of the vehicle camera, common road speed limits, and the maximum physical speed limit of the relative vehicle motion. If the comparison results show that the centroid offset is greater than the threshold for the occlusion escape transition, it indicates that the light source is very likely moving away from the edge of an obstacle (e.g., emerging from behind a tree trunk). The previously physically truncated bright area suddenly reappears in a large area, causing a sudden and significant jump in the image's brightness centroid that does not conform to the actual movement of a vehicle. To prevent this unrealistic jump from disrupting the continuity of subsequent mask expansion, the system backtracks and extracts the "optical halo soft boundary" from the previous frame that was not physically blocked and was in a normal outward expansion state. The system then uses the polygon centroid calculation formula to determine the spatial distribution center coordinates of this soft boundary contour in the plane. Next, the system constructs a two-dimensional vector pointing from the origin coordinates of the historical bright pixels in the previous frame to the spatial distribution center coordinates of this soft boundary, using it as a reference motion trend vector. This vector effectively represents the physical movement intention of the light source before escaping occlusion. Subsequently, based on the reference motion trend vector, the system performs coordinate position smoothing correction on the center point of the initial light source that is currently undergoing anomalies (for example, using a vector weighting formula with hysteresis factor, the directional component of the motion trend vector is superimposed on the center point of the initial light source according to a preset weight ratio for spatial traction smoothing). The coordinates after smoothing correction are then used as the final determined origin of the bright pixel. This corrects the pseudo displacement error caused by occlusion. Conversely, if the calculated centroid offset is less than or equal to the occlusion removal transition threshold, it indicates that the light source is currently in a stable transition state that conforms to the laws of physical motion, and the system directly determines the center point of the initial light source as the final origin of the bright pixel and proceeds to the next process.
[0039] This step involves introducing the soft boundary of the optical halo that was not affected by occlusion in the previous frame, calculating the real physical motion vector, and inversely constraining the centroid of the current jump. This isolates the interference caused by the sudden change in physical occlusion state on the algorithm's positioning origin, ensuring the smooth trajectory of the suppressed reference point, and thus improving the coherence of the night view image.
[0040] S102. Taking the origin of the bright pixel as the center, determine the energy value of each peripheral pixel based on the distance distribution characteristics of the peripheral pixels from the origin of the bright pixel in the current frame image.
[0041] Among them, the distance distribution feature refers to the topological distance of each peripheral pixel in the image space relative to the set origin of the bright pixel and the light energy radiation attenuation law caused by the relative position relationship; the energy value is used to represent the abstract attribute value assigned to a single pixel by the system, reflecting the degree to which the pixel is affected by the light source radiation and the strength of the requirement for the brightness to be suppressed.
[0042] Specifically, a two-dimensional local coordinate system is constructed with the origin of the highlighted pixel as the origin; the peripheral pixels in the current frame image are traversed, and the Euclidean distance between the coordinates of each peripheral pixel and the coordinates of the origin of the highlighted pixel is calculated; a two-dimensional Gaussian decay mathematical model that monotonically decreases with distance is established, and the obtained Euclidean distance is substituted into the exponent of the two-dimensional Gaussian decay mathematical model for calculation; the function value output by the calculation represents the mapping result corresponding to the distance distribution characteristics, and the result is recorded as the energy value of the corresponding peripheral pixel, so that the closer the pixel is to the origin, the greater the energy value it receives.
[0043] In some embodiments, the energy value of each peripheral pixel can be determined in several ways: Optionally, an isotropic exponential decay function is established to calculate the Manhattan distance between the peripheral pixel and the origin; the Manhattan distance is input into the exponential decay function to obtain the decay coefficient, and the energy value of each peripheral pixel is obtained by multiplying the decay coefficient by the base energy of the light source center point. Optionally, a distance-energy mapping lookup table is established to calculate the Chebyshev distance from the peripheral pixel to the origin; the corresponding pre-stored energy value is directly read from memory based on this distance value as the energy value of the pixel. It is understood that other methods can also be used to determine the energy value of each peripheral pixel, which are not limited here.
[0044] S103. Extract continuous pixel regions with energy values greater than a preset energy threshold, and use the edge contours of the continuous pixel regions as boundaries to generate an initial irregular mask that wraps around the origin of the highlight pixels.
[0045] Among them, the preset energy threshold refers to the energy division boundary set by those skilled in the art based on the sensitivity tolerance of the human eye to the diffusion boundary of vehicle headlight halo in nighttime road test data; the continuous pixel region refers to a two-dimensional block in the image whose energy value meets the conditions and whose spatial position is adjacent; the initial irregular mask refers to a binary polygonal mask matrix used to identify the range of brightness suppression processing to be performed.
[0046] Specifically, an empty mask matrix with the same size as the current frame image is established; the image pixels are traversed, and the corresponding positions of pixels with energy values greater than a preset energy threshold in the empty mask matrix are marked as logic high level, and the rest are marked as logic low level, forming a binary continuous pixel region; an edge tracking algorithm is applied to scan the binary region to obtain the outer edge pixel coordinate sequence, and the line connecting the coordinate sequences is used as the boundary; a mask containing the origin of the bright pixels is generated with the boundary as the closed region, thus obtaining the initial irregular mask.
[0047] In some embodiments, the initial irregular mask encompassing the origin of the highlighted pixel can be generated in several ways: Optionally, a mask matrix is generated by threshold truncation, and the gradient magnitude of the mask image is calculated using the Sobel operator; local maxima of the gradient magnitude are extracted to form a boundary contour, and the contour is filled to generate the initial irregular mask. Optionally, an active contour model is introduced, and a small-radius circular curve is initialized with the origin of the highlighted pixel as the center; the gradient information of the pixel energy value is used as external energy to drive the circular curve to expand outward until the curve stops at the contour line where the preset energy threshold is located, and the closed curve region after the evolution stops is used as the initial irregular mask. It is understood that other methods can also be used to generate the initial irregular mask encompassing the origin of the highlighted pixel, which is not limited here.
[0048] S104. Based on the energy values of each pixel within the initial irregular mask, calculate the corresponding local histogram stretching weights, and use the local histogram stretching weights to perform histogram suppression mapping on the pixels within the initial irregular mask to obtain the image to be verified.
[0049] Among them, local histogram stretching weight refers to the adjustment coefficient assigned to a specific local pixel based on its energy level, which is used to control the transformation amplitude of the image grayscale mapping curve; histogram suppression mapping refers to the image processing technique that compresses the width of the bright section by changing the original grayscale frequency distribution of the pixel; the image to be verified refers to a temporary cached image that has completed a preliminary brightness suppression operation but has not yet undergone smoothness quality evaluation.
[0050] Specifically, the energy values of each pixel within the mask are extracted, and a linear normalization formula is used to map the energy values to a weight range of zero to one, resulting in independent local histogram stretching weights for each pixel. A non-linear logarithmic mapping function with a weight adjustment term is established. The original grayscale values of each pixel within the mask and the corresponding local histogram stretching weights are substituted into this logarithmic mapping function, so that pixels with larger weights have higher brightness compression ratios. The new grayscale values output by the function are used to replace the original image pixel data to generate an image to be verified for subsequent quality inspection.
[0051] In some embodiments, the calculation of weights and histogram suppression mapping can be implemented in several ways: Optionally, the local histogram stretching weight is calculated based on the ratio of energy value to maximum energy, and a piecewise linear histogram specification model is established; the weights are introduced into the slope parameter of the highlight segment of the specification model, and the pixels within the mask are iterated and reassigned to generate the image to be verified. Optionally, the energy value is substituted into an inverse proportional function to calculate the local histogram stretching weight, and a gamma correction function is constructed; the gamma coefficient value of each pixel is dynamically adjusted using the weights, and a pixel-by-pixel gamma transform is performed to suppress the highlights to obtain the image to be verified. It is understood that other methods can also be used to implement the calculation of weights and histogram suppression mapping, which are not limited here. S105. In the image to be verified, along the boundary of the initial irregular mask, extend a preset pixel distance to the inside and outside of the initial irregular mask respectively, and extract the internal sampling pixel set and the external sampling pixel set.
[0052] Among them, the preset pixel distance refers to the morphological operation step size or topological offset scalar that is pre-set through experiments based on the empirical proportional relationship between the image resolution of the vehicle sensor and the edge diffusion width of the conventional vehicle light halo; the internal sampled pixel set refers to the pixel array located within a specified distance band inside the mask boundary; the external sampled pixel set refers to the pixel array located within a specified distance band outside the mask boundary.
[0053] Specifically, the process involves reading the image to be verified and the initial irregular mask matrix; constructing structuring elements using the scale corresponding to the preset pixel distance; performing a morphological dilation operation on the initial irregular mask to generate an expanded mask; performing a logical XOR operation between the expanded mask and the initial mask to obtain an outer annular region; and extracting the corresponding image pixels to be verified within this outer annular region to form an external sampling pixel set. Then, performing a morphological erosion operation on the initial irregular mask using the same structuring elements to generate a contracted mask; performing a logical XOR operation between the initial mask and the contracted mask to obtain an inner annular region; and extracting the corresponding image pixels to be verified within this inner annular region to form an internal sampling pixel set.
[0054] In some embodiments, the extraction of the internal and external sampled pixel sets can be achieved in several ways: Optionally, the boundary coordinate set of the initial irregular mask is obtained, and the normal vector of each pixel on the boundary is calculated; the internal pixel set is extracted by moving the sampling step by a preset pixel distance along the direction of the normal vector pointing inwards from the mask; the external pixel set is extracted by moving the sampling step by a preset pixel distance along the direction of the normal vector pointing outwards from the mask. Optionally, the minimum distance from all pixels in the image to be verified to the mask boundary is calculated using a distance transformation algorithm; distance contour maps are extracted by setting positive and negative distance thresholds, and pixels with positive distance values and less than a preset distance are assigned to the external sampled pixel set, while pixels with negative distance values and absolute values less than a preset distance are assigned to the internal sampled pixel set. It is understood that other methods can also be used to extract the internal and external sampled pixel sets, which are not limited here.
[0055] S106. Calculate the internal information entropy of the internal sampled pixel set and the external information entropy of the external sampled pixel set respectively, and calculate the absolute value of the difference between the internal information entropy and the external information entropy as the information entropy difference.
[0056] Among them, internal information entropy is used to represent the degree of disorder and information enrichment index of the gray-level distribution state of the internal sampled pixel set; external information entropy represents the gray-level distribution information index of the external sampled pixel set; information entropy difference refers to the value obtained by subtracting the above two sets of information indexes and taking the absolute value, which reflects the degree of discontinuity of image texture and brightness on both sides of the boundary.
[0057] Specifically, the frequency of each gray level in the internal sampled pixel set is counted, and the frequency of each gray level is divided by the total number of pixels in the internal set to obtain the internal gray level probability distribution law. The internal gray level probability distribution law is substituted into the Shannon information entropy mathematical model to calculate and sum to obtain the internal information entropy. The external gray level probability distribution law of the external sampled pixel set is counted, and the external information entropy is calculated using the same Shannon information entropy mathematical model. The internal information entropy is subtracted from the external information entropy, and the absolute value of the subtraction result is processed to obtain the information entropy difference.
[0058] In some embodiments, the information entropy difference can be calculated in several ways: Optionally, a one-dimensional grayscale histogram of the internal sampled pixel set is constructed to extract the distribution probability, and the negative sum of the logarithm of the probability and the product of the probability is calculated to obtain the internal information entropy; an external set histogram is constructed, and the external information entropy is calculated using the same steps; the absolute value of the difference between the two is calculated using subtraction and the absolute value function as the information entropy difference. Optionally, the spatial gradient magnitude distribution features of the internal and external pixel sets are extracted separately, and the internal local weighted information entropy and the external local weighted information entropy are calculated based on the probability of gradient magnitude occurrence; the difference between the internal local weighted information entropy and the external local weighted information entropy is obtained by subtracting them. It is understood that other methods can also be used to calculate the information entropy difference, and this is not limited here.
[0059] In some embodiments, when there is local high-frequency random noise interference in the boundary region of the image to be verified caused by low-light sensor noise or environmental suspended particles, the underlying noise pollution can be eliminated and the accuracy of boundary tear judgment can be improved by reducing the two-dimensional boundary pixels to a one-dimensional spatial sequence and smoothing the noise.
[0060] After extracting the internal and external sampled pixel sets, the system first extracts the pixel grayscale values one by one from the sampled pixel sets according to the closed boundary contour trajectory of the initial irregular mask (e.g., uniformly along the clockwise topological extension direction), and then performs linear stitching and arrangement. This reconstructs the pixels originally scattered on the complex two-dimensional surface into a continuous internal one-dimensional spatial sequence and an external one-dimensional spatial sequence. The reason for performing this spatial dimensionality reduction mapping is that the shape of the mask boundary is extremely irregular. Directly performing filtering operations to fit the boundary in a two-dimensional matrix would consume a lot of computing power and easily involve background pixels. Flattening it into a one-dimensional sequence not only reduces the computational complexity from quadratic to linear, but also ensures that the data strictly follows the natural direction of the halo edge. Subsequently, the system uses a preset smoothing filtering algorithm to perform spatial domain denoising processing on the above-mentioned internal and external one-dimensional spatial sequences. The preset smoothing filtering algorithm refers to a one-dimensional Gaussian filtering or median filtering algorithm based on the common knowledge of one-dimensional digital signal processing, combined with the computing power allocation of the vehicle chip, and pre-selected and configured sliding window parameters. Specifically, the system sets a fixed-length sliding window on the one-dimensional sequence, calculates the arithmetic mean of the gray levels of the sequence elements within the window or a weighted average of the elements distributed according to a Gaussian distribution, and replaces the original value of the window's center point with this value. This filters out isolated high-frequency noise abrupt changes, resulting in a smoothly transitioning denoised internal and external sequences. This step effectively removes random artifact noise generated by the physical environment or sensors, preventing these high-frequency noises from falsely reporting a large amount of information in subsequent calculations, thus making the data source cleaner. Next, the system calculates the probability of each gray level appearing in the denoised internal and external sequences, substitutes it into the Shannon information entropy formula to obtain the negative sum of the product of the probability and the logarithm, and obtains the true internal and external information entropies, respectively. Finally, the system subtracts the external information entropy from the internal information entropy and takes the absolute value, using this result as the final information entropy difference after removing underlying noise interference.
[0061] This step, through dimensionality reduction reconstruction and one-dimensional filtering, removes sensor background noise and high-frequency artifacts caused by environmental particles. It cuts off the path of random noise contaminating the information content statistical formula, ensuring that the final calculated information entropy difference can reflect the halo boundary discontinuity caused by the histogram suppression algorithm, thus preventing the system from falling into an infinite loop.
[0062] S107. Determine whether the information entropy difference is greater than the preset boundary tearing threshold; If so, proceed with step S108 below; If the preset maximum number of expansion iterations is not reached, then proceed to step S109 below.
[0063] Among them, the preset boundary tearing threshold refers to the boundary tolerance critical constant set by those skilled in the art through the distribution law of the information entropy difference between the edge of the smooth transition image and the edge of the image that has undergone gray-scale truncation tearing, which is obtained by a large number of statistical smooth transition images; the preset maximum number of expansion iterations is the upper limit value of the loop termination set to ensure the real-time frame rate of the video stream processing of the vehicle system and to avoid the exhaustion of computing resources.
[0064] Specifically, the control unit extracts the calculated information entropy difference and uses numerical comparison logic to compare this difference with a preset boundary tearing threshold. Since the information entropy difference directly reflects the abrupt change in grayscale distribution inside and outside the boundary, if the difference is greater than the threshold, it indicates that the current histogram suppression mapping has caused a steep grayscale step at the mask boundary, resulting in an unnatural light spot tearing and disjointed feeling. Therefore, the system determines that the current mask range is insufficient and triggers a jump to execute the subsequent step S108 to adaptively expand the mask and adjust the suppression parameters, thereby attempting to alleviate the tearing phenomenon. If the difference is less than or equal to the threshold, it indicates that the amount of information inside and outside the boundary tends to be consistent, and the suppression transition is natural. Or, when the iteration operation trigger counter exceeds the preset maximum number of expansion iterations, it indicates that the marginal benefit of further expanding the mask is extremely low and will threaten the real-time performance of the system. In both of these cases, the system terminates the attempt to continue adjusting and triggers a jump to execute the subsequent step S109 to release the data stream.
[0065] In some embodiments, the judgment and branch jump can be implemented in multiple ways: Optionally, the information entropy difference and boundary tearing threshold input digital comparator are called in the memory register for calculation; when the comparator outputs a high-level flag, the expansion interrupt signal is pulled high to execute step S108; when the comparator outputs a low-level flag or the iteration counter overflows, a completion signal is triggered to execute step S109. Optionally, a joint cost function including the information entropy difference factor and the iteration number factor is constructed and the current generation value is solved; it is verified whether the cost value meets the preset loss convergence boundary condition; if the convergence condition is not met, the driver pointer points to the entry address of step S108; if the convergence condition is met, the driver pointer jumps to the entry address of step S109. It is understood that other methods can also be used to implement the judgment and branch jump, which are not limited here.
[0066] S108. Expand the boundary of the initial irregular mask outward to update the initial irregular mask, simultaneously reduce the local histogram stretching weight corresponding to the expanded region, and return to execute the step of using the local histogram stretching weight to perform histogram suppression mapping on the pixels in the initial irregular mask, until the recalculated information entropy difference is less than or equal to the boundary tearing threshold, or the preset maximum number of expansion iterations is reached.
[0067] The expanded region refers to the pixel set space that was not originally covered by the mask, which is newly included due to the outward extension of the mask boundary according to preset rules.
[0068] Specifically, the edge coordinates of the initial irregular mask are updated according to a preset topological step size, causing it to expand outward in a circle on the two-dimensional plane to form the updated initial irregular mask; the annular expansion region generated by this expansion action is extracted, and a monotonically decaying function based on the distance from the origin is established; a lower local histogram stretching weight is calculated using the monotonically decaying function and assigned to the pixels in the expansion region; with the globally updated range and parameters, the histogram suppression mapping logic is reconstructed for all pixels in the current mask using the adjusted stretching weight to obtain a new image to be verified, until the newly calculated information entropy difference drops to within the threshold or the iteration count reaches the target.
[0069] In some embodiments, the iterative process of mask expansion and weight reduction can be implemented in several ways: Optionally, the mask boundary is expanded at equal intervals along the normal direction to generate a new irregular polygonal contour; the average displacement of the expanded region from the center is calculated, and the stretching weight is reduced proportionally using a linear decay formula; the image is updated by reorganizing the histogram transformation matrix with the new weights to complete a single iteration. Optionally, the local energy gradient vector matrix of the mask periphery is extracted; non-uniform adaptive morphological dilation is performed according to the direction of the fastest gradient descent to obtain an updated mask, and the stretching weight of the expanded region is configured using an exponential decay function, before returning to the execution suppression mapping module for verification. It is understood that other methods can also be used to implement the iterative process of mask expansion and weight reduction, which are not limited here.
[0070] In some embodiments, when the mask boundary becomes extremely close to the physical boundary of the image (such as the edge of the sensor's field of view limit) during continuous expansion iterations, an edge suppression buffering step can also be performed. When the low-light environment night view image histogram optimization system performs the step of expanding the boundary of the initial irregular mask outwards, it calculates the spatial pixel margin from the current boundary to the physical edge of the image; determines whether the spatial pixel margin is lower than a preset truncation margin threshold; when it is lower than the preset truncation margin threshold, it suppresses the normal expansion speed of the mask towards that physical edge and modifies the weight decay logic to a non-linear sag function to terminate halo expansion. This avoids system anomalies caused by boundary over-limit calculations and improves the coherence of low-light environment night view images.
[0071] In some embodiments, when strong light sources are blocked by physical obstacles at night, causing the halo diffusion to be hindered, the asymmetric expansion of the mask can be achieved by identifying and distinguishing between physical hard boundaries and optical soft boundaries, thereby protecting the image's physical structure and avoiding blindly smoothing physical contours.
[0072] When the information entropy difference is greater than the preset boundary tearing threshold, the system first extracts high-frequency features of the surrounding neighborhood along the boundary of the initial irregular occlusion. Then, it calculates the gray-level gradient change rate at each pixel coordinate position on the boundary using a first-order differential operator or a second-order Laplacian operator, and uses this as a local abrupt change feature value characterizing the steepness of the edge. The reason for extracting this feature is that real object occlusion causes a sharp increase in brightness, while natural halos decay slowly. Quantifying this feature can accurately identify the causal attributes of the boundary. The preset physical blocking threshold is a pre-calibrated distinguishing value determined by those skilled in the art based on the statistical differences in gradient distribution between the edges of real physical obstacles and the edges of optical lens glare at night on a large number of actual vehicles, through experimental comparison. Subsequently, the system compares the calculated abrupt change values one by one with this physical blocking threshold. Positions with abrupt change values higher than the threshold are classified as hard physical occlusion boundaries caused by light truncation from physical obstacles, while other positions with gradual changes are classified as soft optical halos generated by natural scattering in the air. Based on the segmentation results, the system applies position latching instructions to the physical occlusion hard boundaries in the memory coordinate system, forcibly blocking their outward expansion path. This prevents the algorithm from erroneously crossing physical obstacles to modify the pixels in the background area, preserving the realistic geometric discontinuity of the physical world. At the same time, the system only drives the optical halo soft boundaries to continue exploring and expanding along the normal direction, thereby reconstructing and generating an asymmetric update mask whose shape adapts to the physical environment. By using the inverse proportional decay function of spatial distance, the system synchronously and dynamically reduces the local histogram stretching weight of the newly expanded area according to the actual expansion distance of the soft boundaries, achieving adaptive and smooth transition control of the highlight area.
[0073] By distinguishing between physical hard boundaries and optical soft boundaries and implementing unidirectional blocking, the algorithm avoids the geometric structure destruction caused by blindly expanding and smoothing across the entity contour. While naturally suppressing diffuse halos, this mechanism preserves the sharp edges of real obstacles, improving the spatial logical coherence of images in complex occlusion scenarios.
[0074] S109. Determine if the boundary transition is smooth, and render the current image to be verified as the target image.
[0075] In this context, "smooth boundary transition" refers to a state where, after local brightness suppression processing, there are no visual abrupt changes between the highlighted areas and the dark background, and the grayscale gradient changes continuously and naturally. The target image refers to a two-dimensional pixel matrix that has undergone multiple iterations of algorithmic verification and finally meets the requirements for visually coherent output. Rendering output refers to the process of transferring digital image data to a display device or transmitting it to downstream computing nodes. Specifically, the rendering output referred to in this application includes not only transmitting target image data to an in-vehicle screen for visualization but also directly outputting the optimized target image as a low-level perceptual data stream to an in-vehicle visual perception module (such as object detection or semantic segmentation models) for subsequent scene understanding. All of these application forms fall within the protection scope of the rendering output in this application.
[0076] Specifically, the current frame of the image to be verified stored in the buffer is marked as processed in memory; the data body of the image is encapsulated and backed up in the target image format; the pixel matrix of the target image is streamed into the frame buffer of the display controller for level-driven display of the image by calling the video stream interface protocol or display bus instructions, or sent to the vehicle target detection module for subsequent scene understanding via the data bus.
[0077] In some embodiments, the target image can be rendered and output in several ways: Optionally, the target image data pointer is assigned to the video output queue, and the data is moved to the video memory pool using direct memory access technology; color depth parameters are configured using a display driver; and the high-definition multimedia interface is driven to output electrical signals to achieve screen rendering. Optionally, the target image undergoes color space conversion, mapping and merging from a single-channel grayscale image into a red, green, and blue three-channel pseudo-color image; a video encoding algorithm is applied to perform intra-frame compression and encapsulation of the single-frame image; and the image is pushed to a remote monitoring terminal via a network socket. It is understood that other methods can also be used to render and output the target image, and these are not limited here.
[0078] In the above embodiments, the grayscale tortuosity of the image is quantitatively evaluated by using the information entropy difference between the inner and outer sides of the mask boundary. When boundary tearing is detected, the mask range is expanded outward and the local histogram stretching weight is reduced simultaneously for iterative mapping. This allows the brightness suppression range to dynamically extend according to the halo distribution, and the suppression intensity gradually decreases from the center to the outer edge. This avoids grayscale truncation and artificial pseudo-contours caused by fixed-area suppression, ensures a smooth transition between the highlight suppression area and the dark background, and improves the coherence of night view images in low-light environments.
[0079] In some other embodiments of this application, when a unidirectional blurred trail is generated by the high-speed movement of a light source, the trailing light leakage and side background compression may occur due to the mismatch of the deformed light spot caused by the symmetrical mask. By using the low-light environment night view image histogram optimization method provided in this application, the primary and secondary directions and deformation coefficients can be extracted to construct an anisotropic metric function, so that the suppression energy field adaptively fits the asymmetric physical trail shape.
[0080] like Figure 2 The diagram shown is another flowchart illustrating the low-light environment night view image histogram optimization method provided in this application embodiment, including the following steps: S201. Obtain the current frame image, extract the pixels in the current frame image whose brightness value is greater than the preset brightness threshold, extract consecutive adjacent pixels as bright connected regions, and determine the center point of the light source of the bright connected region as the origin of the bright pixels.
[0081] Step S201 and Figure 1 Step S101 in the illustrated embodiment is similar and can be found in the description of step S101, which will not be repeated here.
[0082] S202. Extract the set of two-dimensional spatial coordinates of all pixels within the highlighted connected region.
[0083] The two-dimensional spatial coordinate set refers to the mathematical set consisting of the row and column position indices of all pixels containing brightness information within the highlighted connected region in the digital image matrix.
[0084] Specifically, the system traverses the image matrix buffer block processed by the connected component labeling algorithm; identifies the valid pixels that have been assigned highlight region target labels; extracts the x and y coordinates of these pixels in the two-dimensional image plane Cartesian coordinate system; and writes these coordinate values into the linear list or array space in the system memory according to a specific data structure, thereby forming a two-dimensional spatial coordinate set for subsequent spatial moment extraction and matrix operations.
[0085] In some embodiments, the extraction of a two-dimensional spatial coordinate set can be achieved in several ways: Optionally, a raster scanning method can be used to read the logical values of image pixels row by row; the coordinate sequence corresponding to pixels with true logical values can be recorded; this sequence can be encapsulated and backed up to the memory stack to form a coordinate set. Optionally, a contour tracking combined with a region filling method can be used to obtain the outer boundary coordinate chain code of the connected region using an edge extraction operator; the pixel positions inside the contour can be obtained by applying a scanline polygon filling algorithm; and the boundary coordinates and the internal coordinates can be merged and output to obtain the coordinate set. It is understood that other methods can also be used to extract the two-dimensional spatial coordinate set, which are not limited here.
[0086] S203. Calculate the second-order spatial distribution feature parameters of the two-dimensional spatial coordinate set, and obtain the main extension direction vector and the secondary extension direction vector of the highlighted connected region based on the second-order spatial distribution feature parameters.
[0087] Among them, the second-order spatial distribution feature parameter refers to the statistical feature value that uses the second-order central moments to measure the breadth and dispersion of the image region in various directions; the main extension direction vector refers to the mathematical vector that represents the geometric axis direction corresponding to the longest spatial distribution and the largest variance of the pixel set; the secondary extension direction vector refers to the geometric axis vector that is orthogonal to the main extension direction and represents the secondary width of the distribution.
[0088] Specifically, the system reads a set of two-dimensional spatial coordinates and uses mean operation to calculate the centroid coordinates of the set in the horizontal and vertical directions; it calculates the mean-reduced coordinates by subtracting the centroid coordinates from the coordinates of each pixel; it accumulates the products of the mean-reduced coordinates to calculate the second-order autocorrelation moment and second-order cross-correlation moment (including horizontal variance, vertical variance, and covariance) of the region; it constructs a two-dimensional covariance matrix using these second-order moment parameters; then it applies a matrix eigenvalue decomposition algorithm to solve for the eigenvalues and eigenvectors of the covariance matrix; the eigenvector corresponding to the largest eigenvalue is established as the primary extension direction vector, and the eigenvector corresponding to the smallest eigenvalue is established as the secondary extension direction vector.
[0089] In some embodiments, the parameters and direction vectors can be calculated and obtained in several ways: Optionally, principal component analysis (PCA) is applied to construct a sample matrix from the set of two-dimensional spatial coordinates; the empirical covariance of the sample matrix is calculated and singular value decomposition is performed; the first and second principal components are extracted as the principal extension direction vector and the secondary extension direction vector, respectively. Optionally, based on image gray-level moment theory, the brightness value of the pixels is used as the quality weight; the weights are substituted into the second-order central moment accumulation formula to solve the inertia tensor matrix; the two orthogonal principal inertia axis vectors are obtained by solving the characteristic equation of the inertia tensor as the principal and secondary extension directions. It is understood that other methods can also be used to calculate the parameters and obtain the direction vectors, which are not limited here.
[0090] In some embodiments, when encountering a fast-moving light source at the edge of a fisheye camera with wide-angle distortion in low-light nighttime conditions, a nonlinear extension axis fitting step can also be performed. After acquiring the coordinate set, the low-light environment nighttime image histogram optimization system calculates the radial distortion deviation of the coordinate points from the physical center of the image; it introduces a pre-defined distortion correction model for the lens and uses a quadratic curve fitting algorithm instead of linear covariance decomposition to perform nonlinear curve fitting on the bright edge regions; it extracts the tangent vector distribution of the fitted curve as a dynamic principal extension direction vector that varies spatially. This method reduces the vector calculation bias caused by linear eigenvalue decomposition in optical distortion regions, avoids errors in halo direction evaluation, and improves the coherence of low-light environment nighttime images.
[0091] S204. Based on the scale difference characteristics between the main extension direction vector and the secondary extension direction vector, calculate the motion distortion coefficient that characterizes the shadow caused by relative motion in the bright connected region.
[0092] Among them, scale difference feature refers to the size comparison between the spatial distribution length in the main extension direction and the spatial distribution length in the secondary extension direction; the motion blur coefficient is used to represent the specific value of the degree of unidirectional blur stretching caused by the relative spatial displacement of the light source entity in the image during the camera exposure time.
[0093] Specifically, the system retrieves the largest and smallest eigenvalues obtained during the covariance matrix decomposition stage; it then performs square root operations on these two eigenvalues to obtain the equivalent standard deviations in the primary and secondary extension directions, which are used as scale measures; a scale ratio function is constructed, and the ratio of the square root of the smallest eigenvalue to the square root of the largest eigenvalue is used to obtain scale difference characteristics; a deformation mapping formula is introduced, and this ratio is calculated by subtracting a constant from the ratio, or by substituting the ratio into the negative correlation mapping curve, to obtain a value as the trailing distortion coefficient. When the light source is relatively stationary, the two axes are close in scale, and the coefficient is low; when the light source moves at high speed, causing the trailing shadow to lengthen, the primary axis is longer than the secondary axis, and the coefficient increases accordingly.
[0094] In some embodiments, the motion blur coefficient can be calculated in several ways: Optionally, extract the smallest bounding rectangle of the highlighted connected region; calculate the length of the long side and the length of the short side of the rectangle respectively; divide the long side by the short side to obtain the aspect ratio, input the aspect ratio into a logarithmic activation function for mapping calculation, and output the result as the motion blur coefficient. Optionally, calculate the bounding elliptical envelope of the highlighted region; extract the eccentricity value of the elliptical envelope; establish a lookup table based on the eccentricity, and retrieve the corresponding dynamic blur attenuation compensation value from the table based on the current eccentricity as the motion blur coefficient. It is understood that other methods can also be used to calculate the motion blur coefficient, which are not limited here.
[0095] S205. Based on the main extension direction vector, the secondary extension direction vector, and the shadow deformation coefficient, an anisotropic distance metric function is constructed.
[0096] Among them, the anisotropic distance metric function refers to a coordinate operation expression with different scaling scales and distance growth rates in different spatial directions; the distance decay rate refers to the rate at which the spatial distance value increases as the pixel coordinates deviate from the origin by physical displacement; the distance decay rate of the anisotropic distance metric function in the main extension direction vector is lower than the distance decay rate in the secondary extension direction vector.
[0097] Specifically, the system establishes a local two-dimensional coordinate system based on the origin of the bright pixel; calculates the rotation angle between the main extension direction vector and the coordinate axis; uses this rotation angle to establish an affine transformation rotation matrix, aligning the spatial calculation coordinate system with the light source's shadow direction; introduces a shadow deformation coefficient, assigning different scaling factors to the principal and secondary axes in the rotated coordinate system; configures the scaling denominator of the main extension direction to increase with the increase of the shadow deformation coefficient, resulting in a slower increase in the function calculation result in that direction after substituting the physical coordinates, manifested as a lower distance attenuation rate; integrates these matrix operations into a quadratic mathematical analytical expression, forming an anisotropic distance metric function.
[0098] In some embodiments, anisotropic distance metrics can be constructed in several ways: Optionally, a Mahalanobis distance mathematical formula can be established based on the inverse matrix of the covariance matrix; the values of the main diagonal elements in the inverse matrix can be adjusted using a trailing distortion coefficient; the weight coefficients corresponding to the principal components can be configured to be smaller, thereby outputting a structured asymmetric Mahalanobis distance calculation formula. Optionally, the coordinate position vector can be decomposed using trigonometric functions; the projection lengths of the position vectors in the principal and secondary directions can be calculated; the projection lengths can be divided by the adjustment factor with the trailing distortion coefficient, and the square root of the sum of the squares can be calculated, encapsulating the formula into a weighted Euclidean distance function. It is understood that other methods can also be used to construct anisotropic distance metrics, which are not limited here.
[0099] In some embodiments, when a strong light source is in high-speed relative motion and produces asymmetric optical trailing with significant directionality, an asymmetric anisotropic distance metric function can be constructed by extracting the deviation component between the geometric center and the energy centroid. This function highly conforms to the physical attenuation pattern of unidirectional motion blur and improves the coherence of edge suppression.
[0100] Specifically, the system reads the two-dimensional spatial coordinates of all pixels within the bright connected region, calculates the arithmetic mean of all pixel coordinates to obtain the geometric distribution center without brightness weighting; simultaneously, it reads the grayscale value of the corresponding pixel within the region as a quality coefficient, and uses a coordinate-weighted averaging algorithm to calculate the energy concentration centroid of the bright connected region. This dual-centroid calculation mechanism utilizes the physical integral law of image photosensitivity: the trailing shadow left by a high-speed moving light source during camera exposure time presents a pattern of bright front and dark back, causing the calculated geometric distribution center to shift geometrically towards the dark trailing side, while the energy concentration centroid remains at the bright moving front. Subsequently, the system performs vector subtraction, subtracting the two-dimensional coordinates of the geometric distribution center from the two-dimensional coordinates of the energy concentration centroid to calculate the centroid eccentricity vector pointing from the geometric distribution center to the energy concentration centroid. This eccentricity vector, without requiring cross-frame comparison, can infer the true physical relative motion orientation of the light source entity solely based on the uneven energy distribution characteristics within a single frame, providing zero-delay prior information on motion intent. Next, the system performs a vector dot product projection operation between the centroid eccentric vector and the principal extension direction vector obtained in the previous step to extract the corresponding direction components. Based on the positive and negative polarity of these direction components, the originally spatially symmetric principal extension direction vector is split into two opposing unidirectional rays with the origin of the highlight pixel as the boundary: the ray forming an angle with the eccentric vector direction component is designated as the leading motion half-axis, and the ray forming an opposing angle is designated as the hysteresis shadow half-axis. After completing the spatial axis splitting, the system constructs an asymmetric anisotropic distance metric function based on the leading motion half-axis, the hysteresis shadow half-axis, the secondary extension direction vector, and the shadow deformation coefficient by setting a piecewise quadratic matrix. When configuring the attenuation parameters within this function, the system uses an algebraic scaling factor to set the distance attenuation rate on the hysteresis half-axis to the lowest level among the three, allowing the final calculated suppression weight to extend far backward to cover the long optical trail. The distance attenuation rate on the leading motion half-axis is set higher than that on the hysteresis half-axis to constrain the normal expansion boundary of the physical halo in front of the light source. Simultaneously, the distance attenuation rate on the secondary extension direction vector is set to the highest level, allowing the halo to contract rapidly on the side perpendicular to the motion direction. This mechanism results in the final output anisotropic distance and corresponding energy value distribution exhibiting a teardrop-shaped gradient profile in the spatial domain that is highly consistent with the physical unidirectional motion blur characteristics.
[0101] This step extracts the centroid eccentricity vector, enabling the calculation of the physical motion direction of the light source within a single frame, thus spatially decoupling the motion front and tail. By configuring an asymmetric metric function where the hysteresis attenuation rate is lower than that of the leading axis and the leading axis is lower than that of the secondary axis, the radiation profile of the suppression weights closely matches the asymmetric optical motion blur pattern, avoiding the problems of background artifacts in front of the motion and insufficient glare suppression caused by symmetric suppression.
[0102] S206. Substitute the coordinates of each peripheral pixel into the anisotropic distance metric function to calculate the anisotropic distance of each peripheral pixel relative to the origin of the highlight pixel.
[0103] Among them, the anisotropic distance is used to represent the abstract value of the deviation of the peripheral pixels from the highlight origin in a comprehensive sense of geometric distance and luminous diffusion perception after taking into account the morphological factors of light source motion blur.
[0104] Specifically, the system iterates through all pixels in the current frame image that are located within a defined search range outside the highlighted connected region; obtains the row and column coordinates of each peripheral pixel; uses these row and column coordinates along with the coordinates of the origin of the highlighted pixel as independent variables, and substitutes them into the anisotropic distance metric function generated in step S205; solves for a single scalar value through algebraic multiplication, addition, and square root operations, and uses this scalar value as the anisotropic distance. Because the metric function has directional scaling characteristics, the anisotropic distance calculated for peripheral pixels located in the main extension direction of the trail is relatively smaller than that for pixels in other directions at the same physical distance.
[0105] In some embodiments, anisotropic distance can be calculated in several ways: Optionally, a parallel computing shader program can be constructed; the coordinates of the outer pixels can be input into the graphics processor as texture coordinates; matrix-vector multiplication instructions for the anisotropic function can be executed in the fragment shader stage, and the calculated distance value can be written into the framebuffer object. Optionally, the two-dimensional space can be discretized into a polar coordinate grid; a two-dimensional numerical lookup table can be established by pre-calculating a series of reference distance values for angle and radius nodes; and the anisotropic distance can be obtained by bilinear interpolation based on the angles and linear Euclidean distances of the outer pixels. It is understood that other methods can also be used to calculate the anisotropic distance, which are not limited here.
[0106] S207. Using anisotropic distance as the distance distribution feature, calculate and determine the energy value of each peripheral pixel.
[0107] Among them, the distance distribution feature refers to using the above-mentioned anisotropic distance as a reference index to evaluate the equivalent position of a pixel in the halo attenuation field; the energy value is used to represent the input parameter that determines the magnitude of the local histogram stretching weight.
[0108] Specifically, the system establishes a radiation model expression based on anisotropic distance attenuation; uses a constant term as the initial value of the basic radiation at the center of the light source; inputs the anisotropic distance value as the independent variable of the exponential attenuation function; through the mapping operation of the exponential function, it solves for the output value that monotonically decreases with the increase of anisotropic distance; and assigns this output value to the corresponding peripheral pixel as its energy value. Since the anisotropic distance increases more slowly in the main extension direction of the motion blur, the peripheral pixels in this direction can obtain relatively high energy values after the operation, thus receiving a stronger histogram suppression force in subsequent processes, which counteracts the unidirectional halo diffusion caused by motion blur.
[0109] In some embodiments, the energy value can be calculated and determined in several ways: Optionally, a molecular boundary value for energy calculation can be set; an energy conversion equation can be constructed using an inverse proportional function structure; the anisotropic distance plus an offset constant can be used as the denominator, and the energy value of each peripheral pixel can be obtained through division. Optionally, multiple discrete distance value segments can be pre-divided; a decreasing energy step value can be assigned to each segment; and the anisotropic distance can be compared with the segment to which it belongs through a conditional judgment instruction, and the corresponding energy step value can be assigned to complete the energy value calculation. It is understood that other methods can also be used to calculate and determine the energy value, which are not limited here.
[0110] In some embodiments, when driving at night on a flooded road after rain, and the bright light source of an oncoming vehicle produces a strong specular reflection and trailing shadow on the slippery road surface below the image, an asymmetric half-plane energy compensation step can be performed. The low-light environment night view image histogram optimization system obtains the horizontal horizon reference coordinates from the vehicle attitude sensor when calculating the energy value of each peripheral pixel; it determines whether the vertical coordinate position of the peripheral pixel is below the horizon and within the lower half-plane range of the secondary extension direction; if it is within this reflection half-plane range, a reflection compensation gain coefficient pre-calibrated according to the optical reflection law of water surface is introduced; the calculated initial energy value is multiplied by this reflection compensation gain coefficient for enhancement calculation. This operation compensates for the deficiency of the anisotropic model in lacking constraints on the high reflectivity of one side of the road surface, reduces local overexposure caused by insufficient suppression of reflection in the lower half, and improves the coherence of low-light environment night view images.
[0111] S208. Extract continuous pixel regions with energy values greater than a preset energy threshold, and use the edge contours of the continuous pixel regions as boundaries to generate an initial irregular mask that wraps around the origin of the highlight pixels.
[0112] S209. Based on the energy values of each pixel within the initial irregular mask, calculate the corresponding local histogram stretching weights, and use the local histogram stretching weights to perform histogram suppression mapping on the pixels within the initial irregular mask to obtain the image to be verified.
[0113] In some embodiments, when the demand for local pixel suppression drops dramatically due to the rapid departure or sudden extinguishing of a strong light source, differential evaluation can be performed by introducing historical time-series parameters and implementing asymmetric damping smoothing to achieve the technical effect of simulating the dark adaptation process of human vision and alleviating instantaneous brightness flicker in the image.
[0114] Specifically, the system extracts the energy values of each pixel within the initial irregular mask, converts them into floating-point coefficients in the range of zero to one using a normalization formula, and calculates the theoretically required baseline histogram stretching weight for each pixel in the current frame. Subsequently, the system retrieves the historical actual histogram stretching weight at the corresponding coordinate position after the previous video frame was processed from the temporal cache queue in memory. Subtraction logic is executed, subtracting the historical actual histogram stretching weight from the baseline histogram stretching weight of the current frame to calculate the temporal difference change representing the degree of parameter jump between frames. The system determines the trend of change by judging the algebraic sign of this difference change and the magnitude of change by calculating its absolute value. If the trend is a decaying histogram suppression intensity and the magnitude of change is greater than a preset release jump threshold, the corresponding pixel is classified as a transient region where the light source leaves. The preset release jump threshold is a constant that allows for smoothing of parameters between adjacent frames, pre-calibrated by those skilled in the art based on the human eye's tolerance to sudden changes in brightness through temporal flicker experiments. The purpose of defining transient zones is to identify risk areas where the suppression parameters are about to experience a catastrophic rebound, thus preventing image jitter. For pixels located in the transient zone where the light source is leaving, the system performs asymmetric damping smoothing calculations. For example, it constructs a first-order inertial hysteresis filter, assigns a high retention coefficient to the historical actual histogram stretching weights, and assigns a low update coefficient to the baseline histogram stretching weights. The actual local histogram stretching weights are generated through weighted summation. This unidirectional hysteresis design simulates the dark adaptation physical recovery time of the human eye's photosensitive system after the removal of strong light, resulting in a gradual exponential decay of the suppression force and avoiding the sudden whitening and flickering phenomenon in local areas caused by the instantaneous reset of the mapping curve. For pixels not located in the transient zone where the light source leaves, it indicates that the ambient light change is within a reasonable range. The system directly uses the currently calculated baseline histogram stretching weights as the actual local histogram stretching weights to maintain agile response. By collecting and applying all processed actual local histogram stretching weight parameters, the system substitutes the pixels within the initial irregular mask into a nonlinear mapping function to perform histogram suppression mapping, and finally calculates and outputs a verification image with smooth spatiotemporal transitions in brightness.
[0115] This step involves applying asymmetric damping smoothing to the area where the suppression intensity drops sharply, causing the brightness suppression parameters to exhibit a slow release hysteresis characteristic when the light source moves away. This mechanism cuts off the path of violent rebound and jump in the local mapping curve caused by the sudden withdrawal of the highlight, thus eliminating visual flicker in the video image.
[0116] S210. In the image to be verified, along the boundary of the initial irregular mask, extend a preset pixel distance to the inside and outside of the initial irregular mask respectively, and extract the internal sampled pixel set and the external sampled pixel set.
[0117] S211. Calculate the internal information entropy of the internal sampled pixel set and the external information entropy of the external sampled pixel set respectively, and calculate the absolute value of the difference between the internal information entropy and the external information entropy as the information entropy difference.
[0118] S212. Determine whether the information entropy difference is greater than the preset boundary tearing threshold; If so, proceed with step S213 below; If the preset maximum number of expansion iterations is not reached, then proceed with step S214 below.
[0119] S213. Expand the boundary of the initial irregular mask outward to update the initial irregular mask, simultaneously reduce the local histogram stretching weight corresponding to the expanded region, and return to execute the step of using the local histogram stretching weight to perform histogram suppression mapping on the pixels in the initial irregular mask, until the recalculated information entropy difference is less than or equal to the boundary tearing threshold, or the preset maximum number of expansion iterations is reached.
[0120] S214. Determine if the boundary transition is smooth, and render the current image to be verified as the target image.
[0121] Steps S208-S214 and Figure 1 Steps S103-S109 in the illustrated embodiment are similar and can be found in the descriptions of steps S103-S109, which will not be repeated here.
[0122] By combining the spatial distribution characteristics of the highlight area with the motion blur characteristics, an anisotropic distance metric function is constructed to determine the pixel energy value. This allows the attenuation rate of the distance metric model in different spatial directions to adapt to the relative motion trajectory of the light source and the degree of blur stretching. Since the calculated suppression energy distribution shape matches the real asymmetric diffusion contour of the physical light spot, it avoids insufficient suppression of motion blur direction and excessive suppression of the lateral background area caused by the isotropic suppression model. This improves the shape adaptability of histogram optimization and the preservation of details in the dark areas of the image under dynamic highlight scenes.
[0123] The following describes an exemplary low-light environment night view image histogram optimization system 300 provided in an embodiment of this application. Figure 3 This is an exemplary hardware structure diagram of the low-light environment night view image histogram optimization system 300 provided in the embodiments of this application.
[0124] In some embodiments, the low-light environment night view image histogram optimization system 300 is a computer device or includes a computer device in the low-light environment night view image histogram optimization system 300. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device stores data. The network interface of the computer device is used to communicate with other external terminals or servers via a network connection. In some embodiments, the network interface can be a wired network interface; in some embodiments, the network interface can also be a wireless network interface. When the computer program is executed by the processor, it implements the methods in the embodiments of this application.
[0125] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0126] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0127] As used in the above embodiments, depending on the context, the term "when..." can be interpreted as "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if (the stated condition or event) is interpreted as "if determining...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".
[0128] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.
[0129] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A method for optimizing the histogram of night view images in low-light environments, characterized in that, include: The current frame image is acquired, and pixels with brightness values greater than a preset brightness threshold are extracted from the current frame image. The consecutive adjacent pixels are extracted as bright connected regions, and the center point of the light source of the bright connected region is determined as the origin of the bright pixels. Centered on the origin of the bright pixel, the energy value of each of the peripheral pixels is determined based on the distance distribution characteristics of the peripheral pixels in the current frame image from the origin of the bright pixel. Extract the continuous pixel region whose energy value is greater than a preset energy threshold, and use the edge contour of the continuous pixel region as the boundary to generate an initial irregular mask that wraps the origin of the bright pixel. Based on the energy values of each pixel within the initial irregular mask, the corresponding local histogram stretching weights are calculated, and the local histogram stretching weights are used to perform histogram suppression mapping on the pixels within the initial irregular mask to obtain the image to be verified. In the image to be verified, along the boundary of the initial irregular mask, a preset pixel distance is extended to the inside and outside of the initial irregular mask, respectively, to extract the inner sampling pixel set and the outer sampling pixel set; Calculate the internal information entropy of the internal sampled pixel set and the external information entropy of the external sampled pixel set respectively, and calculate the absolute value of the difference between the internal information entropy and the external information entropy as the information entropy difference; Determine whether the information entropy difference is greater than a preset boundary tearing threshold; If the information entropy difference is greater than the boundary tearing threshold, the boundary of the initial irregular mask is expanded outward to update the initial irregular mask. Simultaneously, the local histogram stretching weight corresponding to the expanded region is reduced, and the step of using the local histogram stretching weight to perform histogram suppression mapping on the pixels in the initial irregular mask is returned to be executed until the recalculated information entropy difference is less than or equal to the boundary tearing threshold, or the preset maximum number of expansion iterations is reached. If the information entropy difference is less than or equal to the boundary tearing threshold or reaches the preset maximum expansion iteration number, the boundary transition is determined to be smooth, and the current image to be verified is rendered and output as the target image.
2. The method according to claim 1, characterized in that, If the information entropy difference is greater than the boundary tearing threshold, the boundary of the initial irregular mask is expanded outward to update the initial irregular mask, and the local histogram stretching weight corresponding to the expanded region is reduced simultaneously, specifically including: If the information entropy difference is greater than the boundary tearing threshold, extract the image features on the boundary of the initial irregular mask and calculate the local mutation feature values at each position on the boundary; The boundary positions where the local mutation feature value is greater than the preset physical blocking threshold are divided into physical occlusion hard boundaries, the remaining boundary positions are divided into optical halo soft boundaries, and the path of the physical occlusion hard boundaries expanding outward is blocked. The optical halo soft boundary is driven to expand outward, reconstructing and generating the initial irregular mask with asymmetric updates. Based on the expansion distance of the optical halo soft boundary, the local histogram stretching weight corresponding to the expansion region is reduced synchronously.
3. The method according to claim 1, characterized in that, The step of determining the center point of the light source in the bright connected region as the origin of the bright pixel specifically includes: Extract the initial light source center point of the highlighted connected region; Calculate the spatial position difference between the initial light source center point and the corresponding historical bright pixel origin in the previous frame image, and use it as the centroid offset. Determine whether the centroid offset is greater than a preset detachment threshold. If the centroid offset is greater than the occlusion detachment threshold, the spatial distribution center of the optical halo soft boundary in the previous frame image in the expanded state is extracted, and the direction vector from the origin of the historical bright pixel to the spatial distribution center is calculated as the reference motion trend vector. Based on the reference motion trend vector, the coordinate position of the initial light source center point is smoothly corrected, and the coordinates after the coordinate position smoothing correction are determined as the final origin of the bright pixel. If the centroid offset is less than or equal to the detachment threshold, then the initial light source center point is directly determined as the final origin of the bright pixel.
4. The method according to claim 1, characterized in that, The step of determining the energy value of each peripheral pixel, centered on the origin of the bright pixel and based on the distance distribution characteristics of peripheral pixels in the current frame image from the origin of the bright pixel, specifically includes: Extract the set of two-dimensional spatial coordinates of all pixels within the highlighted connected region; Calculate the second-order spatial distribution feature parameters of the two-dimensional spatial coordinate set, and obtain the main extension direction vector and the secondary extension direction vector of the highlighted connected region based on the second-order spatial distribution feature parameters; Based on the scale difference characteristics between the main extension direction vector and the secondary extension direction vector, the motion distortion coefficient of the highlighted connected region caused by relative motion is calculated; An anisotropic distance metric function is constructed based on the primary extension direction vector, the secondary extension direction vector, and the trailing distortion coefficient; the distance attenuation rate of the anisotropic distance metric function on the primary extension direction vector is lower than the distance attenuation rate on the secondary extension direction vector. Substitute the coordinates of each of the peripheral pixels into the anisotropic distance metric function to calculate the anisotropic distance of each of the peripheral pixels relative to the origin of the highlight pixel; Using the anisotropic distance as the distance distribution feature, the energy value of each peripheral pixel is calculated and determined.
5. The method according to claim 4, characterized in that, The construction of an anisotropic distance metric function based on the primary extension direction vector, the secondary extension direction vector, and the trailing distortion coefficient specifically includes: Extract the geometric distribution center of the bright connected region, and calculate the energy concentration centroid of the bright connected region by combining the pixel brightness value; Calculate the centroid eccentricity vector pointing from the geometric distribution center to the energy accumulation centroid; Based on the directional component of the centroid eccentricity vector on the main extension direction vector, the main extension direction vector is split into a leading motion half-axis and a hysteresis trailing half-axis. Based on the leading motion half-axis, the hysteresis half-axis, the secondary extension direction vector, and the shadow deformation coefficient, an asymmetric anisotropic distance metric function is constructed. The asymmetric anisotropic distance metric function is configured such that the distance attenuation rate on the hysteresis half-axis is lower than the distance attenuation rate on the leading motion half-axis, and the distance attenuation rate on the leading motion half-axis is lower than the distance attenuation rate on the secondary extension direction vector.
6. The method according to claim 1, characterized in that, The step of calculating the corresponding local histogram stretching weights based on the energy values of each pixel within the initial irregular mask, and then using these local histogram stretching weights to perform histogram suppression mapping on the pixels within the initial irregular mask to obtain the image to be verified, specifically includes: Based on the energy values of each pixel within the initial irregular mask, calculate the baseline histogram stretching weight of each pixel in the current frame; Obtain the historical actual histogram stretching weights for the corresponding position in the previous time series; Calculate the time difference change of the baseline histogram stretching weights relative to the historical actual histogram stretching weights; Determine the trend and magnitude of the change represented by the change in time difference. If the trend is that the histogram suppression intensity is decreasing and the magnitude of the change is greater than the preset release jump threshold, the corresponding pixel is divided into the transient region where the light source leaves. For the pixel in the transient zone where the light source leaves, the reference histogram stretching weight is subjected to asymmetric damping smoothing calculation based on the historical actual histogram stretching weight to generate the actual local histogram stretching weight. For the pixels that are not in the transient region where the light source leaves, the reference histogram stretching weight is directly used as the actual local histogram stretching weight, and histogram suppression mapping is performed using the actual local histogram stretching weights of all the pixels to obtain the image to be verified.
7. The method according to claim 1, characterized in that, The step of calculating the internal information entropy of the internal sampled pixel set and the external information entropy of the external sampled pixel set, and calculating the absolute value of the difference between the internal information entropy and the external information entropy as the information entropy difference, specifically includes: The internal sampled pixel set and the external sampled pixel set are extracted and arranged along the boundary contour trajectory of the initial irregular mask to construct an internal one-dimensional spatial sequence and an external one-dimensional spatial sequence; A preset smoothing filtering algorithm is used to perform spatial domain denoising on the inner one-dimensional spatial sequence and the outer one-dimensional spatial sequence to obtain a denoised inner sequence and a denoised outer sequence. Calculate the internal information entropy of the denoised internal sequence and the external information entropy of the denoised external sequence, respectively. The absolute value of the difference between the internal information entropy and the external information entropy is calculated as the information entropy difference.
8. A low-light environment night view image histogram optimization system, characterized in that, The low-light environment night view image histogram optimization system includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the low-light environment night view image histogram optimization system to perform the method as described in any one of claims 1-7.
9. A computer program product containing instructions, characterized in that, When the computer program product is run on the low-light environment night view image histogram optimization system, the low-light environment night view image histogram optimization system performs the method as described in any one of claims 1-7.
10. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on the low-light environment night view image histogram optimization system, the low-light environment night view image histogram optimization system performs the method as described in any one of claims 1-7.