Method and system for identifying abnormal machining of aluminum surface lines based on machine vision detection
By pre-processing and feature extraction of aluminum surface images, combined with texture design drawing analysis, the problems of unreasonable demarcation of texture areas and incomplete abnormal identification in the existing technology are solved, and more accurate texture abnormal identification is achieved.
Patent Information
- Application Number
- CN202411415181.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-10-11
AI Technical Summary
The existing surface texture abnormal identification technology is difficult to accurately extract boundary information under the influence of light and color value differences, resulting in unreasonable demarcation of texture areas and incomplete abnormal identification, which is prone to errors.
By pre-processing the aluminum surface image, enhancing image features, extracting texture distribution features and texture features, using texture design diagrams for analysis, constructing error distribution diagrams and error linear equations, and determining whether the texture is abnormal.
It improves the accuracy and rationality of surface texture abnormal identification, ensures accurate demarcation of texture areas, and reduces the impact of lighting and color value deviation.
Smart Images

Figure CN119251608A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of surface texture anomaly recognition technology, specifically to a method and system for identifying aluminum surface texture processing anomalies based on machine vision inspection. Background Technology
[0002] Surface texture anomaly recognition technology refers to a method that analyzes and compares the texture, pattern, or structure of an object's surface to detect and identify anomalies or defects. This technology typically utilizes computer vision, image processing, and pattern recognition technologies to extract, analyze, and match surface texture features, thereby achieving automatic identification and classification of surface anomalies. This technology has important applications in industrial production, quality control, and safety monitoring, helping to improve production efficiency while reducing quality risks and ensuring product quality and safety.
[0003] Existing surface texture anomaly recognition technologies typically identify the shape, style, and location of textures to determine whether a surface texture is abnormal. Furthermore, these technologies often delineate texture regions by directly scanning the boundaries of the surface texture image. However, due to differences in lighting and color values, directly extracting the boundaries from the surface texture image is difficult to obtain accurate boundary information, compromising the accuracy of analysis based on this method. For example, patent application CN116051528A discloses a carved panel pattern detection system and method, which uses direct boundary scanning of the surface texture image to delineate the texture region. The boundary information extracted by this method is usually incomplete, making it impossible for the machine to automatically identify the texture region. Existing surface texture anomaly recognition technologies also suffer from incomplete anomaly identification and unreasonable texture region delineation, leading to erroneous results in surface texture anomaly recognition. Summary of the Invention
[0004] This invention aims to at least partially solve one of the technical problems in the prior art. By acquiring images of the aluminum surface, preprocessing the aluminum surface images to enhance their image features, and obtaining a preprocessed image, the invention then performs characterization analysis on the preprocessed image to extract the distribution features of the aluminum surface texture. Based on these distribution features, the preprocessed image is further analyzed to extract the texture features of the aluminum surface texture. Finally, based on these texture features, the invention analyzes whether the aluminum surface texture is abnormal. This addresses the problem that existing surface texture anomaly identification technologies are not comprehensive enough in identifying texture anomalies and do not define texture regions reasonably enough, leading to errors in the results of surface texture anomaly identification.
[0005] To achieve the above objectives, in a first aspect, this application provides a method for identifying surface texture anomalies on aluminum based on machine vision inspection, comprising the following steps:
[0006] Image acquisition is performed on the aluminum surface to obtain an image of the aluminum surface;
[0007] Image preprocessing is performed on the aluminum surface image to enhance its image features, resulting in a preprocessed image.
[0008] The preprocessed image is analyzed to extract the texture features of the aluminum surface.
[0009] Analyze whether the texture of aluminum surface is abnormal based on texture characteristics.
[0010] Furthermore, image acquisition is performed on the aluminum surface, and obtaining an image of the aluminum surface includes the following sub-steps:
[0011] Place the aluminum material within the shooting area;
[0012] An image of the aluminum surface is obtained by taking a picture of the aluminum surface using a high-definition camera.
[0013] Furthermore, image preprocessing is performed on the aluminum surface image to enhance its image features, resulting in a preprocessed image. This process includes the following sub-steps:
[0014] Denoising the image of the aluminum surface;
[0015] The image of the aluminum surface after noise reduction is converted to grayscale to obtain a preprocessed image.
[0016] Further analysis of the preprocessed image to extract the texture features of the aluminum surface includes the following sub-steps:
[0017] Characterization analysis was performed on the preprocessed image to extract the distribution characteristics of the aluminum surface texture;
[0018] Further analysis of the preprocessed image based on distribution characteristics is performed to extract the texture features of the aluminum surface.
[0019] Furthermore, characterization analysis is performed on the preprocessed image to extract the distribution features of the aluminum surface texture, including the following sub-steps:
[0020] Contour extraction is performed on the preprocessed image to extract the texture contour of the aluminum surface. The texture contour is composed of several black pixels, and the black pixels in the texture contour are marked as texture points.
[0021] Import the texture design drawing, which includes several unit textures;
[0022] The texture design drawing is extracted to obtain the design outline, which is composed of several black pixels. The black pixels in the design outline are marked as design points.
[0023] Place the design outline on top of the texture outline, find the number of texture points in the image and mark it as the texture number, represented by the symbol NP; find the number of design points in the image and mark it as the design number, represented by the symbol ND;
[0024] Calculate 1-NP / (NP+ND) and label the result as the contour overlap.
[0025] Get the number of pixels in the horizontal direction within a unit texture and mark it as the horizontal count. Get the number of pixels in the vertical direction within a unit texture and mark it as the vertical count. Calculate the horizontal count multiplied by the vertical count and mark the result as the number of pixels per unit.
[0026] Randomly select any pixel within the texture outline and mark it as a marker point. Randomly define a moving range within the texture outline, requiring that a marker point exists within the moving range, and the outline of the moving range is the same as that of the unit texture.
[0027] Using the marker point as a reference, the marker point is moved to each pixel within the movement range. Each time it moves, the texture outline moves with the marker point, and the outline overlap is calculated once for each movement. The overlap of the outline per unit pixel is obtained through analysis.
[0028] The distribution characteristics of aluminum surface texture were extracted based on contour overlap analysis.
[0029] Furthermore, the analysis of contour overlap and extraction of the distribution characteristics of aluminum surface texture includes the following sub-steps:
[0030] Find the maximum value in the contour overlap and mark it as the best overlap. Mark the image where the design contour corresponding to the best overlap coincides with the texture contour as the texture overlap image.
[0031] Remove the parts of the design outline that do not overlap with the texture outline in the texture overlap map, and mark the remaining image as a texture distribution map;
[0032] Based on the design outline, the unit textures within the design outline in the texture distribution map are numbered in order from left to right and from top to bottom, using the symbol P. n It is represented as follows, where n is a non-zero natural number and n is the index of P;
[0033] The P n This refers to the distribution characteristics of the texture on the aluminum surface.
[0034] Furthermore, based on the distribution characteristics, the preprocessed image is further analyzed to extract the texture features of the aluminum surface, including the following sub-steps:
[0035] For any P n , for P n The grayscale values of the pixels in the image are numbered using the symbol S. n (i,j) represents, where i is the number of horizontal rows, j is the number of vertical rows, and (i,j) is the number of columns in S. n The serial number, the S n (i,j) represents P n The grayscale value of the pixel that is located at the i-th horizontal position and the j-th vertical position;
[0036] Obtain max(n), where max(n) is the maximum value of n. Calculate max(n) / 2, keep the result as an integer and label it as m;
[0037] Starting with n=1, calculate |S n (i,j)-S m (i,j)|, that is, calculating the difference in grayscale values of pixels at the same position in different unit textures, and labeling the calculation result as T. n (i,j), add n+1 and recalculate T n (i,j), until n = max(n), when n = m, skip the calculation and add 1 to n again;
[0038] The T n (i,j) represents the texture features.
[0039] Furthermore, analyzing whether the texture of an aluminum surface is abnormal based on texture characteristics includes the following sub-steps:
[0040] P is arranged in order from top left to bottom right. n T inside n (i,j) are numbered and denoted by the symbol R(n,k), where n and P are related. n The n in the inner corresponds to k, which is P. n T inside n The numbering of (i,j);
[0041] Establish a Cartesian coordinate system with k as the X coordinate and R(n,k) as the Y coordinate, and name it the error distribution map. Enter R(n,k) into the error distribution map according to k.
[0042] Perform linear regression on the error distribution plot and name the resulting equation the error linear equation.
[0043] The analysis of whether the surface texture of aluminum is abnormal is based on the error distribution map and the error linear equation.
[0044] Furthermore, analyzing whether the surface texture of aluminum is abnormal based on the error distribution map and the error linear equation includes the following sub-steps:
[0045] Name the coordinate points on the error distribution map as error points;
[0046] Obtain the error point k, label it as h, substitute h into the error linear equation, and label the calculation result as the error reference value;
[0047] Mark the Y value of the error point as the error value, calculate the difference between the error value and the error reference value, and mark it as the error deviation.
[0048] The error deviation is compared with the first deviation threshold. If the error deviation is less than or equal to the first deviation threshold, a normal error signal is output; if the error deviation is greater than the first deviation threshold, an abnormal error signal is output.
[0049] If an abnormal error signal is output, it indicates that there is an abnormality in the texture of the aluminum surface.
[0050] Secondly, this application provides an aluminum surface texture processing anomaly recognition system based on machine vision inspection, including an image acquisition module, an image preprocessing module, a texture feature extraction module, and a texture anomaly analysis module; the image acquisition module, the image preprocessing module, and the texture anomaly analysis module are respectively data connected to the texture feature extraction module;
[0051] The image acquisition module is used to acquire images of the aluminum surface and obtain images of the aluminum surface;
[0052] The image preprocessing module is used to preprocess the aluminum surface image, enhance the image features of the aluminum surface image, and obtain a preprocessed image.
[0053] The texture feature extraction module is used to analyze the preprocessed image and extract the texture features of the aluminum surface.
[0054] The texture anomaly analysis module is used to analyze whether the texture on the aluminum surface is abnormal based on texture characteristics.
[0055] The beneficial effects of this invention are as follows: This invention acquires images of the aluminum surface by image acquisition, then preprocesses the aluminum surface images to enhance their image features, resulting in a preprocessed image. The preprocessed image is then characterized and analyzed to extract the distribution features of the aluminum surface texture. The advantage lies in the fact that this invention introduces a texture design map for analysis when extracting the distribution features of the aluminum surface texture. The texture design map does not contain deviations in lighting and color values, allowing for accurate extraction of the texture contour features. These features are then superimposed on the contours extracted from the actual preprocessed image, thus obtaining the distribution of the aluminum surface texture in the preprocessed image. This improves the accuracy and effectiveness of surface texture anomaly identification.
[0056] This invention further analyzes preprocessed images based on distribution characteristics to extract texture features of aluminum surface patterns. Then, it constructs an error distribution map and an error linear equation based on the texture features. Finally, it analyzes whether the aluminum surface patterns are abnormal based on the error distribution map and the error linear equation. The advantage is that, under normal circumstances, each unit texture of the aluminum surface is the same. However, due to factors such as actual lighting, the color values of the pixels in the unit texture may fluctuate. This fluctuation will remain within a certain threshold range. By analyzing the difference in grayscale values between each unit texture, it is possible to determine whether the unit texture is abnormal, thereby determining whether the aluminum surface patterns are abnormal. This improves the accuracy and rationality of surface texture anomaly identification. Attached Figure Description
[0057] Figure 1 This is a schematic diagram of the system of the present invention;
[0058] Figure 2 This is a preprocessed image for the present invention;
[0059] Figure 3 This is a schematic diagram of the texture outline of the present invention;
[0060] Figure 4 This is a schematic diagram of the design outline of the present invention;
[0061] Figure 5 This is a schematic diagram of the texture overlap pattern of the present invention;
[0062] Figure 6 This is a schematic diagram of the texture distribution of the present invention;
[0063] Figure 7 This is an error distribution diagram of the present invention;
[0064] Figure 8 This is a flowchart of the steps of the method of the present invention. Detailed Implementation
[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] Example 1, please refer to Figure 1As shown, this application provides an aluminum surface texture processing anomaly recognition system based on machine vision inspection, including an image acquisition module, an image preprocessing module, a texture feature extraction module, and a texture anomaly analysis module; the image acquisition module, the image preprocessing module, and the texture anomaly analysis module are respectively connected to the texture feature extraction module for data processing.
[0067] The image acquisition module is used to acquire images of the aluminum surface.
[0068] The image acquisition module is configured with an image acquisition strategy, which includes:
[0069] Place the aluminum material within the shooting area;
[0070] An image of the aluminum surface is obtained by taking a picture of the aluminum surface using a high-definition camera;
[0071] In practical applications, supplementary lights are set up in the shooting area to provide uniform illumination to the aluminum material, reducing the error caused by lighting conditions in the recognition results. The high-definition camera uses an existing high-definition camera.
[0072] The image preprocessing module is used to preprocess the aluminum surface image, enhance the image features of the aluminum surface image, and obtain a preprocessed image;
[0073] The image preprocessing module is configured with image preprocessing strategies, which include:
[0074] Denoising the image of the aluminum surface;
[0075] See also Figure 2 As shown, the image of the aluminum surface after noise reduction is converted to grayscale to obtain a preprocessed image;
[0076] In practical applications, noise reduction is performed using existing Gaussian filtering techniques, followed by grayscale conversion, to obtain the preprocessed image as shown below. Figure 2 As shown, Figure 2 Only a partially enlarged image is shown.
[0077] The texture feature extraction module is used to analyze the preprocessed image and extract the texture features of the aluminum surface. The texture feature extraction module includes an overlap analysis unit, a distribution feature analysis unit, and a texture feature analysis unit.
[0078] The overlap analysis unit is configured with overlap analysis strategies, which include:
[0079] See also Figure 3 As shown, contour extraction is performed on the preprocessed image to extract the texture contour of the aluminum surface. The texture contour is composed of several black pixels, and the black pixels in the texture contour are marked as texture points.
[0080] Import the texture design drawing, which includes several unit textures;
[0081] See also Figure 4 As shown, the outline of the texture design is extracted to obtain the design outline, which is composed of several black pixels. The black pixels in the design outline are marked as design points.
[0082] In practical applications, texture contours are obtained through contour extraction, such as... Figure 3 As shown, Figure 3 The pixels in the black lines are the texture points; the design outline is obtained through contour extraction, such as... Figure 4 As shown, Figure 4 The pixels within the gray lines are the design points. Figure 4 The black lines in the middle form a unit texture. In this embodiment, the gray lines are used to distinguish it from the texture dots.
[0083] Place the design outline on top of the texture outline, find the number of texture points in the image and mark it as the texture number, represented by the symbol NP; find the number of design points in the image and mark it as the design number, represented by the symbol ND;
[0084] Calculate 1-NP / (NP+ND) and label the result as the contour overlap.
[0085] In practical applications, when the design outline is placed on top of the texture outline, if the design point overlaps with the texture point, the design point will obscure the texture point. At this time, only gray design points exist in the image, and no black texture points exist. The higher the degree of overlap, the fewer texture points can be seen. The greater the degree of outline overlap, the closer the design outline is to the actual outline. Based on this, the design outline can be placed on the preprocessed image to accurately divide the texture into regions. The number of textures NP is 23728, the number of designs ND is 54636, and the calculated outline overlap is 0.6972. The calculation result is rounded to four decimal places.
[0086] Get the number of pixels in the horizontal direction within a unit texture and mark it as the horizontal count. Get the number of pixels in the vertical direction within a unit texture and mark it as the vertical count. Calculate the horizontal count multiplied by the vertical count and mark the result as the number of pixels per unit.
[0087] Randomly select any pixel within the texture outline and mark it as a marker point. Randomly limit a movement range within the texture outline, requiring that a marker point exists within the movement range, and that the outline of the movement range is the same as that of the unit texture.
[0088] Using the marker point as a reference, the marker point is moved to each pixel within the movement range. Each time it moves, the texture outline moves with the marker point, and the outline overlap is calculated once for each movement. The overlap of the outline per unit pixel is obtained through analysis.
[0089] Based on contour overlap analysis, the distribution characteristics of aluminum surface texture are extracted;
[0090] In practical applications, limiting the movement range is to ensure that the marker point moves within a single unit texture. Within a single unit texture, there will always be a pixel corresponding to the marker point, maximizing the contour overlap and achieving the best contour overlap effect. If the movement range is exceeded, the marker point will enter the next unit texture and cycle through it. In this case, the analysis result is redundant, as there will be the same analysis result within the movement range. Typically, a unit texture is a rectangle or parallelogram, conforming to the length-width calculation method. However, irregular shapes may occur in rare cases. In such cases, it is only necessary to obtain the number of pixels within it. Obtaining the horizontal and vertical counts simplifies the calculation of the number of unit pixels. If the unit texture is irregular, it can be obtained directly. In this embodiment, the unit texture is an irregular shape, so the number of unit pixels obtained is 1080, meaning that there are ultimately 1080 contour overlaps. Due to the large amount of data, it is not specifically shown in this embodiment.
[0091] The distribution feature analysis unit is used to characterize and analyze the preprocessed image and extract the distribution features of the aluminum surface texture;
[0092] The distribution feature analysis unit is configured with a distribution feature analysis strategy, which includes:
[0093] See also Figure 5 As shown, find the maximum value in the contour overlap and mark it as the best overlap. Mark the image where the design contour corresponding to the best overlap coincides with the texture contour as the texture overlap image.
[0094] See also Figure 6 As shown, the parts of the design outline that do not overlap with the texture outline in the texture overlap map are removed, and the remaining image is marked as a texture distribution map.
[0095] Based on the design outline, the unit textures within the design outline in the texture distribution map are numbered in order from left to right and from top to bottom, using the symbol P. n It is represented as follows, where n is a non-zero natural number and n is the index of P;
[0096] P n This refers to the distribution characteristics of the texture on the aluminum surface;
[0097] In practical applications, the maximum value was found among 1080 contour overlap ratios, and the optimal overlap ratio was 0.6972. The texture overlap diagram at this point is as follows: Figure 5 As shown, in order to better calculate the contour overlap, the design contour is usually larger than the texture contour, so it is necessary to remove the excess parts. After removal, the result is... Figure 6 ,Will Figure 6 The design outline is placed on top of the preprocessed image according to its position in the preprocessed image. At this time, the preprocessed image will be divided into several regions based on the design outline, and each region contains a unit texture, which is numbered P1 to P2. 252 , 1≤n≤252;
[0098] The texture feature analysis unit is used to further analyze the preprocessed image based on distribution features and extract the texture features of the aluminum surface texture;
[0099] The texture feature analysis unit is configured with texture feature analysis strategies, which include:
[0100] For any P n , for P n The grayscale values of the pixels in the image are numbered using the symbol S. n (i,j) represents, where i is the number of horizontal rows, j is the number of vertical rows, and (i,j) is the number of columns in S. n The serial number, S n (i,j) represents P n The grayscale value of the pixel that is located at the i-th horizontal position and the j-th vertical position;
[0101] Get max(n), which is the maximum value of n. Calculate max(n) / 2, keep the result as an integer and mark it as m;
[0102] Starting with n=1, calculate |S n (i,j)-S m (i,j)|, that is, calculating the difference in grayscale values of pixels at the same position in different unit textures, and labeling the calculation result as T. n (i,j), add n+1 and recalculate T n (i,j), until n = max(n), when n = m, skip the calculation and add 1 to n again;
[0103] T n (i,j) represents the texture features;
[0104] In practical applications, this embodiment does not have horizontal or vertical counts. Therefore, i and j do not represent horizontal or vertical counts; i and j are merely subscripts used to indicate the row and column position of a pixel within a unit texture. Taking P1 as an example, each unit texture has 1080 pixels, meaning the total number of pixels in S1(i,j) is 1080. max(n) = 252, and we calculate m = 126. Therefore, n = 1, and we calculate T1(1,1) = |S1(1,1) - S 126 (1,1)|=3, calculate each S1(i,j) and S in turn. 126 The difference between (i,j) is calculated by taking n=1 and calculating T1(i,j) again, then taking n+1 and calculating T2(i,j) again, and so on, until all T values are obtained. 252 Up to (i,j), due to the excessive amount of data, it is not convenient to demonstrate in the embodiments, so it is omitted in this embodiment.
[0105] The texture anomaly analysis module is used to analyze whether the texture of the aluminum surface is abnormal based on texture characteristics; the texture anomaly analysis module includes an error analysis unit and an anomaly judgment unit;
[0106] The error analysis unit is configured with an error analysis strategy, which includes:
[0107] P is arranged in order from top left to bottom right. n T inside n (i,j) are numbered and denoted by the symbol R(n,k), where n and P are related. n The n in the inner corresponds to k, which is P. n T inside n The numbering of (i,j);
[0108] See also Figure 7 As shown, a Cartesian coordinate system is established with k as the X coordinate and R(n,k) as the Y coordinate, named the error distribution map. R(n,k) is entered into the error distribution map according to k.
[0109] Perform linear regression on the error distribution plot and name the resulting equation the error linear equation.
[0110] Analyze whether the texture of the aluminum surface is abnormal based on the error distribution map and the error linear equation;
[0111] In practical applications, k represents (i,j), and the error distribution plot shows each P n The k-th coordinate point within P 126The difference at the k-th coordinate point; in this embodiment, there are 252 unit textures, but when n=126, they are not considered. Therefore, there are 251 coordinate points on each horizontal axis. Due to the excessive density of coordinate points, this embodiment simplifies the problem, resulting in the error distribution diagram as shown below. Figure 7 As shown, the linear equation for the error obtained through linear regression is Y = 0.0023 × X + 2.4977, where Y is R(n,k), which is the difference in gray values of the corresponding pixels, and X is k, which is the kth pixel in the unit texture.
[0112] The exception detection unit is configured with exception detection strategies, which include:
[0113] Name the coordinate points on the error distribution map as error points;
[0114] Obtain the error point k, label it as h, substitute h into the error linear equation, and label the calculation result as the error reference value;
[0115] Mark the Y value of the error point as the error value, calculate the difference between the error value and the error reference value, and mark it as the error deviation.
[0116] The error deviation is compared with the first deviation threshold. If the error deviation is less than or equal to the first deviation threshold, a normal error signal is output; if the error deviation is greater than the first deviation threshold, an abnormal error signal is output.
[0117] If an abnormal error signal is output, it indicates that there is an abnormality in the texture of the aluminum surface;
[0118] In practical applications, 1 ≤ h ≤ 1080, resulting in 1080 error reference values. These reference values represent the deviation of the grayscale value of a pixel within each unit of the texture on the aluminum surface. The actual calculated error may be greater or less than the reference value. If it is less than or slightly greater than the reference value, the error is within the normal range. If the actual calculated error is significantly greater than the reference value, the error is too large, indicating an anomaly in the texture. This embodiment uses extensive experimental data for analysis. Analysis of different normal aluminum surface textures revealed that, under normal texture conditions, the grayscale value error mostly remained within 13, meaning the first deviation threshold in this embodiment was set to 13. Taking k=1 as an example, h=1, substituting X=h=1 into Y=0.0023×X+2.4977, the calculated error baseline value was 2.5. When k=1, there were 251 error points. Taking the first error point as an example, R(1,1), we obtained R(1,1)=T1(1,1)=|S1(1,1)-S 126(1,1)|=3, the error deviation is calculated to be 0.5, and the error deviation is less than the first deviation threshold. The error normal signal is output. Similarly, if all error normal signals are output, it means that the texture of the aluminum surface is normal. If there is an error abnormal signal, it means that the texture of the aluminum surface is abnormal.
[0119] Example 2, please refer to Figure 8 As shown, this application provides a method for identifying surface texture anomalies on aluminum based on machine vision inspection, including the following steps:
[0120] Step S1 involves acquiring an image of the aluminum surface; Step S1 includes the following sub-steps:
[0121] Step S101: Place the aluminum material within the shooting area;
[0122] Step S102: Take a picture of the aluminum surface using a high-definition camera to obtain an image of the aluminum surface;
[0123] Step S2 involves preprocessing the aluminum surface image to enhance its features, resulting in a preprocessed image. Step S2 includes the following sub-steps:
[0124] Step S201: Denoise the aluminum surface image;
[0125] Step S202: Perform grayscale processing on the aluminum surface image after noise reduction to obtain a preprocessed image;
[0126] Step S3 involves analyzing the preprocessed image and extracting the texture features of the aluminum surface. Step S3 includes the following sub-steps:
[0127] Step S301: Perform characterization analysis on the preprocessed image to extract the distribution characteristics of the aluminum surface texture;
[0128] Step S301 includes the following sub-steps:
[0129] Step S301.1: Extract the contour of the preprocessed image to extract the texture contour of the aluminum surface. The texture contour is composed of several black pixels. Mark the black pixels in the texture contour as texture points.
[0130] Step S301.2: Import the texture design drawing, which includes several unit textures;
[0131] Step S301.3: Extract the outline of the texture design drawing to obtain the design outline, which is composed of a number of black pixels. Mark the black pixels in the design outline as design points.
[0132] Step S301.4: Place the design outline on top of the texture outline, find the number of texture points in the image and mark it as the texture number, represented by the symbol NP; find the number of design points in the image and mark it as the design number, represented by the symbol ND.
[0133] Step S301.5: Calculate 1-NP / (NP+ND) and mark the calculation result as the contour overlap.
[0134] Step S301.6: Obtain the number of pixels in the horizontal direction within a unit texture and mark it as the horizontal number; obtain the number of pixels in the vertical direction within a unit texture and mark it as the vertical number; calculate the horizontal number multiplied by the vertical number and mark the result as the number of pixels per unit.
[0135] Step S301.7: Randomly select any pixel within the texture outline and mark it as a marker point. Randomly limit a moving range within the texture outline, requiring that there be a marker point within the moving range, and that the outline of the moving range is the same as that of the unit texture.
[0136] Step S301.8: Using the marker point as a reference, move the marker point to each pixel within the moving range. Each time it moves, the texture outline will move along with the marker point, and the outline overlap will be calculated once each time it moves. The number of outline overlaps per unit pixel is obtained through analysis.
[0137] Step S301.9: Based on the contour overlap analysis, extract the distribution characteristics of the aluminum surface texture;
[0138] Step S301.9 includes the following sub-steps:
[0139] Step S301.9.a: Find the maximum value in the contour overlap degree, mark it as the best overlap degree, and mark the image where the design contour corresponding to the best overlap degree coincides with the texture contour as the texture overlap image.
[0140] Step S301.9.b: Remove the parts of the design outline that do not overlap with the texture outline in the texture overlap image, and mark the remaining image as a texture distribution map;
[0141] Step S301.9.c: Based on the design outline, number the unit textures within the design outline in the texture distribution diagram in a left-to-right and top-to-bottom order, using the symbol P. n It is represented as follows, where n is a non-zero natural number and n is the index of P;
[0142] Step S301.9.d, P n This refers to the distribution characteristics of the texture on the aluminum surface;
[0143] Step S302: Further analyze the preprocessed image based on the distribution characteristics to extract the texture features of the aluminum surface.
[0144] Step S302 includes the following sub-steps:
[0145] Step S302.1, for any P n , for P n The grayscale values of the pixels in the image are numbered using the symbol S. n (i,j) represents, where i is the number of horizontal rows, j is the number of vertical rows, and (i,j) is the number of columns in S. n The serial number, S n (i,j) represents P n The grayscale value of the pixel that is located at the i-th horizontal position and the j-th vertical position;
[0146] Step S302.2: Obtain max(n), which is the maximum value of n. Calculate max(n) / 2, keep the result as an integer and mark it as m;
[0147] Step S302.3, starting with n=1, calculate |S n (i,j)-S m (i,j)|, that is, calculating the difference in grayscale values of pixels at the same position in different unit textures, and labeling the calculation result as T. n (i,j), add n+1 and recalculate T n (i,j), until n = max(n), when n = m, skip the calculation and add 1 to n again;
[0148] Step S302.4, T n (i,j) represents the texture features;
[0149] Step S4: Analyze whether the aluminum surface texture is abnormal based on texture characteristics; Step S4 includes the following sub-steps:
[0150] Step S401, process P in order from top left to bottom right. n T inside n (i,j) are numbered and denoted by the symbol R(n,k), where n and P are related. n The n in the inner corresponds to k, which is P. n T inside n The numbering of (i,j);
[0151] Step S402: Establish a Cartesian coordinate system with k as the X coordinate and R(n,k) as the Y coordinate, and name it the error distribution map. Enter R(n,k) into the error distribution map according to k.
[0152] Step S403: Perform linear regression on the error distribution map and name the resulting equation the error linear equation.
[0153] Step S404: Analyze whether the texture of the aluminum surface is abnormal based on the error distribution map and the error linear equation;
[0154] Step S404 includes the following sub-steps:
[0155] Step S404.1: Name the coordinate points in the error distribution map as error points;
[0156] Step S404.2: Obtain the error point k, mark it as h, substitute h into the error linear equation, and mark the calculation result as the error reference value;
[0157] Step S404.3: Mark the Y value of the error point as the error value, calculate the difference between the error value and the error reference value, and mark it as the error deviation.
[0158] Step S404.4: Compare the error deviation with the first deviation threshold. If the error deviation is less than or equal to the first deviation threshold, output a normal error signal; if the error deviation is greater than the first deviation threshold, output an abnormal error signal.
[0159] Step S404.5: If an error error signal is output, then mark that there is an abnormality in the texture of the aluminum surface.
[0160] Example 3: This application also provides an electronic device, which may include: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. The memory stores computer-readable instructions, and the processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, steps such as those in the machine vision-based aluminum surface texture processing anomaly identification method are performed to achieve the following functions: image acquisition of the aluminum surface to obtain an aluminum surface image; image preprocessing of the aluminum surface image to enhance the image features of the aluminum surface image to obtain a preprocessed image; analysis of the preprocessed image to extract the texture features of the aluminum surface; and analysis of whether the aluminum surface texture is abnormal based on the texture features.
[0161] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0162] Example 4: This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it performs the steps of the above-described method for identifying anomalous aluminum surface textures based on machine vision detection, to achieve the following functions: acquiring an image of the aluminum surface; preprocessing the aluminum surface image to enhance its image features, resulting in a preprocessed image; analyzing the preprocessed image to extract texture features of the aluminum surface; and analyzing whether the aluminum surface texture is abnormal based on the texture features.
[0163] Based on the above description of the embodiments, the embodiments of the present invention can be provided as methods, systems, or computer program products. Based on this understanding, the technical solutions described above, or the parts that contribute to the prior art, can be embodied in the form of software products. These computer software products can be stored in computer-readable storage media, such as ROM / RAM, magnetic disks, optical disks, etc., and include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or certain parts of the embodiments.
[0164] In the embodiments provided in this application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules or units is only a logical functional division, and there may be other division methods in actual implementation. Furthermore, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interfaces. The indirect coupling or communication connection between systems, modules, and units may be electrical, mechanical, or other forms.
[0165] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for identifying abnormalities in aluminum surface texture processing based on machine vision detection, characterized in that: The steps include: Capturing an image of the aluminum surface to obtain an image of the aluminum surface; Performing image preprocessing on the aluminum surface image to enhance the image features of the aluminum surface image and obtain a preprocessed image; Analyze the preprocessed image to extract the texture features of the aluminum surface; Analyze whether the aluminum surface texture is abnormal based on the texture characteristics.
2. The method for identifying abnormalities in aluminum surface texture processing based on machine vision detection according to claim 1 is characterized in that: The aluminum surface is imaged and the acquisition of the aluminum surface image includes the following sub-steps: Place the aluminum in the shooting area; The surface of the aluminum material is photographed by a high-definition camera to obtain an aluminum surface image.
3. The method for identifying abnormalities in aluminum surface texture processing based on machine vision detection according to claim 2 is characterized in that: Performing image preprocessing on the aluminum surface image to enhance the image features of the aluminum surface image and obtaining the preprocessed image includes the following sub-steps: De-noising the aluminum surface image; The aluminum surface image that has been denoised is grayed to obtain a pre-processed image.
4. The method for identifying abnormalities in aluminum surface texture processing based on machine vision detection according to claim 3 is characterized in that: Analyzing the preprocessed image and extracting the texture features of the aluminum surface texture includes the following sub-steps: Characterize and analyze the preprocessed images to extract the distribution characteristics of aluminum surface texture; The preprocessed image is further analyzed based on the distribution characteristics to extract the texture features of the aluminum surface texture.
5. The method for identifying abnormalities in aluminum surface texture processing based on machine vision detection according to claim 4 is characterized in that: Characterization and analysis of the preprocessed image to extract the distribution characteristics of the aluminum surface texture includes the following sub-steps: Perform contour extraction on the preprocessed image to extract the texture contour of the aluminum surface texture, wherein the texture contour is composed of a number of black pixel points, and the black pixel points in the texture contour are marked as texture points; Importing a texture design drawing, wherein the texture design drawing includes a plurality of unit textures; Performing contour extraction on the texture design image to obtain a design contour, wherein the design contour is composed of a number of black pixel points, and marking the black pixel points in the design contour as design points; Place the design outline on the grain outline, find the number of grain points in the picture, mark it as the grain number, and represent it with the symbol NP; find the number of design points in the picture, mark it as the design number, and represent it with the symbol ND; Calculate 1-NP / (NP+ND) and mark the result as the contour coincidence; Obtain the number of pixels in the horizontal direction of the unit texture, marked as the horizontal number, obtain the number of pixels in the vertical direction of the unit texture, marked as the vertical number; calculate the horizontal number multiplied by the vertical number, and mark the result as the unit pixel number; Randomly select any pixel point in the texture contour and mark it as a marker point. Randomly define a moving range in the texture contour. It is required that there is a marker point in the moving range, and the contour of the moving range is the same as the unit texture. Taking the marker point as the reference, move the marker point to each pixel point within the moving range. Each time the marker point is moved, the texture contour will move with the marker point, and the contour overlap will be calculated once each time it is moved. The contour overlap of several unit pixels is obtained through analysis. The distribution characteristics of aluminum surface texture are analyzed and extracted based on contour overlap.
6. The method for identifying abnormalities in aluminum surface texture processing based on machine vision detection according to claim 5 is characterized in that: Analyzing and extracting the distribution characteristics of aluminum surface texture based on contour overlap includes the following sub-steps: Find the maximum value of the contour overlap, mark it as the best overlap, and mark the image where the design contour corresponding to the best overlap overlaps with the texture contour as the texture overlap image; The portion of the design outline that does not overlap with the texture outline in the texture overlap image is removed, and the remaining image is marked as a texture distribution map; Based on the design outline, the unit textures in the design outline of the texture distribution map are numbered from left to right and from top to bottom, and the symbol P is used to represent the unit textures in the design outline of the texture distribution map. n Represents, where n is a non-zero natural number and n is the serial number of P; The P n That is the distribution characteristics of the aluminum surface texture.
7. The method for identifying abnormalities in aluminum surface texture processing based on machine vision detection according to claim 6 is characterized in that: Further analysis of the preprocessed image based on the distribution characteristics and extraction of the texture features of the aluminum surface texture include the following sub-steps: For any P n , for P n The grayscale values of the pixels in are numbered, and the symbol S n (i,j) represents, where i is the horizontal number, j is the vertical number, and (i,j) is S n The serial number of S n (i,j) represents P n The gray value of the pixel at the i-th horizontal position and the j-th vertical position in ; Get max(n), where max(n) is the maximum value of n, calculate max(n) / 2, and keep the calculation result as an integer and mark it as m; Starting with n=1, calculate |S n (i,j)-S m (i,j)|, that is, calculate the difference in the grayscale values of the pixels at the same position in different unit textures, and mark the calculation result as T n (i,j), add n+1 and recalculate T n (i, j) until n = max(n). When n = m, skip the calculation and add n to 1 again. The T n (i,j) is the texture feature.
8. The method for identifying abnormalities in aluminum surface texture processing based on machine vision detection according to claim 7 is characterized in that: Analyzing whether the aluminum surface texture is abnormal based on the texture characteristics includes the following sub-steps: In order from top left to bottom right, n Inside T n (i, j) are numbered and represented by the symbol R(n, k), where n and P n The n in the corresponding, k is P n Inside T n The number of (i,j); A plane rectangular coordinate system is established with k as the X coordinate and R(n,k) as the Y coordinate, named as the error distribution graph, and R(n,k) is entered into the error distribution graph according to k; Perform linear regression on the error distribution graph, and name the equation obtained by regression as the error linear equation; Analyze whether the aluminum surface texture is abnormal based on the error distribution diagram and error linear equation.
9. The method for identifying abnormalities in aluminum surface texture processing based on machine vision detection according to claim 8, characterized in that: Analyzing whether the aluminum surface texture is abnormal based on the error distribution diagram and the error linear equation includes the following sub-steps: Name the coordinate points in the error distribution graph as error points; Get the error point k, mark it as h, substitute h into the error linear equation, and mark the calculation result as the error reference value; The Y value of the error point is marked as the error value, and the difference between the error value and the error reference value is calculated and marked as the error deviation; The error deviation is compared with the first deviation threshold, and if the error deviation is less than or equal to the first deviation threshold, an error normal signal is output; If the error deviation is greater than the first deviation threshold, an error abnormality signal is output; If an abnormal error signal is output, it indicates that there is an abnormality in the texture of the aluminum surface.
10. A system for identifying abnormalities in aluminum surface grain processing based on machine vision detection, used to implement the method for identifying abnormalities in aluminum surface grain processing based on machine vision detection according to any one of claims 1 to 9, characterized in that: It includes an image acquisition module, an image preprocessing module, a texture feature extraction module and a texture abnormality analysis module; the image acquisition module, the image preprocessing module and the texture abnormality analysis module are respectively connected to the texture feature extraction module data; The image acquisition module is used to acquire an image of the aluminum surface to obtain an image of the aluminum surface; The image preprocessing module is used to perform image preprocessing on the aluminum surface image, enhance the image features of the aluminum surface image, and obtain a preprocessed image; The texture feature extraction module is used to analyze the preprocessed image and extract the texture features of the aluminum surface texture; The texture abnormality analysis module is used to analyze whether the texture on the aluminum surface is abnormal based on the texture characteristics.
Citation Information
Patent Citations
Steel plate surface defect detection method
CN110827235A
Copper-clad aluminum surface defect detection method and system based on machine vision
CN116563277A
Die-casting clock surface identification method and system based on machine vision
CN118628502A
Product location tracking system using 2d design drawings and computer vision
KR102258657B1
