Partition brightness characteristic detection method for surface scratch defect of glass lamp tube
Through an unsupervised detection algorithm based on the fusion of statistical features between axial partitions, Otsu adaptive threshold segmentation and local brightness analysis, the problems of low efficiency and high error detection in the detection of scratch defects on the surface of glass lamp tubes are solved, and efficient and accurate scratch detection is achieved, which is suitable for industrial assembly line production.
Patent Information
- Application Number
- CN202510606028.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-12
- Publication Date
- 2025-08-08
AI Technical Summary
The prior art has low efficiency and high error detection rate when detecting scratch defects on the surface of glass lamp tubes. It is difficult to effectively detect small low-contrast defects in assembly line production, and deep learning models rely on large-scale labeling data and consume too much computing resources.
An unsupervised detection algorithm based on the fusion of statistical features of axial partitions is adopted to suppress background noise through Otsu adaptive threshold segmentation and mask enhancement technology, and combined with local brightness mean and standard deviation analysis, a dual-channel statistical feature map is constructed to detect scratch defects in real time.
It realizes efficient and accurate scratch defect detection, short detection time of single image, meets the real-time requirements of industrial assembly lines, avoids the high latency problem of deep learning models, and has a detection accuracy of 99% and a low false detection rate.
Smart Images

Figure CN120451123A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of glass lamp tube surface scratch defect detection, and in particular relates to a method for detecting zone brightness characteristics of glass lamp tube surface scratch defects. Background Art
[0002] In the manufacturing process of electric light source devices, surface defects of empty bulbs (such as horizontal scratches, uneven light transmission, etc.) directly affect their packaging airtightness and optical performance. [1] In the production process of glass light bulbs, surface scratches are one of the most common defects that affect product quality. Such defects may have a negative impact on consumers' perception of product quality. Therefore, scratch detection is very important in the production process of light bulbs. [2,3] Traditional manual visual inspection has problems such as strong subjectivity and low efficiency. Therefore, in recent years, research methods for scratch detection in industrial applications have mainly focused on the use of machine vision and deep learning technology.
[0003] The advantage of deep learning in scratch defect detection is that it can automatically extract multi-scale features, adapt to complex backgrounds and lighting changes, and has high detection accuracy and generalization ability. [4,5] . Du et al. [6] proposed a method combining image processing and Fourier transform to detect scratches on printed products with an accuracy of 98.7%. Yang et al. [7] A method combining deep learning and image segmentation is introduced, which combines a multi-feature fusion module and a principal component growth segmentation algorithm to improve the accuracy of detecting low-contrast and small-sized scratches. Yue et al. [8] Using optimized photometric stereo vision and FFT-Gabor filtering, an enhanced system for textured materials was developed, achieving a 100% scratch capture rate and a 98.43% recognition success rate. While these methods address challenges such as noise interference, background texture differentiation, and precise segmentation, and improve efficiency and accuracy compared to traditional manual inspection methods, deep learning-based inspection solutions, while capable of improving accuracy, face bottlenecks such as reliance on large-scale annotated data for model training and high computational resource consumption. [9 ,10 ,11] .
[0004] Existing machine vision methods mostly adopt global image processing strategies. Yang et al.
[12] developed a system that uses a high-resolution camera and YOLOv3 to identify fine scratches smaller than 30 μm, achieving good agreement with traditional microscopic methods.
[13] A digital evaluation system using line scan cameras and machine learning techniques was proposed to improve the efficiency of defect detection compared to manual inspection.
[14] et al. focused on the visual inspection system for glass ampoule packaging and improved the defect detection rate from 55% to 99.6% by optimizing the lighting and camera configuration. Finally, Gruber and Haselmann
[15] This paper introduces a method for enhancing defect detection in translucent automotive parts using Frangi filters, demonstrating fast and accurate defect segmentation. However, this method is not suitable for the highly reflective materials and curved surfaces of hollow light bulbs used in assembly line production. Light reflection noise and background interference can lead to increased false detection rates, and the sensitivity is particularly limited when detecting small, low-contrast defects.
[0005] In order to ensure the quality of the final product in industrial production, it is necessary to accurately detect the scratch defects of glass lamp tubes. Surface scratch defects usually appear as long and thin stripes along the wall (such as Figure 1 (a) in the figure) may be caused by mechanical friction, improper handling and other factors during the production process.
[16] The depth and length of these scratches vary, which may have a significant impact on the optical performance and appearance of the glass lamp tube, and thus affect the airtightness of its packaging.
[17] The characteristics of the inspection task are reflected in the following aspects (such as Figure 1 (b) (i) The arc-shaped edge of the glass tube shows a cliff-like sudden change in pixel brightness against a dark background; (ii) When only considering a local area of the glass tube, the brightness gradient intensity of the area containing defects on a certain axis shows a significant upward fluctuation compared to the defect-free bulb wall. [18,19] . Summary of the Invention
[0006] To address the above technical challenges, the present invention proposes a partitioned brightness feature detection method for scratch defects on the surface of glass lamp tubes. This method is an unsupervised detection algorithm based on the fusion of statistical features between axial partitions. This algorithm divides the vertical pixels into multiple detection intervals through a dynamic partitioning strategy. Combining Otsu's adaptive threshold segmentation and mask enhancement technology effectively suppresses background noise. The brightness mean and standard deviation are simultaneously calculated in the horizontal pixel dimension, a dual-channel statistical feature map is constructed, and signal enhancement is achieved by utilizing the local brightness mutation characteristics of the defective area. This method replaces traditional convolution operations with real-time analysis of column-wise statistics (processing a single interval takes only 0.8ms). This method successfully detects scratch defects on empty light bulbs without the need for a pre-trained model, while avoiding the high latency problem of deep learning models.
[0007] The present invention adopts the following technical solution to solve the above technical problems: a method for detecting the brightness characteristics of scratch defects on the surface of a glass lamp tube by using a partitioned method, characterized by the following specific steps:
[0008] Step S1: extracting the main area of the glass lamp tube through Otsu adaptive threshold segmentation preprocessing;
[0009] Step S2: Divide the target area into 10 equal intervals along the axis, independently calculate the horizontal pixel brightness gradient eigenvalue in each interval, and construct a local joint eigenvector;
[0010] Step S3: Triggering a defect alarm through a gradient threshold.
[0011] Furthermore, the specific process of step S1 is: CLAHE contrast enhancement → Otsu threshold segmentation → morphological optimization;
[0012] Contrast enhancement: Contrast Limited Adaptive Histogram Equalization (CLAHE) is used to perform local equalization on the image. CLAHE can finely adjust the contrast of local areas to avoid the influence of uneven lighting or background noise. The specific processing formula is as follows:
[0013] Ienh(x,y)=CLAHE(Igray,ClipLimit=0.02,TileSize=[8,8]) (1)
[0014] Among them, ClipLimit = 0.02 means limiting the local contrast enhancement amplitude to avoid excessive noise amplification; TileSize = [8,8] means dividing the image into 8×8 sub-blocks for local equalization;
[0015] Otsu adaptive threshold segmentation: The image is binarized using the Otsu adaptive threshold segmentation method to extract the target area and remove background noise. The Otsu method automatically selects the optimal threshold by maximizing the inter-class variance to achieve optimal image segmentation. The segmentation threshold T is dynamically determined based on the maximum inter-class variance method (Otsu's Method):
[0016]
[0017] in, Generate a binary mask for the between-class variance of foreground and background:
[0018]
[0019] Morphological optimization: Binary images after adaptive threshold segmentation often contain some small noise and holes, which can affect subsequent feature extraction and analysis. To suppress this noise, a two-stage morphological operation is applied to the binary image. First, a closing operation (dilation) is used followed by an erosion operation to fill holes in the target area and connect separated areas. Then, an opening operation (erosion) is used followed by a dilation operation to remove small isolated noise points. These operations can significantly improve the connectivity of the target area and make the image smoother. The largest connected area is selected and segmented, and a 15×5 rectangular structuring element is used to fill holes and connect broken areas.
[0020] Mclose=B·Srect,Srect=strel(rectangle,[15,5]) (4)
[0021] Use a circular structure element with an opening radius of 3 to remove isolated noise points:
[0022]
[0023] Among them, Srect = [15, 5] is the horizontal structural element, and Sdisk = 3 is the circular open operation kernel.
[0024] Furthermore, the specific process of step S2 is as follows: feature extraction quantifies the surface quality by analyzing the brightness distribution and local area features of the image, and adopts an analysis method based on the statistical characteristics of brightness between partitions. The specific process of constructing the local statistical features that characterize the surface quality is as follows:
[0025] In order to fully consider the local features of the image, the image is divided into several equal-height intervals along the axial direction, that is, the height direction. The total height of the image is H. The target area is divided into K equal-height intervals along the axial direction of the lamp tube, that is, the image height direction. The height of each interval is: The Kth interval range R k =[kh,(k+1)h], K=10 is set to ensure that each interval contains enough image information, while avoiding too fine-grained division that leads to high computational complexity. The height of each interval is one tenth of the total height of the image, which can effectively capture the brightness characteristics of different regions. Then, brightness statistical features are performed. In each partition, the horizontal brightness mean μk(x) and standard deviation σk(x) are calculated to describe the overall brightness distribution and brightness dispersion of the image in the interval, respectively. The brightness mean reflects the average brightness level of the region, and the standard deviation reflects the fluctuation of the regional brightness. The specific calculation formula is:
[0026]
[0027]
[0028] Among them, I(x,y) is the grayscale value of the pixel at position (x,i) in the image. In this way, a set of statistical features can be obtained for each interval.
[0029] Furthermore, the specific process of step S3 is as follows: after feature extraction, the defect detection stage determines whether there are surface defects such as scratches in the image based on the calculated brightness statistical features. This process mainly relies on two important detection rules: standard deviation sudden increase and mean gradient change. Since surface defects such as scratches usually cause drastic changes in the brightness of local areas, defects are detected by analyzing the change in standard deviation. When the standard deviation σk(x) in a certain interval exceeds the preset threshold, it means that the brightness fluctuation in this area is large and there may be defects. In order to further improve the accuracy of defect detection, the gradient change of the brightness mean in each interval is analyzed. Scratch defects usually appear as a sudden change in the brightness mean. When the brightness mean gradient |μ k (x+1)-μ k When (x-1)| is greater than the set threshold, the existence of the defect is further confirmed. The brightness of the defect-free bulb tube is used as the baseline, and the curve of the defect brightness is subtracted from it. In this way, the area of the scratch defect can be accurately located.
[0030] The method for detecting scratch defects on the surface of glass lamp tubes by using a partitioned brightness feature is characterized by the following specific steps: in the data preprocessing stage, CLAHE is used to enhance the local contrast of the image to improve the visibility of scratches in low-contrast areas; Otsu threshold segmentation is used to remove background noise, and morphological processing is combined to further optimize the integrity of the bulb area; in the scratch detection stage, the interval brightness gradient analysis method is used to divide the bulb area into 10 equal-height intervals along the axial direction, and the brightness mean (μk(x)), brightness standard deviation (σk(x)) and brightness gradient (|μk(x)) are calculated in each interval. k (x+1)-μ k (x-1)|) to extract the local features of the scratch; the detection strategy is based on the mean surge threshold, namely |μ k (x+1)-μ k The scratch area is determined by using (x-1)|>10 and a standard deviation sudden increase threshold of 1.5σ.
[0031] Compared with the existing technology, the present invention has the following advantages and beneficial effects: In order to solve the problem of low efficiency of manual detection of surface scratch defects in glass lamp tubes produced on the assembly line, the present invention proposes an unsupervised detection algorithm based on brightness gradient analysis between partitions. First, the main area of the glass tube is extracted through preprocessing such as Otsu adaptive threshold segmentation to eliminate background interference; then the target area is divided into 10 equal intervals along the axial direction, and the horizontal pixel brightness gradient eigenvalues are independently calculated in each interval to construct a local joint feature vector; finally, the gradient threshold is used to trigger the defect alarm, and the algorithm does not require pre-training or labeled data. Simulation results show that the detection method of the present invention has an accuracy of 99% on a data set of 800 scratches, and the average single image detection time is only 82.6ms, which meets the real-time detection needs of industrial assembly lines. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A glass lamp tube with scratches and its three-dimensional brightness distribution, (a) glass lamp tube with scratches; (b) three-dimensional brightness distribution of the glass lamp tube.
[0033] Figure 2 This is a diagram of the framework for detecting scratch defects on the surface of glass lamp tubes.
[0034] Figure 3 This is the process of segmenting the glass tube area.
[0035] Figure 4 Threshold scratch detection after baseline subtraction.
[0036] Figure 5 The following are the detection results between the example light bulb partitions. DETAILED DESCRIPTION
[0037] The above contents of the present invention are further described in detail below through examples, but this should not be understood as limiting the scope of the above subject matter of the present invention to the following examples. All technologies implemented based on the above contents of the present invention fall within the scope of the present invention.
[0038] Example
[0039] 1. Check the task description and standards
[0040] In order to ensure the quality of the final product in industrial production, it is necessary to accurately detect the scratch defects of glass lamp tubes. Surface scratch defects usually appear as long and thin stripes along the wall (such as Figure 1 (a) in the figure) may be caused by mechanical friction, improper handling and other factors during the production process.
[16] The depth and length of these scratches vary, which may have a significant impact on the optical performance and appearance of the glass lamp tube, and thus affect the airtightness of its packaging.
[17] The characteristics of the inspection task are reflected in the following aspects (such as Figure 1(b) (i) The arc-shaped edge of the glass tube shows a cliff-like sudden change in pixel brightness against a dark background; (ii) When only considering a local area of the glass tube, the brightness gradient intensity of the area containing defects on a certain axis shows a significant upward fluctuation compared to the defect-free bulb wall. [18,19] .
[0041] 2 Research Methods
[0042] 2.1 Overall framework of scratch defect detection
[0043] The glass lamp surface scratch defect detection method proposed in this invention is based on image processing and statistical analysis
[20] , combined with the brightness features of the local area to achieve unsupervised defect detection. This method consists of three main steps: image preprocessing, feature extraction and analysis, and defect detection. The specific framework is as follows Figure 2 As shown in Figure 1, each step plays a key role in improving detection accuracy and reducing background noise interference. The implementation principles and technical details of each step are detailed below.
[0044] 2.1.1 Image Preprocessing
[0045] The main task of the image preprocessing stage is to enhance the contrast of the target bulb area and effectively remove background noise so that the subsequent feature extraction can better capture the local changes of the scratch defect. The specific steps are as follows: CLAHE contrast enhancement → Otsu threshold segmentation → morphological optimization (such as Figure 3 shown).
[0046] CLAHE contrast enhancement: To overcome the problem of detail loss in low-contrast areas, Contrast Limited Adaptive Histogram Equalization (CLAHE) is used to solve the over-enhancement problem of traditional histogram equalization in low-contrast areas. CLAHE can effectively enhance the contrast of the target area without over-enhancement by performing local equalization on the image.
[21] Compared with traditional global histogram equalization, CLAHE can adjust the contrast of local areas more finely and avoid the influence of uneven lighting or background noise. The specific processing formula of CLAHE is:
[0047] Ienh(x,y)=CLAHE(Igray,ClipLimit=0.02,TileSize=[8,8]) (1)
[0048] Among them, ClipLimit = 0.02 means limiting the local contrast enhancement amplitude to avoid excessive noise amplification; TileSize = [8,8] means dividing the image into 8×8 sub-blocks for local equalization.
[0049] Otsu adaptive threshold segmentation: The image is then binarized using the Otsu adaptive threshold segmentation method to extract the target area and remove background noise. The Otsu method automatically selects the optimal threshold by maximizing the inter-class variance to achieve optimal image segmentation.
[22] This method does not require manual threshold setting and can adaptively calculate the threshold based on the grayscale histogram information of the image, effectively improving the accuracy of image segmentation. The segmentation threshold T is dynamically determined based on the maximum inter-class variance method (Otsu's Method):
[0050]
[0051] in is the inter-class variance of foreground and background. Generate a binary mask:
[0052]
[0053] Morphological optimization: The binary image after adaptive threshold segmentation often contains some small noise and holes, which will affect the subsequent feature extraction and analysis. In order to suppress these noises, a two-stage morphological operation is applied to the binary image to suppress the noise.
[23] First, a closing operation (dilation) is used followed by an erosion operation to fill holes in the target region and connect separated areas. Then, an opening operation (erosion) is used followed by a dilation operation to remove small isolated noise points. These operations can significantly improve the connectivity of the target region and make the image smoother. The largest connected region is selected and segmented. A 15×5 rectangular structuring element is used to fill holes and connect broken areas:
[0054] Mclose=B·Srect,Srect=strel(rectangle,[15,5]) (4)
[0055] Use a circular structure element with an opening radius of 3 to remove isolated noise points:
[0056]
[0057] Among them, Srect = [15, 5] is the horizontal structural element, and Sdisk = 3 is the circular open operation kernel.
[0058] 2.1.2 Feature extraction and analysis
[0059] Feature extraction is a crucial step in the defect detection process. It quantifies surface quality by analyzing the brightness distribution and local area characteristics of the image. Using an analysis method based on the statistical characteristics of brightness between partitions, the specific steps for constructing local statistical features to characterize surface quality are as follows:
[0060] In order to fully consider the local features of the image, the image is divided into several equal-height intervals along the axial direction, i.e., the height direction. Specifically, the total height of the image is H, and the target area is divided into K equal-height intervals along the axial direction of the lamp tube, i.e., the image height direction, where the height of each interval is: The Kth interval range R k =[kh,(k+1)h]. K=10 is set to ensure that each interval contains sufficient image information, while avoiding overly fine-grained divisions that lead to excessive computational complexity. The height of each interval is one-tenth of the total height of the image, so the brightness characteristics of different regions can be effectively captured. Then, brightness statistical features are performed. In each partition, the horizontal brightness mean μk(x) and standard deviation σk(x) are calculated to describe the overall brightness distribution and brightness dispersion of the image in the interval, respectively. The brightness mean reflects the average brightness level of the region, and the standard deviation reflects the degree of fluctuation of the regional brightness. The specific calculation formula is:
[0061]
[0062] Among them, I(x,y) is the grayscale value of the pixel at position (x,i) in the image. In this way, a set of statistical features can be obtained for each interval.
[0063] 2.1.3 Defect Detection
[0064] After feature extraction, the defect detection stage determines whether there are surface defects such as scratches in the image based on the calculated brightness statistical features. This process mainly relies on two important detection rules: standard deviation surge and mean gradient change. Since surface defects such as scratches usually cause drastic changes in brightness in local areas, defects can be detected by analyzing the change in standard deviation. When the standard deviation σk(x) within a certain interval exceeds the preset threshold, it means that the brightness fluctuation in this area is large and there may be defects. A sudden increase in standard deviation can be used as an effective sign of scratch defects. In order to further improve the accuracy of defect detection, the gradient change of the brightness mean in each interval is analyzed. Scratch defects usually appear as a sudden change in the brightness mean, so when the brightness mean gradient ∣μ k (x+1)-μ k When (x-1)| is greater than the set threshold, the existence of the defect is further confirmed. The brightness of the non-defective bulb is used as the baseline and the curve of the defect brightness is subtracted from it (such as Figure 4 shown)
[24] In this way, the scratch defect area can be accurately located. This statistical feature-based detection method can not only effectively identify obvious defects, but also has high sensitivity for low-contrast and small defects. It is particularly suitable for detecting complex backgrounds and small defects such as the surface of glass tubes.
[0065] 2.2 Simulation design and verification
[0066] 2.2.1 Simulation Objectives
[0067] The simulation experiment aims to verify the effectiveness of the glass lamp surface scratch defect detection method based on the brightness gradient analysis between partitions. Since the morphology of the glass lamp surface scratches in the industrial assembly line environment is highly random and it is difficult to obtain a large amount of real data, the geometric features and optical properties of the scratches are extracted based on the actual collected glass lamp scratch images, and a simulation data set is constructed on this basis.
[25] The applicability and robustness of the detection method are analyzed by testing synthetic scratch data.
[0068] 2.2.2 Simulation Dataset Construction
[0069] A simulation dataset was constructed based on the real scratch features on the surface of glass lamp tubes. By analyzing scratch images collected from industrial production lines, it was found that scratches are usually long and thin, slightly curved, and have high light reflectivity.
[26] Most scratches are between 0.5 and 2 pixels wide, their brightness is usually 20% to 50% higher than the surrounding glass area, and their edges are relatively blurred, with relatively low contrast with the background. Based on these characteristics, Bezier curves and random noise perturbations are used to generate simulated scratches with the same shape as real scratches.
[27] , and are randomly distributed within the bulb area to ensure the rationality of the detection task.
[0070] Based on the above-mentioned real scratch features, MATLAB R2022a was used to synthesize scratches. The synthesis process of the data set includes the following steps: First, the glass bulb area was extracted using Otsu adaptive threshold segmentation, and the scratches were constrained to be generated only on the surface of the bulb. Then, Bezier curve modeling was used to generate scratches with slight curvature and irregular disturbances, and the edges were processed by Gaussian blur (σ=1.2) to make them more consistent with the optical characteristics of real scratches. The brightness of the scratches was increased by 20% to 50% to simulate the high reflectivity of the glass material. Finally, 500 sets of glass lamp tube images with different scratch morphologies were generated, covering different types such as short scratches, long scratches, curved scratches and intermittent scratches, in order to comprehensively test the detection capability of the proposed method.
[0071] 2.2.3 Simulation Experiment Process
[0072] The experimental process mainly includes three stages: data preprocessing, scratch detection and result visualization. First, in the data preprocessing stage, CLAHE is used to enhance the local contrast of the image to improve the visibility of scratches in low-contrast areas. Then, Otsu threshold segmentation is used to remove background noise, and morphological processing is combined to further optimize the integrity of the bulb area. In the scratch detection stage, the interval brightness gradient analysis method is used to divide the bulb area into 10 equal height intervals along the axial direction, and the brightness mean (μk(x)), brightness standard deviation (σk(x)) and brightness gradient (|μ k (x+1)-μ k (x-1)|) to extract the local features of the scratch. The detection strategy is based on the mean surge threshold (|μ k (x+1)-μ k (x-1)|>10) and the standard deviation sudden increase threshold (1.5σ) are used to determine the scratch area.
[0073] 2.2.4 Evaluation indicators and result analysis
[0074] To quantitatively evaluate the detection performance of this method, accuracy, recall, precision, and F1-score were used as key metrics. Experimental analysis was conducted on a test dataset of 800 glass light tube images. The dataset consisted of 500 positive images (defective light tubes) with various scratches and 300 negative images (normal light tubes) without defects. Scratch detection was performed using a method that combines the standard deviation spike feature with the brightness gradient mutation feature. The statistical results are as follows: True Positives (TP) = 492 (actually defective images that were correctly detected as such); False Positives (FP) = 0 (actually non-defective images that were incorrectly detected as such); True Negatives (TN) = 300 (actually non-defective images that were correctly detected as such); and False Negatives (FN) = 8 (actually defective images that were not detected).
[0075] Based on the above data, the four evaluation indicators calculated are as follows:
[0076] Accuracy: measures the accuracy of the model's overall classification, that is, the proportion of samples that are correctly predicted. It is defined as follows:
[0077]
[0078] Accuracy = 99.00%, indicating that most glass lamp samples can be correctly classified.
[0079] Recall: This measures the algorithm's ability to detect scratched samples. It measures how many scratched lamps are successfully detected among all the scratched lamps. It is defined as follows:
[0080]
[0081] Recall = 98.40%, indicating that scratches can be accurately detected in the vast majority of defective samples with a low missed detection rate.
[0082] Precision: This measures the algorithm's false positives for non-defective lamps. This refers to the percentage of samples identified as defective that actually have scratches. It is defined as follows:
[0083]
[0084] Precision = 100.00%, indicating that the false positive rate for non-defective lamps is 0, and non-defective samples can be accurately judged.
[0085] F1-score: It is used to comprehensively measure the balance between precision and recall. The calculation formula is as follows:
[0086]
[0087] F1-score = 99.19%. The high F1-score indicates that while ensuring a high detection rate, the false alarm rate is extremely low, achieving a good detection balance.
[0088] Simulation experiments show that the glass tube surface scratch detection method based on interval brightness gradient analysis can accurately detect different types of scratches and maintain a high detection rate in the case of low contrast, curved or intermittent scratches. Typical scratch detection results are shown in the figure below. Figure 5 As shown. For short scratches and minor scratches, the present invention can accurately locate their boundaries and effectively reduce false detections caused by reflections on the glass surface; for longer or curved scratches, the brightness gradient analysis between partitions can fully capture their axial variation trends, making the detection more stable and robust. In addition, in order to evaluate the application performance in industrial assembly lines, the experiment also measured the processing time of a single image. In the environment of AMD Ryzen 54600U with RadeonGraphics 2.10GHz processor, the total processing time was 66.0771s, that is, the average single image detection time was only 82.6ms. The detection method has a fast calculation speed while ensuring high accuracy, meeting the real-time detection needs of industrial assembly lines. The experimental results further verified the effectiveness of the present method, and provided a computationally efficient and highly accurate solution for the automated defect detection of glass lamp tubes.
[0089] This paper proposes a method for detecting scratches on glass lamp tube surfaces based on inter-zone brightness gradient analysis, and verifies its effectiveness through simulation experiments. Experimental results demonstrate that this method demonstrates high detection accuracy and stability when detecting different types of scratches, including short scratches, long scratches, curved scratches, and intermittent scratches. Compared with traditional global brightness analysis methods, the inter-zone brightness gradient calculation used in this method can more accurately extract local brightness change information, making the detection process more stable and effectively reducing the risk of false detection due to reflections or uneven thickness of the glass surface.
[0090] In the simulation experiment, the sudden increase in the standard deviation of the scratch area can clearly reflect the abnormal brightness distribution of the scratch, proving that the detection strategy based on the brightness standard deviation can effectively distinguish scratches from normal glass areas. At the same time, the brightness gradient change characteristics of the scratch further enhance the recognition ability of small scratches. Even in the case of low contrast, the method of the present invention can still make accurate judgments through the brightness mutation point. Experimental data show that when the threshold is set appropriately, the method of the present invention can not only maintain an extremely low false detection rate (Precision = 100.00%), but also achieve high-precision detection (Recall = 98.40%) on the vast majority of scratch samples, and the overall detection accuracy (Accuracy) reaches 99.00%. In addition, the computational complexity of the method of the present invention is low, and the average processing time for a single image is only 82.6ms, which has important application value for online detection of industrial assembly lines.
[0091] Although the method of the present invention performs well on simulation data, it still has certain limitations, and the detection ability of extremely small scratches (less than 0.5 pixel width) still needs to be improved. This is because the brightness mutation amplitude of the scratches is small, resulting in insufficient standard deviation changes to reach the detection threshold. In the future, it can be considered to introduce multi-scale feature fusion, combining brightness distribution information at different scales to enhance the algorithm's sensitivity to tiny scratches. Secondly, the method of the present invention is mainly verified based on simulation data. Although these data are constructed based on real scratch features, there are still certain differences from the imaging characteristics of actual glass lamps in complex optical environments. Therefore, in the future, it is necessary to collect more real samples in an industrial assembly line environment and further optimize the detection method to improve its practicality. In addition, the current method still relies on manually setting the standard deviation threshold. In the future, it can be combined with adaptive threshold strategies or machine learning methods to make the detection process more intelligent to further reduce the false detection rate and missed detection rate.
[0092] Overall, the proposed glass lamp tube scratch detection method based on intra-regional brightness gradient analysis successfully overcomes detection challenges posed by the high reflectivity and transparency of glass materials by simultaneously utilizing local brightness standard deviations and gradient variation information, achieving a good balance between computational efficiency and detection accuracy. Future research will focus on optimizing micro-scratch detection capabilities, improving the adaptability of detection parameters, and conducting large-scale testing in real-world production environments to further enhance the method's industrial applicability.
[0093] The present invention proposes a method for detecting scratches on the surface of glass lamp tubes based on brightness gradient analysis between partitions, and systematically experiments on the method are conducted on a simulation data set. The experimental results show that the method can accurately detect different types of scratches and maintain high stability and robustness under the conditions of illumination changes and background noise interference. On 800 test images, the experimental results show that: all scratches can be successfully detected, and their scratch areas show significant mutation characteristics in both the standard deviation curve and the brightness gradient map; short scratches and minor scratches can be accurately located, and false detections caused by reflections on the glass surface can be effectively reduced; because longer or curved scratches span multiple partitions, the use of brightness gradient analysis between partitions can continuously extract scratch features in multiple areas, making detection more stable.
[0094] The present invention further analyzed the brightness distribution characteristics of different scratches and visualized the significant differences between scratched and normal glass areas using a three-dimensional brightness distribution. The results showed that scratched areas exhibited a sudden change in brightness distribution, while normal glass areas exhibited a smoother brightness transition. By calculating the standard deviation change rate, it was observed that the standard deviation of the scratched area significantly exceeded the detection threshold, further demonstrating the feasibility of the scratch detection method based on brightness standard deviation.
[0095] In terms of computational efficiency, this method processes a single image in less than 100ms on an AMD Ryzen 54600U with Radeon Graphics 2.10GHz processor, with an experimentally measured average processing time of 82.6ms, meeting the real-time inspection requirements of industrial assembly lines. Compared to deep learning-based detection methods, this method does not rely on large-scale training data, can adapt to glass tube samples of varying sizes and lighting conditions, and exhibits superior stability. Experiments demonstrate that this method achieves a high detection rate on simulated data and exhibits superior computational efficiency, providing an efficient and reliable solution for the automated inspection of glass tubes. Future research will further optimize this method to enhance its ability to detect even finer scratches, and conduct large-scale experiments in real industrial environments to verify its applicability in production line environments.
[0096] The basic principles, main features and advantages of the present invention are shown and described above. Without departing from the spirit and scope of the present invention, the present invention may also be subject to various changes and improvements, which fall within the scope of the present invention to be protected.
[0097] References:
[0098] [1] Thorsen KA. Forensic examination of bulb filaments by the SEM [J]. Electron Microscopy in Forensic, Occupational, and Environmental Health Sciences, 1986: 117-147.
[0099] [2]Bellchambers HE,Phillipson S M.Lighting for inspection[J].Transactions of the Illuminating Engineering Society,1962,27(2_IEStrans):71-87.
[0100] [3] Zhao Baiting, Cheng Ruifeng, Jia Xiaofen. YOLOv8 crack defect detection algorithm integrating multi-scale features[J]. Computer Engineering and Applications, 2024, 60(22): 261-270.
[0101] ZHAO Baiting, CHENG Ruifeng, JIA Xiaofen.YOLOv8 Crack Defect DetectionAlgorithm Based on Multi-Scale Features[J]. Computer Engineering and Applications, 2024, 60(22):261-270.
[0102] [4] Pan Z, Yang J, Wang X, et al. Image-based surface scratch detection on architectural glass panels using deep learning approach [J]. Construction and Building Materials, 2021, 282: 122717.
[0103] [5]Li W,Zhang L,Wu C,et al.A new lightweight deep neural network forsurface scratch detection[J].The International Journal ofAdvancedManufacturing Technology,2022,123(5):1999-2015。
[0104] [6]Du Y,Zuo C,Zhang Y.Classification and detection of printed productsurface scratches based on machine vision[C] / / 20222nd InternationalConference on Algorithms,High Performance Computing andArtificialIntelligence(AHPCAI).IEEE,2022:738-741。
[0105] [7]Yang L,Zhou F,Wang L.A scratch detection method based on deeplearning and image segmentation[J].IEEE Transactions on Instrumentation andMeasurement,2022,71:1-12。
[0106] [8]Yue Y,Sang W,Zhai K,et al.Enhanced Scratch Detection for TexturedMaterials Based on Optimized Photometric Stereo Vision and Fast FourierTransform–Gabor Filtering[J].Applied Sciences,2024,14(17):7812。
[0107] [9]Hamishebahar Y,Guan H,So S,et al.A comprehensive review of deeplearning-based crack detection approaches[J].Applied Sciences,2022,12(3):1374-1398。
[0108]
[10] Bhatt P M,Malhan R K,Rajendran P,et al.Image-based surface defectdetection using deep learning:A review[J].Journal of Computing andInformation Science in Engineering,2021,21(4):040801。
[0109]
[11] Qi S,Yang J,Zhong Z.A review on industrial surface defectdetection based on deep learning technology[C] / / Proceedings of the 20203rdinternational conference on machine learning and machine intelligence.2020:24-30。
[0110]
[12] Yang W,Zhang Y,Dong Y,et al.Development of machine vision systemfor off-line inspection of fine defects on glass screen surface[J].IEEETransactions on Instrumentation and Measurement,2022,71:1-8。
[0111]
[13] Jiang J,Xiao X,Feng G,et al.Detection and classification of glassdefects based on machine vision[C] / / Applied Optical Metrology III.SPIE,2019,11102:244-249。
[0112]
[14] Rawashdeh N A,Abu-Khalaf J M,Khraisat W,et al.A visual inspectionsystem of glass ampoule packaging defects:effect of lighting configurations[J].International Journal of Computer Integrated Manufacturing,2018,31(9):848-856。
[0113]
[15] Du Y,Zuo C,Zhang Y.Classification and detection ofprinted productsurface scratches based on machine vision[C] / / 20222nd InternationalConference on Algorithms,High Performance Computing andArtificialIntelligence(AHPCAI).IEEE,2022:738-741。
[0114]
[16] Cormier A J.Assessment of current scratch standards[C] / / OpticalComponents and Systems.SPIE,1987,805:152-161。
[0115]
[17] Liu L,Zhang H,Jiao F,et al.Review of optical detectiontechnologies for inner-wall surface defects[J].Optics&LaserTechnology,2023,162:109313。
[0116]
[18] Adamo F, Attivissimo F, Di Nisio A, et al. A low-cost inspection system for online defects assessment in satin glass [J]. Measurement, 2009, 42(9): 1304-1311.
[0117]
[19] DeVitis GA,FogliaP,Prete CA.Row-level algorithm to improve real-time performance of glass tube defect detection in the productionphase[J].IETImage Processing,2020,14(12):2911-2921.
[0118]
[20] Bergmann P, Batzner K, Fauser M, et al. Beyond dents and scratches: Logical constraints in unsupervised anomaly detection and localization[J]. International Journal of Computer Vision, 2022, 130(4):947-969.
[0119]
[21] Fang Danyang, Fu Qingqing, Wu Aiping. Foggy image enhancement based on adaptive dynamic range CLAHE[J]. Laser & Optoelectronics Progress, 2023, 60(4):0410008.
[0120] Danyang Fang, Qingqing Fu, Aiping Wu. Foggy Image Enhancement Based on Adaptive Dynamic Range CLAHE[J]. Laser&Optoelectronics Progress, 2023, 60(4):0410008.
[0121]
[22] Wang Yan, Hu Ruifu, Chen Daixin, Dong Yinghuai, Fu Zhiqiang, Luan Qi. Research on pipeline edge detection method based on adaptive threshold segmentation and improved Canny operator[J]. Optoelectronics and Lasers, 2024, 35(2):164.
[0122] WANG Yan,HU Ruifu,CHEN Daixin,DONG Yinghuai,FU Zhiqiang,LUANQi. Research on pipeline edge detection based on improved Canny operator with adaptive threshold segmentation[J]. Journal of Optoelectronics·Laser, 2024, 35(2):164.
[0123]
[23] Li Zhenghao, Diao Yan, Shi Shengkun, et al. Geometric feature recognition of raw bamboo based on morphological method and edge detection [J]. Forest Products Industry, 2024, 61(02): 18-23.
[0124] LI Zheng-hao, DIAO Yan, SHI Sheng-kun et al. Identification ofGeometricCharacteristics of Bamboo Based on Morphological Method and Edge Detection[J]. Forest Products Industry, 2024, 61(02):18-23.
[0125]
[24] De Vitis GA,FogliaP,Prete CA.Apre-processing technique to decrease inspection time in glass tubeproduction lines[J].IET ImageProcessing,2021,15(10):2179-2191.
[0126]
[25] Hou J, Wang S, Sun X, et al. Simulation and detection of surface defects of optical components [J]. Optical Engineering, 2024, 63(12): 124106-124106.
[0127]
[26] Khatri S,Sue H J.Scratch visibility modeling on flat&texturedpolymeric surfaces[J].Polymer,2024,312:127595.
[0128]
[27] Bosnar L,Hagen H,Gospodnetic P.Procedural defect modeling forvirtual surface inspection environments[J].IEEE Computer GraphicsandApplications,2023,43(2):13-22。
Claims
1. A method for detecting scratch defects on the surface of glass lamp tubes based on the brightness characteristics of the partitions, characterized in that The specific steps are: Step S1: extracting the main area of the glass lamp tube through Otsu adaptive threshold segmentation preprocessing; Step S2: Divide the target area into 10 equal intervals along the axis, independently calculate the horizontal pixel brightness gradient eigenvalue in each interval, and construct a local joint eigenvector; Step S3: Triggering a defect alarm through a gradient threshold.
2. The method for detecting the brightness characteristics of scratch defects on the surface of a glass lamp tube according to claim 1, characterized in that The specific process of step S1 is: CLAHE contrast enhancement → Otsu threshold segmentation → morphological optimization; Contrast enhancement: Contrast-limited adaptive histogram equalization (CLAHE) is used to perform local equalization on the image. CLAHE can more finely adjust the contrast of local areas to avoid the influence of uneven lighting or background noise. The specific processing formula is as follows: Ienh(x,y)=CLAHE(Igray,ClipLimit=0.02,TileSize=[8,8]) (1) Among them, ClipLimit = 0.02 means limiting the local contrast enhancement amplitude to avoid excessive noise amplification; TileSize = [8,8] means dividing the image into 8×8 sub-blocks for local equalization; Otsu adaptive threshold segmentation: The image is binarized using the Otsu adaptive threshold segmentation method to extract the target area and remove background noise. The Otsu method automatically selects the optimal threshold by maximizing the inter-class variance to achieve optimal image segmentation. The segmentation threshold T is dynamically determined based on the maximum inter-class variance method, namely Otsu's Method: in, Generate a binary mask for the between-class variance of foreground and background: Morphological optimization: Binary images after adaptive threshold segmentation often contain some small noise and holes, which can affect subsequent feature extraction and analysis. To suppress this noise, a two-stage morphological operation is applied to the binary image. First, a closing operation (dilation) is used followed by an erosion operation to fill holes in the target area and connect separated areas. Then, an opening operation (erosion) is used followed by a dilation operation to remove small isolated noise points. These operations can significantly improve the connectivity of the target area and make the image smoother. The largest connected area is selected and segmented, and a 15×5 rectangular structuring element is used to fill holes and connect broken areas. Mclose=B·Srect,Srect=strel(rectangle,[15,5]) (4) Use a circular structure element with an opening radius of 3 to remove isolated noise points: Among them, Srect = [15, 5] is the horizontal structural element, and Sdisk = 3 is the circular open operation kernel.
3. The method for detecting the brightness characteristics of scratch defects on the surface of a glass lamp tube according to claim 2, characterized in that The specific process of step S2 is as follows: Feature extraction quantifies the surface quality by analyzing the brightness distribution and local area characteristics of the image. An analysis method based on the statistical characteristics of brightness between partitions is adopted. The specific process of constructing the local statistical characteristics that characterize the surface quality is as follows: In order to fully consider the local features of the image, the image is divided into several equal-height intervals along the axial direction, that is, the height direction. The total height of the image is H. The target area is divided into K equal-height intervals along the axial direction of the lamp tube, that is, the image height direction. The height of each interval is: The Kth interval range R k =[kh,(k+1)h], K=10 is set to ensure that each interval contains enough image information, while avoiding too fine-grained division that leads to high computational complexity. The height of each interval is one tenth of the total height of the image, which can effectively capture the brightness characteristics of different regions. Then, brightness statistical features are performed. In each partition, the horizontal brightness mean μk(x) and standard deviation σk(x) are calculated to describe the overall brightness distribution and brightness dispersion of the image in the interval, respectively. The brightness mean reflects the average brightness level of the region, and the standard deviation reflects the fluctuation of the regional brightness. The specific calculation formula is: Among them, I(x,y) is the grayscale value of the pixel at position (x,i) in the image. In this way, a set of statistical features can be obtained for each interval.
4. The method for detecting the brightness characteristics of scratches on the surface of a glass lamp tube according to claim 3, characterized in that The specific process of step S3 is as follows: after feature extraction, the defect detection stage determines whether there are surface defects such as scratches in the image based on the calculated brightness statistical features. This process mainly relies on two important detection rules: standard deviation sudden increase and mean gradient change. Since surface defects such as scratches usually cause drastic changes in the brightness of local areas, defects are detected by analyzing the change in standard deviation. When the standard deviation σk(x) in a certain interval exceeds the preset threshold, it means that the brightness fluctuation in this area is large and there may be defects. In order to further improve the accuracy of defect detection, the gradient change of the brightness mean in each interval is analyzed. Scratch defects usually appear as a sudden change in the brightness mean. When the brightness mean gradient |μ k (x+1)-μ k When (x-1)| is greater than the set threshold, the existence of the defect is further confirmed. The brightness of the defect-free bulb tube is used as the baseline, and the curve of the defect brightness is subtracted from it. In this way, the area of the scratch defect can be accurately located.
5. The method for detecting the brightness characteristics of scratches on the surface of a glass lamp tube according to claim 1, characterized in that The specific process is as follows: in the data preprocessing stage, CLAHE is used to enhance the local contrast of the image to improve the visibility of scratches in low-contrast areas; Otsu threshold segmentation is used to remove background noise, and morphological processing is combined to further optimize the integrity of the bulb area. In the scratch detection stage, the interval brightness gradient analysis method is used to divide the bulb area into 10 equal-height intervals along the axial direction, and the brightness mean μk(x), brightness standard deviation σk(x) and brightness gradient ∣μ are calculated in each interval. k (x+1)-μ k (x-1)|, to extract the local features of the scratch; the detection strategy is based on the mean surge threshold, namely |μ k (x+1)-μ k The scratch area is determined by using (x-1)|>10 and a standard deviation sudden increase threshold of 1.5σ.
Citation Information
Cited By
Glass bead defect detection method and system based on visual detection
CN121696142A