A method and system for detecting glass transmittance based on optical imaging

By combining overlapping sliding windows and support vector machine classifiers, the problem of distinguishing between surface adhesion interference and intrinsic alteration defects in glass transmittance detection is solved, achieving transmittance detection with high accuracy and reliability.

CN123118628APending Publication Date: 2026-11-17GUANGDONG HONGBOSHENG PHOTOELECTRIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611610905.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-19
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively distinguish between surface adhesion interference and intrinsic etching defects in glass transmittance testing, resulting in high rates of missed detections and false positives, and insufficient reliability of overall test results.

Method used

The overlapping sliding window technique is used to divide the analysis blocks. The adaptive anomaly discrimination threshold is determined by the local median and the absolute median difference. A pre-trained support vector machine classifier is used to distinguish between surface adhesion interference and intrinsic alteration defects. After removing interference pixels in local areas, repair is performed to ensure the integrity of the transmittance statistics.

Benefits of technology

It effectively suppresses backlight edge attenuation and grayscale drift caused by glass thickness changes, improves the accuracy of abnormal pixel identification, realizes selective evaluation of the intrinsic optical properties of glass, and ensures the reliability of transmittance detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123118628A_ABST
    Figure CN123118628A_ABST
Patent Text Reader

Abstract

This invention belongs to the field of optical analysis technology, specifically relating to a method and system for detecting glass transmittance based on optical imaging. The method includes: acquiring a transmission image to obtain an effective grayscale region; dividing the region into blocks using an overlapping sliding window, setting a dynamic anomaly threshold using local median and absolute median difference, marking anomaly seeds and extracting edge sharpness, merging and deduplicating to form a seed set; after connected component clustering, classifying anomalies into surface adhesion interference or intrinsic alteration defects using a support vector machine based on morphological compactness and average edge sharpness; dividing the effective grayscale region into sub-domains and calculating the rejection ratio; for sub-domains with low rejection ratios, removing interference and repairing edges to calculate the mean transmittance, while sub-domains with high rejection ratios are marked as unconfident; calculating the overall transmittance uniformity from the mean transmittance of the confident sub-domains, and obtaining the global confidence coverage rate based on the proportion of the total area of ​​the confident sub-domains; if the coverage rate is lower than the requirement, the test is considered unsuccessful. This invention can improve the reliability of transmittance evaluation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of optical analysis technology. More specifically, this invention relates to a method and system for detecting the transmittance of glass based on optical imaging. Background Technology

[0002] In optical imaging inspection of the transmittance of transparent materials such as mobile phone glass covers, highly uniform backlights naturally exhibit edge illumination attenuation effects, causing large-scale, spatially gradual grayscale drift in the acquired transmitted grayscale image. Minor fluctuations in the glass cover thickness superimpose local transmittance fluctuations, further exacerbating local grayscale baseline differences in the image. Simultaneously, the sample surface is prone to adhering to residual water stains, crystallization points, and other minute foreign matter, forming isolated, abruptly bright or dark pixels in the image. Intrinsic defects such as gradual changes in refractive index and material alteration within the glass generate diffuse light spots with smooth grayscale transitions. These two types of defect signals coexist against the gradually varying background. Traditional detection methods generally employ fixed global threshold segmentation to identify abnormal pixels. This approach fails to adapt to the differentiated local grayscale baselines across the image. In bright areas, it easily masks subtle grayscale abrupt changes caused by surface deposits, leading to missed detections. In dark areas, it easily misjudges normal grayscale fluctuations and imaging noise as defects, ultimately increasing both the false positive and false negative rates of anomaly detection.

[0003] Furthermore, surface adhesion interference and intrinsic alteration defects differ fundamentally in spatial morphology and edge gradient characteristics. However, existing filtering or segmentation methods struggle to selectively process them based on their origin, often attenuating both types of signals indiscriminately. This makes it impossible to separately eliminate surface adhesion interference to accurately evaluate the intrinsic transmittance of glass. Additionally, directly removing interfering pixels reduces the number of effective pixels within the statistical subdomain, introducing statistical bias and variance bias into the transmittance mean. In areas with dense interference, the remaining pixels may be insufficient to support a reliable local transmittance estimate, and existing methods lack quantitative control over local confidence levels, resulting in unreliable overall transmittance uniformity evaluation results.

[0004] Therefore, there is a need for a transmittance detection method that is immune to background grayscale drift, automatically distinguishes between surface-adhesion interference and intrinsic alteration defects, and maintains statistical integrity through confidence control and intelligent repair after interference removal. This method would output transmittance and its uniformity indicators that only reflect the intrinsic optical properties of the glass, and ensure the overall reliability of the detection results. Summary of the Invention

[0005] To address the above problems, the present invention provides solutions in the following two aspects.

[0006] In a first aspect, the present invention provides a glass transmittance detection method based on optical imaging, employing the following technical solution: acquiring a transmission image of the glass to obtain an effective grayscale region; dividing the effective grayscale region into analysis blocks using an overlapping sliding window method, calculating the local median and absolute median difference of pixel grayscale in each analysis block, thereby determining an anomaly detection threshold for the analysis block, marking pixels exceeding the anomaly detection threshold as anomaly seeds, and extracting the edge sharpness of the anomaly seeds, merging and deduplicating to form a seed set; performing connected component clustering on the seed set to obtain anomaly clusters, calculating the morphological compactness of each anomaly cluster and the average edge sharpness of the anomaly seeds it contains, and using a pre-trained classifier based on the morphological compactness... The abnormal clusters are identified as surface-attached interference or intrinsic alteration defects based on the intensity and average edge sharpness. The effective grayscale area is divided into sub-domains, and the proportion of surface-attached interference pixels in each sub-domain is used as the rejection ratio. For sub-domains with a rejection ratio lower than or equal to a preset threshold, surface-attached interference pixels are removed, and edge-preserving repair processing is applied before calculating the average transmittance of the sub-domain. For sub-domains with a rejection ratio exceeding the preset threshold, they are marked as unconfident. The overall transmittance uniformity of the glass is calculated based on the average transmittance of all confident sub-domains, and the global confidence coverage is obtained based on the ratio of the total area of ​​the confident sub-domains to the area of ​​the effective grayscale area. When the global confidence coverage is lower than the minimum coverage, the detection is deemed unsuccessful.

[0007] Furthermore, the local median and absolute median difference are local gray-level statistical features that are robust to outlier pixels, and can also be replaced by equivalent robust statistical measures such as quartiles and interquartile ranges.

[0008] Furthermore, the anomaly detection threshold includes an upper boundary and a lower boundary; the upper boundary is the sum of the local median of the analysis block and the preset anomaly sensitivity adjustment coefficient multiplied by the absolute median difference; the lower boundary is the difference between the local median of the analysis block and the preset anomaly sensitivity adjustment coefficient multiplied by the absolute median difference.

[0009] Furthermore, the step of dividing the area into analysis blocks includes: dividing the effective grayscale region into square blocks according to a preset side length; adjacent blocks are offset by half the side length in both the horizontal and vertical directions.

[0010] Furthermore, the merging and deduplication step includes: for the abnormal seeds generated in different analysis blocks for the same pixel coordinates, retaining the largest edge sharpness value as the final edge sharpness of the pixel, to form the seed set.

[0011] Furthermore, the connected component clustering step includes: using 8-neighbor connected component analysis to group seeds that are adjacent within 8 neighborhoods in the seed set into the same abnormal cluster.

[0012] Furthermore, the method for calculating the morphological compactness is as follows: the ratio of the area of ​​the abnormal cluster to the square of the perimeter is multiplied by four times pi.

[0013] Furthermore, the pre-trained classifier is a support vector machine based on a radial basis function kernel, which performs classification in a two-dimensional feature space consisting of the morphological compactness and the average edge sharpness.

[0014] Furthermore, the step of dividing into subdomains involves dividing the effective grayscale region into non-overlapping square subdomains of equal area.

[0015] Secondly, the present invention provides a glass transmittance detection system based on optical imaging, comprising: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned glass transmittance detection method based on optical imaging is implemented.

[0016] The embodiments of the present invention have at least the following beneficial effects: 1. An overlapping sliding window is used to obtain an adaptive anomaly detection threshold for blocks based on the local median and the absolute median difference. The anomaly seed determination can adapt to the gray-level fluctuation level at different locations in the image, and can suppress the interference caused by the spatial gradual gray-level drift caused by backlight edge attenuation and glass thickness changes. Both bright and dark areas of the image can stably identify anomalous pixels with gray-level abrupt changes, reducing the missed detections and false judgments caused by the global fixed threshold. At the same time, through the overlapping window and the processing of retaining the maximum edge sharpness during merging and deduplication, the anomaly seed fragmentation artifacts caused by block boundaries are eliminated, ensuring the complete localization of anomaly locations, and conservatively retaining the edge steepness information, providing a reliable feature basis for subsequent differentiation between interference and defects.

[0017] 2. Abnormal seeds are clustered by connected components to obtain abnormal clusters. The compactness of the cluster shape and the average edge sharpness are used to form two-dimensional features, which can quantify the spatial differences between the near-circular shape and steep edges of surface attachment interference and the diffuse shape and soft edges of intrinsic alteration defects. The cluster formation is determined by a pre-trained support vector machine, which can distinguish between surface attachment interference and intrinsic alteration defects. Surface attachment interference is removed separately while intrinsic alteration defects are retained, so that the transmittance statistics exclude interference signals from non-glass materials themselves, and selective evaluation of the intrinsic optical properties of glass is achieved.

[0018] 3. The effective grayscale region is divided into multiple sub-domains, and a rejection ratio is introduced to quantify the degree of contamination caused by surface adhesion interference in each sub-domain. For sub-domains with a low interference ratio, after removing interfering pixels, a fast-moving method is used for edge preservation repair to restore the complete sub-domain pixel array. This avoids the shift in the transmittance statistical mean caused by directly deleting interfering pixels, ensuring the unbiasedness of the sub-domain transmittance statistical results. For sub-domains with an excessively high interference ratio, they are directly marked as unconfident and do not participate in transmittance statistics, avoiding the output of unreliable local transmittance results based on incomplete pixel data. Furthermore, a global confidence coverage ratio is introduced, and the transmittance uniformity result of the entire glass is output only when the area ratio of the confident sub-domain reaches the minimum requirement, ensuring the credibility of the overall evaluation result. As an optional implementation, event messages can also be generated for unconfident sub-domains and reported to the production line system to provide data support for upstream process traceability. Attached Figure Description

[0019] Figure 1 The flowchart illustrates the steps of the glass transmittance detection method and system based on optical imaging in this invention. Detailed Implementation

[0020] 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.

[0021] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings, such as... Figure 1 As shown.

[0022] S1: Acquire a transmission image of the glass to obtain the effective grayscale area.

[0023] This step begins by acquiring a high-resolution grayscale image using an area array camera within the transmission imaging optical path of the glass cover of the mobile phone under test.

[0024] Because the highly uniform backlight used in the transmission imaging optical path has a gradual attenuation of illumination from the center to the edge, and the glass cover plate has a transmission optical path difference due to slight local thickness changes during the processing, these two factors together introduce a slowly varying large-scale background grayscale drift in the acquired transmission image, which manifests as a difference in local grayscale reference level at different locations in the image.

[0025] If the entire image is processed directly according to fixed rules, the background grayscale shift will interfere with the perception of minor local anomalies.

[0026] To address the aforementioned issues, this step obtains an effective grayscale area to limit subsequent analysis to the light transmission range of the glass body.

[0027] First, during the offline configuration phase of the system, a standard glass cover plate with no surface adhesion interference and uniform intrinsic light transmission is used to acquire its transmission image as a template image under the same lighting and acquisition parameters as the online detection.

[0028] The template image is binarized. Based on the grayscale difference between the physical contour of the glass cover and the image background, the glass area is separated from the image background, generating a binary detection region mask that corresponds one-to-one with the pixel coordinates of the acquired image, denoted as . .

[0029] in, The pixels represent the coordinates of the area within the effective light-transmitting region of the glass. The pixels represent the background area or the area occluded by the clamp.

[0030] During online detection, the original transmission grayscale matrix actually acquired by the area scan camera... ,Will Each pixel coordinate grayscale value With detection area mask Perform pixel-by-pixel bitwise multiplication and retain only the bits. The grayscale value at the corresponding position is invalid, while the grayscale values ​​at other positions are invalid. This results in grayscale data that only contains the effective light-transmitting area of ​​the glass, forming the effective grayscale matrix output in the first step. .

[0031] The effective grayscale matrix The interference from the background and fixture areas was completely eliminated, providing a precise spatial boundary for subsequent analysis based on local grayscale statistics.

[0032] S2: Divide the effective grayscale region into analysis blocks using an overlapping sliding window method. Calculate the local median and absolute median difference of the pixel grayscale in each analysis block. Determine the anomaly detection threshold for the analysis block based on this. Mark pixels that exceed the threshold as anomaly seeds. Extract the edge sharpness of the seed point and merge and remove duplicates to form a seed set.

[0033] The effective grayscale matrix obtained in step S1 Building upon this foundation, the key challenge addressed in this step is: due to edge light attenuation from a highly uniform backlight and minute variations in glass thickness, the effective grayscale matrix... The different local grayscale reference levels at different locations constitute the background grayscale drift that gradually increases in scale.

[0034] If a globally uniform fixed threshold is used to detect abnormal pixels, it is easy to miss weak gray-level changes caused by surface-attached interference in darker areas of the image, while normal gray-level fluctuations are easily misjudged as abnormal in brighter areas. This results in a large number of false positives or missed reports mixed in the abnormal seed set, which cannot provide a reliable spatial localization basis for subsequent cause classification.

[0035] Meanwhile, simply marking the coordinates of abnormal pixels is insufficient to express the steepness of their edges, which is precisely the key local feature needed to distinguish between surface-attached interference (clear boundaries) and intrinsic alteration defects (smooth grayscale transitions).

[0036] Therefore, this step constructs an adaptive labeling mechanism that is sensitive to local gray-level anomalies and can simultaneously extract edge sharpness factors, and uses an overlapping sliding window method to eliminate artificial artifacts at the boundaries of the analysis blocks.

[0037] First, the effective grayscale matrix Divide the area into square analysis blocks according to the preset side length.

[0038] Let the preset side length be... The empirical value of 32 pixels is used, but it can also be adjusted by the implementer according to the specific implementation scenario.

[0039] This value takes into account two constraints: firstly, the typical spatial scale of surface-attached interference is about 5 to 15 pixels, and the preset side length... It should be large enough to fully accommodate a single interference point and its adjacent background; on the other hand, the spatial half-cycle of slowly varying illumination is usually greater than 100 pixels, and the grayscale reference can be approximated as stationary within a local block of 32 pixels square.

[0040] To eliminate the artificial splitting or unassigned assignment of abnormal pixels located precisely at block boundaries due to rigid block segmentation, adjacent blocks are offset in both the horizontal and vertical directions. That is, 16 pixels, forming an overlapping sliding layout, so that any pixel in the effective grayscale area is covered by multiple blocks, and the boundary artifacts can be eliminated during subsequent merging and deduplication.

[0041] For each analysis block obtained from the division, the data that falls within that block and is within the effective grayscale matrix will be analyzed. The effective pixel grayscale values ​​are extracted into a one-dimensional sequence and arranged in ascending order.

[0042] Take the median value of the sequence as the local median grayscale reference. The unit is dimensionless grayscale value.

[0043] The reason for using the median instead of the arithmetic mean is that there may be a small number of extremely bright or dark pixels caused by surface-attached interference within the block. The mean would be biased by these outliers, while the median has a natural robustness to a small number of high-frequency disturbances and can more accurately reflect the true gray-scale center level of the background of the block.

[0044] Next, the grayscale values ​​of all valid pixels within the block are calculated and compared with the grayscale reference. The absolute deviations are used to form a deviation sequence. Then, the median of this deviation sequence is taken to obtain the local gray-level absolute median difference. The unit is dimensionless grayscale value.

[0045] absolute median In a statistical sense, it is proportional to the overall grayscale fluctuation scale of that local area: within a normal block where grayscale fluctuations are mainly determined by system noise and intrinsic glass uniformity, the absolute median difference... The value is low; if the block contains pixels with strong grayscale abrupt changes caused by surface adhesion, the absolute median difference is low. Protected by median operation, it does not expand significantly and still mainly reflects the dispersion of normal background pixels, thus it can be used as an adaptive estimate of the noise level within the block.

[0046] Based on grayscale reference and absolute median The anomaly detection threshold for this analysis block is dynamically determined.

[0047] Anomaly detection thresholds include the upper boundary. and lower boundary Calculate using the following two formulas respectively:

[0048]

[0049] In the formula, This is the abnormal sensitivity adjustment coefficient, taken as an empirical value of 3.5. It is dimensionless and can also be adjusted by the implementer according to the specific implementation scenario.

[0050] The function of this coefficient is to control the strictness of anomaly detection: increase the anomaly sensitivity adjustment coefficient. As the threshold expands outward, anomaly detection becomes more conservative, leading to an increased false negative rate and a decreased false positive rate; reducing the anomaly sensitivity adjustment coefficient... The threshold shrinks inward, the anomaly detection becomes more sensitive, the false positive rate increases while the false negative rate decreases.

[0051] Under typical conditions where photon shot noise and readout noise dominate in an imaging system, normal grayscale fluctuations approximately follow a normal distribution, with an absolute median difference... with standard deviation There is a public intellectual relationship between them. ,at this time The corresponding upper and lower boundaries are approximately on both sides of the central reference. Location, bilateral confidence probability is approximately It can maintain a high capture rate for true local grayscale mutations while allowing for a small amount of normal grayscale fluctuations.

[0052] Abnormal sensitivity adjustment coefficient The values ​​were calibrated by acquiring a large number of images of glass samples known to be free of surface adhesion interference, and calculating the absolute median difference in each block of the full field of view. The distribution and observation of false alarm rates were completed to ensure that the false alarm rate was controlled within a certain range. the following.

[0053] For each valid pixel falling within the analysis block, its grayscale value is... Each with the upper boundary and lower boundary Comparison: If satisfied or If so, the pixel is marked as an anomaly seed candidate point, and its pixel coordinates are recorded. .

[0054] The marked pixels correspond to locations with abnormally high or low gray values ​​in the local background. The cause may be surface adhesion interference or intrinsic material alteration, and further edge feature extraction is needed to distinguish them.

[0055] For each marked anomalous seed point Calculate the edge sharpness factor centered on this point. The unit is the dimensionless grayscale gradient value.

[0056] The calculation method is as follows: This pixel and its... grayscale values ​​of neighboring pixels and horizontal Convolution kernel and vertical The convolution kernels are used to perform discrete convolutions to obtain the first-order derivative components of the gray level in the horizontal direction. and the first derivative component of gray level in the vertical direction .

[0057] Horizontal grayscale first derivative component The first derivative component of the gray level in the vertical direction reflects the degree of drastic change in gray level at that pixel location along the horizontal direction. Reflecting the degree of change along the vertical direction, the square root of the sum of the squares of both factors yields the edge sharpness factor:

[0058] In the formula, the first derivative component of gray level in the horizontal direction and the first derivative component of gray level in the vertical direction All are based on the effective grayscale matrix The original grayscale value of the corresponding pixel neighborhood is calculated, and the unit is the dimensionless grayscale gradient value.

[0059] The essential meaning is that this abnormal seed point The abruptness of the transition with surrounding pixels: Surface-attached interference, due to its significant difference in refractive index from the glass substrate and its clear boundaries, exhibits a strong edge gradient and abruptness. Values ​​are typically high; intrinsic alteration defects exhibit a smooth and diffuse grayscale transition, with abrupt changes in degree. The value is significantly low.

[0060] Therefore, the degree of suddenness This provides a directly measurable basis for describing the boundary characteristics of abnormal clusters.

[0061] After all overlapping analysis blocks have completed the above processing, the abnormal seeds from different blocks are merged and deduplicated.

[0062] Because of the overlapping sliding window mechanism, the same pixel coordinate may be covered by multiple analysis blocks, and each block is independently marked as an anomaly seed and its abruptness is calculated. If deduplication is not performed, redundant seeds will be generated.

[0063] When merging and deduplicating, use pixel coordinates. As a unique identifier, for multiple anomaly seeds generated at the same coordinates in different analysis blocks, the largest edge sharpness value is retained as the final edge sharpness of that pixel. Only one seed record is retained.

[0064] The causal logic behind this retention strategy is that overlapping blocks correspond to different local background estimation windows, and a certain block may be assigned a lower degree of abruptness to the anomaly seed due to an underestimation of the background noise level. Retaining the maximum value can represent the edge prominence at that location in the most conservative way, avoiding the underestimation of sharpness caused by window boundary cutting, thus preserving more complete edge information for subsequent cluster average sharpness calculation.

[0065] After merging and deduplication, an initial set of anomaly seeds is formed, containing the spatial location of each anomalous pixel and its corresponding final edge sharpness. .

[0066] Each element in this set is an atomic unit for subsequent connected component clustering and feature extraction. Its positional information provides the precise spatial distribution of anomalies on the glass surface, while its sharpness information provides key local gradient feature support for distinguishing between surface-attached interference and intrinsic alteration defects.

[0067] S3: Perform connected component clustering on the seed set to obtain abnormal clusters, calculate the morphological compactness of each cluster and the average edge sharpness of the seeds contained therein, and use a pre-trained classifier to classify the clusters as surface adhesion interference or intrinsic alteration defects based on the morphological compactness and average edge sharpness.

[0068] The set of anomaly seeds generated in step S2 It includes both surface adhesion interference and intrinsic alteration defects.

[0069] Surface-adhesion interference (such as residual water stains from cleaning or crystallization points) typically results in anomalous seeds that aggregate into extremely small, well-defined, nearly circular patches with distinct grayscale gradients at their edges. The intrinsic alteration defects (such as light spots caused by local refractive index gradients) are relatively high; they appear as sheet-like areas with soft edges and diffuse shapes, and their edge gray-scale gradient values ​​are relatively high. Lower.

[0070] These two types of objects differ significantly in spatial compactness and edge sharpness. Therefore, this step performs connected component clustering on the seed set, calculates the morphological compactness and average edge sharpness of each cluster, and uses a pre-trained classifier to make causal judgments.

[0071] First, for the abnormal seed set Perform connected component clustering based on 8 neighborhoods. The 8-neighbor connected component analysis is a well-known image processing technique and will not be described in detail here.

[0072] The specific process is as follows: Traverse the set of exception seeds. For all seed points, for seed points that have not yet been assigned to a cluster, a new cluster is created and the seed point is added; then, the eight neighboring locations around it are recursively searched. If other seed points exist, they are merged into the same cluster and the cluster continues to expand outward from the newly added seed point as the center until no new neighboring seed points can be found.

[0073] Through this process, the abnormal seed set is obtained. Classified as A spatially disjoint cluster of anomalous structures, denoted as .

[0074] For each abnormal cluster First, count the number of seed points within the cluster, which will be used as the area of ​​the cluster. The unit is square pixels.

[0075] Next, the outer contour of the cluster is extracted, and the distance is accumulated point by point along the contour using an 8-chain code method to calculate the perimeter. For horizontally or vertically adjacent contour point pairs, the distance is measured as 1 pixel; for diagonally adjacent contour point pairs, the distance is measured as... The length is 1 pixel.

[0076] perimeter The unit is pixels.

[0077] Based on area and perimeter Calculate the morphological compactness of the cluster. :

[0078] When a minimal constant is superimposed on the square term of the perimeter, the denominator will not return to zero when a single point is clustered, while maintaining the range characteristic of the circularity (0,1], without changing the original feature differentiation logic.

[0079] In the formula, the compactness of the shape It is a dimensionless index, and its range is .

[0080] When the cluster shape is close to a standard circle, the morphological compactness Approaching 1; when the shape is elongated or irregularly diffused, the morphological compactness is... Significantly lower than 1.

[0081] Surface-adhesion-type interferences typically have high roundness, while intrinsic alteration-type defects have low roundness.

[0082] Meanwhile, cluster The content contains One abnormal seed point Each seed point carries the final edge sharpness calculated and retained in step S2. (subscript) (This refers to the seed number within the cluster).

[0083] Calculate the arithmetic mean of these sharpnesses to obtain the average edge sharpness of the cluster. :

[0084] Take the floating-point minimum value. When Ni>0, the effect on the calculation result is negligible. When Ni=0, the denominator is always greater than 0 to avoid division by zero anomaly.

[0085] In the formula, The unit is the dimensionless grayscale gradient value. The units are dimensionless.

[0086] grayscale gradient value This comprehensively reflects the overall abruptness of the boundary transitions of all anomaly points within the cluster: Surface-attached clusters, due to their clear boundaries, exhibit clear grayscale gradient values. The value is too large; the intrinsic alteration clusters have gray-level gradient values ​​due to the gradual change in gray level. The value is too small.

[0087] The above-mentioned compactness and average edge sharpness Form a cluster Two-dimensional eigenvectors.

[0088] To achieve causal classification based on this feature vector, a support vector machine (RBF) based on radial basis function kernel function has been pre-trained. SVM model.

[0089] The training data for this model comes from more than 50 glass cover plate samples covering typical surface adhesion and intrinsic alteration. Through high-magnification microscopic confirmation and manual annotation, the data for each annotated cluster is extracted. and degree of suddenness And assign a category label.

[0090] A total of 1,500 surface adhesion cluster samples and 1,200 intrinsic alteration cluster samples were collected, and the categories were balanced using synthetic minority class oversampling technology.

[0091] During training, 10-fold cross-validation and grid search are used to determine the support vector machine (RBF). Hyperparameters of SVM: Penalty coefficient Take an empirical value of 1.0, kernel coefficient An empirical value of 0.5 is used. Both are dimensionless hyperparameters and can be adjusted by the implementer according to the specific implementation scenario.

[0092] The trained support vector machine (RBF) SVM achieved a classification misclassification rate of less than 1.5% on the independent test set.

[0093] During the online detection phase, for any cluster currently to be classified... to make its shape compact and average edge sharpness Input the above-mentioned trained Support Vector Machine (RBF) SVM model.

[0094] The Support Vector Machine (RBF) SVM outputs a real value through its decision function. .

[0095] when When the cluster is identified as surface-attached interference, all its seed coordinates are classified into the surface-attached interference set. ;when When the cluster is identified as an intrinsic alteration defect, its seed coordinates are assigned to the intrinsic defect preservation set. .

[0096] Traverse all After completing the cluster analysis, the causes of all abnormal seeds are classified and identified.

[0097] S4: Divide the effective grayscale region into sub-domains and calculate the proportion of surface-attached interference pixels in each sub-domain as the rejection ratio.

[0098] In step S3, the causes of all abnormal clusters are classified, resulting in a surface adhesion interference set. and intrinsic defect retention set Next, the core issue to be addressed is: the interference set. The grayscale values ​​of the pixels contained in the glass reflect the light transmission characteristics of the surface deposits rather than the glass itself. If these pixels are directly included in the subsequent light transmittance statistics, the calculated average light transmittance will deviate from the true intrinsic light transmittance level of the glass, and the local uniformity index will also be distorted due to these extremely bright or extremely dark abrupt values.

[0099] Therefore, the interference set must be The identified pixels are excluded from the transmittance evaluation process.

[0100] However, if indiscriminate removal is performed without constraint throughout the entire effective grayscale area, it will destroy the statistical integrity of each local area: the removal operation reduces the total number of pixels participating in the statistics in the local area, the decrease in sample size leads to increased random fluctuations in the statistics; and when the surface-attached interference in a certain area is too dense, the number of remaining effective pixels is too small to give a reliable transmittance estimate for that area.

[0101] To quantify the degree of interference in each local area and provide a basis for decision-making on whether to allow removal and compensation in that area, this step divides the effective evaluation area into non-overlapping sub-domains and calculates the proportion of surface-attached interfering pixels in each sub-domain as the rejection ratio for that sub-domain.

[0102] The specific processing procedure is as follows.

[0103] First, based on the detection region mask in step S1 The defined effective light transmittance range of the glass will The connected region consisting of all pixel coordinates is used as the valid evaluation region.

[0104] The effective evaluation area is divided into Let the set of non-overlapping, contiguous square subdomains of equal area be denoted as . .

[0105] The side length of each square subfield is denoted as . The empirical value of 200 pixels is used, but it can also be adjusted by the implementer according to the specific implementation scenario.

[0106] Subfield side length The selected values ​​ensure that, for typical mobile phone glass cover sizes, the number of subdomains is moderate, each subdomain contains enough pixels to guarantee statistical stability, while also accurately reflecting the degree of interference at different locations on the glass surface on a subdomain basis.

[0107] The subdomains are divided using a grid-based layout, starting from the top left corner of the effective evaluation area and proceeding sequentially along the row and column directions according to the subdomain side length. Perform non-overlapping segmentation based on step size; if the edge of the effective evaluation region is less than the side length of a complete subdomain. Then the actual remaining area forms a rectangular subdomain.

[0108] For each subdomain obtained by partitioning The number of surface-attached interference pixels that fall into the count is determined.

[0109] By traversing this subdomain Each pixel coordinate within Check whether it belongs to the surface adhesion interference set output in step S3. .

[0110] If it belongs to the category, then accumulate the number of interfering pixels.

[0111] Subdomain The total number of pixels contained within is Its value is The area of ​​the region is expressed in square pixels; the area of ​​the region within this subdomain is denoted as the area of ​​the region being disturbed. The total number of marked interference pixels is .

[0112] Calculate the rejection ratio for this subdomain. :

[0113] The denominator of the empty subdomain is Refuse to As the value approaches 0, the system can simultaneously add a pre-judgment: if... =0 directly marks the subfield as invalid, providing double protection for numerical stability.

[0114] In the formula, the rejection ratio The dimensionless proportional value represents the subdomain. The density of interfering pixels attached to the inner surface.

[0115] Total number of interfering pixels The unit is the number of pixels, total number of pixels The unit is the number of pixels.

[0116] Rejection ratio A higher rejection ratio indicates that the subdomain is more severely contaminated by surface deposits, and the lower the proportion of remaining undisturbed pixels; conversely, a lower rejection ratio indicates a higher rejection rate. The lower the value, the fewer interfering pixels there are in the subdomain, and most pixels can reliably reflect the intrinsic light transmission characteristics of the glass.

[0117] At this point, each subdomain has obtained an objective rejection ratio. The numerical value serves as a direct quantitative input for subsequent decisions to reject or compensate.

[0118] S5: For sub-domains with a rejection ratio lower than or equal to a preset threshold, remove interfering pixels and perform edge-preserving repair processing before calculating the average transmittance of the sub-domain.

[0119] Rejection ratio Subdomains below a preset threshold.

[0120] After removing interfering pixels and performing edge-preserving repair processing, the average transmittance of the sub-domain is calculated. The specific execution process is as follows.

[0121] When traversing to a certain subdomain in the set of subdomains Obtain the rejection ratio calculated in step S4. .

[0122] will refuse to compare Compared to the preset rejection ratio threshold Comparison, rejection ratio threshold The empirical value of 0.001 is used; it is dimensionless and can be adjusted by the implementer according to the specific implementation scenario.

[0123] When the comparison result is When the value is zero, it indicates that the proportion of surface-attached interference pixels in this subdomain is extremely low, and the remaining effective pixels have statistical reliability in terms of quantity and spatial distribution, which can support the local estimation of the intrinsic light transmission characteristics of the glass. Therefore, the allow / reject and compensate processing procedure is performed on this subdomain.

[0124] First, perform the interference pixel removal operation.

[0125] Based on the surface adhesion interference set generated in step S3 Subdomain All coordinates within the set belong to the interference set. The pixels are identified, and the set of coordinates of these pixels is denoted as... .

[0126] In subdomain The corresponding set of coordinates in the current grayscale matrix or transmittance matrix. The values ​​at each coordinate position are temporarily marked as invalid so that they are not included in subsequent statistical calculations.

[0127] At this time, subdomain Several holes formed by invalid markers appeared on the pixel array. The positions of these holes originally corresponded to the surface adhesion interference that had been removed, while their neighborhoods retained the effective transmittance values ​​that reflected the intrinsic properties of the glass.

[0128] Since directly removing interfering pixels reduces the total number of effective pixels in the subdomain, it destroys the integrity and statistical homogeneity of the subdomain pixel array. Therefore, edge-preserving repair processing is required for the hole area to restore the complete structure of the subdomain pixel array.

[0129] This step uses the FastMarching Method (FMM) image inpainting algorithm to fill the image.

[0130] The algorithm uses the effective pixel transmittance value on the boundary of the hole to be repaired as a known boundary condition, and treats the repair of the internal region of the hole as a problem of boundary information propagation.

[0131] Specifically, the algorithm first constructs a narrow band containing all pixels with known transmittance values ​​at the hole boundaries. For each pixel to be repaired within the narrow band, the transmittance value is estimated by solving a function equation along its gradient direction. The basic form of the equation is: However, in the FastMarching Method (FMM) repair process, the iterative update rule calculates the most likely transmittance value of the current pixel to be repaired in a weighted manner based on the transmittance value and gradient information of the known pixels in the neighborhood, so that the filling value geometrically smoothly continues the texture and gradient features of the hole edge.

[0132] The algorithm starts from the boundary of the hole and gradually moves inward to fill it until all invalid marked pixels in the hole area are assigned new transmittance values.

[0133] FastMarching Method (FMM) image inpainting is a well-known image processing technique and will not be elaborated upon further.

[0134] After repair, subdomain It is restored to a complete, hole-free pixel array, and the padding value is strictly constrained by the statistical properties of the subdomain's own neighborhood, without introducing additional variance bias.

[0135] After obtaining the repaired and fully restored subdomain After the pixel array is formed, the average transmittance of the sub-domain is calculated.

[0136] For the repaired subdomain The transmittance value of each pixel is obtained based on the grayscale-transmittance conversion lookup table mentioned in step S4. This conversion process has been completed in the system optical calibration stage and is a well-known preprocessing step for transmittance detection, so it will not be described again.

[0137] Subdomain The transmittance values ​​of all pixels within the subfield are summed, and then divided by the total number of pixels contained in the subfield. The arithmetic mean is obtained, which is the average transmittance of the subdomain. :

[0138] The empty subdomain is calculated and outputs a very small value. Combined with the pre-emptive empty region judgment logic, this avoids program calculation errors.

[0139] In the formula, Subdomain after compensation processing Interior coordinates The transmittance value at that point is dimensionless. For subdomain The total number of pixels, expressed as a count, is determined by the subfield side length. The square of is determined.

[0140] This refers to the local average level of the intrinsic transmittance of the glass after surface adhesion interference has been eliminated and integrity restoration has been completed. Its value does not include the optical contribution of surface adhesions.

[0141] This subdomain is labeled "state confidence," and its mean transmittance is... It is recorded and output as an input unit for subsequent evaluation of the uniformity of the entire glass sheet.

[0142] S6: For subdomains where the rejection ratio exceeds a preset threshold, mark them as unconfident. Subdomains with unconfident states will not participate in the subsequent calculation of overall transmittance uniformity.

[0143] For the rejection ratio already calculated in step S4 subdomain When the comparison result is When this occurs, it indicates that the density of surface-attached interference pixels within the subdomain has exceeded the preset confidence threshold.

[0144] Under these conditions, the effective pixels in the subdomain that originally reflected the intrinsic light transmission characteristics of the glass are squeezed out by a large number of interfering pixels, and their remaining number and spatial distribution continuity are no longer sufficient to constitute a statistically reliable estimate of the light transmission characteristics of the local area.

[0145] If a similar elimination and filling operation as that for low-interference subdomain is forcibly performed on this subdomain, the value filled by the filling algorithm will be largely inferred from the neighboring region rather than directly derived from the actual glass transmission information in this subdomain because the area of ​​the void to be repaired is too large. As a result, the average transmittance calculated in this way will lose the actual physical representativeness of this local area and will introduce uncontrollable bias into the subsequent statistics on the uniformity of the entire glass.

[0146] Based on the above phenomena, for subdomain The interference pixel removal and edge preservation repair processes in step S5 are not performed, and the average transmittance of this sub-domain is not calculated. .

[0147] The system will subdomain Marked as "Status Unbelievable".

[0148] This marker is a logical status identifier, recorded in the system memory corresponding to this subdomain. Within the attribute field, its meaning is that of the subdomain. Due to excessive surface contamination, it is impossible to output a reliable local transmittance evaluation index. Therefore, it is not included in the subsequent calculation of the uniformity of transmittance of the entire glass based on the confidence subdomain and related macroscopic statistics.

[0149] While marking the subfield as unbelievable, the system generates an unbelievable event message for that event.

[0150] The message body contains the following data fields: a message type identifier, which is fixed as a subdomain nonconfidence event; and a subdomain unique identifier, used to uniquely locate the subdomain within the subdomain partitioning grid of the valid evaluation area. The coordinates of the subdomain center in the glass physical coordinate system are calculated based on the row and column indices of the subdomain in the mesh and the system optical path calibration parameters, in millimeters (mm); the rejection ratio of the current subdomain. , dimensionless; the current testing timestamp; and the batch number of this test.

[0151] The event message is transmitted via industrial Ethernet and uses the Open Platform Communications Unified Architecture (OPCUA) to push data from the image processing unit at the inspection station to the production line manufacturing execution system.

[0152] After receiving the data at the production line end, the frequency and rejection ratio of the state of the glass cover plates in each batch at each spatial location can be aggregated in real time, thereby providing traceable data for locating local anomalies in the preceding cleaning or processing processes.

[0153] The non-confidence flag and event reporting for this subdomain will only output the judgment result and process data, and will no longer generate the average transmittance output for this subdomain.

[0154] S7: Calculate the overall transmittance uniformity of the glass based on the average transmittance of all confidence subdomains, and obtain the global confidence coverage based on the ratio of the total area of ​​the confidence subdomains to the area of ​​the effective grayscale region. When the global confidence coverage is lower than the minimum coverage, the detection is deemed to have failed.

[0155] The objects to be processed in this step are: those with low rejection ratios after completing step S5. subdomain Interference pixels are removed, repaired, and the average transmittance is calculated. Step S6 then addresses high rejection ratios. subdomain After being marked as state of disbelief, two types of subdomains exist simultaneously within the effective evaluation area of ​​the entire glass pane—the mean output transmittance. The confidence subdomain and the non-confidence subdomain for states where the mean is not output.

[0156] In this case, if we directly use all subdomains When participating in the statistical analysis of the overall transmittance uniformity of glass, the missing data of the state-unconfidence subdomain will introduce a non-negligible bias on a macro scale. At the same time, when the state-unconfidence subdomain accounts for too large a proportion of the effective evaluation area, the uniformity index obtained based on the remaining confidence subdomain is no longer representative of the global transmittance distribution of the glass.

[0157] Based on the above phenomena, this step first performs macroscopic consistency statistics on the average transmittance of all confidence subdomains to calculate the overall transmittance uniformity of the glass.

[0158] All subdomains marked as state confidence in the output of step S5 average transmittance Included in the computation set.

[0159] Let the number of confidence subfields be . Calculate the arithmetic mean of the transmittance values ​​of these subdomains to obtain the overall transmittance baseline of the glass. :

[0160] , The denominator is The global baseline value approaches 0; the program synchronously adds branch judgment: The test is deemed unqualified, and no light transmittance index is output.

[0161] In the formula, For the first The average transmittance of each confidence subdomain is dimensionless and is obtained from the statistics of the repaired subdomain in step S5. The total number of confidence subdomains, expressed in terms of quantity; overall transmittance baseline. The global average transmittance of the glass is dimensionless and reflects the macroscopic average level of the intrinsic light transmittance characteristics of the glass after surface interference removal and compensation treatment.

[0162] Next, based on the overall transmittance baseline As a reference, the dispersion between the mean transmittance values ​​of the confidence subdomains is calculated, and this is used as the overall transmittance uniformity of the glass. :

[0163] ,avoid Division by zero error; The standard deviation is only used as a numerical output; constraints are added to the business logic: The time uniformity index is invalid.

[0164] In the formula, the overall transmittance uniformity is the standard deviation of the mean transmittance of each confidence subdomain relative to the global mean, and is dimensionless.

[0165] Overall transmittance uniformity The physical meaning refers to the degree of large-scale inconsistency in the intrinsic transmittance of different local areas of glass: overall transmittance uniformity. The smaller the value, the more uniform the light transmittance across different areas of the glass, and the better the macroscopic uniformity of light transmittance; overall uniformity of light transmittance. The larger the value, the more it indicates that there are regional intrinsic differences in light transmission in the glass.

[0166] Because the average transmittance used in the calculation All data originate from confidence subdomains that have undergone surface adhesion interference removal and repair treatment, resulting in overall transmittance uniformity. The optical contribution of surface deposits is not included, which can truly reflect the intrinsic homogeneity level of the glass material.

[0167] While obtaining the uniformity index based on the confidence subdomain, it is also necessary to quantify the spatial coverage completeness of the effective data on which this detection relies.

[0168] All divisions in step S4 Among the subdomains, those subdomains that were processed in step S5 and marked as having a state confidence are selected, and their total area is calculated.

[0169] The total number of pixels contained in each confidence subdomain is ,in The subfield side length is taken as an empirical value of 200 pixels, in pixels.

[0170] The total number of confidence subfields is still 1 Then the total area of ​​all confidence subdomains is The unit is square pixels.

[0171] The total area of ​​the effective evaluation region is equal to that in step S4, the area of ​​the effective evaluation region is equal to that in step S The total number of valid pixels defined is denoted as The unit is square pixels.

[0172] Based on this, the global confidence coverage is calculated. :

[0173] , This represents the effective grayscale area without glass, with a coverage rate close to 0. The system determines that there is no glass to be tested in the image before terminating the detection process.

[0174] In the formula, global confidence coverage This is a dimensionless proportionality value, and its range is: .

[0175] When all subdomains within the effective evaluation region are state confidences When some subdomains are marked as unconfident due to an excessively high rejection ratio, .

[0176] Global confidence coverage It quantifies what percentage of the area of ​​the transparent surface of the entire glass produces a reliable estimate of local transmittance, directly reflecting the reliable coverage of the detection data in the spatial domain.

[0177] Finally, the calculated global confidence coverage rate With the preset minimum coverage Comparison, lowest coverage The empirical value of 0.99 is taken. It is dimensionless and is a hyperparameter. It can also be adjusted by the implementer according to the specific implementation scenario.

[0178] when This indicates that the area of ​​the subdomain that can output a reliable average transmittance is less than 99% of the total effective area due to the presence of large, concentrated, and uncompensable surface contamination areas on the glass surface. In this case, based on the overall transmittance baseline... and overall transmittance uniformity The transmittance uniformity evaluation is no longer representative of the true intrinsic optical properties of the entire glass sheet. Therefore, the entire glass sheet is deemed to have failed the test, and an offline re-inspection process is triggered.

[0179] when If the test results for this glass piece are deemed to have sufficient data credibility at the global level, then the overall transmittance baseline calculated in this step is output. and overall transmittance uniformity This serves as an indicator of the final light transmittance and uniformity of the glass.

[0180] This invention also discloses a glass transmittance detection system based on optical imaging, including a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement the glass transmittance detection method based on optical imaging of this invention. The system also includes other components well-known to those skilled in the art, such as a communication bus and a communication interface; their configurations and functions are known in the art and will not be described further here.

[0181] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make several improvements and substitutions without departing from the technical principles of the present invention, and these improvements and substitutions should also be considered within the scope of protection of the present invention.

Claims

1. A method for detecting glass transmittance based on optical imaging, characterized in that, include: Acquire a transmission image of the glass to obtain the effective grayscale area; The effective grayscale region is divided into analysis blocks using an overlapping sliding window method. The local median and absolute median difference of pixel grayscale are calculated for each analysis block. Based on this, the anomaly detection threshold of the analysis block is determined. Pixels exceeding the anomaly detection threshold are marked as anomaly seeds. The edge sharpness of the anomaly seeds is extracted, and the seeds are merged and deduplicated to form a seed set. The seed set is clustered by connected components to obtain anomaly clusters. The morphological compactness and the average edge sharpness of the anomalous seeds contained in each anomalous cluster are calculated. A pre-trained classifier is used to identify the anomalous clusters as surface adhesion interference or intrinsic alteration defects based on the morphological compactness and average edge sharpness. The effective grayscale region is divided into sub-domains, and the proportion of surface-attached interference pixels in each sub-domain is used as the rejection ratio. For subdomains with a rejection ratio lower than or equal to a preset threshold, the surface-attached interference pixels are removed and edge-preserving repair processing is applied before calculating the average transmittance of the subdomain. For subdomains where the rejection ratio exceeds a preset threshold, the status is marked as unbelievable. The overall transmittance uniformity of the glass is calculated based on the average transmittance of all confidence subdomains, and the global confidence coverage is obtained based on the ratio of the total area of ​​the confidence subdomains to the area of ​​the effective grayscale region. When the global confidence coverage is lower than the minimum coverage, the detection is deemed to have failed.

2. The glass transmittance detection method based on optical imaging according to claim 1, characterized in that, The local median and absolute median difference are local gray-level statistical features that are robust to outlier pixels. They can also be replaced by similar robust statistical measures such as quartiles and interquartile ranges.

3. The glass transmittance detection method based on optical imaging according to claim 1, characterized in that, The anomaly detection threshold includes an upper boundary and a lower boundary; The upper boundary is the sum of the local median of the analysis block and the preset anomaly sensitivity adjustment coefficient multiplied by the absolute median difference; The lower boundary is the difference between the local median of the analysis block and the preset anomaly sensitivity adjustment coefficient multiplied by the absolute median difference.

4. The glass transmittance detection method based on optical imaging according to claim 1, characterized in that, The step of dividing the area into analysis blocks includes: dividing the effective grayscale region into square blocks according to a preset side length; Adjacent blocks are offset by half the side length in both the horizontal and vertical directions.

5. The glass transmittance detection method based on optical imaging according to claim 1, characterized in that, The merging and deduplication step includes: for the abnormal seeds generated in different analysis blocks for the same pixel coordinates, retaining the largest edge sharpness value as the final edge sharpness of the pixel, thus forming the seed set.

6. The glass transmittance detection method based on optical imaging according to claim 1, characterized in that, The connected component clustering step includes: using 8-neighbor connected component analysis to group seeds that are adjacent within 8 neighborhoods in the seed set into the same abnormal cluster.

7. The glass transmittance detection method based on optical imaging according to claim 1, characterized in that, The method for calculating the morphological compactness is as follows: the ratio of the area of ​​the abnormal cluster to the square of the perimeter is multiplied by four times pi.

8. The glass transmittance detection method based on optical imaging according to claim 1, characterized in that, The pre-trained classifier is a support vector machine based on radial basis function kernel function, and the support vector machine performs classification in a two-dimensional feature space composed of the morphological compactness and the average edge sharpness.

9. The glass transmittance detection method based on optical imaging according to claim 1, characterized in that, The step of dividing into subdomains involves dividing the effective grayscale region into non-overlapping square subdomains of equal area.

10. A glass transmittance detection system based on optical imaging, characterized in that, The device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the glass transmittance detection method based on optical imaging as described in any one of claims 1 to 9.