Method for automatically detecting width of fine grid line
Automatically detecting the metal grid line width through imaging system and machine learning optimization modular software, the problem of insufficient measurement efficiency and accuracy in the prior art is solved, and efficient automatic detection of line width is achieved.
Patent Information
- Application Number
- CN202510179405.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-07-04
AI Technical Summary
The prior art is difficult to measure the fine line widths of metal grid products quickly and accurately, especially in multi-line and curved situations, manual measurements are time-consuming and software is difficult to apply effectively.
The reference patterns are obtained through the imaging system, the program is written for preprocessing, contour recognition and analysis, the results are optimized using machine learning, and packaged into modular software for automatic detection.
It realizes fast, accurate and automatic detection of metal grid lines, improves measurement efficiency and accuracy, and reduces manual intervention.
Smart Images

Figure BDA0005276532170000051 
Figure HDA0005276532180000011 
Figure HDA0005276532180000021
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of metal grids, and in particular to a method for automatically detecting the width of a fine grid line. Background Art
[0002] Since metal mesh can realize ultra-fine lines (5-15um) on a large scale, the uniformity of product line width has always been the focus of attention in the production process, and it is necessary to ensure that the line width of the sample can be measured quickly and accurately. Transparent conductive materials such as metal mesh and nano silver wire are widely used in technical fields such as ultra-large capacitive touch panels, EMI shielding films, heating films, transparent antennas, photovoltaic cells, etc. In the production process, it is necessary to use microscopes or CCD and other equipment to measure the line width of the product. Since there are many metal grid lines, the nine-square grid method is generally used, that is, different areas on the product are selected for measurement according to the nine-square grid method. However, there are many lines in an area. If they are measured one by one, it will take up a lot of manual time, and some lines are curves, which are difficult to measure with general measurement software. Therefore, it is necessary to develop a method that can automatically detect all lines in the field of view. Summary of the invention
[0003] The object of the present invention is to provide a method for automatically detecting the width of a fine grid line to solve the problems raised in the above background technology.
[0004] To achieve the above object, the present invention provides the following technical solution: A method for automatically detecting the width of a fine grid line, comprising the following steps: S1: acquiring a large number of reference patterns through an imaging system, and measuring the line widths thereof with a built-in ruler to obtain basic data;
[0005] S2: Write relevant programs to pre-process, identify and analyze the reference pattern, and continuously optimize the analysis results through machine learning to make them close to the standard value of the reference pattern;
[0006] S3: Encapsulate the programs in S2 into modular software;
[0007] S4: The imaging system inputs the measured pattern into the modularized software for detection;
[0008] S5: Output line width data report.
[0009] Preferably, the preprocessing in S2 includes:
[0010] Grayscale: Convert color images into grayscale images to simplify subsequent processing;
[0011] Binarization: Convert grayscale images into black and white images to facilitate contour identification;
[0012] Filtering and denoising: Use median filtering or Gaussian filtering to remove image noise.
[0013] Preferably, the specific steps for the Gaussian filtering to remove image noise are as follows:
[0014] S2-1: Create a Gaussian kernel. According to the required standard deviation σ, create a Gaussian kernel.
[0015] S2-2: Normalize the Gaussian kernel. Add up all the element values of the Gaussian kernel, and then divide by this sum so that the sum of all the element values of the Gaussian kernel is 1.
[0016] S2-3: Traverse the image. For each pixel point in the image, take an image region of the same size as the Gaussian kernel with this point as the center.
[0017] S2-4: Convolution operation. Multiply the corresponding pixel values of the Gaussian kernel and the image region, and add up all the products to get a value.
[0018] S2-5: Replace the pixel value. Replace the pixel value at the center point of the filtering window in the original image with the result of the convolution operation.
[0019] S2-6: Repeat the process. Repeat the above steps until every pixel point in the image has been processed.
[0020] S2-7: Output the result. Obtain the filtered image, and the noise in this image is smoothed.
[0021] Preferably, edge detection needs to be performed for contour recognition in S2. Detect the edges in the image, which is usually used to extract line width information, calculate the gradient of the image grayscale, determine the edge positions, highlight the regions with sharp grayscale changes in the image for edge localization; during contour recognition, identify and track the continuous edge points in the image to form a closed contour, and then use methods such as the least squares method and the Hough transform to fit the contour into a straight line or a curve.
[0022] Preferably, the contour analysis in S2 includes distance transformation and region growing. The distance transformation is to calculate the distance from the foreground pixel points to the nearest background pixel points in the binary image, and the line width can be determined by the maximum value of the distance transformation; region growing starts from the seed points, and according to certain criteria, merge the nearby pixel points into the region where the seed points are located, and calculate the line by analyzing the region features.
[0023] Preferably, the imaging system includes an imaging device, which includes a base 1, a placing table is provided at one end of the base, the placing table is used to place the sample to be imaged, a bracket is provided at the other end of the upper surface of the base, a top shell is connected to the top of the bracket, a display screen and a control panel are provided on the top shell, an inner frame is movably provided inside the top shell, a telescopic rod is connected to each of the two ends of the inner frame, a movable block is movably provided inside the inner frame, a sampling camera is provided on the bottom surface of the movable block, the sampling camera is used to sample and shoot the sample, a threaded hole is provided on the movable block, an adjusting motor is installed at one end of the inner frame, a screw rod is connected to the output end of the adjusting motor, the screw rod passes through the movable block and is connected to the threaded hole.
[0024] Compared with the prior art, the present invention has the following beneficial effects:
[0025] The present invention proposes a method for automatically detecting the width of a fine grid line. First, a large number of product drawings can be prepared, including straight lines, curves, composite graphics and other styles, and the line width of several lines in the drawings can be measured using the measuring equipment provided by the imaging system. Then, relevant programs are written in Python and other languages to pre-process, identify and analyze the reference drawings, and the results of the analysis are continuously optimized through machine learning to make them close to the standard values of the reference drawings. After that, it is packaged into modular software for general workers to use. Finally, the software and algorithm can be iterated according to the actual use results to improve the measurement accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a schematic diagram of the process of the present invention.
[0027] Figure 2 It is a structural diagram of the imaging device of the present invention.
[0028] Figure 3 This is the internal frame structure diagram of the present invention.
[0029] In the figure: base 1, placement table 2, top shell 3, inner frame 4, telescopic rod 5, movable block 6, sampling camera 7, adjustment motor 8, screw rod 9. DETAILED DESCRIPTION
[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. 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 creative work are within the scope of protection of the present invention.
[0031] See also Figures 1-3, the present invention provides a technical solution: a method for automatically detecting the width of a fine grid line, including the following steps: S1: Obtain a large number of reference patterns through an imaging system, and measure the line width with a self - contained scale to obtain basic data;
[0032] S2: Write relevant programs to pre - process, identify and analyze the contour of the reference pattern, and continuously optimize the analysis results through machine learning to make them close to the standard values of the reference pattern;
[0033] S3: Package the program in S2 into a modular software;
[0034] S4: The imaging system inputs the measured pattern into the modularized software for detection;
[0035] S5: Output a line width data report.
[0036] The imaging system includes an imaging device. The imaging device includes a base 1. At one end of the base 1, there is a placement table 2 for placing the sample to be imaged. At the other end of the upper surface of the base 1, there is a bracket. At the top of the bracket, there is a top housing 3. The top housing 3 is provided with a display screen and a control panel. Inside the top housing 3, there is an inner frame 4 movably arranged. At both ends of the inner frame 4, there is a telescopic rod 5 connected respectively. Inside the inner frame 4, there is a movable block 6 movably arranged. At the bottom surface of the movable block 6, there is a sampling camera 7 for sampling and photographing the sample. The movable block 6 is provided with a threaded hole. At one end of the inner frame 4, there is an adjustment motor 8 installed. The output end of the adjustment motor 8 is connected with a lead screw 9. The lead screw 9 passes through the movable block 6 and is in threaded connection with the threaded hole. When imaging, place the sample on the placement table 2, start the device through the control panel, the device automatically images the sample, the sampling camera 7 takes pictures of the sample and uploads them to the system, control the telescopic rod 5 to stretch and retract to make the inner frame 4 move horizontally, and control the adjustment motor 8 to rotate to drive the lead screw 9 to rotate, so that the movable block 6 moves inside the inner frame 4, thereby adjusting the position of the sampling camera 7, and then the sample can be photographed at various places.
[0037] The pre - processing in S2 includes:
[0038] Gray - scale conversion: Convert the color image into a gray - scale image to simplify subsequent processing;
[0039] Binarization: Convert the gray - scale image into a black - and - white image to facilitate contour recognition;
[0040] Filtering and denoising: Use median filtering or Gaussian filtering to remove image noise.
[0041] The specific steps for removing image noise by Gaussian filtering are:
[0042] S2-1: Create a Gaussian kernel. According to the required standard deviation σ, create a Gaussian kernel, which is a two-dimensional matrix. The element values of the Gaussian kernel are calculated according to the Gaussian function, and the formula is:
[0043]
[0044] The size of the Gaussian kernel is usually selected as an odd number, such as 3x3, 5x5, etc.
[0045] S2-2: Normalize the Gaussian kernel. Add up all the element values of the Gaussian kernel, and then divide by this sum so that the sum of all the element values of the Gaussian kernel is 1;
[0046] S2-3: Traverse the image. For each pixel point in the image, take the image area with the same size as the Gaussian kernel centered on this point;
[0047] S2-4: Convolution operation. Multiply the corresponding pixel values of the Gaussian kernel and the image area, and add up all the products to get a value;
[0048] S2-5: Replace the pixel value. Replace the pixel value at the center point of the filtering window in the original image with the result of the convolution operation;
[0049] S2-6: Repeat the process. Repeat the above steps until every pixel point in the image has been processed;
[0050] S2-7: Output the result. Obtain the filtered image, and the noise in this image is smoothed. In practical applications, both median filtering and Gaussian filtering can be implemented through functions in ready-made image processing libraries (such as OpenCV, MATLAB, etc.). These libraries usually provide optimized algorithms and can process images quickly.
[0051] Edge detection algorithms such as Canny / Roberts / Sobel / Prewitt can be used to identify the lines in the picture. At the same time, morphological operations such as closing operation can be performed to close the small gaps in the lines and improve the measurement accuracy. Edge detection is required for contour recognition in S2 to detect the edges in the image, which is usually used to extract line width information, calculate the gradient of the image grayscale, determine the edge position, highlight the areas of sharp grayscale changes in the image for edge positioning; during contour recognition, identify and trace the continuous edge points in the image to form a closed contour, and then use methods such as the least squares method and the Hough transform to fit the contour into a straight line or a curve.
[0052] The contour analysis in S2 includes distance transformation and region growing. Distance transformation calculates the distance from foreground pixels to the nearest background pixels in a binary image, and the line width can be determined by the maximum value of the distance transformation. Region growing starts from seed points and merges nearby pixels into the region where the seed points are located according to certain criteria, and the line is calculated by analyzing the region features.
[0053] For machine learning model training, it is expressed in the Python language as follows:
[0054] from sklearn.ensemble import RandomForestClassifier
[0055] from sklearn.model_selection import train_test_split
[0056] # Assume we have corresponding label data
[0057] labels = [...] # Here should be the true line width labels corresponding to features
[0058] # Split the dataset
[0059] X_train, X_test, y_train, y_test = train_test_split(features, labels, test_size = 0.3, random_state = 42)
[0060] # Initialize the random forest classifier
[0061] clf = RandomForestClassifier(n_estimators = 100)
[0062] # Train the model
[0063] clf.fit(X_train, y_train)
[0064] # Evaluate the model
[0065] accuracy = clf.score(X_test, y_test)
[0066] print(f"Model accuracy: {accuracy}")
[0067] The model optimization process is as follows:
[0068] from sklearn.model_selection import GridSearchCV
[0069] # Define the parameter grid
[0070] param_grid = {
[0071] 'n_estimators': [50, 100, 200],
[0072] 'max_depth': [None, 10, 20, 30],
[0073] # You can add more parameters here}
[0074] # Initialize the grid search
[0075] grid_search = GridSearchCV(estimator=clf, param_grid=param_grid, cv=3, n_jobs=-1)
[0076] # Perform the grid search
[0077] grid_search.fit(X_train, y_train)
[0078] # Output the best parameters and the corresponding score
[0079] print(f"Best parameters: {grid_search.best_params_}")
[0080] print(f"Best cross-validation score: {grid_search.best_score_}")
[0081] # Use the model with the best parameters for prediction
[0082] best_clf = grid_search.best_estimator_
[0083] Throughout the process, multiple iterations may be required, including adjusting preprocessing steps, feature extraction methods, model selection, and parameter tuning, to obtain the best analysis results. Additionally, ensuring there is sufficient labeled data for training and validating the model is the key to success.
[0084] Although embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for automatically detecting the width of a fine grid line, characterized in that: It includes the following steps: S1: Obtain a large number of reference patterns through an imaging system, and measure their line widths with the built-in scale to obtain basic data; S2: Write relevant programs to preprocess, contour recognize, and analyze the reference patterns, and continuously optimize the analysis results through machine learning to make them close to the standard values of the reference patterns; S3: Package the program in S2 into modular software; S4: The imaging system inputs the measured pattern into the modularized software for detection; S5: Output a line width data report.
2. The method for automatically detecting the width of a fine grid line according to claim 1, wherein: The preprocessing in S2 includes: Grayscale conversion: Convert the color image into a grayscale image to simplify subsequent processing; Binarization: Convert the grayscale image into a black-and-white image to facilitate contour recognition; Filtering and denoising: Use median filtering or Gaussian filtering to remove image noise.
3. The method for automatically detecting the width of a fine grid line according to claim 2, characterized in that: The specific steps for Gaussian filtering to remove image noise are: S2-1: Create a Gaussian kernel. According to the required standard deviation σ, create a Gaussian kernel; S2-2: Normalize the Gaussian kernel. Add up all the element values of the Gaussian kernel, and then divide by this sum so that the sum of all the element values of the Gaussian kernel is 1; S2-3: Traverse the image. For each pixel point in the image, take an image area of the same size as the Gaussian kernel centered on this point; S2-4: Convolution operation. Multiply the corresponding pixel values of the Gaussian kernel and the image area, and add up all the products to get a value; S2-5: Replace the pixel value. Replace the pixel value at the center point of the filtering window in the original image with the result of the convolution operation; S2-6: Repeat the process. Repeat the above steps until every pixel point in the image has been processed; S2-7: Output the result. Obtain the filtered image, and the noise in this image is smoothed.
4. The method for automatically detecting the width of a fine grid line according to claim 1, characterized in that: Edge detection needs to be performed for contour recognition in S2 to detect the edges in the image, which is usually used to extract line width information, calculate the gradient of the image grayscale, determine the edge positions, and highlight the areas of sharp grayscale changes in the image for edge positioning; during contour recognition, continuously detect and track the edge points in the image to form a closed contour, and then use methods such as the least squares method and the Hough transform to fit the contour into a straight line or a curve.
5. A method for automatically detecting the width of a fine grid line according to claim 1, characterized in that: The contour analysis in S2 includes distance transformation and region growing. Distance transformation is to calculate the distance from the foreground pixel points to the nearest background pixel points in the binary image, and the line width can be determined by the maximum value of the distance transformation; region growing starts from the seed points and merges the nearby pixel points into the region where the seed points are located according to certain criteria, and calculates the line by analyzing the region features.
6. A method for automatically detecting the width of a fine grid line according to claim 1, characterized in that: The imaging system includes an imaging device. The imaging device includes a base (1). At one end of the base (1), there is a placement table (2) for placing the sample to be imaged. At the other end of the upper surface of the base (1), there is a bracket, and at the top of the bracket, there is a top housing (3). The top housing (3) is provided with a display screen and a control panel. An inner frame (4) is movably arranged inside the top housing (3). At each end of the inner frame (4), there is a telescopic rod (5) connected. An activity block (6) is movably arranged inside the inner frame (4). A sampling camera (7) is arranged on the bottom surface of the activity block (6) for sampling and photographing the sample. A threaded hole is arranged on the activity block (6). At one end of the inner frame (4), an adjustment motor (8) is installed. The output end of the adjustment motor (8) is connected with a lead screw (9). The lead screw (9) passes through the activity block (6) and is in threaded connection with the threaded hole.