Galvanized pipe surface defect detection method and system
By visually segmenting and feature extraction of the surface images of galvanized tubes, combined with clustering analysis and fractal feature recognition, the problem of insufficient sensitivity to complex defects and texture changes in the prior art is solved, and more accurate detection of surface defects of galvanized tubes is achieved.
Patent Information
- Application Number
- CN202411625892.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-03-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has low sensitivity to complex defects and surface texture changes in the detection of surface defects of galvanized pipes, and is prone to missed detection of complex small-scale defects, and it is difficult to conduct fine edge contour closure analysis.
By visually segmenting the surface image of the galvanized tube, the texture features and color histogram values of the local area are extracted, and the normalization process is performed to establish a data set of local texture and color feature. Then, based on these feature data, the clustering center is set, density differences and texture changes are identified, and a local anomaly clustering map is generated. Further, through grid coverage and fractal feature analysis, complex defect areas are identified, and edge contour recognition and morphological analysis are carried out.
It improves the capture accuracy of complex textures on the surface of galvanized pipes, enhances the positioning accuracy of complex defects and abnormal areas, and achieves more accurate and intuitive detection of surface defects of galvanized pipes.
Smart Images

Figure CN119579521A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image analysis, and in particular to a method and system for detecting surface defects of galvanized pipes. Background Art
[0002] The method of surface defect detection of galvanized pipes involves the use of image analysis technology to detect and identify surface defects that may occur in the production and processing of galvanized pipes, ensuring that the quality of galvanized pipes meets industrial standards and safety requirements. Through automated defect detection methods, the need for manual inspection can be effectively reduced, the speed and accuracy of detection can be improved, and production costs can be reduced. The method involves using a high-resolution camera to capture images of the pipe surface, and then analyzing these images through specific algorithms to identify cracks, scratches or other types of surface defects.
[0003] The existing technology in the defect detection process mainly focuses on the identification of large-scale surface defects in image analysis, resulting in low sensitivity to complex defects or surface texture changes, which easily leads to the omission of some complex small-scale defects on the surface of galvanized pipes. The existing technology relies on the overall analysis of the image, which easily ignores the feature differences in local areas and loses detailed information when identifying surface density changes or texture mutations. In addition, the existing technology is also difficult to perform fine closure analysis on edge contours, which easily leads to inaccurate detection results and affects the further repair or treatment of defects. Summary of the invention
[0004] The purpose of the present invention is to solve the shortcomings in the prior art and to propose a method and system for detecting surface defects of galvanized pipes.
[0005] In order to achieve the above object, the present invention adopts the following technical scheme: a method for detecting surface defects of a galvanized pipe comprises the following steps:
[0006] S1: Perform visual segmentation on the surface image of the galvanized pipe, extract the frequency distribution and phase information of the texture features of each area, obtain the color histogram value of the local area, normalize the color histogram and the extracted texture features, and establish a local texture and color feature data set;
[0007] S2: Based on the local texture and color feature data set, the cluster center is set in the visual image. By analyzing the similarity of features in the region and judging the region type, the density difference of each region on the surface of the galvanized pipe is identified, and the abnormal region is marked by comparing the changes in regional color and texture, and a local abnormal clustering map is generated;
[0008] S3: Based on the local abnormal clustering map, the local area of the galvanized pipe is subdivided by grid covering, the changes between the texture distribution and the geometric ratio of the local area are analyzed, the area with fractal features is identified, the area with significant fractal features is screened, and the differentiated complex defect area map is formed;
[0009] S4: The edge contours of the differentiated complex defect area map are identified through edge vision detection operations. For the edge contours of each defect area, the closedness of the boundary contour, the direction of the edge line and the morphological integrity are analyzed, and graphical representation is performed through visual annotation to form a defect edge morphological map.
[0010] As a further solution of the present invention, the step of obtaining the color histogram value of the local area is specifically as follows:
[0011] S111: Divide the original galvanized pipe surface image into several local areas, identify the boundary transition area of the image, obtain the frequency distribution value of each local area in each direction, capture the phase information inside the local area, and generate an initial data set;
[0012] S112: Based on the initial data set, use the formula:
[0013]
[0014] Calculate the weighted amplitude average A at different angles avg , obtain the texture feature data of the galvanized pipe surface in all directions;
[0015] Among them, A i (θ) represents the frequency amplitude of the i-th local area in the direction θ, θ represents the direction angle parameter, W(θ) represents the direction weight parameter, T(θ) represents the direction texture coefficient, and n represents the total number of local areas divided on the galvanized pipe surface.
[0016] As a further solution of the present invention, the step of normalizing the color histogram and the extracted texture features is specifically as follows:
[0017] S121: based on the texture feature data of the galvanized pipe surface in various directions, extract the color histogram and texture features in the local area, and establish a normalized matrix including directional features and color matching features through matching and normalization processing to obtain a normalized eigenvalue set;
[0018] S122: Based on the normalized feature value set, the feature data of the local area is classified and labeled, and the color histogram and texture feature data are integrated to generate a local texture and color feature data set.
[0019] As a further solution of the present invention, the steps of identifying the density difference of each area on the surface of the galvanized pipe are specifically as follows:
[0020] S211: Based on the local texture and color feature data set, the color histogram, texture frequency distribution and phase information are processed by a feature clustering method, the belonging relationship between the local area and the cluster center is dynamically adjusted, and a cluster category distribution map is established;
[0021] S212: According to the cluster category distribution diagram, use the formula:
[0022]
[0023] Calculate the density difference ΔD to obtain density difference data;
[0024] Among them, D i represents the density value of the i-th local area, D avg It represents the average density value of all areas on the surface of the galvanized pipe, and n represents the total number of local areas into which the surface of the galvanized pipe is divided.
[0025] As a further solution of the present invention, the step of marking abnormal areas by comparing the changes in color and texture of the areas is specifically as follows:
[0026] S221: Based on the density difference data, the density value of each area is compared with the preset conventional density standard value, the area with significant density deviation is identified, and the texture features of each area are combined to mark and classify the area to generate a defect marking map;
[0027] S222: Based on the defect marking map, visual image analysis is performed on the marked abnormal area, density differences and texture features are combined and annotated, and the abnormal areas are distinguished by color and number to form a local abnormality clustering map.
[0028] As a further solution of the present invention, the step of analyzing the change between the texture distribution and the geometric ratio of the local area is specifically:
[0029] S311: Based on the local abnormality clustering map, further analyze the marked abnormal area, use the grid coverage method to subdivide the local area of the galvanized pipe, extract the texture features and grayscale distribution in the grid, and compare the feature differences to generate abnormal distribution information of the grid area;
[0030] S312: According to the abnormal distribution information of the grid area, the formula is used:
[0031]
[0032] Calculate the i ′ The geometric ratio R of the local area i′ , identify geometric fluctuation anomalies through ratio results, conduct regional complexity assessment, and establish a complex defect area distribution map;
[0033] Among them, N i′ Indicates the i ′ The total number of grids in the local area, A i′ Indicates the i ′ The actual area of a local area, i ′ Indicates the i ′ The subdivision grid area number.
[0034] As a further solution of the present invention, the step of identifying the area with fractal features is specifically:
[0035] S321: According to Article i ′ The geometric ratio R of the local area i′ , using the formula:
[0036]
[0037] Calculate the fractal dimension D f ;
[0038] Where δ represents the mesh size, which is used to subdivide the mesh size of the local area on the surface of the galvanized pipe, N ′ (R i ,δ) represents the number of grids after being corrected by the adjustment factor, lim δ→0 It indicates the ratio limit when the grid size δ gradually approaches 0, log represents the logarithmic function, and α is the geometric ratio adjustment factor;
[0039] S322: Based on the fractal dimension, the difference between the fractal dimension of each region and the reference value is compared, the abnormal region with significant fractal characteristics is identified, and a differentiated complex defect region map is generated.
[0040] As a further solution of the present invention, the steps of defect edge morphology diagram are specifically as follows:
[0041] S411: Based on the differentiated complex defect area map, edge visual detection operation is used to identify the edge contour of the marked area on the surface of the galvanized pipe, the intensity and direction changes of each defect edge are recorded, the edge position with abnormal changes is marked, and the visual result of the defect area is generated;
[0042] S412: Based on the visualization result of the defect area, the edge contour is analyzed for closure, line direction and morphological integrity, the boundary contour is optimized, and a defect edge morphological map is generated.
[0043] The system for detecting surface defects of galvanized pipes is used to perform the above-mentioned method for detecting surface defects of galvanized pipes, and the system comprises:
[0044] The image segmentation and feature extraction module divides the surface of the galvanized pipe into multiple local areas through image segmentation, extracts the texture features and color histogram values of each area, establishes a feature data set after normalization, and generates a local feature data set;
[0045] The feature clustering and anomaly identification module sets cluster centers based on local feature data sets, analyzes regional feature similarities, identifies density differences, marks abnormal areas, and generates local anomaly cluster maps;
[0046] The grid subdivision and fractal feature analysis module performs grid subdivision on the abnormal area based on the local abnormal clustering map, analyzes the texture distribution and geometric ratio changes, identifies fractal features, and generates a fractal feature area map;
[0047] The defect area screening module screens areas with high geometric complexity based on the fractal feature area map, and generates a complex defect area map by combining texture complexity judgment;
[0048] The edge contour recognition module performs edge detection based on the complex defect area map, analyzes the closure of the contour and the direction of the lines, and generates a defect edge morphology map through graphical representation.
[0049] Compared with the prior art, the advantages and positive effects of the present invention are:
[0050] In the present invention, the capture accuracy of complex textures on the surface of galvanized pipes is improved by visually segmenting the surface image of galvanized pipes and extracting the frequency distribution and phase information of texture features. In the clustering process of local feature data, by setting the cluster center and marking the abnormalities of density difference and texture mutation, the areas with significant surface density deviation or texture complexity mutation can be effectively identified, thereby improving the positioning accuracy of abnormal areas. When subdividing abnormal areas, combined with the analysis of changes in grid coverage and geometric ratios, areas with significant fractal features can be accurately identified, providing a more in-depth analysis basis for judging complex defects. By analyzing the closure of edge contours and the direction of lines, defective areas are accurately marked, and clear visualization results are provided, making the detection of surface defects of galvanized pipes more accurate and intuitive. The comprehensive detection capability of abnormal and complex defects on the surface of galvanized pipes is enhanced. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a schematic diagram of the workflow of the present invention. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0053] In the description of the present invention, it should be understood that the terms "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, in the description of the present invention, "multiple" means two or more, unless otherwise clearly and specifically defined.
[0054] See also Figure 1 The present invention provides a technical solution: a method for detecting surface defects of a galvanized pipe, comprising the following steps:
[0055] S1: Perform visual segmentation on the galvanized pipe surface image, divide the image into multiple local areas, and extract the frequency distribution and phase information of the texture features of each area. Capture the texture features in the local area of the galvanized pipe surface by calculating the frequency amplitude of multiple angles, obtain the color histogram value of the local area, normalize the color histogram and the extracted texture features, and establish a local texture and color feature data set;
[0056] S2: Based on the local texture and color feature data set, the cluster center is set in the visual image. By analyzing the similarity of features in the region and judging the region type, combined with the statistical density distribution, the density difference of each region on the surface of the galvanized pipe is identified. The changes in regional color and texture are compared to mark abnormal regions. The abnormal region is a defective region with obviously low density or texture mutation, and a local abnormal clustering map is generated;
[0057] S3: Based on the local abnormal clustering map, the marked abnormal area is further analyzed, the local area of the galvanized pipe is subdivided by grid covering, the geometric ratio of the number of grids to the actual area is calculated, the change between the texture distribution and the geometric ratio of the local area is analyzed, the area with fractal features is identified, and the area with significant fractal features is screened. The area with significant fractal features is the area with abnormal geometric ratio fluctuations, forming a differentiated complex defect area map;
[0058] S4: Perform edge contour recognition on the differentiated complex defect area map through edge vision detection operation, record the intensity and direction changes of each defect edge on the surface of the galvanized pipe, analyze the closedness of the boundary contour, the direction of the edge line and the morphological integrity of each defect area edge contour, and graphically represent it through visual annotation to form a defect edge morphological map;
[0059] The local texture and color feature data set includes the frequency amplitude data, color distribution histogram and phase angle eigenvalues of the local area. The local anomaly clustering map includes the category boundaries of the anomaly area, the numbering information of the marked area and the distribution map of the cluster center points. The distinguished complex defect morphological characteristics include the geometric ratios, fractal dimension parameters and morphological boundary characteristics of each fractal feature area. The defect edge morphology map includes the contour lines of the defect edge, the boundary closure status and the edge direction identification.
[0060] The specific steps for obtaining the color histogram value of the local area are:
[0061] S111: Divide the original galvanized pipe surface image into several local areas, identify the boundary transition area of the image, obtain the frequency distribution value of each local area in each direction, capture the phase information inside the local area, and generate an initial data set;
[0062] Firstly, the surface image of the galvanized pipe is preprocessed by the image segmentation method, and the local division operation is performed using the image grayscale value and pixel density as the standards. By setting different grayscale thresholds to identify the transition area of the boundary in the image, the image is divided into several local areas with different grayscale characteristics. Then, a filter in a specific direction is applied to extract the texture features of each local area. The frequency amplitude of each local area is obtained by the response value of the filter, and the frequency amplitude is corresponded to the grayscale change to extract the frequency distribution characteristics inside the local area. At the same time, the phase extraction method is used to obtain the phase value in each direction, and the phase distribution and phase change trend in each direction are recorded. Finally, the frequency amplitude and phase value in each direction are integrated to form a complete texture feature data set for each local area, and a local texture and color feature data set containing texture feature data in multiple directions is established.
[0063] S112: Based on the initial data set, use the formula:
[0064]
[0065] Calculate the weighted amplitude average A at different angles avg , obtain the texture feature data of the galvanized pipe surface in all directions;
[0066] Among them, A i(θ) represents the frequency amplitude of the ith local area in the direction θ, which is obtained by applying the filter response value of a specific direction to the local area. This value represents the texture feature intensity of the image in a specific angle direction. θ represents the directional angle parameter, which is set by analyzing the texture features in different directions in the image. Multiple directions (for example, 0° to 180°) can be selected for frequency amplitude extraction. W(θ) represents the directional weight parameter, which ranges from 0.1 to 2.0 and is used to adjust the importance of textures in different directions. The setting of the weight value is determined based on the statistical data of the comparison between the textures in different directions in the image and the overall texture of the image. A higher directional weight indicates that the texture feature in that direction is significant. T(θ) represents the directional texture coefficient, which ranges from 0.5 to 1.5 and is used to distinguish the significance of textures in each direction. It is set by the similarity of adjacent directions in each local area. A lower coefficient is set for directions with higher similarity. n represents the total number of local areas divided on the surface of the galvanized pipe, which is the number of areas obtained after image segmentation.
[0067] Assume that the surface image of the galvanized pipe is divided into 5 local areas, and the amplitudes of each area in the directions of 0°, 45°, and 90° are:
[0068] The first area: A1 = 10dB, 15dB, 12dB, the second area:
[0069] A2=14dB, 18dB, 16dB, 3rd area: A3=11dB, 17dB, 13dB, 4th area: A4=13dB, 20dB, 14dB, 5th area: A5=12dB, 16dB, 15dB.
[0070] The directional weight parameter W(θ) is set to 1.0, 1.2, 1.1, and the directional texture coefficient T(θ) is set to 1.1, 0.9, 1.0.
[0071] Calculate the sum of the weighted amplitudes of each region in different directions
[0072]
[0073] Calculate the weighted average of the amplitudes in different directions
[0074]
[0075]
[0076] The results show that the weighted amplitude averages in different directions can identify the significant features of the texture in each direction, and can be used to capture the texture changes in the local area of the galvanized pipe surface, thereby comparing the texture differences in different directions. Further comparison of the assumed historical values (such as the average values in different directions) shows that when the average value in a certain direction is significantly higher than the normal value (such as the average value of 17.136 in the 45° direction), it indicates that there is a significant texture feature in that direction, which can be used to detect the location and direction of surface defects in galvanized pipes.
[0077] The specific steps of normalizing the color histogram and the extracted texture features are:
[0078] S121: based on the texture feature data of the galvanized pipe surface in various directions, extract the color histogram and texture features in the local area, and establish a normalized matrix including directional features and color matching features through matching and normalization processing to obtain a normalized eigenvalue set;
[0079] By normalizing the texture features in each local area, the color histogram of each local area is matched and normalized with the texture features. During the normalization process, the distribution characteristics of the directional weighted amplitude average are adjusted to obtain the frequency amplitude features in different directions in the local area, and the color histogram of each local area is standardized according to the directional frequency amplitude, so that the color histogram value and the frequency amplitude feature are kept in the same scale range. At the same time, the feature deviation between local areas is eliminated by the mean normalization method, so that the maximum and minimum values of the frequency features and the color features are close. Through feature matching and normalization operations, the data of all local areas are organized into a comparable normalized matrix, and the texture matrices of all local areas are merged with the normalized color histogram data. The mapping relationship between the color and texture features of each local area is established to form a normalized matrix containing directional features and color matching features, and all local matrices are merged to form a complete eigenvalue matrix.
[0080] S122: Based on the normalized feature value set, the feature data of the local area is classified and marked, and the color histogram and texture feature data are integrated to generate a local texture and color feature data set;
[0081] The feature data of each local area are sorted by classifying and aggregating the feature values of each local area, and the feature classification and position marking methods are used. The local areas are first classified according to the similarity between the positional relationship and the feature values, and the type label of each area is identified. The areas with similar texture and color features are classified and marked. Then, the color distribution characteristics, frequency direction characteristics and phase information of the local areas are uniformly managed to establish a local area feature database. Through the correlation analysis of texture features and color histogram values, different weight values are assigned to each feature value according to the importance of the feature data, and the color and texture feature data in all local areas are feature integrated to generate a complete feature information set for each local area, and obtain local texture and color feature data including color histogram and texture features.
[0082] The steps to identify the density differences in each area of the galvanized pipe surface are as follows:
[0083] S211: Based on the local texture and color feature data set, the color histogram, texture frequency distribution and phase information are processed by a feature clustering method, the belonging relationship between the local area and the cluster center is dynamically adjusted, and a cluster category distribution map is established;
[0084] First, the extracted local texture feature data is preliminarily aggregated, and the color histogram, texture frequency distribution and phase information are pre-processed for clustering by feature clustering methods (such as K-means clustering method) to determine the initial cluster center point. Then, the centroid update operation in the K-means method is used to compare the feature differences between each local area and the cluster center, classify each area according to feature similarity, and dynamically adjust the center point of each area belonging to different categories. The similarity of local features is judged according to the Euclidean distance between features, and each area is divided into the center point closest to it to complete the preliminary clustering operation. Then, according to the distribution of cluster center points, the feature uniformity and category distribution within each cluster category are analyzed, and the clustering results are mapped to the visual image. The region type is judged by different color labels, and a visual image containing the cluster category of each region is generated to obtain the region category label and the visual result of preliminary clustering.
[0085] S212: According to the cluster category distribution diagram, use the formula:
[0086]
[0087] Calculate the density difference ΔD to obtain density difference data;
[0088] Among them, ΔD represents the density difference, which is used to reflect the degree of deviation between the density of the local area and the overall average density. It is used to detect the abnormal density distribution of each area on the surface of the galvanized pipe and help identify possible defective areas. irepresents the density value of the ith local area, which is obtained by statistically processing the grayscale value distribution of pixels in the local area of the image. The statistical method is usually obtained by calculating the ratio of the total number of pixels in the area to the total area occupied by it. avg It represents the average density value of all areas on the surface of the galvanized pipe. The calculation method is to add the density values of all local areas and divide it by the total number of areas n. The formula is n represents the total number of local areas divided on the surface of the galvanized pipe, and this value is determined by the number of local segmentations set in the image segmentation operation.
[0089] Assume that the surface of the galvanized pipe is divided into 5 local areas (i.e. n = 5), and the density values of each area are as follows:
[0090] The first area density D1 = 0.8, the second area density D2 = 1.2, the third area density D3 = 1.0, the fourth area density D4 = 0.6, and the fifth area density D5 = 0.9.
[0091] Calculate the average density value D of all regions avg :
[0092]
[0093] Calculate the difference between the density of each area and the average density, and add up the difference values:
[0094]
[0095] Calculate the density difference ΔD:
[0096]
[0097] The results show that the density difference ΔD of the local area is 0, indicating that the average density of all local areas is not significantly different from the overall average density. This shows that in the 5 areas currently divided, the density distribution is uniform, and there is no obvious density anomaly or potential defect area. However, if the density difference of a certain area increases significantly (for example, the density of a certain area is significantly different from the overall density), it can be considered that there may be potential defects in this area.
[0098] The specific steps of marking abnormal areas by comparing the changes in color and texture of the area are:
[0099] S221: Based on the density difference data, the density value of each area is compared with the preset conventional density standard value, the area with significant density deviation is identified, and the texture features of each area are combined to mark and classify the area to generate a defect marking map;
[0100] The calculated density difference value ΔD is compared with the preset conventional density standard value. First, the conventional density standard value range is set according to the material and surface treatment characteristics of the galvanized pipe (assuming that the conventional density standard value is 0.85). Then, the density value of each local area is compared with the standard value item by item, and the areas where the density deviates from the standard value by more than 10% are identified. These areas are marked by marking the positions of these areas in the visual image, and the texture features of each area are combined for detailed analysis. For areas with texture mutations or local areas with obvious abnormalities in density distribution, colors and numbers are used for significant identification. By summarizing the density anomaly and texture mutation information, a complete defect marking map is formed. Areas with density differences greater than 0.09 or abnormal texture features are treated as defective areas. Finally, a defect area map containing density anomalies and significant changes in texture features is obtained.
[0101] S222: Based on the defect marking map, visual image analysis is performed on the marked abnormal area, density difference and texture features are combined and annotated, and the abnormal area is distinguished by color and number to form a local abnormality cluster map;
[0102] Based on the generated defect marking map, the hierarchical clustering method is used to further classify and analyze all marked abnormal areas. The agglomerative clustering method in the hierarchical clustering method is adopted to gradually merge the adjacent areas according to their spatial distribution and feature similarity. First, a unique initial category label is set for each marked defect area, and then the adjacent defect areas with similar features are merged into new cluster categories step by step. During the merging process, the Euclidean distance is used as the similarity measurement indicator between regions. The regions are merged step by step until further aggregation is impossible. After that, a new cluster label is assigned to each merged cluster area, and its label number is adjusted according to the category distribution and feature uniformity of each cluster. Finally, a local abnormality cluster map containing different category identifiers is generated, and the cluster areas of each category are displayed in different colors to obtain a local abnormality cluster map.
[0103] The steps for analyzing the changes between the texture distribution and the geometric ratio of the local area are as follows:
[0104] S311: Based on the local abnormality clustering map, further analyze the marked abnormal area, use the grid coverage method to subdivide the local area of the galvanized pipe, extract the texture features and grayscale distribution in the grid, and compare the feature differences to generate abnormal distribution information of the grid area;
[0105] Firstly, the image segmentation method is used to subdivide the abnormal area on the surface of the galvanized pipe according to a fixed grid size. By setting the aspect ratio parameters and area constraints of each grid, the original image area is subdivided into multiple small grids. The specific position and number of each grid are marked according to the preset grid coverage rules, and the visual features are extracted one by one. In the subdivision process, the texture distribution characteristics inside each grid are recorded, and the grayscale analysis technology is used to extract the grayscale value distribution of the pixels in the grid, and the grayscale mean and grayscale variance of each grid are obtained. Then, the data of all grids are stored in the corresponding grid distribution matrix. By comparing the changes of each eigenvalue in the grid and analyzing the differences with the adjacent grids, it is judged whether there is an abnormal mutation in the texture of each grid. The abnormal texture change is usually manifested in the significant fluctuation of the grayscale mean and the change of variance. According to this judgment, the area is marked, the grid area with abnormal texture is identified, and the overall abnormal area map is formed. Through this refined processing, the position distribution characteristics of small defects on the surface of the galvanized pipe can be further clarified, and the detailed visual identification of all abnormal areas can be obtained.
[0106] S312: According to the abnormal distribution information of the grid area, the formula is used:
[0107]
[0108] Calculate the i ′ The geometric ratio R of the local area i′ , identify geometric fluctuation anomalies through ratio results, conduct regional complexity assessment, and establish a complex defect area distribution map;
[0109] Among them, R i′ It is used to measure the ratio between the number of grids and the area in each local area, reflecting the geometric complexity of the area. The larger the geometric ratio, the higher the texture complexity of the area. i′ Indicates the i ′ The total number of grids in a local area is obtained by counting each local area in the segmented image one by one according to the grid coverage method. i′ Indicates the i ′ The actual area of a local area is calculated by using the relationship between the unit area and the pixel distribution of the area to obtain the actual area value.
[0110] i ′ Indicates the i ′ The subdivision grid area number ranges from 1 to the total number of grids.
[0111] The surface of the galvanized pipe is subdivided into multiple local grid areas by image segmentation. Each grid has a fixed side length and number, and the grid boundaries and center points are marked one by one. Then, according to the number of grids actually covered in the image, N i′ And the actual area A of the grid areai′ Calculate the ratio R i′ For example, in a local area of a galvanized pipe, the number of grids is 15 and the area is 60 square millimeters.
[0112]
[0113] If the geometric ratio R i′ If there is a significant fluctuation or an abnormal value that deviates from the norm, it means that there are potential fractal characteristics and complex defects in the area. Therefore, the size of this ratio can be used as an important basis for judging the surface quality and defect distribution of galvanized pipes.
[0114] The steps to identify areas with fractal features are as follows:
[0115] S321: According to Article i ′ The geometric ratio R of the local area i′ , using the formula:
[0116]
[0117] Calculate the fractal dimension D f ;
[0118] Among them, D f It is used to measure the geometric complexity of the local area on the surface of the galvanized pipe. It is defined as the limit of the relationship between the number of grids covering the image features and the grid size. The value range is usually 0 to 2. δ represents the grid size, which is used to subdivide the grid size of the local area on the surface of the galvanized pipe. It takes a positive value and gradually reduces it to observe the characteristics of the geometric structure at different scales. N ′ (R i ,δ) represents the number of grids after the adjustment factor is corrected. The number of effective grids N in the region is counted under a given grid size and multiplied by the geometric ratio R i The adjustment factor of lim δ→0 It represents the ratio limit when the grid size δ gradually tends to 0. Log represents the logarithmic function, which is used to measure the proportional relationship between the number of grids and their size. α is the geometric ratio adjustment factor, which is used to adjust the sensitivity of geometric ratio fluctuations in different regions, so as to more accurately reflect the areas with significant fractal features. Its value is usually between 1 and 1.5, and is obtained by adjusting the changes in local regional features.
[0119] Assume that the geometric ratio R of a certain area of the galvanized pipe i is 0.8, the introduced adjustment factor α is 1.3, the grid size δ is selected as 0.5, 0.25 and 0.125 respectively, and the number of effective grids counted under each grid size is as follows:
[0120] When δ = 0.5, the number of grids N′ (R i ,δ)=100×1.3=130; when δ=0.25, the number of grids N ′ (R i ,δ)=400×1.3=520; when δ=0.125, the number of grids N ′ (R i ,δ)=1600×1.3=2080;
[0121] Substituting the adjustment factor α = 1.3, the result is as follows:
[0122] Logarithmic values at various grid sizes:
[0123] When δ=0.5: log130=2.114, log(1 / 0.5)=log 2=0.301; when δ=0.25: log520=2.716, log(1 / 0.25)=log4=0.602; when δ=0.125: log2080=3.318, log(1 / 0.125)=log8=0.903;
[0124] Take two adjacent groups of data for calculation:
[0125]
[0126] Similarly,
[0127]
[0128] Results Fractal dimension D f Take the average of all the ratios, which is 2.
[0129] S322: Based on the fractal dimension, the difference between the fractal dimension of each region and the reference value is compared, the abnormal region with significant fractal characteristics is identified, and a differentiated complex defect region map is generated;
[0130] First, the fractal dimension results of each local area are normalized. The fractal dimension of each area is standardized through the normalization formula, and the fluctuation of the fractal dimension value of each area is recorded. Then, the normalized fractal dimension is compared with the set standard value. For comparison and judgment, assuming that the benchmark value is 1.5, when the fractal dimension D of a certain area f Significantly higher or lower than the baseline value , the region is identified as an abnormal region with significant fractal features, and the abnormal region with significant fractal features is mapped back to the visual image for marking, and the geometric ratio R inside each marked region is further analyzed. i The trend of change is observed by observing the geometric ratio R iThe local volatility and uniformity of the galvanized pipe are used to further distinguish the areas with low density from the areas with sudden texture changes, and finally a visualization map containing the locations of complex surface defects is formed, which is used as a complex defect area map for distinguishing the types of surface abnormalities of galvanized pipes, that is, a distinguished complex defect area map.
[0131] The specific steps of defect edge morphology diagram are:
[0132] S411: Based on the differentiated complex defect area map, edge visual detection operation is used to identify the edge contour of the marked area on the surface of the galvanized pipe, the intensity and direction changes of each defect edge are recorded, the edge position with abnormal changes is marked, and the visual result of the defect area is generated;
[0133] Firstly, the complex defective areas marked on the surface of the galvanized pipe are subjected to edge visual detection. The Canny edge detection method is used to obtain the initial edge contour of each area. The gradient intensity of all pixels in the area is screened by selecting the upper and lower thresholds in the gradient space. The rate of change of pixels in the gradient direction is recorded first, and then the edge points below the lower threshold are eliminated. The pixels between the upper and lower thresholds and adjacent to the high-intensity edges are connected to extract the edge lines of each defective area. On this basis, directional features are extracted. The directional angle value of each pixel is converted into an angle gradient map using the edge directional gradient angle mapping method. The edge direction change pattern in the defective area is observed on the angle gradient map. By comparing the directional consistency and the rate of change, the edge positions with abnormal changes are identified and marked, and a visual result containing complete edge direction change features is obtained in each defective area.
[0134] S412: Based on the visualization result of the defect area, the edge contour is analyzed for closure, line direction and morphological integrity, the boundary contour is optimized, and a defect edge morphological map is generated;
[0135] First, the connectivity between each edge point is detected, and the closure is judged by setting the Euclidean distance between the starting point and the end point. If the distance between the starting point and the end point is less than the threshold, the edge contour is considered to have a closed characteristic. Then, the morphological features of the boundary contour with a closed characteristic are extracted, and the morphology of the contour line is optimized by morphological operations (erosion and expansion), and the continuity and smoothness of the overall line are recorded. According to the curvature change trend, it is judged whether there is a break or mutation in the direction of the edge line. By fitting the curve model, the edge point sequence is fitted into multiple continuous line segments, and the integrity of the overall morphology is analyzed. Finally, the irregular or morphologically mutated areas are marked to form a defect edge morphology diagram containing complex defect boundary morphology, and the morphological features of each defect boundary are visualized.
[0136] The system for detecting surface defects of galvanized pipes is used to perform the above-mentioned method for detecting surface defects of galvanized pipes, and the system comprises:
[0137] The image segmentation and feature extraction module divides the surface of the galvanized pipe into multiple local areas through image segmentation, extracts the texture features and color histogram values of each area, establishes a feature data set after normalization, and generates a local feature data set;
[0138] The feature clustering and anomaly identification module sets cluster centers based on local feature data sets, analyzes regional feature similarities, identifies density differences, marks abnormal areas, and generates local anomaly cluster maps;
[0139] The grid subdivision and fractal feature analysis module performs grid subdivision on the abnormal area based on the local abnormal clustering map, analyzes the texture distribution and geometric ratio changes, identifies fractal features, and generates a fractal feature area map;
[0140] The defect area screening module screens areas with high geometric complexity based on the fractal feature area map, and generates a complex defect area map by combining texture complexity judgment;
[0141] The edge contour recognition module performs edge detection based on the complex defect area map, analyzes the closure of the contour and the direction of the lines, and generates a defect edge morphology map through graphical representation.
[0142] The above are only preferred embodiments of the present invention and are not intended to limit the present invention in other forms. Any technician familiar with the profession may use the technical contents disclosed above to change or modify them into equivalent embodiments with equivalent changes and apply them to other fields. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the technical solution of the present invention still falls within the protection scope of the technical solution of the present invention.
Claims
1. A method for detecting surface defects of a galvanized pipe, characterized in that: The following steps are involved: S1: Perform visual segmentation on the surface image of the galvanized pipe, extract the frequency distribution and phase information of the texture features of each area, obtain the color histogram value of the local area, normalize the color histogram and the extracted texture features, and establish a local texture and color feature data set; S2: Based on the local texture and color feature data set, the cluster center is set in the visual image. By analyzing the similarity of the features in the region and judging the region type, the density difference of each region on the surface of the galvanized pipe is identified, and the abnormal region is marked by comparing the changes in regional color and texture, and a local abnormal clustering map is generated; S3: Based on the local abnormal clustering map, the local area of the galvanized pipe is subdivided by grid covering, the changes between the texture distribution and the geometric ratio of the local area are analyzed, the area with fractal features is identified, the area with significant fractal features is screened, and the differentiated complex defect area map is formed; S4: The edge contours of the differentiated complex defect area map are identified through edge vision detection operations. For the edge contours of each defect area, the closedness of the boundary contour, the direction of the edge line and the morphological integrity are analyzed, and graphical representation is performed through visual annotation to form a defect edge morphological map.
2. The method for detecting surface defects of a galvanized pipe according to claim 1, characterized in that: The specific steps for obtaining the color histogram value of the local area are: S111: Divide the original galvanized pipe surface image into several local areas, identify the boundary transition area of the image, obtain the frequency distribution value of each local area in each direction, capture the phase information inside the local area, and generate an initial data set; S112: Based on the initial data set, use the formula: Calculate the weighted amplitude average A at different angles avg , obtain the texture feature data of the galvanized pipe surface in all directions; Among them, A i (θ) represents the frequency amplitude of the i-th local area in the direction θ, θ represents the direction angle parameter, W(θ) represents the direction weight parameter, T(θ) represents the direction texture coefficient, and n represents the total number of local areas divided on the galvanized pipe surface.
3. The method for detecting surface defects of a galvanized pipe according to claim 2, characterized in that: The specific steps of normalizing the color histogram and the extracted texture features are: S121: based on the texture feature data of the galvanized pipe surface in various directions, extract the color histogram and texture features in the local area, and establish a normalized matrix including directional features and color matching features through matching and normalization processing to obtain a normalized eigenvalue set; S122: Based on the normalized feature value set, the feature data of the local area is classified and labeled, and the color histogram and texture feature data are integrated to generate a local texture and color feature data set.
4. The method for detecting surface defects of a galvanized pipe according to claim 3, characterized in that: The steps to identify the density differences in each area of the galvanized pipe surface are as follows: S211: Based on the local texture and color feature data set, the color histogram, texture frequency distribution and phase information are processed by a feature clustering method, the belonging relationship between the local area and the cluster center is dynamically adjusted, and a cluster category distribution map is established; S212: According to the cluster category distribution diagram, use the formula: Calculate the density difference ΔD to obtain density difference data; Among them, D i represents the density value of the i-th local area, D avg It represents the average density value of all areas on the surface of the galvanized pipe, and n represents the total number of local areas into which the surface of the galvanized pipe is divided.
5. The method for detecting surface defects of a galvanized pipe according to claim 4, characterized in that: The specific steps of marking abnormal areas by comparing the changes in color and texture of the area are: S221: Based on the density difference data, the density value of each area is compared with the preset conventional density standard value, the area with significant density deviation is identified, and the texture features of each area are combined to mark and classify the area to generate a defect marking map; S222: Based on the defect marking map, visual image analysis is performed on the marked abnormal area, density differences and texture features are combined and annotated, and the abnormal areas are distinguished by color and number to form a local abnormality clustering map.
6. The method for detecting surface defects of a galvanized pipe according to claim 5, characterized in that: The steps for analyzing the changes between the texture distribution and the geometric ratio of the local area are as follows: S311: Based on the local abnormality clustering map, further analyze the marked abnormal area, use the grid coverage method to subdivide the local area of the galvanized pipe, extract the texture features and grayscale distribution in the grid, and compare the feature differences to generate abnormal distribution information of the grid area; S312: According to the abnormal distribution information of the grid area, the formula is used: Calculate the i ′ The geometric ratio R of the local area i′ , identify geometric fluctuation anomalies through ratio results, conduct regional complexity assessment, and establish a complex defect area distribution map; Among them, N i′ Indicates the i ′ The total number of grids in the local area, A i′ Indicates the i ′ The actual area of a local area, i ′ Indicates the i ′ The subdivision grid area number.
7. The method for detecting surface defects of a galvanized pipe according to claim 6, characterized in that: The steps to identify areas with fractal features are as follows: S321: According to Article i ′ The geometric ratio R of the local area i′ , using the formula: Calculate the fractal dimension D f ; Where δ represents the mesh size, which is used to subdivide the mesh size of the local area on the surface of the galvanized pipe, N ′ (R i ,δ) represents the number of grids after being corrected by the adjustment factor, lim δ→0 It indicates the ratio limit when the grid size δ gradually approaches 0, log indicates the logarithmic function, and α is the geometric ratio adjustment factor; S322: Based on the fractal dimension, the difference between the fractal dimension of each region and the reference value is compared, the abnormal region with significant fractal characteristics is identified, and a differentiated complex defect region map is generated.
8. The method for detecting surface defects of a galvanized pipe according to claim 7, characterized in that: The specific steps of defect edge morphology diagram are: S411: Based on the differentiated complex defect area map, edge visual detection operation is used to identify the edge contour of the marked area on the surface of the galvanized pipe, the intensity and direction changes of each defect edge are recorded, the edge position with abnormal changes is marked, and the visual result of the defect area is generated; S412: Based on the visualization result of the defect area, the edge contour is analyzed for closure, line direction and morphological integrity, the boundary contour is optimized, and a defect edge morphological map is generated.
9. A system for detecting surface defects of galvanized pipes, characterized in that: According to the method for detecting surface defects of a galvanized pipe according to any one of claims 1 to 8, the system comprises: The image segmentation and feature extraction module divides the surface of the galvanized pipe into multiple local areas through image segmentation, extracts the texture features and color histogram values of each area, establishes a feature data set after normalization, and generates a local feature data set; The feature clustering and anomaly identification module sets cluster centers based on local feature data sets, analyzes regional feature similarities, identifies density differences, marks abnormal areas, and generates local anomaly cluster maps; The grid subdivision and fractal feature analysis module performs grid subdivision on the abnormal area based on the local abnormal clustering map, analyzes the texture distribution and geometric ratio changes, identifies fractal features, and generates a fractal feature area map; The defect area screening module screens areas with high geometric complexity based on the fractal feature area map, and generates a complex defect area map by combining texture complexity judgment; The edge contour recognition module performs edge detection based on the complex defect area map, analyzes the closure of the contour and the direction of the lines, and generates a defect edge morphology map through graphical representation.
Citation Information
Cited By
Water heating pipeline maintenance detection method and system
CN119844713A
Film material surface treatment defect detection method and system based on image recognition
CN119887755A
Historical building brick wall surface damage intelligent identification and diagnosis method
CN120472220A
Visual inspection system and method for tiny flaws of industrial products
CN120612327A
Metal product industry AI corpus processing method and system based on cloud platform
CN122049461A