Surface defect detection method for glass bottles based on visual inspection
By performing performance testing and multispectral image acquisition on high-definition industrial cameras, combined with image preprocessing and feature extraction, the problems of poor image quality and inaccurate defect identification in surface defect inspection of glass bottles and cans were solved, achieving efficient and accurate defect detection and quality assessment.
Patent Information
- Application Number
- CN202510307413.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-17
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2045-03-17
AI Technical Summary
In the existing technology, no effective performance testing is performed on glass bottles and jars before the initial image capture, resulting in poor image quality, inaccurate defect identification and positioning, insufficient screening of defect areas, and inaccurate final quality judgment results.
High-definition industrial cameras are used for performance testing, combined with multispectral image acquisition, image preprocessing, feature extraction and visual defect detection. The defect boundaries are extracted through contour detection method, and a comprehensive score is given by weighting based on the defect type, number and severity.
It improves the quality and stability of image capture, accurately locates and identifies defects, provides a reliable data basis, ensures the accuracy and consistency of inspection results, and improves inspection efficiency and the scientific nature of quality judgment.
Smart Images

Figure CN120142307B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of surface defect detection, and in particular to a method for detecting surface defects of glass bottles and cans based on visual inspection. Background Art
[0002] Surface defect detection refers to the use of specific techniques or methods to identify and evaluate any irregularities, flaws or damage on the surface of a product.
[0003] Chinese patent publication number CN114219805B discloses an intelligent glass defect detection method. This method primarily preprocesses a captured glass image to obtain a threshold segmentation image and a corresponding target connected domain. The resulting threshold segmentation image mitigates the effects of illumination or other external factors on the glass image. The grayscale similarity of the target connected domain is calculated based on the grayscale corresponding to each pixel within the target connected domain. Based on this grayscale similarity, the target connected domain is first screened to obtain a candidate connected domain. The selected candidate connected domain is more likely to be a streak defect connected domain. The connected domain width of the candidate connected domain is calculated to obtain a width difference sequence. The proportion of values with the same sign in the width difference sequence is the tail spur rate of the candidate connected domain. Since defective textures typically have tail spurs, the tail spur rate of the candidate connected domain is determined based on the width of the connected domain. The greater the tail spur rate, the greater the probability that the candidate connected domain is a streak defect connected domain. The internal and external differences of the candidate connected domain are calculated based on the grayscale of the candidate connected domain. The product of the internal and external differences and the tail spur rate is the streak rate. A binary group is constructed by the stripe rate and the curvature degree, and a stripe defect connected domain is selected from multiple candidate connected domains based on the binary group. Although the above patent solves the problem of defect detection, the following problems still exist in actual operation:
[0004] 1. Before capturing the initial images of the glass bottles and jars, the camera device was not effectively tested for performance, resulting in initial image errors.
[0005] 2. There is no more effective defect identification and location of defective areas on the surface of glass bottles and jars, resulting in inaccurate final quality judgment results.
[0006] 3. No further image processing is performed on the initial image, and no targeted feature extraction is performed on the processed image, resulting in poor image capture accuracy. Summary of the Invention
[0007] The present invention aims to provide a method for detecting surface defects in glass bottles and jars based on visual inspection. By combining information on defect type, quantity, and severity, assigning weights, and then performing a comprehensive scoring process, this mechanism can comprehensively consider various factors to produce a more comprehensive and accurate scoring result. Defect boundaries are extracted through contour detection. This method can accurately locate defects and accurately extract defect boundaries, providing a reliable data foundation for subsequent analysis and processing. Defect candidate regions are generated through threshold segmentation, and are screened through methods such as size filtering, shape matching, and texture analysis. These regions can eliminate candidate regions without defects and accurately obtain images of defective glass bottles and jars, resolving the problems encountered in the prior art.
[0008] To achieve the above object, the present invention provides the following technical solutions:
[0009] Glass bottle and can surface defect detection method based on visual inspection, including:
[0010] Using a camera device to capture images of glass bottles and jars, performing image preprocessing on the captured images, and performing feature extraction on the preprocessed images;
[0011] The extracted features are subjected to visual defect detection, which includes defect recognition and defect location. The defects are then subjected to quality judgment based on the visual defect detection results. The quality judgment includes determining the defect type, quantity, and grade.
[0012] Preferably, using a camera device to capture images of glass bottles and jars includes:
[0013] Use high-definition industrial cameras to capture images of glass bottles and jars. Before capturing images of glass bottles and jars, the high-definition industrial cameras are first tested for performance;
[0014] Performance testing includes image resolution testing, illumination uniformity testing, color reproduction testing, focal length and focus accuracy testing, lens distortion testing, noise testing, image capture rate testing, automatic white balance testing, and lens cleanliness testing;
[0015] Only after the performance test of the high-definition industrial camera is completed and qualified can the image of the glass bottles and jars be captured.
[0016] Preferably, the method of capturing an image of the glass bottle or jar using a camera device further comprises:
[0017] First, a V-shaped mechanical fixture is used to fix the longitudinal axis of the glass bottle, and a servo motor drives a precision rotary table to achieve 0-360° axial rotation. The rotation angular speed is controlled in an adjustable range of 2-5r / min.
[0018] A ring-shaped LED array light source, which includes visible and near-infrared wavelengths, is used to trigger a high-definition industrial camera to capture multispectral image sequences during the rotation of the glass bottles. Each rotation angle interval triggers three sets of lighting combinations with different wavelengths: 450nm, 650nm, and 850nm.
[0019] Multi-exposure fusion technology is implemented for highly reflective areas, using an image sequence with 3-frame exposure times distributed in a ratio of 1:4:16;
[0020] Install a polarizing filter set in the optical path of the high-definition industrial camera, and adjust the angle combination of the polarizer and analyzer to attenuate the mirror-reflected light intensity to less than 10% of the original value;
[0021] The focal scanning method is used to obtain multi-focal plane images, and the depth synthesis algorithm is used to generate images of glass bottles and jars.
[0022] Preferably, the captured image is subjected to image preprocessing, including:
[0023] Perform image preprocessing on the generated glass bottle images;
[0024] The generated glass bottle images are first fused, and the scale-invariant feature transformation algorithm is used to perform sub-pixel spatial alignment on the 450nm, 650nm, and 850nm three-band images.
[0025] The corresponding relationship between multispectral features was established, and the image sequence with a 1:4:16 exposure ratio was merged through a weighted fusion algorithm. Adaptive gamma correction was used to generate a composite image with a dynamic range of 120dB.
[0026] Then, the orthogonal polarization state images are differentially processed to calculate the Stokes vector parameter matrix and extract the surface micro-texture features.
[0027] Preferably, performing image preprocessing on the captured image further comprises:
[0028] After the fusion process is completed, image correction is performed. Lens distortion compensation is first performed. Lens distortion compensation is based on pre-calibrated radial-tangential distortion parameters. The reverse mapping algorithm is applied to achieve image geometric correction. The residual distortion amount is ≤0.05 pixels. Then cylindrical projection transformation is performed. Cylindrical projection transformation is used to establish a parameterized model of the three-dimensional surface of the bottle and can. The spiral scanning image sequence is mapped to a cylindrical coordinate system to generate a seamless two-dimensional unfolded image. Finally, multi-focal plane fusion is performed. Multi-focal plane fusion uses the Laplace pyramid fusion algorithm to synthesize images of different focal planes into a full-definition image with an edge sharpness retention rate of ≥98%;
[0029] After image correction, image enhancement is performed. This involves constructing a dual illumination model to separate diffuse and specular reflection components, removing residual reflective noise through non-local mean filtering, applying three-scale illumination compensation with a Gaussian kernel function, and performing anisotropic enhancement with a Gabor filter bank.
[0030] After image enhancement, standardization is performed, which includes illumination equalization, color space conversion, and noise suppression.
[0031] Image preprocessing of glass bottle images is completed after image enhancement.
[0032] Preferably, the pre-processed image is subjected to feature extraction, comprising:
[0033] Feature extraction includes texture feature extraction, edge feature extraction, shape feature extraction, color feature extraction, frequency domain feature extraction and multi-scale feature extraction;
[0034] Texture feature extraction is to extract anisotropic texture features in the image using Gabor filters; edge feature extraction is to extract edge features in the image by calculating the gradient information of the image; shape feature extraction is to obtain the shape information of the surface of the glass bottle through the contour detection algorithm; color feature extraction is to extract the color distribution characteristics by analyzing the color distribution of the image; frequency domain feature extraction is to decompose the image from different scales using wavelet transform to extract multi-level texture information; multi-scale feature extraction is to decompose the image from different resolution levels using image pyramid technology to extract features at different scales;
[0035] The threshold segmentation method is used to generate defect candidate areas from the image after feature extraction;
[0036] Screening the generated defect candidate areas and excluding candidate areas without defects, wherein size filtering, shape matching and texture analysis are used for exclusion;
[0037] After screening, images of defective glass bottles and jars are obtained.
[0038] Preferably, the extracted features are subjected to visual defect detection, including:
[0039] The defective glass bottle images are fused into N-dimensional feature vectors, and the t-SNE nonlinear dimensionality reduction technique is used to compress the feature dimensions into a 3-5 dimensional visualization space, retaining more than 90% of the original information.
[0040] Input the N-dimensional feature vector into the machine learning model for training, and the machine learning model is a random forest;
[0041] Use defect recognition method to identify the trained N-dimensional feature vector;
[0042] Defect recognition methods include shape recognition, size recognition, color change recognition, and texture anomaly recognition;
[0043] After recognition is completed, images of glass bottles and jars of each defect type are obtained.
[0044] Preferably, performing visual defect detection on the extracted features further comprises:
[0045] Defect location is performed on the obtained glass bottle images of each defect type;
[0046] Defect localization generates a heat map for each defect type of the glass bottle image, wherein the heat map is generated by mapping the probability value of the detected defect area to the pixels of the image, and generating an image with a defect probability value for each pixel;
[0047] By clustering the high-probability areas in the heat map or finding the center points of the areas, the location of the defects can be obtained after clustering or finding.
[0048] For each located defect, the defect boundary is extracted using the contour detection method;
[0049] After the defect boundary extraction is completed, the defect location data of the defective glass bottle image is obtained.
[0050] Preferably, the defects are subjected to quality assessment based on the visual defect detection results, including:
[0051] Identify defect types based on the defect recognition and defect location data obtained during visual defect inspection. Defect types include bubbles, cracks, scratches, stains, irregular shapes, and uneven colors.
[0052] Then count the number of defects of each defect type;
[0053] The size and shape of each defect type are analyzed, and the severity of the defect is determined based on the analysis results.
[0054] Preferably, the method of determining the quality of defects based on the visual defect detection results further includes:
[0055] The severity of each defect is graded into no defect, slight defect, moderate defect and severe defect;
[0056] Combine the defect type, quantity, and severity information, assign weights to the information, and make a comprehensive score based on the assigned weights;
[0057] Determine the surface quality of the glass bottles and jars based on the scoring results;
[0058] When the scoring result is lower than the preset quality threshold, the glass bottle is unqualified.
[0059] Compared with the prior art, the present invention has the following beneficial effects:
[0060] 1. The visual inspection-based surface defect detection method for glass bottles and cans provided by this invention performs performance testing on high-definition industrial cameras, ensuring the high quality and stability of camera image capture. This helps improve the accuracy of subsequent image analysis. A three-frame image sequence with a 1:4:16 exposure ratio is used. This technique improves image quality in highly reflective areas, making them clearer and facilitating subsequent detection of surface defects or liquids within glass bottles and cans.
[0061] 2. The glass bottle and jar surface defect detection method based on visual inspection provided by the present invention generates defect candidate areas through the threshold segmentation method, and screens them through methods such as size filtering, shape matching and texture analysis. It can exclude candidate areas without defects and accurately obtain defective glass bottle and jar images.
[0062] 3. The visual inspection-based surface defect detection method for glass bottles and cans provided by this invention combines information on defect type, quantity, and severity, assigns weights, and then generates a comprehensive score. This mechanism comprehensively considers various factors to produce a more comprehensive and accurate scoring result. Defect boundaries are extracted through contour detection. This method can accurately locate defects and accurately extract defect boundaries, providing a reliable data foundation for subsequent analysis and processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 Schematic diagram of the steps for detecting surface defects of glass bottles and jars according to the present invention;
[0064] Figure 2 This is a schematic diagram of the glass bottle surface defect detection process of the present invention. DETAILED DESCRIPTION
[0065] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0066] In order to solve the problem in the prior art that the performance of the shooting device is not effectively tested before the initial image of the glass bottle is captured, which leads to the initial image error, please refer to Figure 1 and Figure 2 , this embodiment provides the following technical solutions:
[0067] Glass bottle and can surface defect detection method based on visual inspection, including:
[0068] Using a camera device to capture images of glass bottles and jars, performing image preprocessing on the captured images, and performing feature extraction on the preprocessed images;
[0069] The extracted features are subjected to visual defect detection, which includes defect recognition and defect location. The defects are then subjected to quality judgment based on the visual defect detection results. The quality judgment includes determining the defect type, quantity, and grade.
[0070] Specifically, through machine vision technology, defects in glass bottles and jars can be accurately identified and located, avoiding the subjectivity and individual differences of manual inspection, thereby ensuring the accuracy and consistency of the inspection results. The visual inspection system can quickly process and analyze large amounts of image data, and the inspection speed is far superior to manual inspection, which can greatly improve the inspection efficiency. The visual inspection system can adapt to glass bottles and jars of different specifications and types, and realize real-time online quality inspection.
[0071] Use a camera device to capture images of glass bottles and jars, including:
[0072] Use high-definition industrial cameras to capture images of glass bottles and jars. Before capturing images of glass bottles and jars, the high-definition industrial cameras are first tested for performance;
[0073] Performance testing includes image resolution testing, illumination uniformity testing, color reproduction testing, focal length and focus accuracy testing, lens distortion testing, noise testing, image capture rate testing, automatic white balance testing, and lens cleanliness testing;
[0074] Only after the performance test of the high-definition industrial camera is completed and qualified can the image of the glass bottles and jars be captured.
[0075] First, a V-shaped mechanical fixture is used to fix the longitudinal axis of the glass bottle, and a servo motor drives a precision rotary table to achieve 0-360° axial rotation. The rotation angular speed is controlled in an adjustable range of 2-5r / min.
[0076] A ring-shaped LED array light source, which includes visible and near-infrared wavelengths, is used to trigger a high-definition industrial camera to capture multispectral image sequences during the rotation of the glass bottles. Each rotation angle interval triggers three sets of lighting combinations with different wavelengths: 450nm, 650nm, and 850nm.
[0077] Multi-exposure fusion technology is implemented for highly reflective areas, using an image sequence with 3-frame exposure times distributed in a ratio of 1:4:16;
[0078] Install a polarizing filter set in the optical path of the high-definition industrial camera, and adjust the angle combination of the polarizer and analyzer to attenuate the mirror-reflected light intensity to less than 10% of the original value;
[0079] The focal scanning method is used to obtain multi-focal plane images, and the depth synthesis algorithm is used to generate images of glass bottles and jars.
[0080] Specifically, the high-definition industrial camera is tested for multiple performance indicators, including image resolution, illumination uniformity, color reproduction, focal length and focus accuracy, lens distortion, noise, image capture rate, automatic white balance, and lens cleanliness, to ensure high image quality and stability. This helps improve the accuracy of subsequent image analysis. A ring-shaped LED array light source, encompassing both visible and near-infrared wavelengths, is used to trigger the HD industrial camera to capture multispectral image sequences as the glass bottles rotate. This multispectral image acquisition technology provides richer image information, facilitating analysis of various characteristics of the glass bottles, such as material, thickness, and internal liquids. Multi-exposure fusion technology is implemented for highly reflective areas, using a three-frame image sequence with exposure times distributed in a 1:4:16 ratio. This technology improves image quality in highly reflective areas, making them clearer and facilitating subsequent detection of surface defects or internal liquids. A polarizing filter set is installed in the optical path of the HD industrial camera. By adjusting the angle combination of the polarizer and analyzer, the intensity of the specularly reflected light is attenuated to less than 10% of its original value. This helps reduce reflections from non-metallic surfaces, enhances color saturation, and improves image quality. Focus scanning is used to acquire multi-focal plane images, and a depth synthesis algorithm is applied to generate images of glass bottles and jars. This method ensures that objects at different distances and depths in the image are clearly presented, enhancing the three-dimensionality and realism of the image.
[0081] In order to solve the problem in the prior art that the initial image is not further processed and the processed image is not subjected to targeted feature extraction, which results in poor image capture accuracy, please refer to Figure 1 and Figure 2 , this embodiment provides the following technical solutions:
[0082] The captured images are pre-processed, including:
[0083] Perform image preprocessing on the generated glass bottle images;
[0084] The generated glass bottle images are first fused, and the scale-invariant feature transformation algorithm is used to perform sub-pixel spatial alignment on the 450nm, 650nm, and 850nm three-band images.
[0085] The corresponding relationship between multispectral features was established, and the image sequence with a 1:4:16 exposure ratio was merged through a weighted fusion algorithm. Adaptive gamma correction was used to generate a composite image with a dynamic range of 120dB.
[0086] Then, the orthogonal polarization state images are differentially processed to calculate the Stokes vector parameter matrix and extract the surface micro-texture features.
[0087] After the fusion process is completed, image correction is performed. Lens distortion compensation is first performed. Lens distortion compensation is based on pre-calibrated radial-tangential distortion parameters. The reverse mapping algorithm is applied to achieve image geometric correction. The residual distortion amount is ≤0.05 pixels. Then cylindrical projection transformation is performed. Cylindrical projection transformation is used to establish a parameterized model of the three-dimensional surface of the bottle and can. The spiral scanning image sequence is mapped to a cylindrical coordinate system to generate a seamless two-dimensional unfolded image. Finally, multi-focal plane fusion is performed. Multi-focal plane fusion uses the Laplace pyramid fusion algorithm to synthesize images of different focal planes into a full-definition image with an edge sharpness retention rate of ≥98%;
[0088] After image correction, image enhancement is performed. This involves constructing a dual illumination model to separate diffuse and specular reflection components, removing residual reflective noise through non-local mean filtering, applying three-scale illumination compensation with a Gaussian kernel function, and performing anisotropic enhancement with a Gabor filter bank.
[0089] After image enhancement, standardization is performed, which includes illumination equalization, color space conversion, and noise suppression.
[0090] Image preprocessing of glass bottle images is completed after image enhancement.
[0091] Specifically, a scale-invariant feature transformation algorithm is used for sub-pixel spatial alignment, ensuring precise alignment between multi-band images and improving image fusion accuracy. A weighted fusion algorithm is used to merge image sequences with different exposure ratios to generate a high-dynamic-range composite image, enhancing image detail. Orthogonal polarization state images are differentially processed to calculate the Stokes vector parameter matrix, enabling the extraction of microtexture features on the glass bottle surface, which is crucial for subsequent image analysis and recognition. Lens distortion compensation is based on pre-calibrated radial-tangential distortion parameters, and an inverse mapping algorithm is used to achieve image geometric correction, ensuring accurate geometric shape after correction. A cylindrical projection transformation is used to establish a parametric model of the bottle surface. The spiral scanned image sequence is mapped into a cylindrical coordinate system, generating a seamless 2D unrolled image for subsequent processing and analysis. Multi-focal plane fusion employs a Laplacian pyramid fusion algorithm to synthesize a fully sharp image, preserving edge sharpness and improving image clarity. A dual-illumination model is constructed to separate diffuse and specular reflection components, effectively eliminating the impact of specular reflection on image quality. Non-local mean filtering removes residual reflective noise, improving image smoothness. Three-scale illumination compensation using a Gaussian kernel function and anisotropic enhancement using a Gabor filter bank enhances image detail and contrast. Standardized processing steps such as illumination equalization, color space conversion, and noise suppression further improve image quality, making it more suitable for subsequent processing and analysis.
[0092] The preprocessed image is subjected to feature extraction, including:
[0093] Feature extraction includes texture feature extraction, edge feature extraction, shape feature extraction, color feature extraction, frequency domain feature extraction and multi-scale feature extraction;
[0094] Texture feature extraction is to extract anisotropic texture features in the image using Gabor filters; edge feature extraction is to extract edge features in the image by calculating the gradient information of the image; shape feature extraction is to obtain the shape information of the surface of the glass bottle through the contour detection algorithm; color feature extraction is to extract the color distribution characteristics by analyzing the color distribution of the image; frequency domain feature extraction is to decompose the image from different scales using wavelet transform to extract multi-level texture information; multi-scale feature extraction is to decompose the image from different resolution levels using image pyramid technology to extract features at different scales;
[0095] The threshold segmentation method is used to generate defect candidate areas from the image after feature extraction;
[0096] Screening the generated defect candidate areas and excluding candidate areas without defects, wherein size filtering, shape matching and texture analysis are used for exclusion;
[0097] After screening, images of defective glass bottles and jars are obtained.
[0098] Specifically, it covers a variety of feature extraction methods, including texture features, edge features, shape features, color features, frequency domain features, and multi-scale features. These methods can comprehensively describe image information from multiple angles, thereby improving the accuracy and robustness of subsequent processing. Gabor filters are used for texture feature extraction. Gabor filters are similar to the human visual system and can well describe local structural information corresponding to spatial frequency (scale), spatial position, and direction selectivity. They are also well adaptable to changes in illumination. Edge feature extraction is performed by calculating the gradient information of the image. This method is very effective in edge detection and can greatly reduce the amount of image data and highlight the important structure of the image. Shape feature extraction can accurately obtain the shape information of the surface of glass bottles and jars through the contour detection algorithm, which is very important for shape recognition. Color feature extraction can extract the distribution characteristics of color by analyzing the color distribution of the image, which plays an important role in color recognition and processing. Frequency domain feature extraction utilizes wavelet transforms. Due to their multi-resolution nature, wavelet transforms demonstrate a powerful ability to characterize local signal features in both the time and frequency domains, making them ideal for processing non-stationary signals and time-frequency analysis. Multi-scale feature extraction utilizes image pyramid technology, which decomposes images at different resolution levels and extracts features at different scales. This is very useful for multi-scale analysis. Defect candidate regions are generated through threshold segmentation and then screened through methods such as size filtering, shape matching, and texture analysis. This eliminates defect-free candidate regions and accurately captures images of defective glass bottles and jars. This method is highly efficient and accurate in defect detection.
[0099] In order to solve the problem that the existing technology does not have a more effective defect identification and location on the surface of glass bottles and jars, resulting in inaccurate final quality judgment results, please refer to Figure 1 and Figure 2 , this embodiment provides the following technical solutions:
[0100] The extracted features are used for visual defect detection, including:
[0101] The defective glass bottle images are fused into N-dimensional feature vectors, and the t-SNE nonlinear dimensionality reduction technique is used to compress the feature dimensions into a 3-5 dimensional visualization space, retaining more than 90% of the original information.
[0102] Input the N-dimensional feature vector into the machine learning model for training, and the machine learning model is a random forest;
[0103] Use defect recognition method to identify the trained N-dimensional feature vector;
[0104] Defect recognition methods include shape recognition, size recognition, color change recognition, and texture anomaly recognition;
[0105] After recognition is completed, images of glass bottles and jars of each defect type are obtained.
[0106] Defect location is performed on the obtained glass bottle images of each defect type;
[0107] Defect localization generates a heat map for each defect type of the glass bottle image, wherein the heat map is generated by mapping the probability value of the detected defect area to the pixels of the image, and generating an image with a defect probability value for each pixel;
[0108] By clustering the high-probability areas in the heat map or finding the center points of the areas, the location of the defects can be obtained after clustering or finding.
[0109] For each located defect, the defect boundary is extracted using the contour detection method;
[0110] After the defect boundary extraction is completed, the defect location data of the defective glass bottle image is obtained.
[0111] Specifically, the t-SNE nonlinear dimensionality reduction technique is used to compress high-dimensional feature vectors into a 3-5 dimensional visualization space while retaining over 90% of the original information. This method not only reduces the data dimensionality, facilitating subsequent processing and analysis, but also effectively preserves key data features, ensuring that defect information remains clearly visible in the reduced dimensionality space. A random forest is used as the machine learning model for training. Random forests are known for their powerful classification and regression capabilities, effectively handling high-dimensional data and exhibiting robustness to noise and outliers. This enables rapid model convergence during training and accurate distinction between different defect types during the recognition phase. The defect recognition method encompasses multiple aspects, including morphology, size, color variation, and texture anomalies. This comprehensive recognition method captures multiple defect characteristics in glass bottle and jar images, improving recognition accuracy and reliability. Defect areas are visually displayed by generating heat maps. Heat maps map the probability of detected defect areas to image pixels, making them more visible. This method not only facilitates manual inspection and verification, but also provides strong support for subsequent defect location and boundary extraction. It uses clustering or regional center point search methods to determine defect locations, and uses contour detection to extract defect boundaries. This method can accurately locate defects and accurately extract defect boundaries, providing a reliable data foundation for subsequent analysis and processing. In the visual defect inspection of glass bottles and jars, it has many significant advantages, including efficient information retention and visualization, powerful model training and recognition capabilities, comprehensive defect recognition methods, intuitive defect location and visualization, accurate defect location and boundary extraction, and broad application prospects.
[0112] Defects are judged for quality based on the visual defect detection results, including:
[0113] Identify defect types based on the defect recognition and defect location data obtained during visual defect inspection. Defect types include bubbles, cracks, scratches, stains, irregular shapes, and uneven colors.
[0114] Then count the number of defects of each defect type;
[0115] The size and shape of each defect type are analyzed, and the severity of the defect is determined based on the analysis results.
[0116] The severity of each defect is graded into no defect, slight defect, moderate defect and severe defect;
[0117] Combine the defect type, quantity, and severity information, assign weights to the information, and make a comprehensive score based on the assigned weights;
[0118] Determine the surface quality of the glass bottles and jars based on the scoring results;
[0119] When the scoring result is lower than the preset quality threshold, the glass bottle is unqualified;
[0120] The calculation formula for the comprehensive score based on the assigned weights in the above scheme is as follows:
[0121]
[0122] Q represents the comprehensive quality score; K represents the total number of defect types; N k Expressed as the number of defects of type k; S kj W is the severity score of the jth defect in the kth category; k Expressed as defect type weight coefficient; C m It is represented as the composite defect penalty term; η is represented as the composite penalty coefficient.
[0123] Specifically, the visual defect detection process accurately identifies and locates defects, which ensures the accuracy and reliability of subsequent analysis. The detailed classification of defect types (such as bubbles, cracks, scratches, etc.) helps to more accurately understand the problems existing in the product. The number of each defect type is counted and the size and shape are deeply analyzed. This comprehensive data analysis can provide richer information and help to more accurately assess the severity of the defects. The severity of defects is divided into four levels: no defects, minor defects, moderate defects, and severe defects. This scientific grading helps to standardize the quality judgment process and ensure the consistency and objectivity of the judgment results. By combining information on defect type, number, and severity, and assigning weights, and then performing a comprehensive score, this mechanism can comprehensively consider various factors to obtain a more comprehensive and accurate scoring result. The quality of the surface of the glass bottle and jar is directly judged based on the scoring results. When the score is lower than the preset quality threshold, it can be judged as a non-conforming product. This judgment method is efficient and easy to implement, which helps to improve production efficiency and quality control. By recording and analyzing defect data, companies can trace the root cause of the problem and take targeted improvement measures. This helps to continuously improve product quality and production efficiency.
[0124] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus.
[0125] While the embodiments of the present invention have been shown and described, it will be apparent to those skilled in the art that various changes, modifications, substitutions, and alterations can be made to the embodiments without departing from the principles and spirit of the invention.
Claims
1. A method for detecting surface defects of glass bottles and cans based on visual inspection, characterized in that: include: Using a camera device to capture images of glass bottles and jars, performing image preprocessing on the captured images, and performing feature extraction on the preprocessed images; The extracted features are used for visual defect detection. Visual defect detection includes defect recognition and defect location. The defects are then quality-judged based on the visual defect detection results. The quality judgment includes determining the defect type, quantity, and grade. The preprocessed image is subjected to feature extraction, including: Feature extraction includes texture feature extraction, edge feature extraction, shape feature extraction, color feature extraction, frequency domain feature extraction and multi-scale feature extraction; Texture feature extraction is to extract anisotropic texture features in the image using Gabor filters; edge feature extraction is to extract edge features in the image by calculating the gradient information of the image; shape feature extraction is to obtain the shape information of the surface of the glass bottle through the contour detection algorithm; color feature extraction is to extract the color distribution characteristics by analyzing the color distribution of the image; frequency domain feature extraction is to decompose the image from different scales using wavelet transform to extract multi-level texture information; multi-scale feature extraction is to decompose the image from different resolution levels using image pyramid technology to extract features at different scales; The threshold segmentation method is used to generate defect candidate areas from the image after feature extraction; Screening the generated defect candidate areas and excluding candidate areas without defects, wherein size filtering, shape matching and texture analysis are used for exclusion; After screening, images of defective glass bottles and jars are obtained.
2. The method for detecting surface defects of glass bottles and cans based on visual inspection according to claim 1, characterized in that: Use a camera device to capture images of glass bottles and jars, including: Use high-definition industrial cameras to capture images of glass bottles and jars. Before capturing images of glass bottles and jars, the high-definition industrial cameras are first tested for performance; Performance testing includes image resolution testing, illumination uniformity testing, color reproduction testing, focal length and focus accuracy testing, lens distortion testing, noise testing, image capture rate testing, automatic white balance testing, and lens cleanliness testing; Only after the performance test of the high-definition industrial camera is completed and qualified can the image of the glass bottles and jars be captured.
3. The method for detecting surface defects of glass bottles and cans based on visual inspection according to claim 2, characterized in that: Capturing images of glass bottles and jars using a camera device, including: First, a V-shaped mechanical fixture is used to fix the longitudinal axis of the glass bottle, and a servo motor drives a precision rotary table to achieve 0-360° axial rotation. The rotation angular speed is controlled in an adjustable range of 2-5r / min. A ring-shaped LED array light source, which includes visible and near-infrared wavelengths, is used to trigger a high-definition industrial camera to capture multispectral image sequences during the rotation of the glass bottles. Each rotation angle interval triggers three sets of lighting combinations with different wavelengths: 450nm, 650nm, and 850nm. Multi-exposure fusion technology is implemented for highly reflective areas, using an image sequence with 3-frame exposure times distributed in a ratio of 1:4:16; Install a polarizing filter set in the optical path of the high-definition industrial camera, and adjust the angle combination of the polarizer and analyzer to attenuate the mirror-reflected light intensity to less than 10% of the original value; The focal scanning method is used to obtain multi-focal plane images, and the depth synthesis algorithm is used to generate images of glass bottles and jars.
4. The method for detecting surface defects of glass bottles and cans based on visual inspection according to claim 1, characterized in that: The captured images are pre-processed, including: Perform image preprocessing on the generated glass bottle images; The generated glass bottle images are first fused, and the scale-invariant feature transformation algorithm is used to perform sub-pixel spatial alignment on the 450nm, 650nm, and 850nm three-band images. The corresponding relationship between multispectral features was established, and the image sequence with a 1:4:16 exposure ratio was merged through a weighted fusion algorithm. Adaptive gamma correction was used to generate a composite image with a dynamic range of 120dB. Then, the orthogonal polarization state images are differentially processed to calculate the Stokes vector parameter matrix and extract the surface micro-texture features.
5. The method for detecting surface defects of glass bottles and cans based on visual inspection according to claim 4, characterized in that: The captured image is subjected to image preprocessing, which also includes: After the fusion process is completed, image correction is performed. Lens distortion compensation is first performed. Lens distortion compensation is based on pre-calibrated radial-tangential distortion parameters. The reverse mapping algorithm is applied to achieve image geometric correction. The residual distortion amount is ≤0.05 pixels. Then cylindrical projection transformation is performed. Cylindrical projection transformation is used to establish a parameterized model of the three-dimensional surface of the bottle and can. The spiral scanning image sequence is mapped to a cylindrical coordinate system to generate a seamless two-dimensional unfolded image. Finally, multi-focal plane fusion is performed. Multi-focal plane fusion uses the Laplace pyramid fusion algorithm to synthesize images of different focal planes into a full-definition image with an edge sharpness retention rate of ≥98%; After image correction, image enhancement is performed. This involves constructing a dual illumination model to separate diffuse and specular reflection components, removing residual reflective noise through non-local mean filtering, applying three-scale illumination compensation with a Gaussian kernel function, and performing anisotropic enhancement with a Gabor filter bank. After image enhancement, standardization is performed, which includes illumination equalization, color space conversion, and noise suppression. Image preprocessing of glass bottle images is completed after image enhancement.
6. The method for detecting surface defects of glass bottles and cans based on visual inspection according to claim 1, characterized in that: The extracted features are used for visual defect detection, including: The defective glass bottle images are fused into N-dimensional feature vectors, and the t-SNE nonlinear dimensionality reduction technique is used to compress the feature dimensions into a 3-5 dimensional visualization space, retaining more than 90% of the original information. Input the N-dimensional feature vector into the machine learning model for training, and the machine learning model is a random forest; Use defect recognition method to identify the trained N-dimensional feature vector; Defect recognition methods include shape recognition, size recognition, color change recognition, and texture anomaly recognition; After recognition is completed, images of glass bottles and jars of each defect type are obtained.
7. The method for detecting surface defects of glass bottles and cans based on visual inspection according to claim 6, characterized in that: The extracted features are used for visual defect detection, which also includes: Defect location is performed on the obtained glass bottle images of each defect type; Defect localization generates a heat map for each defect type of the glass bottle image, wherein the heat map is generated by mapping the probability value of the detected defect area to the pixels of the image, and generating an image with a defect probability value for each pixel; By clustering the high-probability areas in the heat map or finding the center points of the areas, the location of the defects can be obtained after clustering or finding. For each located defect, the defect boundary is extracted using the contour detection method; After the defect boundary extraction is completed, the defect location data of the defective glass bottle image is obtained.
8. The method for detecting surface defects of glass bottles and cans based on visual inspection according to claim 1, characterized in that: Defects are judged for quality based on the visual defect detection results, including: Identify defect types based on the defect recognition and defect location data obtained during visual defect inspection. Defect types include bubbles, cracks, scratches, stains, irregular shapes, and uneven colors. Then count the number of defects of each defect type; The size and shape of each defect type are analyzed, and the severity of the defect is determined based on the analysis results.
9. The method for detecting surface defects of glass bottles and cans based on visual inspection according to claim 8, characterized in that: The method of determining the quality of defects according to the visual defect detection results further includes: The severity of each defect is graded into no defect, slight defect, moderate defect and severe defect; Combine the defect type, quantity, and severity information, assign weights to the information, and make a comprehensive score based on the assigned weights; Determine the surface quality of the glass bottles and jars based on the scoring results; When the scoring result is lower than the preset quality threshold, the glass bottle is unqualified.
Citation Information
Patent Citations
A Smart Detection Method for Glass Defects
CN114219805B
Glass bottle body flaw recognition and detection method and system based on image processing
CN117333467A
Glass wine bottle surface defect detection method and system
CN119438210A