Industrial glass defect detection method based on Visionmaster

Through the industrial glass defect detection method based on Visionmaster, combined with image preprocessing, expansion processing and image correction, the difficulty of glass defect detection in the prior art is solved, and fast and accurate glass defect detection is achieved, and product quality and detection efficiency are improved.

CN119515825APending Publication Date: 2025-02-25NORTHEASTERN UNIV AT QINHUANGDAO

Patent Information

Application Number
CN202411578936.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

Existing machine vision technology faces detection difficulties caused by light reflection and refraction in industrial glass defect detection, difficulty in detection of micro bubble defects, impact on the stability and accuracy of traditional image processing algorithms in complex defect detection, and the sensitivity of neural network-based detection methods to training data.

Method used

Using the Visionmaster-based industrial glass defect detection method, the rapid and accurate detection of glass defects is achieved through image preprocessing (including grayscale matching, Gaussian filtering and Canny edge detection), expansion processing and image correction, combined with Blob analysis and edge model defect detection.

Benefits of technology

It improves the accuracy and efficiency of glass defect detection, reduces labor costs, enhances product quality assurance, simplifies parameter adjustment of the inspection process, and improves the universality and stability of the inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119515825A_ABST
    Figure CN119515825A_ABST
Patent Text Reader

Abstract

The invention provides an industrial glass defect detection method based on Visionmaster. The industrial glass defect detection method is provided by aiming at the pain point of current glass defect detection and combining the actual demand of an enterprise. A traditional industrial glass defect detection method has many problems and deficiencies, such as poor environmental adaptability, lack of robustness, low precision, dependence on manual adjustment and the like. In order to solve the problems, the innovation comprises the following steps: preprocessing an image, detecting whether the glass is transversely broken or longitudinally divided, detecting glass edge defects, detecting glass surface defects, and summarizing results to judge the qualification of the glass. Firstly, noise interference is removed through an image processing technology, the position and the edge of a glass area are obtained, and an image enhancement means is used for improving the contrast ratio, so that an image is clearer; based on Visionmaster, whether glass is transversely cut or longitudinally divided, whether edge defects exist and whether surface defects exist are judged by utilizing a traditional visual technology and setting a proper threshold range. And finally, determining whether the industrial glass is qualified or not by summarizing detection results of all links. And if not, determining the defects of the glass. The industrial glass defect detection method has the advantages that the coding difficulty is reduced, the parameter adjustment process in the detection process is simplified, and the accuracy, universality and anti-interference capability of industrial glass defect detection are improved; and meanwhile, the labor cost is reduced, the product quality is better guaranteed, and the detection speed and efficiency are improved. In addition, the method has high interpretability and adaptability, and is suitable for complex and changeable industrial field environments. According to the method, while the production efficiency is improved, challenges existing in a traditional method are effectively handled, and a more effective and reliable detection method is provided for the industrial glass production process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of industrial glass defect detection, and in particular to an industrial glass defect detection method based on Visionmaster. Background Art

[0002] Industrial glass plays an important role in many industrial applications, involving high temperature, high pressure, special optical needs and other fields. As industrial production becomes increasingly complex, the standards for glass quality control are also constantly improving, especially in the detection of glass surface defects, which may include scratches, bubbles and cracks. Any tiny flaw may affect the quality and safety of the product. Therefore, it is particularly important to develop an efficient and accurate glass defect detection system.

[0003] Traditional glass defect detection mainly relies on manual methods, which is not only inefficient, but also susceptible to visual fatigue and subjective judgment. Especially when facing a large number of products, it is difficult to meet the needs of fast and accurate detection. The introduction of machine vision technology provides an effective solution for this, using image processing and computer vision technology to identify and locate various defects.

[0004] However, existing machine vision technology still faces some challenges in glass defect detection: first, the reflection and refraction characteristics of the glass surface cause light to form multiple contours, which makes defect detection difficult and may lead to inaccurate results or false alarms; second, the detection of tiny bubble defects is more difficult because their size and shape vary greatly, making it difficult for detection algorithms to accurately identify them; in addition, the stability and accuracy of traditional rule-based image processing algorithms may be affected when dealing with complex defects; finally, although neural network-based detection methods can improve detection accuracy in some cases, they usually require a large amount of labeled data for training and are extremely sensitive to the training process and data quality.

[0005] Therefore, industrial glass defect detection is a challenging task, which requires us to continuously research and explore more effective and excellent new technologies and methods. In addition to the above solutions, there are some emerging technical methods worth exploring, such as three-dimensional vision systems. The three-dimensional vision system uses depth sensors and stereo cameras to capture the three-dimensional structural information of objects, and is widely used in industrial inspection, robot navigation, and automated manufacturing. By calculating the depth information of the object, it can more accurately identify the shape, size, and position, thereby improving the accuracy of detection. For example, in defect detection, three-dimensional vision can effectively identify tiny defects on complex surfaces, overcoming the limitations of traditional two-dimensional images. In addition, this technology can also be combined with machine learning algorithms to enhance the ability of recognition and classification, providing stronger support for automated processes.

[0006] In summary, industrial glass defect detection is a significant issue involving actual production and a wide range of application scenarios. In response to the above challenges and problems and in combination with the actual needs of enterprises, we studied an industrial glass defect detection method based on Visionmaster. By using appropriate algorithms and models, this method can quickly and accurately identify glass defects, providing a guarantee for the product quality of glass manufacturing companies. Summary of the invention

[0007] In view of the deficiencies of the prior art and in combination with the actual needs of enterprises, the present invention provides an industrial glass defect detection technology based on Visionmaster.

[0008] The following steps are involved:

[0009] Step 1: Image preprocessing. First, grayscale matching is performed on the image captured by the industrial linear array camera to obtain the regional position of the glass in the image. The grayscale matching algorithm based on grayscale is also called the template-based matching algorithm. The grayscale values ​​at the corresponding positions of the sub-image and the template image are calculated to obtain a value. This value can be the sum of the absolute values ​​of the corresponding pixels subtracted (i.e., SAD algorithm), or the calculated sum can be divided by the number of template pixels, i.e., (MAD algorithm). Other grayscale-based image matching algorithms are based on this idea, but the calculated values ​​are different. Since the detection object is relatively simple and a higher detection speed is required, the present invention adopts the SAD algorithm. The SAD algorithm is to sum the absolute values ​​of the corresponding pixels subtracted from the template and the reference image, and then slide the template to traverse each position in turn to obtain a matrix of (PM) rows and (QN) columns. The position with the smallest value indicates that the template has the highest similarity with the reference image. The SAD similarity formula is as follows (because the algorithm directly uses the matrix calculation, it is different from the formula expression, but the essence is the same):

[0010]

[0011] Among them: 1≤i≤m-M+1, 1≤j≤n-N+1.

[0012] The image is then Gaussian filtered to filter out noise. The main reasons for the noise generated in the process of collecting images are the uneven brightness of the strip light source, the fluctuation of ambient light, and the interference caused by the image transmission project. In response to the above noise interference, the present invention uses a Gaussian filtering method to filter and denoise the image. Gaussian filtering is essentially a process of weighted averaging the entire image. The value of each pixel is obtained by weighted averaging itself and other pixel values ​​in the neighborhood. The specific operation of Gaussian filtering is: first determine a Gaussian convolution kernel, wherein when determining an integer Gaussian kernel, each pixel value in the fractional Gaussian convolution kernel needs to be divided by the pixel value of its upper left corner, and rounded to obtain an integer Gaussian convolution kernel. The Gaussian convolution kernel is used to scan each pixel in the image, and the weighted average value of the pixels in the neighborhood determined by the convolution kernel is used to replace the value of the central pixel point in the convolution area. The corresponding pixel value of the input image and the corresponding pixel value of the convolution kernel are multiplied and then added. If the summed pixel value is greater than the pixel threshold of 255, it needs to be truncated, and the summed pixel value is divided by 255, and the remainder is taken as the central pixel value of the convolution area. In this way, image noise reduction and smoothing processing are achieved, image quality is improved, and subsequent defect detection is facilitated.

[0013] Then use the Canny edge detection algorithm to obtain the edge of the glass in the image. In order to effectively identify the edge of the glass in the image, minimize the impact of noise and false edge detection, and make subsequent processing and analysis easier and more efficient, the Canny edge detection method is used to obtain the outline of the glass in the image. It mainly consists of four parts: image denoising, gradient calculation, non-maximum suppression, and dual threshold boundary tracking. The Canny edge detection gradient calculation is shown below:

[0014]

[0015] Where f(x,y) is the grayscale value of the image at (x,y), is the partial derivative in the x direction, is the partial derivative in the y direction. From this, we can get the gradient amplitude and direction of this point:

[0016]

[0017] Next, the image after edge detection is expanded to make the glass edge clearer and enhance the contrast. The expansion process is mainly based on mathematical morphology, and the pixel values ​​of the local area of ​​the image are updated through the structural element, thereby changing the characteristics of the image. It is usually used in image denoising, edge detection and morphological transformation. It enhances the characteristics of the image by enlarging the target area in the image. The key component in the expansion process is the structural element, which is a template with variable shape and size, used to traverse the image and compare with pixels. The structural element can be any shape such as rectangular, circular, cross, etc. In combination with the characteristics of the glass, the present invention finally selects a rectangular structural element with a size of 5×5. The calculation formula is as follows:

[0018]

[0019] Finally, image correction. In order to facilitate subsequent defect detection, the processed image is corrected to reduce or eliminate the effects caused by different glass positions and angles. Image correction mainly includes the following steps: 1) Detect reference points. First, the system needs to determine one or more reference points, which are usually known or easily identifiable feature points on the target object. These points can be corners, edges, centers of circles, etc. Here we use the center position of the local glass as the reference point. 2) Calculate the position deviation. By comparing the actual detected reference point position with the theoretical (or preset) position, the position deviation is calculated. This deviation may include multiple types of transformations such as translation, rotation, and scaling. In this device, we use the matching point after grayscale matching as the preset position (under the same lighting environment, the matching points of different glasses after grayscale matching are not much different, so the position of the corrected glass image is close). 3) Generate a transformation matrix. Generate a transformation matrix based on the calculated position deviation. This matrix describes the translation, rotation, scaling, and other transformations required to transform an image or a region in an image from the current position to the correct position. 4) Apply the transformation matrix. Applying the above generated transformation matrix to the input image can obtain the corrected glass image.

[0020] Step 2: Check whether the glass is cut horizontally or vertically. According to the needs of the enterprise, the produced glass may have defects due to mistakes during the cutting process, that is, the glass is cut horizontally or vertically. Through observation, it is not difficult to know that when the glass is cut horizontally or vertically, there will be cracks in the inner area of ​​the glass in the image that penetrate the glass. Therefore, we can process the glass image to a certain extent and detect the cross-cut or vertical defects of the glass based on this feature.

[0021] Based on the above analysis, the processed image is first subjected to median filtering. Since the directions of transverse and longitudinal divisions are different, two structural elements of different sizes are required, so that the input image only retains the transverse lines when detecting transverse sections; and the input image only retains the longitudinal lines when detecting longitudinal divisions. Median filtering is a commonly used nonlinear filtering technology, which is mainly used to remove noise in images or signals, especially when removing salt-and-pepper noise. Its basic principle is to replace the value of a point in a digital image or signal with the median of the values ​​of each point in a neighborhood of the point. Median filtering selects the pixel values ​​of a pixel point and its surrounding adjacent pixel points (there are an odd number of pixel points in total) in a digital image or digital sequence, sorts these pixel values, and then uses the pixel value in the middle position as the pixel value of the current pixel point, so that the surrounding pixel values ​​are close to the true value, thereby eliminating isolated noise points. The present invention uses two different structural elements of 25×80 and 100×27 to perform filtering operations on the processed glass image respectively.

[0022] Then, a straight line search is used on the inner area of ​​the glass in the median filtered image to check whether there are any horizontal or vertical cracks running through the glass; if so, the glass is cut horizontally or vertically and the quality is unqualified.

[0023] Step 3: Glass edge defect detection. If the glass is not cut horizontally or vertically, edge defect detection is performed. Considering that edge defects have different shapes and types, the present invention uses an edge pair model defect detection method to detect edge defects. The edge pair model defect detection method compares the edge pairs actually extracted with the pre-established edge pair model, analyzes the existence, position, width and other information of the edge pairs, and determines whether there are edge pair defects such as edge fractures.

[0024] Step 4: Detection of glass surface defects. According to the needs of enterprises, the types of surface defects mainly include circular surface defects such as bubbles and pits, and linear surface defects such as scratches and cracks. In view of the above defects, the present invention uses the Blob analysis method to detect surface defects. The specific process of Blob analysis to detect surface defects mainly consists of image binarization, Blob extraction, Blob screening, Blob sorting and Blob output.

[0025] The first is image binarization. Image binarization refers to converting the pixels in the image into pure black (grayscale value 255) or pure white (grayscale value 0). After the conversion, the image is divided into black and white. During the conversion process, the pixels whose grayscale values ​​are converted to 0 and 255 are specifically determined by a preset pixel threshold (i.e., a specific grayscale value). The threshold used by the present invention 1) is 90, that is, the grayscale value greater than or equal to 90 is set as the foreground (the grayscale value is set to 255), and the grayscale value less than 90 is set as the background (the grayscale value is set to 0). The specific calculation formula is as follows:

[0026]

[0027] Then, the binarized image is subjected to Blob extraction. The algorithm extracts Blobs according to the connected domain characteristics, and the connected characteristics include 4-connectivity or 8-connectivity, which can be configured by the connectivity mentioned in the parameter configuration. The present invention selects 8-connectivity.

[0028] Then, Blob screening is performed. The algorithm screens blobs according to preset conditions; the present invention combines the geometric characteristics of surface defects and finally selects area, circularity, and the length of the major axis and minor axis as screening conditions. Area screening conditions are used for all surface defects, and areas of 70-10000 will be screened out (in pixels); for circular surface defects such as bubbles and pits, circularity is additionally used as a screening indicator, and those in the range of 0.9-1.0 will be identified as circular surface defects such as bubbles; for strip defects such as surface scratches and cracks, the major axis length and minor axis length are additionally used as screening indicators, and blobs with a major axis length greater than 30 and a minor axis length in the range of 1-30 will be identified as scratches or cracks (in pixels).

[0029] Next, the selected blobs are sorted. The algorithm sorts the blobs selected in the previous process according to specific features, and the present invention sorts the blobs according to their area size.

[0030] Finally, the Blob analysis results are output. The algorithm returns the binary image, Blob image, the number of Blobs that meet the preset screening conditions, and the basic feature information and feature weighted score of each Blob that meets the preset screening conditions. If the output result of the number of Blobs is 0, there are no surface defects on the glass; otherwise, there are defects on the glass surface.

[0031] Step 5: Determine whether the glass is qualified based on the test results of step 2, step 3 and step 4. If defects are detected in any of step 2, step 3 and step 4, the glass is considered to be an unqualified product; if defects are detected in step 2, step 3 and step 4, the glass is considered to be a qualified product.

[0032] The benefits of adopting the above scheme are mainly:

[0033] The present invention provides a method for industrial glass defect detection, which can effectively reduce labor costs, improve production efficiency and product quality, and has strong interpretability. Based on Visionmaster, the present invention reduces the difficulty of coding and simplifies the parameter adjustment process of the industrial glass defect detection process, making it more concise and convenient; at the same time, a simple and efficient detection algorithm is selected to further improve the speed and efficiency of defect detection while ensuring the accuracy of defect detection; in addition, by selecting a suitable threshold, the rigid interference ability of the defect detection method is improved, and the versatility is enhanced. The invention reduces the outflow of defective products, greatly improves product quality, and ensures the reputation of the enterprise. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 This is a flow chart of the defect detection method based on Visionmaster in an example of the present invention.

[0035] Figure 2 This is a structural diagram of the industrial glass defect detection system based on Visionmaster in an example of the present invention. DETAILED DESCRIPTION

[0036] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

[0037] The current traditional industrial glass defect detection methods face many challenges in complex on-site environments, such as lighting changes, optical interference, and equipment vibration, all of which can significantly affect the detection results. In order to solve these problems, researchers have begun to explore the use of deep learning technology for defect detection. However, deep learning requires a large amount of training data, while defect data at industrial sites is usually scarce. In addition, deep learning models are relatively complex, and it is difficult for ordinary workers to manually adjust parameters, which has become a major pain point in current industrial glass defect detection. Based on the above problems, such as Figure 1 As shown, the present invention provides an industrial glass defect detection method based on Visionmaster, comprising the following steps:

[0038] Step 1: Image preprocessing. First, grayscale matching is performed on the image captured by the industrial linear array camera to obtain the regional position of the glass in the image. The grayscale matching algorithm based on grayscale is also called the template-based matching algorithm. The grayscale values ​​at the corresponding positions of the sub-image and the template image are calculated to obtain a value. This value can be the sum of the absolute values ​​of the corresponding pixels subtracted (i.e., SAD algorithm), or the calculated sum can be divided by the number of template pixels, i.e., (MAD algorithm). Other grayscale-based image matching algorithms are based on this idea, but the calculated values ​​are different. Since the detection object is relatively simple and a higher detection speed is required, the present invention adopts the SAD algorithm. The SAD algorithm is to sum the absolute values ​​of the corresponding pixels subtracted from the template and the reference image, and then slide the template to traverse each position in turn to obtain a matrix of (PM) rows and (QN) columns. The position with the smallest value indicates that the template has the highest similarity with the reference image. The SAD similarity formula is as follows (because the algorithm directly uses the matrix calculation, it is different from the formula expression, but the essence is the same):

[0039]

[0040] Among them: 1≤i≤m-M+1, 1≤j≤n-N+1.

[0041] The image is then Gaussian filtered to filter out noise. The main reasons for the noise generated in the process of collecting images are the uneven brightness of the strip light source, the fluctuation of ambient light, and the interference caused by the image transmission project. In response to the above noise interference, the present invention uses a Gaussian filtering method to filter and denoise the image. Gaussian filtering is essentially a process of weighted averaging the entire image. The value of each pixel is obtained by weighted averaging itself and other pixel values ​​in the neighborhood. The specific operation of Gaussian filtering is: first determine a Gaussian convolution kernel, wherein when determining an integer Gaussian kernel, each pixel value in the fractional Gaussian convolution kernel needs to be divided by the pixel value of its upper left corner, and rounded to obtain an integer Gaussian convolution kernel. The Gaussian convolution kernel is used to scan each pixel in the image, and the weighted average value of the pixels in the neighborhood determined by the convolution kernel is used to replace the value of the central pixel point in the convolution area. The corresponding pixel value of the input image and the corresponding pixel value of the convolution kernel are multiplied and then added. If the summed pixel value is greater than the pixel threshold of 255, it needs to be truncated, and the summed pixel value is divided by 255, and the remainder is taken as the central pixel value of the convolution area. In this way, image noise reduction and smoothing processing are achieved, image quality is improved, and subsequent defect detection is facilitated.

[0042] Then use the Canny edge detection algorithm to obtain the edge of the glass in the image. In order to effectively identify the edge of the glass in the image, minimize the impact of noise and false edge detection, and make subsequent processing and analysis easier and more efficient, the Canny edge detection method is used to obtain the outline of the glass in the image. It mainly consists of four parts: image denoising, gradient calculation, non-maximum suppression, and dual threshold boundary tracking. The Canny edge detection gradient calculation is shown below:

[0043]

[0044] Where f(x,y) is the grayscale value of the image at (x,y), is the partial derivative in the x direction, is the partial derivative in the y direction. From this, we can get the gradient amplitude and direction of this point:

[0045]

[0046] Next, the image after edge detection is expanded to make the glass edge clearer and enhance the contrast. The expansion process is mainly based on mathematical morphology, and the pixel values ​​of the local area of ​​the image are updated through the structural element, thereby changing the characteristics of the image. It is usually used in image denoising, edge detection and morphological transformation. It enhances the characteristics of the image by enlarging the target area in the image. The key component in the expansion process is the structural element, which is a template with variable shape and size, used to traverse the image and compare with pixels. The structural element can be any shape such as rectangular, circular, cross, etc. In combination with the characteristics of the glass, the present invention finally selects a rectangular structural element with a size of 5×5. The calculation formula is as follows:

[0047]

[0048] Finally, image correction. In order to facilitate subsequent defect detection, the processed image is corrected to reduce or eliminate the effects caused by different glass positions and angles. Image correction mainly includes the following steps: 1) Detect reference points. First, the system needs to determine one or more reference points, which are usually known or easily identifiable feature points on the target object. These points can be corners, edges, centers of circles, etc. Here we use the center position of the local glass as the reference point. 2) Calculate the position deviation. By comparing the actual detected reference point position with the theoretical (or preset) position, the position deviation is calculated. This deviation may include multiple types of transformations such as translation, rotation, and scaling. In this device, we use the matching point after grayscale matching as the preset position (under the same lighting environment, the matching points of different glasses after grayscale matching are not much different, so the position of the corrected glass image is close). 3) Generate a transformation matrix. Generate a transformation matrix based on the calculated position deviation. This matrix describes the translation, rotation, scaling, and other transformations required to transform an image or a region in an image from the current position to the correct position. 4) Apply the transformation matrix. Applying the above generated transformation matrix to the input image can obtain the corrected glass image.

[0049] Step 2: Check whether the glass is cut horizontally or vertically. According to the needs of the enterprise, the produced glass may have defects due to mistakes during the cutting process, that is, the glass is cut horizontally or vertically. Through observation, it is not difficult to know that when the glass is cut horizontally or vertically, there will be cracks in the inner area of ​​the glass in the image that penetrate the glass. Therefore, we can process the glass image to a certain extent and detect the cross-cut or vertical defects of the glass based on this feature.

[0050] Based on the above analysis, the processed image is first subjected to median filtering. Since the directions of transverse and longitudinal divisions are different, two structural elements of different sizes are required, so that the input image only retains the transverse lines when detecting transverse sections; and the input image only retains the longitudinal lines when detecting longitudinal divisions. Median filtering is a commonly used nonlinear filtering technology, which is mainly used to remove noise in images or signals, especially when removing salt-and-pepper noise. Its basic principle is to replace the value of a point in a digital image or signal with the median of the values ​​of each point in a neighborhood of the point. Median filtering selects the pixel values ​​of a pixel point and its surrounding adjacent pixel points (there are an odd number of pixel points in total) in a digital image or digital sequence, sorts these pixel values, and then uses the pixel value in the middle position as the pixel value of the current pixel point, so that the surrounding pixel values ​​are close to the true value, thereby eliminating isolated noise points. The present invention uses two different structural elements of 25×80 and 100×27 to perform filtering operations on the processed glass image respectively.

[0051] Then, a straight line search is used on the inner area of ​​the glass in the median filtered image to check whether there are any horizontal or vertical cracks running through the glass; if so, the glass is cut horizontally or vertically and the quality is unqualified.

[0052] Step 3: Glass edge defect detection. If the glass is not cut horizontally or vertically, edge defect detection is performed. Considering that edge defects have different shapes and types, the present invention uses an edge pair model defect detection method to detect edge defects. The edge pair model defect detection method compares the edge pairs actually extracted with the pre-established edge pair model, analyzes the existence, position, width and other information of the edge pairs, and determines whether there are edge pair defects such as edge fractures.

[0053] Step 4: Detection of glass surface defects. According to the needs of enterprises, the types of surface defects mainly include circular surface defects such as bubbles and pits, and linear surface defects such as scratches and cracks. In view of the above defects, the present invention uses the Blob analysis method to detect surface defects. The specific process of Blob analysis to detect surface defects mainly consists of image binarization, Blob extraction, Blob screening, Blob sorting and Blob output.

[0054] The first is image binarization. Image binarization refers to converting the pixels in the image into pure black (grayscale value 255) or pure white (grayscale value 0). After the conversion, the image is divided into black and white. During the conversion process, the pixels whose grayscale values ​​are converted to 0 and 255 are specifically determined by a preset pixel threshold (i.e., a specific grayscale value). The threshold used by the present invention 1) is 90, that is, the grayscale value greater than or equal to 90 is set as the foreground (the grayscale value is set to 255), and the grayscale value less than 90 is set as the background (the grayscale value is set to 0). The specific calculation formula is as follows:

[0055]

[0056] Then, the binarized image is subjected to Blob extraction. The algorithm extracts Blobs according to the connected domain characteristics, and the connected characteristics include 4-connected or 8-connected, which can be configured by the connectivity mentioned in the parameter configuration. The present invention selects 8-connected.

[0057] Then, Blob screening is performed. The algorithm screens blobs according to preset conditions; the present invention combines the geometric characteristics of surface defects and finally selects area, circularity, and the length of the major axis and minor axis as screening conditions. Area screening conditions are used for all surface defects, and areas of 70-10000 will be screened out (in pixels); for circular surface defects such as bubbles and pits, circularity is additionally used as a screening indicator, and those in the range of 0.9-1.0 will be identified as circular surface defects such as bubbles; for strip defects such as surface scratches and cracks, the major axis length and minor axis length are additionally used as screening indicators, and blobs with a major axis length greater than 30 and a minor axis length in the range of 1-30 will be identified as scratches or cracks (in pixels).

[0058] Next, the selected blobs are sorted. The algorithm sorts the blobs selected in the previous process according to specific features, and the present invention sorts the blobs according to their area size.

[0059] Finally, the Blob analysis results are output. The algorithm returns the binary image, Blob image, the number of Blobs that meet the preset screening conditions, and the basic feature information and feature weighted score of each Blob that meets the preset screening conditions. If the output result of the number of Blobs is 0, there are no surface defects on the glass; otherwise, there are defects on the glass surface.

[0060] Step 5: Determine whether the glass is qualified based on the test results of step 2, step 3 and step 4. If defects are detected in any of step 2, step 3 and step 4, the glass is considered to be an unqualified product; if defects are detected in step 2, step 3 and step 4, the glass is considered to be a qualified product.

Claims

1. A method for industrial glass defect detection based on Visionmaster, Its characteristics include the following steps: Step 1: Image preprocessing; First, grayscale matching is performed on the image captured by the industrial linear array camera to obtain the regional position of the glass in the image; the grayscale-based matching algorithm is also called the template-based matching algorithm. The grayscale values ​​at the corresponding positions of the sub-image and the template image are calculated to obtain a value. This value can be the sum of the absolute values ​​of the corresponding pixels subtracted (i.e., SAD algorithm), or the calculated sum can be divided by the number of template pixels, i.e., (MAD algorithm). Other grayscale-based image matching algorithms are based on this idea, but the calculated values ​​are different; since the detection object is relatively simple and a higher detection speed is required, the present invention adopts the SAD algorithm; the SAD algorithm is to sum the absolute values ​​of the corresponding pixels subtracted from the template and the reference image, and then slide the template to traverse each position in turn to obtain a matrix of (PM) rows and (QN) columns, where the position with the smallest value indicates that the template has the highest similarity with the reference image; Then, the image is subjected to Gaussian filtering to filter out noise. The main reasons for the noise generated in the process of collecting images are the uneven brightness of the strip light source, the fluctuation of the ambient light, and the interference caused by the image transmission project. In view of the above noise interference, the present invention adopts the method of using Gaussian filtering to filter and denoise the image. The specific operation of Gaussian filtering is: first determine a Gaussian convolution kernel, wherein when determining the integer Gaussian kernel, it is necessary to divide each pixel value in the decimal Gaussian convolution kernel by the pixel value of its upper left corner, and round it to obtain the integer Gaussian convolution kernel; and use the Gaussian convolution kernel to scan each pixel in the image, and use the weighted average value of the pixels in the neighborhood determined by the convolution kernel to replace the value of the central pixel point of the convolution area, and multiply the corresponding pixel value of the input image and the corresponding pixel value of the convolution kernel respectively and then add them. If the summed pixel value is greater than the pixel threshold 255, it is necessary to truncate, and the summed pixel value is divided by 255, and the remainder is taken as the central pixel value of the convolution area; thereby realizing the denoising and smoothing of the image, improving the image quality, and facilitating the subsequent defect detection; Then, the Canny edge detection algorithm is used to obtain the edge of the glass in the image. In order to effectively identify the edge of the glass in the image, minimize the influence of noise and false edge detection, and make subsequent processing and analysis easier and more efficient, the Canny edge detection method is used to obtain the contour of the glass in the image. It mainly consists of four parts: image denoising, gradient calculation, non-maximum suppression, and dual threshold boundary tracking. Next, the image after edge detection is expanded to make the glass edge clearer and enhance the contrast; the expansion process is mainly based on mathematical morphology, and the pixel values ​​of the local area of ​​the image are updated through the structure element, thereby changing the characteristics of the image; it is usually used in image denoising, edge detection and morphological transformation; it enhances the characteristics of the image by enlarging the target area in the image; the key component in the expansion process is the structure element, which is a template with variable shape and size, used to traverse the image and compare with pixels; the structure element can be any shape such as rectangle, circle, cross, etc.; the present invention finally selects a rectangular structure element with a size of 5×5 in combination with the characteristics of the glass; Finally, image correction: In order to facilitate subsequent defect detection, the processed image is corrected to reduce or eliminate the effects caused by different glass positions and angles. Image correction mainly includes the following steps: 1) Detect reference points: First, the system needs to determine one or more reference points, which are usually known or easily identifiable feature points on the target object. These points can be corner points, edges, center points, etc. Here we use the center position of the local glass as the reference point; 2) Calculate position deviation: By comparing the actual detected reference point position with the theoretical (or preset) position, calculate the position deviation; This deviation may include translation, rotation, scaling and other types of transformations; In this device, we use the matching point after grayscale matching as the preset position (under the same lighting environment, the matching points of different glasses after grayscale matching are not much different, so the position of the corrected glass image is close); 3) Generate transformation matrix: Based on the calculated position deviation, generate a transformation matrix; This matrix describes how to transform the image or a region in the image from the current position to the correct position, such as translation, rotation, scaling, etc.; 4) Apply transformation matrix: Apply the above generated transformation matrix to the input image to obtain the corrected glass image; Step 2: Check whether the glass is cut horizontally or vertically. According to the needs of the enterprise, the produced glass may have defects due to errors during the cutting process, that is, the glass is cut horizontally or vertically. Through observation, we can easily know that when the glass is cut horizontally or vertically, there will be cracks that penetrate the glass in the internal area of ​​the glass in the image. Therefore, we can process the glass image to a certain extent and detect the cross-cut or vertical defects of the glass based on this feature. Step 3: glass edge defect detection; if the glass is not cut horizontally or vertically, edge defect detection is performed. Considering that edge defects have different shapes and types, the present invention adopts an edge pair model defect detection method to detect edge defects; the edge pair model defect detection method is to compare the edge pairs actually extracted with the pre-established edge pair model, analyze the existence, position, width and other information of the edge pairs, and determine whether there are edge pair defects such as edge fractures; Step 4: Detection of glass surface defects; According to the needs of enterprises, the types of surface defects mainly include circular surface defects such as bubbles and pits, and linear surface defects such as scratches and cracks; In view of the above defects, the present invention adopts the method of Blob analysis to detect surface defects; The specific process of Blob analysis to detect surface defects mainly consists of image binarization, Blob extraction, Blob screening, Blob sorting and Blob output; First, the image is binarized; image binarization refers to converting the pixels in the image into pure black (grayscale value 255) or pure white (grayscale value 0); after the conversion, the image is divided into black and white parts; during the conversion process, the pixels whose grayscale values ​​are converted to 0 and 255 are specifically determined by a preset pixel threshold (i.e., a specific grayscale value); 1) The threshold used by the team of the present invention is 90, that is, the grayscale value greater than or equal to 90 is set as the foreground (the grayscale value is set to 255), and the grayscale value less than 90 is set as the background (the grayscale value is set to 0); Then, the binarized image is subjected to Blob extraction; the algorithm extracts Blob according to the connected domain characteristics, the connectivity characteristics include 4-connectivity or 8-connectivity, which can be configured by the connectivity mentioned in the parameter configuration; the present invention selects 8-connectivity; Then, Blob screening is performed; the algorithm screens Blobs according to preset conditions; the present invention finally selects area, circularity, and the length of the major axis and the minor axis as screening conditions in combination with the geometric characteristics of surface defects; the area screening condition is used for all surface defects, and those with an area size of 70-10000 will be screened out (in pixels); for circular surface defects such as bubbles and pits, circularity is additionally used as a screening index, and those in the range of 0.9-1.0 will be identified as circular surface defects such as bubbles; for strip defects such as surface scratches and cracks, the major axis length and the minor axis length are additionally used as screening indicators, and blobs with a major axis length greater than 30 and a minor axis length in the range of 1-30 will be identified as scratches or cracks (in pixels); Next, the selected blobs are sorted; the algorithm sorts the blobs selected in the previous process according to specific features, and the present invention sorts the blobs according to their area size; Finally, the Blob analysis results are output; the algorithm returns the binary image, Blob image, the number of Blobs that meet the preset screening conditions, and the basic feature information and feature weighted score of each Blob that meets the preset screening conditions; If the result of outputting the number of blobs is 0, the glass has no surface defects; otherwise, there are defects on the glass surface; Step 5: Determine whether the glass is qualified based on the test results of step 2, step 3 and step 4. If defects are detected in any of step 2, step 3 and step 4, the glass is considered to be an unqualified product; if defects are detected in step 2, step 3 and step 4, the glass is considered to be a qualified product.

2. The industrial glass defect detection method based on Visionmaster according to claim 1, characterized in that: The algorithm described in step 1 searches for glass regions. The core idea is SAD similarity calculation, based on which the glass region information in the image can be effectively extracted. The SAD similarity calculation formula is as follows (because the algorithm directly uses matrix calculation, it is different from the formula expression, but the essence is the same): Among them: 1≤i≤m-M+1, 1≤j≤n-N+1.

3. The industrial glass defect detection method based on Visionmaster according to claim 1, characterized in that: The core idea of ​​the glass edge area enhancement described in step 1 is the gradient calculation and non-maximum suppression of Canny edge detection and edge expansion processing. The above image processing technology can effectively extract the glass edge information and ensure the edge clarity; The edge gradient calculation is shown as follows: Where f(x,y) is the grayscale value of the image at (x,y), is the partial derivative in the x direction, is the partial derivative in the y direction; from this we can get the gradient amplitude and direction of this point: The expansion calculation formula is as follows:

4. The industrial glass defect detection method based on Visionmaster according to claim 1, characterized in that: The algorithm for detecting whether the glass is cut horizontally or vertically described in step 2 performs median filtering on the processed image. Since the directions of the cross-section and vertical division are different, two structural elements of different sizes are required, so that when detecting the cross-section, the input image only retains the horizontal lines; when detecting the vertical division, the input image only retains the vertical lines; the processed glass image is filtered respectively by using two different structural elements of 25×80 and 100×27; then a straight line search is used on the internal area of ​​the glass in the median filtered image to check whether there are horizontal or vertical cracks running through the glass; if so, the glass is cut horizontally or vertically and the quality is unqualified.

Citation Information

Patent Citations

  • Small-size glass panel surface defect detection method and small-size glass panel surface defect detection system

    CN105447854A

  • Wafer defect detection method based on characteristic matching

    CN106600600A

  • A stainless steel surface defect detection method based on machine vision

    CN107478657A

  • Glass panel crack identification method based on image method

    CN117522841A

  • Industrial glass defect detection method based on OpenCV optimization algorithm

    CN118172322A

Cited By

  • Mold cleanliness detection method, system, equipment and medium based on image processing

    CN119785119A

  • Optical performance simulation and evaluation method of AG glass, image acquisition system, computer and storage medium

    CN121213463A