Automobile light distribution quality analysis method and system based on spot image gradient
By adaptively setting the two-stage clustering cutoff distance and the multi-dimensional spatial partitioning tree, the problem of low region partitioning accuracy caused by the multi-scale density heterogeneity of light spot gradient images in the existing technology is solved, and high-precision automated detection of motor vehicle light distribution quality is realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CONGHUA JUNHAO VEHICLE PARTS CO LTD
- Filing Date
- 2026-04-16
- Publication Date
- 2026-07-14
AI Technical Summary
Existing density peak clustering algorithms cannot adapt to the heterogeneous characteristics of multi-scale density when processing light spot gradient images due to the globally uniform cutoff distance. This results in low accuracy in dividing the light distribution functional area, making it difficult to meet the automated detection requirements of motor vehicle light distribution quality.
A vehicle light distribution quality analysis method based on light spot image gradient is adopted. By adaptively setting the two-stage clustering cutoff distance, combining window oscillation rate and density stratification index, and utilizing multi-dimensional spatial partitioning tree and consistency verification mechanism, the functional regions of the light spot are accurately segmented.
It improves the accuracy and robustness of light distribution quality detection, and can accurately quantify functional areas of light spots such as cutoff line and uniform light distribution area, realizing high-precision automated detection.
Smart Images

Figure CN122391130A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of light distribution quality analysis, and in particular to a method and system for analyzing the light distribution quality of motor vehicles based on light spot image gradients. Background Technology
[0002] The light distribution quality of motor vehicle headlights directly affects the clarity of nighttime driving vision and glare control for oncoming vehicles, making it a key indicator in vehicle safety testing. According to domestic and international mandatory standards such as GB4785 and ECE R112, qualified headlight beams must simultaneously meet several stringent requirements: the low beam should have a clear cutoff line to form a "Z"-shaped asymmetrical distribution, avoiding glare for oncoming drivers; the high beam must concentrate sufficient luminous flux in the hot zone (i.e., the area with the highest illuminance) to ensure illumination needs at long distances; simultaneously, the illuminance should gradually decrease from the hot zone to the surrounding areas, avoiding abrupt bright spots or dark areas and ensuring uniform light distribution.
[0003] Traditional manual visual inspection methods rely on the subjective experience of quality inspectors to judge the shape and boundary of light spots. This is subject to significant individual differences and the risk of misjudgment due to visual fatigue, making it difficult to meet the real-time and consistent inspection requirements of mass production lines. While sampling measurement methods based on single-point illuminance meters can obtain illuminance values at specific locations, they cannot fully reflect the two-dimensional spatial distribution characteristics of the light spot. In particular, they are difficult to quantify the sharpness of the cutoff line, the gradient change rate of the transition zone, and the subtle fluctuations in the uniform light distribution zone, resulting in the omission of a large number of local light distribution defects.
[0004] With the development of machine vision technology, automated analysis based on spot images has become a mainstream approach. Among these, spot gradient images, by calculating the rate of change of illuminance in space, can transform key features such as cutoff line contours, hot zone boundaries, and uniformity of illumination into calculable gradient magnitude and direction distributions, providing a data foundation for automated detection. Density Peak Clustering (DPC) algorithms, due to their advantages such as no need for pre-training, clear physical meaning of cluster centers, and strong adaptability to non-uniform distributions, have been attempted for the segmentation of functional regions of spot images. However, actually acquired spot gradient images exhibit significant multi-scale density heterogeneity: gradient magnitudes are extremely high and pixels are densely clustered near the cutoff line, while gradient magnitudes are weak and pixel distribution is extremely sparse in uniformly illuminated regions. This density difference can reach tens or even hundreds of times. Traditional DPC algorithms rely on a globally uniform cutoff distance parameter. :like If the setting is too large, the fine boundary structure of the cutoff line will be obscured by the smoothing; if If the setting is too small, the uniform light distribution area will generate a large number of fragmented clusters due to local density fluctuations. This structural contradiction leads to a significant decrease in the region segmentation accuracy of existing methods in the analysis of vehicle light distribution quality. Summary of the Invention
[0005] To address the problem that existing density peak clustering algorithms suffer from low accuracy in dividing light distribution functional regions when processing light spot gradient images due to the inability of the globally uniform cutoff distance to adapt to the heterogeneous characteristics of multi-scale densities, this invention provides a method and system for analyzing the light distribution quality of motor vehicles based on light spot image gradients.
[0006] In a first aspect, the present invention provides a method for analyzing the light distribution quality of motor vehicles based on light spot image gradients, employing the following technical solution: A method for analyzing the light distribution quality of motor vehicles based on light spot image gradients includes the following steps: acquiring a standardized light spot gradient image; dividing the standardized light spot gradient image into multiple non-overlapping windows; calculating the oscillation rate of each window; dividing all windows into high-oscillation groups and low-oscillation groups based on the oscillation rate of each window; calculating the density stratification index; the density stratification index is positively correlated with the inter-class mean difference between the high-oscillation group and the low-oscillation group, and negatively correlated with the intra-class variance within the group; extracting the median nearest neighbor distance of the high-gradient feature point set corresponding to the low-oscillation group, and the median nearest neighbor distance of the low-gradient feature point set corresponding to the high-oscillation group; and calculating the density stratification index based on the median nearest neighbor distance of the low-gradient feature point set and the high-gradient feature point set. The median nearest neighbor distance of the feature point set is adaptively set to determine the two-stage clustering cutoff distance. This method performs multi-level region segmentation on the standardized light spot gradient image and outputs functional region annotation results. Based on this, evaluation indicators are extracted to complete the analysis of motor vehicle light distribution quality. The adaptive method for determining the two-stage clustering cutoff distance is as follows: the median nearest neighbor distance of the low-gradient feature point set is divided by the median nearest neighbor distance of the high-gradient feature point set, and the quotient is used as the scale separation index. The median nearest neighbor distance of the low-gradient feature point set is used as the first-stage coarse clustering cutoff distance, and the median nearest neighbor distance of the high-gradient feature point set is used as the second-stage fine clustering cutoff distance to guide the execution of the density peak clustering algorithm.
[0007] The technical advantage of this invention is that it overcomes the shortcomings of existing density peak clustering algorithms, which rely on a globally uniform cutoff distance when dealing with the multi-scale density heterogeneity of light spot images, which can easily lead to a decrease in the accuracy of region segmentation. By combining the window oscillation rate to adaptively derive the two-stage clustering cutoff distance, it achieves accurate segmentation of light spot functional regions such as cutoff lines and uniform light distribution areas in the light distribution quality inspection scenario of motor vehicle headlights, thereby improving the accuracy and robustness of automated light distribution quality inspection.
[0008] Preferably, the specific steps for obtaining a standardized light spot gradient image are as follows: Gaussian filtering is used to smooth and denoise the acquired grayscale light spot image; the Sobel operator is used to calculate the first-order partial derivatives of each pixel in the horizontal and vertical directions respectively; the squares of the first-order partial derivatives in the horizontal and vertical directions are summed, and the square root operation is performed on the summed value to synthesize a gradient magnitude image; the gradient magnitude image is subjected to maximum and minimum normalization processing to linearly map the pixel values to the interval between zero and one, thereby obtaining a standardized light spot gradient image.
[0009] The technical effect of this invention is that by combining Gaussian filtering and the Sobel operator to preprocess the original detection image, random noise interference in the darkroom industrial acquisition environment is effectively suppressed, and the spatial variation rate of illumination is accurately quantified without destroying edge details, providing a high-quality data base for the stable division of complex light spot areas.
[0010] Preferably, the method for calculating the oscillation rate of each window is as follows: initialize the active contour in the corresponding window, record the total energy during contour iteration step by step, and calculate the first difference between the energies of two adjacent steps; extract the minimum value of the amplitude of the first difference between the energies of two adjacent steps as the amplitude weight; determine whether the signs of the first difference between the energies of two adjacent steps are consistent; if they are consistent, extract the corresponding amplitude weights and sum them up to obtain the numerator sum; sum the amplitude weights of all iteration steps to obtain the denominator sum; divide the numerator sum by the denominator sum to obtain the energy evolution ratio, and subtract the energy evolution ratio from the preset constant to obtain the oscillation rate of the corresponding window.
[0011] The technical advantage of this invention is that, compared with simple contour flip count statistics, this method introduces energy difference amplitude weight and direction change information to calculate window oscillation rate, which can accurately remove the small fluctuations caused by environmental noise, truly restore the oscillation situation under different gradient drives, and improve the reliability of the system in identifying the density attributes of various light distribution areas in actual vehicle headlight detection.
[0012] Preferably, the specific steps for dividing all non-overlapping windows into high-oscillation groups and low-oscillation groups are as follows: construct a one-dimensional sequence based on the oscillation rates of all non-overlapping windows, and automatically determine the optimal segmentation threshold using the Otsu method; classify non-overlapping windows with oscillation rates greater than or equal to the optimal segmentation threshold into the high-oscillation group, and classify non-overlapping windows with oscillation rates less than the optimal segmentation threshold into the low-oscillation group.
[0013] The technical advantage of this invention is that it uses the Otsu method to automatically determine the optimal segmentation threshold of the window oscillation rate in a data-driven manner, avoiding the subjective error caused by manually setting a fixed threshold based on experience. This enables the automated detection system to adapt to photometric testing scenarios under different vehicle models and exposure conditions.
[0014] Preferably, the method for calculating the density stratification index is as follows: Calculate the mean oscillation, variance oscillation, and number of windows for each of the high-oscillation group and the low-oscillation group; calculate the square of the difference between the mean oscillation of the high-oscillation group and the mean oscillation of the low-oscillation group, using this as the first operand; calculate the sum of the variances of the high-oscillation group and the low-oscillation group, using this as the second operand; compare the number of windows for the high-oscillation group and the low-oscillation group, extract the minimum and maximum values, and divide the minimum by the maximum to obtain the correction factor; divide the first operand by the second operand to obtain the base quotient; multiply the base quotient by the correction factor to obtain the density stratification index.
[0015] The technical advantage of this invention is that it introduces a correction factor based on the sample size ratio when statistically analyzing the density stratification index, which effectively avoids the statistical evaluation distortion caused by the small intraclass variance when the cutoff line is blurred due to small sample size or light distribution defects.
[0016] Preferably, the step of extracting the median nearest neighbor distance is as follows: pixels with gradient magnitudes exceeding the local mean within the low oscillation group window are assigned to the high gradient feature point set, and the corresponding pixels of the high oscillation group are assigned to the low gradient feature point set; for each feature point in the high gradient feature point set, the nearest neighbor distance of its specified order is found using a multidimensional space partitioning tree, and the median of the nearest neighbor distances of all points is taken as the median nearest neighbor distance of the high gradient feature point set; the same search logic is performed for the low gradient feature point set to obtain the median nearest neighbor distance of the low gradient feature point set.
[0017] The technical advantages of this invention are that by using a multi-dimensional spatial partitioning tree and median extraction strategy to obtain the nearest neighbor distance, the time cost of nearest neighbor search is greatly reduced when processing a large number of light spot gradient feature points. At the same time, the noise resistance of the median is used to improve the fault tolerance rate for free light spots or abnormal outliers, and ensure the accurate calculation of the cutoff distance setting.
[0018] Preferably, the method for adaptively setting the two-stage clustering cutoff distance further includes a consistency check step: determining whether the median nearest neighbor distance of the low-gradient feature point set is greater than twice the median nearest neighbor distance of the high-gradient feature point set; if it is greater, it is determined that the two-stage scale difference is significant, and two-stage density peak clustering is performed; if it is less than or equal to, the effective scale separation index is set to 1, the algorithm degenerates into single-stage density peak clustering, the cutoff distance is taken as the median nearest neighbor distance of the low-gradient feature point set, and a defect alarm is triggered.
[0019] The technical effect of this invention is that by introducing a consistency verification mechanism to dynamically judge the scale difference between the two stages, the detection system can promptly trigger single-stage degradation and defect alarms when encountering extreme detection conditions such as severe light distribution defects or highly similar feature scales. This avoids misjudgments caused by forced clustering of algorithms and improves the security and business fault tolerance of the automatic quality inspection system.
[0020] Preferably, the specific steps for multi-level region segmentation of the standardized light spot gradient image are as follows: In the first stage, the density peak clustering algorithm is run in the global feature space with the first stage coarse clustering cutoff distance to identify the cluster center and complete the coarse segmentation of the hot zone, transition zone and uniform light distribution zone; the feature point with the lowest local density between adjacent coarse segmentation regions is extracted as the saddle point, and the coordinates of the saddle point are used as the boundary seed point to define the spatial range of each coarse segmentation region; if the density stratification index in the coarse segmentation region is not lower than the preset threshold, the second stage is entered, and the local density peak clustering algorithm is run again with the second stage fine clustering cutoff distance to output the multi-level clustering result covering the fine boundary structure.
[0021] The technical effect of this invention is that it combines global coarse segmentation with local fine segmentation, and accurately defines the transition boundary through saddle points. This can quickly lock large areas of hot zones and uniform light distribution zones, while also perfectly preserving the fine transition structure of areas such as cutoff lines. This fundamentally overcomes the pain point of boundary structure loss caused by single-scale clustering, and realizes the refinement of the extraction of vehicle lamp light distribution quality evaluation indicators.
[0022] Preferably, the steps for outputting the functional area annotation results are as follows: execute the following annotation rules in sequence: label the cluster with the highest average gradient amplitude and spatial aspect ratio exceeding the preset threshold in the second-stage clustering as the cutoff line; label the cluster with the closest spatial distance to the highest illuminance reference value measurement point in the first-stage coarse clustering as the hot zone; label the cluster with the lowest average gradient amplitude and largest spatial area in the first-stage coarse clustering as the uniform light distribution zone; label the remaining clusters as transition zones; after each type of annotation is completed, remove the corresponding cluster from the set to be annotated.
[0023] The technical effect of this invention is that, based on the spatial aspect ratio, gradient magnitude and distance and other physical geometric attributes of the clustering results, a hierarchical stripping labeling rule is established, which accurately maps the abstract clustering data at the bottom layer to the actual motor vehicle light distribution test indicators such as the cutoff line and hot zone required by national standards and specifications, thereby realizing the standardized presentation of complex light distribution characteristics.
[0024] Secondly, the present invention provides a vehicle light distribution quality analysis system based on light spot image gradient, which adopts the following technical solution: A vehicle light distribution quality analysis system based on light spot image gradient includes a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement the vehicle light distribution quality analysis method based on light spot image gradient described above.
[0025] The above-mentioned method for analyzing the light distribution quality of motor vehicles based on light spot image gradients is generated into a computer program and stored in a memory so that it can be loaded and executed by a processor. Thus, a system can be built based on the memory and processor for convenient use.
[0026] The present invention has the following technical effects: This invention proposes a method and system for analyzing the light distribution quality of motor vehicles based on light spot image gradient and adaptive two-stage density peak clustering (DPC). Addressing the problem of low accuracy in existing DPC algorithms due to the multi-scale density heterogeneity of light spot images when using a single cutoff distance, this invention innovatively introduces active contour energy oscillation rate to quantify the macroscopic density layering of the image region. Based on this, coarse and fine two-stage clustering cutoff distances are adaptively derived. Combined with a consistency verification mechanism and multi-dimensional spatial scale separation methods, this invention effectively preserves the fine boundaries of the cutoff line while avoiding fragmented clustering of uniform light distribution areas. Thus, in practical industrial scenarios such as headlight inspection, it achieves high-precision and fully automated quantitative analysis of the light distribution quality of motor vehicles. Attached Figure Description
[0027] Figure 1 This is a flowchart of the method for analyzing the light distribution quality of motor vehicles based on the gradient of light spot images according to the present invention.
[0028] Figure 2 This is the original image of the light spot image.
[0029] Figure 3 This is a schematic diagram of the partitioning result of the two-stage DPC improvement algorithm of the present invention. Detailed Implementation
[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0031] This invention discloses a method for analyzing the light distribution quality of motor vehicles based on light spot image gradients, referring to... Figure 1 This includes the following steps: Step S1: Data acquisition and preprocessing.
[0032] In a darkroom environment conforming to GB4785 standards, the headlight under test is mounted on a six-DOF positioning fixture, with the measurement distance fixed at 25m. An industrial-grade CCD camera with a resolution of no less than 2048×2048 pixels is used to capture light spot images directly facing a standard measurement screen. The light spot images are grayscale images. Simultaneously, illuminance reference values at each standard measurement point are collected through a silicon photodiode sensor grid arranged on the surface of the measurement screen, which are used for calibration of light distribution quality evaluation in subsequent steps. After the luminaire is preheated for 15 minutes to a stable state, the synchronous controller triggers the camera and sensor grid to synchronously sample, and the data is recorded uniformly to the industrial control computer.
[0033] The acquired light spot images were smoothed and denoised using a Gaussian filter with a kernel size of 5×5 and a standard deviation of [missing value]. Then, the Sobel operator is used to calculate the first-order partial derivatives of each pixel in the horizontal and vertical directions. , At the same time, retain , This is used for gradient direction analysis in step five and for synthesizing gradient magnitude images. Perform min-max normalization on the gradient magnitude image to linearly map pixel values to... This yields a standardized light spot gradient image, which serves as the unified input for subsequent steps.
[0034] Step S2: Calculate the oscillation rate.
[0035] In standardized light spot gradient images, the gradient amplitude is dense and strong near the cutoff line, while the gradient is weak and sparse in the uniformly distributed region, showing a significant difference in gradient density between the two types of regions. When an active contour model is applied to the gradient image for iteration, according to the energy functional theory of the active contour model, the contour evolution is driven by both internal elastic energy and external gradient attraction energy. In the high gradient region near the cutoff line, the strong external gradient attraction causes the contour energy to decrease monotonically, and the energy difference sign remains consistent and the amplitude remains significant in each iteration. In the low gradient region of the uniformly distributed region, the external gradient force is extremely weak, and the internal smoothing constraint force dominates the contour evolution, resulting in repeated energy fluctuations and frequent alternation of the difference sign, with small amplitudes before and after each alternation. The high gradient region not only has fewer alternations but also a large amplitude of continuous unidirectional energy decrease; the low gradient region not only has frequent alternations but also small amplitudes of the difference in each step. Simply counting the number of alternations cannot distinguish between small alternations caused by noise and real oscillations driven by the gradient; amplitude information must be introduced for weighting. Therefore, the oscillation rate is calculated window by window, with the weighted cumulative intensity of the change in the energy difference direction as the core. It quantitatively describes the gradient density properties of each region.
[0036] The normalized light spot gradient image is divided into several non-overlapping 16×16 pixel windows. For the first... A window is initialized with a circular active contour, and the total number of iterations is set. Record the number of iterations step by step. Total energy of time profile Calculate the first-order difference The following formula yields the first... The oscillation rate of each window.
[0037] set up , Then the oscillation rate of each window is:
[0038] in, For the first The oscillation rate of each window, with a value range of [value missing]. ; This is an indicator function; it takes the value 1 if the condition inside the parentheses is true, and 0 otherwise. For the first Step, First The minimum value of the difference amplitude of the step is used as the amplitude weight of that step; Indicates the first The window in the first The oscillation indicator value of the step; the numerator is the sum of the amplitude weights of all adjacent difference pairs with the same sign, and the denominator is the sum of the amplitude weights of all adjacent difference pairs; This represents the total number of iterations; a reference value of 50 steps is used. For the first The window in the first The energy of the first-order difference step.
[0039] Within the window of the high gradient dense region of the cutoff line, The signs remain consistent and the amplitudes are large. Term terms with large amplitudes all participate in the numerator accumulation, and the ratio of numerator to denominator approaches 1. Approaching 0; in the window of the low gradient region of uniform light distribution, the difference sign flips frequently with small amplitudes, and large amplitude terms do not participate in molecule accumulation due to inconsistent signs. Increase.
[0040] Step S3: Calculate the density stratification index.
[0041] In oscillation rate Further analysis of its statistical characteristics based on the distribution: It exhibits a significant bimodal clustering distribution within the image space—the high gradient region window at the cutoff line. Concentrated in the low-value region close to 0, the window of uniform light distribution. Concentrated in the higher value region, with a distinct valley between the two peaks. The clearer the cutoff line, the more pronounced the two sets of peaks. The more compact the distribution and the larger the mean difference, the more overlapping and diffuse the two distributions become when the cutoff line is blurred or the light distribution is uneven. According to Fisher's linear discriminant theory, the separability of two classes of data is quantitatively measured by the ratio of the square of the difference between the inter-class means to the sum of the within-class variances; a larger ratio indicates a clearer density stratification structure. However, when the sample size is too small, the within-class variance may approach 0, potentially leading to an artificially high Fisher's ratio. Therefore, sample size correction is needed to ensure statistical reliability. For this purpose, a density stratification index is constructed using the corrected Fisher's discriminant ratio. This quantifies the clarity of the density layers in the light spot image and provides a basis for partitioning in subsequent feature scale analysis steps.
[0042] With the overall window oscillation rate A one-dimensional sequence is constructed, and the optimal segmentation threshold is automatically determined using Otsu's method. All windows are divided into high oscillation groups ( The low gradient region (denoted as group H) and the low oscillation group ( (High gradient region, denoted as group L), count the number of windows in each group separately. , oscillation rate mean , With variance , .
[0043] The expression for the density stratification index is:
[0044] in, This is the density stratification index; a larger value indicates clearer density stratification. , The oscillation rates of groups H and L are respectively. Mean; , Two sets of oscillation rates The variance; , The number of windows for group H and group L are respectively; correction factor It approaches 1 when both groups have sufficient sample sizes, and automatically decreases when the sample size is extremely small. To avoid inflated statistics; Otsu threshold Automatically calculated by maximizing inter-class variance.
[0045] When the cutoff line is clear, the two distributions are compact with a large mean difference, the Fisher ratio term increases significantly, the correction factor is close to 1, and the density stratification index... Significantly increased; when the number of windows in a certain group is extremely small (e.g. When ), the correction factor becomes smaller. Automatic reduction to avoid artificially high values for small samples; when light distribution defects cause the cutoff line to blur, the two distributions overlap. Reduced. Compared to methods that rely on absolute thresholds of gradient magnitude for stratification, the density stratification index... It can stably reflect the density stratification structure under different vehicle models and exposure conditions, and the sample size correction further improves the statistical reliability.
[0046] Step S4: Calculate the scale separation index.
[0047] In oscillation rate With density stratification index Based on the description of the macroscopic density stratification morphology, this paper further analyzes the actual distribution scale of feature points in each functional area in the feature space. According to the DPC algorithm theory, the truncation distance... Essentially, it estimates the neighborhood radius of the local density, when Density estimation is most accurate when matched with the typical nearest neighbor spacing of feature points. In spot gradient images, feature points in high gradient regions are closely spaced within the feature space, while feature points in low gradient regions are sparsely distributed, reaching several to tens of times the typical spacing in high gradient regions. The two-stage DPC cutoff distance must satisfy: the first-stage coarse segmentation cutoff distance... It must cover the feature neighborhood of the low gradient region, and the second stage fine-truncation distance. The fine boundary of the cutoff line must be accurately distinguished, and the ratio between the two is determined by the scale ratio of the high and low gradient regions. Therefore, a scale separation index is constructed. , with high and low gradient regions The ratio of nearest-neighbor median distances quantifies the scale span of the two-stage cutoff distance, which is crucial for subsequent steps. , The automatic determination provides a numerical basis.
[0048] Based on the H and L group window labels obtained from the Otsu segmentation in step S3, pixels within the L group window whose gradient magnitude exceeds the local mean of that window are assigned to the high gradient feature point set. Pixels within window H whose gradient magnitude exceeds the local mean of that window are assigned to the low-gradient feature point set. ;right Each feature point Use a KD-tree to find its first... Nearest neighbor distance Take the median of all points to get ;right The same method is used to obtain , Take the reference value of 5.
[0049] Scale Separation Index The expression is:
[0050] A consistency check is introduced to obtain the effective scale separation index, expressed as:
[0051] in, The scale separation index has a range of values of 100. A larger value indicates a more significant difference in the scale of characteristic distribution in high and low gradient regions. For high gradient feature point set The first of all points inside The median nearest neighbor distance, in pixels, is directly used as the second-stage cutoff distance. ; low gradient feature point set The first of all points inside The median nearest neighbor distance, in pixels, is used directly as the first-stage cutoff distance. ; The nearest neighbor order is used, with a reference value of 5. The effective scale separation index after consistency verification, when If the two-stage scale difference is significant, perform a two-stage DPC; otherwise... The algorithm automatically degenerates into a single-stage DPC.
[0052] When the gradient is highly concentrated at the cutoff line, Reduce; when the gradient in the uniform light distribution region is extremely sparse. Increase, scale separation index Significantly increased; when light distribution defects are severe, the scale of characteristic points in the two regions tends to converge. Trending towards 1, Trigger degradation and alarm mechanisms. Compared to manually setting fixed values based on experience. The method, scale separation index It is automatically derived entirely based on the current image feature space geometry, and the use of median distance further enhances the robustness to outliers.
[0053] Step S5: Improve algorithm implementation and analyze light distribution quality.
[0054] Based on the effective scale separation index obtained in step S4 and the two regions The median distance to nearest neighbors is used as the cutoff distance for the first-stage coarse clustering. Second-stage fine clustering cutoff distance The ratio of the two is the scale separation index. .when At this point, the algorithm degenerates into a single-stage DPC, with the cutoff distance taken as... And trigger a defect alarm. When At that time, a two-phase process is executed: the first phase is... The DPC algorithm is run in the global feature space to identify cluster centers in the density decision map, completing the coarse segmentation of the hot zone, transition zone, and uniform light distribution zone. Between stages, the coordinates of the feature points (saddle points) with the lowest local density between adjacent coarse zones are used as boundary seed points to accurately define the spatial range of each coarse zone, and the density stratification index is used. As a basis for selective refinement, if the local density stratification index within a certain coarse partition... If the value is below a preset threshold (reference value 0.3), skip the fine-tuning process; otherwise, proceed to the second stage. Rerun the local DPC algorithm to accurately identify fine gradient structures such as cutoff line contours and hot zone boundaries, and output multi-level clustering results covering macroscopic functional regions and fine boundary structures.
[0055] The multi-level clustering results are mapped back to the pixel space of the original light spot image, and four functional regions—hot zones, cutoff lines, transition zones, and uniform light distribution zones—are automatically labeled. The specific labeling method for these four functional regions is as follows: The clustering results output by the two-stage DPC are assigned functional labels sequentially according to the following rules: In the second-stage fine clustering, the cluster with the highest average gradient magnitude and a spatial aspect ratio exceeding a preset threshold (reference value 3.0) is labeled as the cutoff line; in the first-stage coarse clustering, the cluster with the closest spatial distance to the highest illuminance reference value measurement point in step S1 is labeled as the hot zone; in the first-stage coarse clustering, the cluster with the lowest average gradient magnitude and the largest spatial area is labeled as the uniform light distribution zone; the remaining clusters are labeled as transition zones. The above rules are executed sequentially in the order of cutoff line → hot zone → uniform light distribution zone → transition zone. After each type of labeling is completed, the corresponding cluster is removed from the set to be labeled to avoid duplicate assignment.
[0056] After completing the functional area labeling, the statistical characteristics carried by the cluster structure itself are directly used to extract light distribution quality evaluation indicators from the following dimensions to analyze the light distribution quality.
[0057] Cutoff line sharpness: variance of gradient magnitude within the cutoff line clustering region It directly reflects the sharpness of the cutoff line. When the cutoff line is sharp, the pixels in the corresponding cluster region are highly concentrated in the feature space. Minimal; when the cutoff line is blurred, boundary pixels are diffused. Significantly increased. Exceeding the preset threshold is considered unqualified. The preset threshold is obtained by measuring the variance of the gradient magnitude within the cutoff line under the condition of a standard spot image.
[0058] Light distribution uniformity: During the second stage of DPC's further operation within the coarse clusters in the uniform light distribution region, if multiple density peaks exist within that region, multiple sub-clusters will be identified. The number of sub-clusters is denoted as... When the light distribution is uniform, the gradient distribution within the uniform light distribution area is highly consistent, and there are no identifiable density peaks. When periodic uneven brightness or local hotspots exist, multiple density concentration points form within the region. Increase. With If the light distribution uniformity exceeds the preset threshold (reference value 2), it is determined to be unqualified. If in step S4... If the calibration triggers the uniform light distribution area to skip fine processing, then proceed directly with... Record it, but do not judge it as unqualified.
[0059] Transition region width: The coordinate span of the transition region cluster member pixels along the direction perpendicular to the cutoff line. This directly reflects whether the light distribution transition is smooth. When the size is too small, the transition zone is narrow, and the light distribution changes drastically. When the light intensity is too high, the transition between the cutoff line and the hot zone is slow, and the light distribution layer is unclear. Exceeding the allowable range (reference value range) (Pixel) The transition characteristics are deemed unqualified.
[0060] The technical effects of this invention can also be illustrated in conjunction with the accompanying drawings. Figure 2 This is the original image of the light spot image. Figure 3 This diagram illustrates the partitioning results of the two-stage DPC improvement algorithm of this invention. The diagram accurately labels four regions: the hot zone, the cutoff line, the transition zone, and the uniform light distribution zone. The specific details are as follows: Cutoff line: In the second-stage fine clustering, the algorithm utilizes a smaller cutoff distance derived from the scale separation index. It accurately identifies local density peak regions with the highest average gradient magnitude and spatial aspect ratio exceeding a preset threshold, effectively preserving the fine boundary structure near the cutoff line and avoiding the loss of boundary features caused by traditional large cutoff distances.
[0061] Hot zone: It was accurately located in the first stage coarse clustering. This clustering region is the closest in spatial distance to the measurement point with the highest illuminance reference value, and the core bright part of the headlight spot was completely and clearly extracted.
[0062] Uniform light distribution region: also based on the larger cutoff distance in the first-stage coarse clustering. The region was accurately identified as a complete color patch with the lowest average gradient magnitude and the largest spatial distribution area. As can be seen from the illustration, even with scattered minor defects within this region, the algorithm maintained the overall connectivity of this low-gradient area, fundamentally eliminating the fragmented clustering phenomenon that traditional small truncation distance algorithms are prone to cause in this region.
[0063] Transition zone: Clearly defined between the hot zone, the cutoff line, and the uniform light distribution zone, encompassing all other cluster members. The coordinate span of this region along the direction perpendicular to the cutoff line is fully preserved, intuitively reflecting the smooth gradual change of the illuminance gradient, providing a highly reliable image data foundation for subsequent calculation of the transition zone width and analysis of light distribution transition characteristics.
[0064] Overall, Figure 3 This intuitively demonstrates the effectiveness of the two-stage processing flow driven by scale separation and density stratification linkage, as well as the saddle point connection mechanism in this invention. The result realizes a multi-level clustering closed loop from the macroscopic light distribution functional area to the microscopic fine boundary, improving the accuracy and robustness of automated analysis of motor vehicle light distribution quality.
[0065] This invention also discloses a vehicle light distribution quality analysis system based on light spot image gradient, including a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement the vehicle light distribution quality analysis method based on light spot image gradient according to this invention.
[0066] The system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and will not be described in detail here.
[0067] The above are all preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape and principle of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A method for analyzing the light distribution quality of motor vehicles based on light spot image gradients, characterized in that, The steps include: acquiring a standardized light spot gradient image; dividing the standardized light spot gradient image into multiple windows and calculating the oscillation rate of each window; dividing all windows into high-oscillation groups and low-oscillation groups based on the oscillation rate of each window, and calculating the density stratification index; the density stratification index is positively correlated with the inter-class mean difference between the high-oscillation group and the low-oscillation group, and negatively correlated with the intra-class variance within the group; extracting the median nearest neighbor distance of the high-gradient feature point set corresponding to the low-oscillation group, and the median nearest neighbor distance of the low-gradient feature point set corresponding to the high-oscillation group; and calculating the density stratification index based on the median nearest neighbor distance of the low-gradient feature point set and the median nearest neighbor distance of the high-gradient feature point set. An adaptive two-stage clustering cutoff distance is used to perform multi-level region segmentation on standardized light spot gradient images and output functional region annotation results. Based on this, evaluation indicators are extracted to complete the analysis of motor vehicle light distribution quality. The method of adaptively setting the two-stage clustering cutoff distance is as follows: the median nearest neighbor distance of the low gradient feature point set is divided by the median nearest neighbor distance of the high gradient feature point set, and the quotient is used as the scale separation index. The median nearest neighbor distance of the low gradient feature point set is used as the first-stage coarse clustering cutoff distance, and the median nearest neighbor distance of the high gradient feature point set is used as the second-stage fine clustering cutoff distance to guide the execution of the density peak clustering algorithm.
2. The method for analyzing the light distribution quality of motor vehicles based on light spot image gradients according to claim 1, characterized in that, The specific steps for obtaining a standardized spot gradient image are as follows: Gaussian filtering is used to smooth and denoise the acquired grayscale spot image; the Sobel operator is used to calculate the first-order partial derivatives of each pixel in the horizontal and vertical directions; the squares of the first-order partial derivatives in the horizontal and vertical directions are summed, and the square root operation is performed on the summed value to synthesize a gradient magnitude image; the gradient magnitude image is subjected to max-min normalization to linearly map the pixel values to the interval between zero and one, thus obtaining a standardized spot gradient image.
3. The method for analyzing the light distribution quality of motor vehicles based on light spot image gradients according to claim 1, characterized in that, The method for calculating the oscillation rate of each window is as follows: initialize the active contour in the corresponding window, record the total energy during contour iteration step by step, and calculate the first difference between the energies of two adjacent steps; extract the minimum value of the amplitude of the first difference between the energies of two adjacent steps as the amplitude weight. Determine if the first-order difference signs of the energies of two adjacent steps are consistent. If they are consistent, extract the corresponding amplitude weights and sum them up to obtain the numerator sum. Sum the amplitude weights of all iteration steps to obtain the denominator sum. Divide the sum of the numerators by the sum of the denominators to obtain the energy evolution ratio. Subtract the energy evolution ratio from the preset constant to obtain the oscillation rate of the corresponding window.
4. The method for analyzing the light distribution quality of motor vehicles based on light spot image gradients according to claim 1, characterized in that, The specific steps for dividing all non-overlapping windows into high-oscillation groups and low-oscillation groups are as follows: construct a one-dimensional sequence based on the oscillation rates of all non-overlapping windows, and automatically determine the optimal segmentation threshold using the Otsu method; classify non-overlapping windows with oscillation rates greater than or equal to the optimal segmentation threshold into the high-oscillation group, and classify non-overlapping windows with oscillation rates less than the optimal segmentation threshold into the low-oscillation group.
5. The method for analyzing the light distribution quality of motor vehicles based on light spot image gradients according to claim 4, characterized in that, The method for calculating the density stratification index is as follows: calculate the mean oscillation, variance oscillation, and number of windows for each of the high-oscillation group and the low-oscillation group; calculate the square of the difference between the mean oscillation of the high-oscillation group and the mean oscillation of the low-oscillation group, and use it as the first operand. Calculate the sum of the oscillation variances of the high oscillation group and the low oscillation group, and use it as the second operand; compare the number of windows in the high oscillation group and the number of windows in the low oscillation group, extract the minimum and maximum values, and divide the minimum value by the maximum value to obtain the correction factor; divide the first operand by the second operand to obtain the basic quotient, and multiply the basic quotient by the correction factor to obtain the density stratification index.
6. The method for analyzing the light distribution quality of motor vehicles based on light spot image gradients according to claim 1, characterized in that, The steps for extracting the median nearest neighbor distance are as follows: Pixels with gradient magnitudes exceeding the local mean within the low oscillation group window are assigned to the high gradient feature point set, and the corresponding pixels of the high oscillation group are assigned to the low gradient feature point set; for each feature point in the high gradient feature point set, the nearest neighbor distance of its specified order is found using a multidimensional spatial partitioning tree, and the median of the nearest neighbor distances of all points is taken as the median nearest neighbor distance of the high gradient feature point set; the same search logic is performed for the low gradient feature point set to obtain the median nearest neighbor distance of the low gradient feature point set.
7. The method for analyzing the light distribution quality of motor vehicles based on light spot image gradients according to claim 1, characterized in that, The adaptive method for setting the two-stage clustering cutoff distance also includes a consistency check step: determining whether the median nearest neighbor distance of the low-gradient feature point set is greater than twice the median nearest neighbor distance of the high-gradient feature point set; if it is greater, it is determined that the two-stage scale difference is significant, and two-stage density peak clustering is performed; if it is less than or equal to, the effective scale separation index is set to 1, the algorithm degenerates into single-stage density peak clustering, the cutoff distance is taken as the median nearest neighbor distance of the low-gradient feature point set, and a defect alarm is triggered.
8. The method for analyzing the light distribution quality of motor vehicles based on light spot image gradients according to claim 1, characterized in that, The specific steps for multi-level region segmentation of standardized light spot gradient images are as follows: In the first stage, the density peak clustering algorithm is run in the global feature space with the first stage coarse clustering cutoff distance to identify the cluster center and complete the coarse segmentation of the hot zone, transition zone and uniform light distribution zone; the feature points with the lowest local density between adjacent coarse segmentation regions are extracted as saddle points, and the coordinates of the saddle points are used as boundary seed points to define the spatial range of each coarse segmentation region; if the density stratification index in the coarse segmentation region is not lower than the preset threshold, the second stage is entered, and the local density peak clustering algorithm is run again with the second stage fine clustering cutoff distance to output multi-level clustering results covering fine boundary structures.
9. The method for analyzing the light distribution quality of motor vehicles based on light spot image gradients according to claim 8, characterized in that, The steps for outputting the functional area annotation results are as follows: Execute the following annotation rules in sequence: Mark the cluster with the highest average gradient amplitude and spatial aspect ratio exceeding the preset threshold in the second-stage clustering as the cutoff line; Mark the cluster with the closest spatial distance to the highest illuminance reference value measurement point in the first-stage coarse clustering as the hot zone; Mark the cluster with the lowest average gradient amplitude and largest spatial area in the first-stage coarse clustering as the uniform light distribution zone; Mark the remaining clusters as transition zones; After each type of annotation is completed, remove the corresponding cluster from the set to be annotated.
10. A vehicle light distribution quality analysis system based on light spot image gradient, characterized in that, include: A processor and a memory, the memory storing computer program instructions that, when executed by the processor, implement the method for analyzing the light distribution quality of motor vehicles based on light spot image gradients according to any one of claims 1-9.