Aluminum surface texture processing abnormality recognition method and system based on machine vision detection
By collecting and preprocessing aluminum surface images, combining them with texture design drawings and error analysis, the problem of inaccurate texture anomaly recognition in existing technologies is solved, and more efficient aluminum surface texture anomaly recognition is achieved.
Patent Information
- Application Number
- CN202411415181.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2044-10-11
AI Technical Summary
Existing surface texture anomaly recognition technology is difficult to accurately extract texture boundaries due to the influence of lighting and color value differences, resulting in incomplete anomaly recognition and unreasonable area demarcation, which is prone to errors.
By collecting and preprocessing the aluminum surface image, enhancing the image features, extracting the texture distribution characteristics, combining the texture design diagram to perform contour coincidence analysis, constructing the error distribution diagram and linear equation, it is determined whether the texture is abnormal.
The accuracy and rationality of surface texture anomaly identification are improved, and it can accurately identify texture anomalies under changes in lighting and color values, reducing errors.
Smart Images

Figure CN119251608B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of surface texture anomaly recognition, and in particular to a method and system for recognizing aluminum surface texture processing anomalies based on machine vision detection. Background Art
[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 on the object's surface. This technology usually uses related technologies such as computer vision, image processing and pattern recognition to extract, analyze and match the features of the surface texture, thereby realizing automatic recognition and classification of surface anomalies. This technology has important applications in industrial production, quality control and safety monitoring. It can help improve production efficiency while reducing quality risks and ensuring product quality and safety.
[0003] Existing surface texture anomaly recognition technologies usually identify the shape, style and position of the texture to determine whether the surface texture is abnormal. In addition, when demarcating the texture area, existing surface texture anomaly recognition technologies usually use a method of directly scanning the boundaries of the surface texture image. However, due to differences in lighting and color values, it is difficult to extract accurate boundary information by directly extracting the boundaries of the surface texture image, and the accuracy of the analysis based on this cannot be guaranteed. For example, in a patent application with publication number CN116051528A, a carved board pattern detection system and method are disclosed. This solution uses a method of directly scanning the boundaries of the surface texture image to delineate the texture area. The boundary information extracted by this method is usually incomplete, and the texture area cannot be identified by the machine itself. The existing surface texture anomaly recognition technology also has the problem of insufficient comprehensive recognition of texture anomalies and unreasonable demarcation of texture areas, which leads to the problem that the surface texture anomaly recognition results are prone to errors. Summary of the Invention
[0004] The present invention aims to solve one of the technical problems in the prior art to at least a certain extent, by performing image acquisition on the aluminum surface to obtain an aluminum surface image, then performing image preprocessing on the aluminum surface image, enhancing the image features of the aluminum surface image, obtaining a preprocessed image, and then performing characterization analysis on the preprocessed image to extract the distribution characteristics of the aluminum surface texture, further analyzing the preprocessed image based on the distribution characteristics to extract the texture characteristics of the aluminum surface texture, and finally analyzing whether the aluminum surface texture is abnormal based on the texture characteristics, so as to solve the problem that the existing surface texture abnormality recognition technology still has the problems of insufficient comprehensive recognition of texture abnormalities and unreasonable demarcation of texture areas, which leads to the problem that the surface texture abnormality recognition results are prone to errors.
[0005] To achieve the above objectives, in a first aspect, the present application provides a method for identifying abnormalities in aluminum surface texture processing based on machine vision detection, comprising the following steps:
[0006] Performing image acquisition on the aluminum surface to obtain an aluminum surface image;
[0007] Performing image preprocessing on the aluminum surface image to enhance image features of the aluminum surface image and obtain a preprocessed image;
[0008] Analyze the preprocessed image and extract the texture features of the aluminum surface;
[0009] Analyze whether the aluminum surface texture is abnormal based on the texture characteristics.
[0010] Furthermore, the aluminum surface is imaged, and obtaining the aluminum surface image includes the following sub-steps:
[0011] Place the aluminum in the shooting area;
[0012] The surface of the aluminum material is photographed by a high-definition camera to obtain an aluminum surface image.
[0013] Furthermore, 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:
[0014] Denoising of aluminum surface images;
[0015] The aluminum surface image that has completed the denoising process is gray-scaled to obtain a pre-processed image.
[0016] Furthermore, the pre-processed image is analyzed to extract the grain features of the aluminum surface texture, which includes the following sub-steps:
[0017] Perform characterization analysis on the pre-processed image to extract the distribution characteristics of the aluminum surface texture;
[0018] The preprocessed image is further analyzed based on the distribution characteristics to extract the texture features of the aluminum surface texture.
[0019] Furthermore, characterization analysis of the preprocessed image is performed to extract the distribution characteristics of the aluminum surface texture, which includes the following sub-steps:
[0020] 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 pixels, and the black pixels in the texture contour are marked as texture points;
[0021] Importing a texture design drawing, wherein the texture design drawing includes a plurality of unit textures;
[0022] Performing contour extraction on the texture design image to obtain a design contour, wherein the design contour is composed of a number of black pixels, and marking the black pixels in the design contour as design points;
[0023] Place the design outline on the grain outline, find the number of grain points in the picture, mark it as the grain number, and express it with the symbol NP; find the number of design points in the picture, mark it as the design number, and express it with the symbol ND;
[0024] Calculate 1-NP / (NP+ND) and mark the result as contour coincidence;
[0025] Get the number of pixels in the horizontal direction within the unit texture, marked as the horizontal number, get the number of pixels in the vertical direction within 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;
[0026] Randomly select any pixel point within 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 within the moving range, and the contour of the moving range is the same as the unit texture.
[0027] Taking the marker point as the reference, move the marker point to each pixel point within the moving range. Each time it moves, the texture contour will move with the marker point, and the contour overlap will be calculated once each time it moves. The contour overlap of several unit pixels can be obtained through analysis.
[0028] The distribution characteristics of aluminum surface texture are analyzed and extracted based on contour overlap.
[0029] Furthermore, the following sub-steps are included in analyzing and extracting the distribution characteristics of aluminum surface textures based on the contour overlap:
[0030] 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;
[0031] 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 the texture distribution map;
[0032] Based on the design outline, the unit textures in the design outline of the texture distribution map are numbered in the order from left to right and from top to bottom, and the symbol P is used to represent the unit textures in the design outline. n Represents, where n is a non-zero natural number and n is the sequence number of P;
[0033] The P n That is the distribution characteristics of the aluminum surface texture.
[0034] Furthermore, the pre-processed image is further analyzed based on the distribution characteristics to extract the texture features of the aluminum surface texture, including the following sub-steps:
[0035] 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, the S n (i,j) represents P n The grayscale value of the pixel at the i-th horizontal position and the j-th vertical position in ;
[0036] Obtain max(n), where max(n) is the maximum value of n, calculate max(n) / 2, and retain the calculated result as an integer and mark it as m;
[0037] Starting with n=1, calculate |S n (i,j)-S m (i, j)|, that is, calculate the difference in the grayscale value of the pixel 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.
[0038] The T n (i,j) is the texture feature.
[0039] Furthermore, analyzing whether the aluminum surface texture is abnormal based on the texture characteristics includes the following sub-steps:
[0040] In order from upper left to lower right, n T inside 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 T inside n The number of (i,j);
[0041] With k as the X coordinate and R(n,k) as the Y coordinate, a rectangular coordinate system is established, named the error distribution map, and R(n,k) is entered into the error distribution map according to k;
[0042] Perform linear regression on the error distribution graph, and name the regression equation as the error linear equation;
[0043] Analyze whether the aluminum surface texture is abnormal based on the error distribution diagram and error linear equation.
[0044] Furthermore, analyzing whether the aluminum surface texture is abnormal based on the error distribution diagram and the error linear equation includes the following sub-steps:
[0045] Name the coordinate points in the error distribution graph as error points;
[0046] Get the k of the error point, mark it as h, substitute h into the error linear equation, and mark the calculated result as the error baseline 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] Compare the error deviation with the first deviation threshold, and 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;
[0049] If an abnormal error signal is output, it indicates that there is an abnormality in the texture of the aluminum surface.
[0050] In a second aspect, the present application provides an aluminum surface texture processing anomaly identification system based on machine vision detection, comprising 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 an image of the aluminum surface to obtain an image of the aluminum surface;
[0052] 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;
[0053] The texture feature extraction module is used to analyze the preprocessed image and extract the texture features of the aluminum surface texture;
[0054] The texture abnormality analysis module is used to analyze whether the texture on the aluminum surface is abnormal based on the texture characteristics.
[0055] Beneficial effects of the present invention: The present invention acquires an image of the aluminum surface by performing image acquisition on the aluminum surface, then performs image preprocessing on the aluminum surface image, enhances the image features of the aluminum surface image, obtains a preprocessed image, and then characterizes and analyzes the preprocessed image to extract the distribution characteristics of the aluminum surface texture. The advantage is that the present invention introduces a texture design drawing for analysis when extracting the distribution characteristics of the aluminum surface texture. There is no deviation in the illumination and color value in the texture design drawing, and the contour features of the texture can be accurately extracted. Then, the contour features are overlapped with the contour extracted from the actual preprocessed image, and the distribution of the aluminum surface texture can be obtained in the preprocessed image, thereby improving the accuracy and effectiveness of surface texture abnormality recognition;
[0056] The present invention further analyzes the preprocessed image based on the distribution characteristics, extracts the texture characteristics of the aluminum surface texture, and then constructs an error distribution map and an error linear equation based on the texture characteristics. Finally, based on the error distribution map and the error linear equation, it analyzes whether the aluminum surface texture is abnormal. The advantage is that, under normal circumstances, each unit texture of the aluminum surface texture is the same, but due to actual lighting and other reasons, the color value of the pixel point in the unit texture will fluctuate, and this fluctuation will be maintained 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 texture is abnormal, thereby improving the accuracy and rationality of surface texture abnormality identification. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 is a functional block diagram of the system of the present invention;
[0058] Figure 2 is the pre-processed image of the present invention;
[0059] Figure 3 is a schematic diagram of the texture profile of the present invention;
[0060] Figure 4 A schematic diagram of the design outline of the present invention;
[0061] Figure 5 Schematic diagram of the texture overlap diagram of the present invention;
[0062] Figure 6 Schematic diagram of the texture distribution diagram of the present invention;
[0063] Figure 7 is the error distribution diagram of the present invention;
[0064] Figure 8 Flow chart of the steps of the method of the present invention. DETAILED DESCRIPTION
[0065] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0066] Example 1, please refer to Figure 1As shown, the present application provides an aluminum surface texture processing anomaly recognition system based on machine vision detection, 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 data;
[0067] The image acquisition module is used to acquire images of the aluminum surface and obtain the aluminum surface image;
[0068] The image acquisition module is configured with an image acquisition strategy, which includes:
[0069] Place the aluminum in the shooting area;
[0070] The surface of the aluminum material is photographed by a high-definition camera to obtain an image of the aluminum surface;
[0071] In actual applications, a fill light is set in the shooting area to evenly illuminate the aluminum material and reduce the error in the recognition result caused by lighting. The high-definition camera uses an existing high-definition camera.
[0072] 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;
[0073] The image preprocessing module is configured with an image preprocessing strategy, which includes:
[0074] Denoising of aluminum surface images;
[0075] See also Figure 2 As shown, the aluminum surface image that has completed the denoising process is gray-scaled to obtain a pre-processed image;
[0076] In practical applications, the denoising process is performed using the existing Gaussian filtering technology, and then grayscale processing is performed to obtain the preprocessed image as shown in the figure. Figure 2 As shown, Figure 2 Only a portion of the enlarged image is shown.
[0077] The texture feature extraction module is used to analyze the pre-processed image and extract the texture features of the aluminum surface texture; the texture feature extraction module includes a coincidence analysis unit, a distribution feature analysis unit and a texture feature analysis unit;
[0078] The coincidence analysis unit is configured with a coincidence analysis strategy, which includes:
[0079] See also Figure 3 As shown, contour extraction is performed on the pre-processed image to extract the texture contour of the aluminum surface texture. The texture contour is composed of a number of black pixels, and the black pixels in the texture contour are marked as texture points;
[0080] Import a texture design drawing, which includes several unit textures;
[0081] See also Figure 4 As shown, the texture design image is subjected to contour extraction to obtain a design contour, which is composed of a number of black pixels. The black pixels in the design contour are marked as design points.
[0082] In practical applications, the texture contour is obtained by contour extraction. Figure 3 As shown, Figure 3 The pixel points in the black lines are the texture points; the design contour is obtained by contour extraction. Figure 4 As shown, Figure 4 The pixels in the gray lines are the design points. Figure 4 The pattern composed of the black lines is a unit texture. The gray lines in this embodiment are used to distinguish them from the texture points.
[0083] Place the design outline on the grain outline, find the number of grain points in the picture, mark it as the grain number, and express it with the symbol NP; find the number of design points in the picture, mark it as the design number, and express it with the symbol ND;
[0084] Calculate 1-NP / (NP+ND) and mark the result as contour coincidence;
[0085] In actual applications, the design outline is placed on the texture outline. If the design point overlaps with the texture point, the design point will block the texture point. At this time, only gray design points will exist in the image, and no black texture points will exist. The higher the overlap, the fewer texture points can be seen. At this time, the greater the contour overlap, the closer the design outline is to the actual outline. The design outline can be placed on the preprocessed image accordingly to accurately divide the texture area. The obtained texture number NP is 23728, the design number ND is 54636, and the contour overlap is calculated to be 0.6972. The calculation result is rounded to four decimal places.
[0086] Get the number of pixels in the horizontal direction within the unit texture, marked as the horizontal number, get the number of pixels in the vertical direction within 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;
[0087] Randomly select any pixel point within the texture outline and mark it as a marker point. Randomly define a moving range in the texture outline. It is required that there is a marker point within the moving range and the outline of the moving range is the same as the unit texture.
[0088] Taking the marker point as the reference, move the marker point to each pixel point within the moving range. Each time it moves, the texture contour will move with the marker point, and the contour overlap will be calculated once each time it moves. The contour overlap of several unit pixels can be obtained through analysis.
[0089] Analyze and extract the distribution characteristics of aluminum surface texture based on contour overlap;
[0090] In practical applications, the purpose of limiting the moving range is to allow the marker point to move within a unit texture. In a unit texture, there will always be a pixel point corresponding to the marker point, so that the contour overlap is maximized, that is, the contour overlap effect is best. If the moving range is exceeded, the marker point will enter the next unit texture for a cycle. The analysis result at this time is redundant, and there will be an identical analysis result within the moving range. Normally, the unit texture is a rectangle or a parallelogram, which conforms to the length multiplied by width calculation method, but in a few cases, irregular graphics will appear. At this time, it is only necessary to obtain the number of pixels therein. The purpose of obtaining the horizontal and vertical numbers is to more easily calculate the number of unit pixels. If the unit texture is irregular, it can be directly obtained. The unit texture in this embodiment is an irregular graphic, so the number of unit pixels directly obtained is 1080, that is, the final calculated contour overlap is 1080. Due to the large amount of data, it is not specifically demonstrated in this embodiment.
[0091] The distribution feature analysis unit is used to characterize and analyze the pre-processed 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, the maximum value of the contour overlap is found and marked as the best overlap, and the image where the design contour corresponding to the best overlap overlaps with the texture contour is marked as the texture overlap image;
[0094] See also Figure 6 As shown, 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 the texture distribution image;
[0095] Based on the design outline, the unit textures in the design outline of the texture distribution map are numbered in the order from left to right and from top to bottom, and the symbol P is used to represent the unit textures in the design outline. n Represents, where n is a non-zero natural number and n is the sequence number of P;
[0096] P n That is the distribution characteristics of the aluminum surface texture;
[0097] In actual application, the maximum value is found among 1080 contour overlaps, and the best overlap is 0.6972. The texture overlap diagram at this time 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 the redundant part needs to be removed. Figure 6 ,Will Figure 6 The design outline in the pre-processed image is placed on the pre-processed image according to the position of the texture outline in the pre-processed image. At this time, the pre-processed image will be divided into several areas based on the design outline. Each area is a unit texture, and the numbers P1 to P 252 , 1≤n≤252;
[0098] The texture feature analysis unit is used to further analyze the pre-processed image based on the distribution characteristics and extract the texture features of the aluminum surface texture;
[0099] The texture feature analysis unit is configured with a texture feature analysis strategy, which includes:
[0100] 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 Serial number, S n (i,j) represents P n The grayscale value of the pixel at the i-th horizontal position and the j-th vertical position in ;
[0101] Get max(n), where max(n) is the maximum value of n, calculate max(n) / 2, and 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, calculate the difference in the grayscale value of the pixel 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.
[0103] T n (i, j) is the texture feature;
[0104] In actual applications, there is no horizontal number and vertical number in this embodiment, so i and j do not represent the horizontal number and vertical number. i and j are just subscripts used to indicate the position of the pixel point in the row and column of the unit texture. Taking P1 as an example, there are 1080 pixels in each unit texture, that is, the total number of S1(i,j) is 1080, max(n) = 252, and m = 126 is calculated. At this time, n = 1, and T1(1,1) = |S1(1,1)-S 126 (1,1)|=3, calculate each S1(i,j) and S 126 When all T1(i,j) calculations are completed for n=1, then n+1 is added and T2(i,j) is calculated again, and so on, until all T 252 (i, j), the amount of data is too large to be conveniently displayed in the embodiment, so it is omitted in this embodiment.
[0105] The grain abnormality analysis module is used to analyze whether the grain on the aluminum surface is abnormal based on the grain characteristics; the grain abnormality analysis module includes an error analysis unit and an abnormality judgment unit;
[0106] The error analysis unit is configured with an error analysis strategy, which includes:
[0107] In order from upper left to lower right, n T inside 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 T inside n The number of (i,j);
[0108] See also Figure 7 As shown, 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 map, and R(n,k) is entered into the error distribution map according to k;
[0109] Perform linear regression on the error distribution graph, and name the regression equation as the error linear equation;
[0110] Analyze whether the aluminum surface texture is abnormal based on the error distribution diagram and error linear equation;
[0111] In practical applications, k represents (i, j), and the error distribution diagram shows the error distribution of each P n The kth coordinate point in P 126In this embodiment, there are 252 unit lines, and n=126 is not included in the consideration range. Therefore, there are 251 coordinate points on each horizontal axis. Since the coordinate points are too dense, they are simplified in this embodiment to obtain the error distribution diagram as shown below: Figure 7 As shown in the figure, the error linear equation obtained by linear regression is Y = 0.0023 × X + 2.4977, where Y is R (n, k), which is the difference in the grayscale values of the corresponding pixels, and X is k, which is the k-th pixel in the unit texture;
[0112] The abnormality judgment unit is configured with an abnormality judgment strategy, which includes:
[0113] Name the coordinate points in the error distribution graph as error points;
[0114] Get the k of the error point, mark it as h, substitute h into the error linear equation, and mark the calculated result as the error baseline 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] Compare the error deviation with the first deviation threshold, and 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;
[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, and 1080 error reference values are calculated. The error reference value represents the reference value of the deviation of the grayscale value of a certain pixel point in each unit texture in the aluminum surface texture. The error actually calculated may be greater than the error reference value or less than the error reference value. If it is less than or slightly greater than the error reference value, it means that the error is within the normal range. If the error actually calculated is significantly greater than the error reference value, it means that the error is too large, and the texture here is abnormal. This embodiment is analyzed through a large amount of experimental data. Analysis was performed on different normal aluminum surface textures. It was found that when the texture was normal, the grayscale value error was mostly maintained within 13, that is, the first deviation threshold in this embodiment was set to 13; taking k = 1 as an example, at this time h = 1, substituting X = h = 1 into Y = 0.0023 × X + 2.4977, the error reference value was calculated to be 2.5. When k = 1, there were 251 error points. Taking the first error point as an example, that is, R(1,1), it was obtained that 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 through comparison, and a normal error signal is output; and so on, if all normal error signals are output, it means that there is no abnormality in the texture of the aluminum surface; if an abnormal error signal exists, it means that there is an abnormality in the texture of the aluminum surface.
[0119] Example 2, please refer to Figure 8 As shown, the present application provides a method for identifying abnormalities in aluminum surface texture processing based on machine vision detection, comprising the following steps:
[0120] Step S1, collecting an image of the aluminum surface to obtain an image of the aluminum surface; Step S1 includes the following sub-steps:
[0121] Step S101, placing an aluminum material in a shooting area;
[0122] Step S102, photographing the surface of the aluminum material with a high-definition camera to obtain an aluminum surface image;
[0123] Step S2, performing image preprocessing on the aluminum surface image to enhance the image features of the aluminum surface image to obtain a preprocessed image; Step S2 includes the following sub-steps:
[0124] Step S201, performing denoising processing on the aluminum surface image;
[0125] Step S202, grayscale processing is performed on the aluminum surface image after the denoising process to obtain a pre-processed image;
[0126] Step S3, analyzing the pre-processed image to extract the grain features of the aluminum surface texture; Step S3 includes the following sub-steps:
[0127] Step S301, characterizing and analyzing the pre-processed image to extract the distribution characteristics of the aluminum surface texture;
[0128] Step S301 includes the following sub-steps:
[0129] Step S301.1, performing contour extraction on the pre-processed image to extract the texture contour of the aluminum surface texture. The texture contour is composed of a number of black pixels, and the black pixels in the texture contour are marked as texture points;
[0130] Step S301.2, importing a texture design drawing, wherein the texture design drawing includes a plurality of unit textures;
[0131] Step S301.3: Extract the outline of the texture design image to obtain a design outline. The design outline consists of a number of black pixels. The black pixels in the design outline are marked as design points.
[0132] Step S301.4: Place the design outline on the texture outline, find the number of texture points in the image, mark it as the texture number, and represent it with the symbol NP; find the number of design points in the image, mark it as the design number, and represent it with the symbol ND;
[0133] Step S301.5, calculate 1-NP / (NP+ND), and mark the result as contour overlap;
[0134] Step S301.6: Obtain the number of pixels in the horizontal direction within the unit texture, marked as the horizontal number, and obtain the number of pixels in the vertical direction within 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;
[0135] Step S301.7: Randomly select any pixel point within the texture contour and mark it as a marker point. Randomly define a moving range within the texture contour. The marker point must exist within the moving range, and the contour of the moving range must be 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 the marker point is moved, the texture contour moves along with the marker point. The contour overlap is calculated for each movement, and the contour overlap per unit pixel is obtained through analysis.
[0137] Step S301.9, analyzing and extracting the distribution characteristics of the aluminum surface texture based on the contour overlap;
[0138] Step S301.9 includes the following sub-steps:
[0139] Step S301.9.a, finding the maximum value of the contour overlap, marking it as the optimal overlap, and marking the image where the design contour and the texture contour corresponding to the optimal overlap overlap as the texture overlap image;
[0140] Step S301.9.b, remove the portion of the design outline that does not overlap with the texture outline in the texture overlap image, and mark the remaining image as the texture distribution image;
[0141] Step S301.9.c: Based on the design outline, number the unit lines in the design outline in the line distribution map in the order from left to right and from top to bottom, and use the symbol P n Represents, where n is a non-zero natural number and n is the sequence number of P;
[0142] Step S301.9.d, P n That is the distribution characteristics of the aluminum surface texture;
[0143] Step S302, further analyzing the pre-processed image based on the distribution characteristics to extract the texture characteristics of the aluminum surface texture;
[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 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 Serial number, S n (i,j) represents P n The grayscale value of the pixel at the i-th horizontal position and the j-th vertical position in ;
[0146] Step S302.2, obtain max(n), where max(n) is the maximum value of n, calculate max(n) / 2, and 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, calculate the difference in the grayscale value of the pixel 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.
[0148] Step S302.4, T n (i, j) is the texture feature;
[0149] Step S4, analyzing whether the aluminum surface texture is abnormal based on the texture characteristics; Step S4 includes the following sub-steps:
[0150] Step S401: P n T inside 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 T inside n The number of (i,j);
[0151] Step S402: establish a plane rectangular coordinate system with k as the X coordinate and R(n,k) as the Y coordinate, name it as the error distribution map, and enter R(n,k) into the error distribution map according to k;
[0152] Step S403, performing linear regression on the error distribution graph, and naming the regression equation as the error linear equation;
[0153] Step S404: analyzing whether the aluminum surface texture is abnormal based on the error distribution diagram and the error linear equation;
[0154] Step S404 includes the following sub-steps:
[0155] Step S404.1, naming the coordinate points in the error distribution graph 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 calculated result as the error baseline 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 a 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 abnormality signal is output, it indicates that there is an abnormality in the aluminum surface texture.
[0160] In Example 3, the present application further 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 via 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, the steps in the method for identifying abnormalities in aluminum surface grain processing based on machine vision detection are executed 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 grain features of the aluminum surface texture; and analysis of whether the aluminum surface grain is abnormal based on the grain features.
[0161] In addition, the logical instructions in the above-mentioned memory can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0162] Example 4. The present application also provides a computer-readable storage medium. The present application provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method for identifying abnormalities in aluminum surface texture processing based on machine vision detection are executed 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 texture; and analysis of whether the aluminum surface texture is abnormal based on the texture features.
[0163] Through the description of the above embodiments, the embodiments of the present invention can be provided as methods, systems or computer program products. Based on this understanding, the above technical solutions, in essence or in other words, the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiment.
[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 function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of systems, modules and units can 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 the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for identifying abnormalities in aluminum surface texture processing based on machine vision detection, characterized in that: The steps include: Performing image acquisition on the aluminum surface to obtain an aluminum surface image; Performing image preprocessing on the aluminum surface image to enhance image features of the aluminum surface image and obtain a preprocessed image; Analyze the preprocessed image and extract the texture features of the aluminum surface; Analyze whether the aluminum surface texture is abnormal based on texture characteristics; Characterization and analysis of the preprocessed image to extract the distribution characteristics of 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 pixels, and the black pixels 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 pixels, and marking the black pixels 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 express it with the symbol NP; find the number of design points in the picture, mark it as the design number, and express it with the symbol ND; Calculate 1-NP / (NP+ND) and mark the result as contour coincidence; Get the number of pixels in the horizontal direction within the unit texture, marked as the horizontal number, get the number of pixels in the vertical direction within 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 within 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 within 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 it moves, the texture contour will move with the marker point, and the contour overlap will be calculated once each time it moves. The contour overlap of several unit pixels can be obtained through analysis. The distribution characteristics of aluminum surface texture are analyzed and extracted based on contour overlap.
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 image is captured 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: Denoising of aluminum surface images; The aluminum surface image that has completed the denoising process is gray-scaled 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 includes the following sub-steps: Perform characterization analysis on the pre-processed image to extract the distribution characteristics of the 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: 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 the texture distribution map; Based on the design outline, the unit textures in the design outline of the texture distribution map are numbered in the order from left to right and from top to bottom, and the symbol P is used to represent the unit textures in the design outline. n Represents, where n is a non-zero natural number and n is the sequence number of P; The P n That is the distribution characteristics of the aluminum surface texture.
6. The method for identifying abnormalities in aluminum surface texture processing based on machine vision detection according to claim 5 is characterized in that: Further analysis of the pre-processed 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, the S n (i,j) represents P n The grayscale value of the pixel at the i-th horizontal position and the j-th vertical position in ; Obtain max(N), where max(N) is the maximum value of n, calculate max(N) / 2, and retain the calculated 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 value of the pixel 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 set n+1; The T n (i,j) is the texture feature.
7. The method for identifying abnormalities in aluminum surface texture processing based on machine vision detection according to claim 6, characterized in that: Analyzing whether the aluminum surface texture is abnormal based on texture characteristics includes the following sub-steps: In order from upper left to lower right, n T inside 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 T inside n The number of (i,j); With k as the X coordinate and R(n,k) as the Y coordinate, a rectangular coordinate system is established, named the error distribution map, and R(n,k) is entered into the error distribution map according to k; Perform linear regression on the error distribution graph, and name the regression equation as the error linear equation; Analyze whether the aluminum surface texture is abnormal based on the error distribution diagram and error linear equation.
8. The method for identifying abnormalities in aluminum surface texture processing based on machine vision detection according to claim 7, characterized in that: Analyzing whether the aluminum surface texture is abnormal based on the error distribution diagram and error linear equation includes the following sub-steps: Name the coordinate points in the error distribution graph as error points; Obtain h at the error point, substitute h into the error linear equation, and mark the calculated result as the error baseline value; The Y coordinate 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; Comparing the error deviation with a first deviation threshold, and outputting an error normal signal if the error deviation is less than or equal to the first deviation threshold; 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.
9. 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 8, characterized in that: It includes 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; 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
Carved plate pattern detection system and method
CN116051528A
Die-casting clock surface identification method and system based on machine vision
CN118628502A