Seamless steel pipe defect detection method based on image processing
Through the combination of adaptive filters and SVM classifiers, the corrugated and wrinkled defects on the surface of seamless steel pipes are dynamically detected, solving the problem of insufficient detection capabilities in traditional methods and achieving high accuracy and real-time defect detection.
Patent Information
- Application Number
- CN202411874626.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-12-19
AI Technical Summary
The prior art cannot effectively detect defects such as corrugation and wrinkle on the surface of the steel pipe during the sizing process of seamless steel pipes, resulting in missed or mis-checked, and the feature extraction ability is limited, so it is impossible to fully extract the morphology and texture characteristics of the defect area.
Adaptive filters are used to combine directional filters and frequency filters to dynamically construct filters through gradient direction histograms and spectrum analysis. Combined with SVM classifiers, the morphology and texture characteristics of steel tube images are extracted to achieve accurate detection of defects.
It improves the accuracy and real-time nature of defect detection, reduces the incidence of missed and missed detection, and adapts to the changes in defect characteristics under complex production conditions.
Smart Images

Figure CN119338809B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of image processing, and in particular to a seamless steel pipe defect detection method based on image processing. Background Art
[0002] Seamless steel pipe is an important industrial material used in high-end manufacturing fields such as petroleum, chemical industry, aerospace, etc. It has excellent mechanical properties and corrosion resistance. In the production process of seamless steel pipe, sizing process is one of the key steps. The heated seamless steel pipe gradually reaches the target outer diameter and wall thickness through multiple actions of multiple rollers in the sizing machine. The sizing process plays an important role in ensuring the dimensional accuracy and surface quality of seamless steel pipes. However, during the sizing process, the surface of the steel pipe will be deformed due to the complex roller pressure and thermal stress, which will bury hidden dangers for subsequent use. Because the rollers may vibrate or deviate during the sizing process, defects such as corrugation or wrinkling are prone to occur on the surface of the steel pipe. These defects not only destroy the appearance quality of the steel pipe, but also may have potential effects on its internal structure, such as weakening the tensile strength, yield strength and pressure resistance.
[0003] The prior art usually uses direct image processing methods to detect surface defects of seamless steel pipes. For example, the Chinese patent application document with publication number CN118674721A discloses a quality analysis system and method for seamless steel pipe production based on image processing, which realizes seamless steel pipe production quality analysis and defect identification through preprocessing, segmentation, edge detection, feature extraction and BP neural network training. However, this method has some technical defects: it cannot respond adaptively to the production characteristics of seamless steel pipes, is prone to missed detection or false detection, and has limited feature extraction capabilities, and cannot fully extract the morphology and texture characteristics of the defect area. Summary of the invention
[0004] In view of the problem of limited feature extraction capability, the present invention proposes a seamless steel pipe defect detection method based on image processing, comprising: obtaining a steel pipe image containing surface defects after sizing; filtering the steel pipe image based on an adaptive filter, extracting morphological features and texture features of the filtered steel pipe image to obtain a feature vector, and manually marking defect degree labels for training a classifier; photographing an actual image of a steel pipe after sizing in production to obtain a feature vector of the actual image; inputting the feature vector into a trained classifier to determine whether there are defects in the corresponding steel pipe area of the actual image; the adaptive filter comprises a directional filter and a frequency filter; the directional ... The direction angle corresponding to the frequency domain coordinates of the direction filter and the image spectrum is positively correlated with the difference between the main gradient direction of the defect; the frequency filter is positively correlated with the difference between the frequency amplitude in the image spectrum and the main spatial frequency of the defect; the main gradient direction of the defect is the gradient direction corresponding to the maximum value of the ordinate in the gradient direction histogram; the abscissa of the gradient direction histogram is all non-repeated gradient directions in the steel pipe image, and the ordinate is the sum of the gradient amplitudes of the same gradient direction; multiple vertical line segments are selected along the main gradient direction of the defect, and the spectrum average of the gray value sequence of each vertical line segment is obtained to obtain the overall spectrum; the main frequency of the overall spectrum is recorded as the main spatial frequency of the defect.
[0005] The surface image of the steel pipe is enhanced in the direction and frequency domains by an adaptive filter, and the characteristics of periodic defects such as ripples and wrinkles are effectively extracted. Directional filters and frequency filters are introduced, and filters are dynamically constructed according to the gradient direction and spatial frequency of the defect, which improves the response capability to the target defect characteristics and overcomes the problem of insufficient direction and frequency response in traditional methods. The defect characteristic parameters are accurately determined by gradient direction histogram and spectrum analysis, and the adaptive design of the filter is realized, which reduces the occurrence of missed detection and false detection. Through the comprehensive analysis of feature vectors and combined with SVM classifier, the accuracy and real-time performance of defect classification are improved. Traditional methods mostly use fixed filters or simple image processing methods, which cannot dynamically adapt to defect characteristics. The adaptive filter of the present invention realizes dynamic adjustment through direction and frequency characteristics, which greatly improves the detection capability of complex defects.
[0006] Furthermore, the calculation method of the adaptive filter is specifically as follows:
[0007] ;
[0008] Where F(u,v) represents the adaptive filter; D(u,v) represents the response function of the directional filter; G(u,v) represents the response function of the frequency filter.
[0009] Through adaptive design, the problem of insufficient response of traditional fixed filters to complex surface defects is avoided, and the incidence of missed detection and false detection is reduced. In traditional methods, filters are mostly fixed designs and cannot adapt to the dynamic changes in defect direction and frequency characteristics in production. The present invention achieves targeted enhancement of defect characteristics by adaptively adjusting parameters, solving the problem that fixed filters are difficult to detect periodic defects.
[0010] Furthermore, the method for calculating the scale parameter of the adaptive filter is specifically as follows:
[0011] ;
[0012] Where D(u,v) represents the response function of the directional filter; exp( ) represents the natural exponential function; , represents the direction angle corresponding to the frequency domain coordinate (u, v); Indicates the main gradient direction of the defect; Indicates the set direction standard deviation, and the value range is set to the empirical value .
[0013] Furthermore, the method for calculating the scale parameter of the adaptive filter is specifically as follows:
[0014] ;
[0015] Where G(u,v) represents the response function of the frequency filter; exp( ) represents the natural exponential function; , represents the frequency amplitude; Indicates the main spatial frequency of the defect; Indicates the set frequency standard deviation, and the value range is set to the empirical value .
[0016] Furthermore, the method for calculating the scale parameter of the adaptive filter is specifically as follows:
[0017] ;
[0018] in represents the scale parameter of the adaptive filter; Indicates the main spatial frequency of the defect.
[0019] By associating the filter scale parameters with the main spatial frequency of the defect, the filter's extension range in the spatial domain is ensured to match the defect characteristics. Dynamic adjustment of the scale parameters optimizes the filter's selectivity and detection accuracy, and adapts to changes in defect size under different production conditions. Traditional filters are mostly designed with fixed scales, which are difficult to adapt to defects of different sizes.
[0020] Furthermore, obtaining the steel pipe image containing surface defects after sizing also includes: using a high-speed industrial camera to shoot the steel pipe surface image containing defects, and using a ring-shaped LED lighting device to provide a light source; graying the steel pipe surface image using a weighted average method; using a Gaussian filter to reduce noise on the grayed image, and using an adaptive histogram equalization algorithm to enhance contrast; using a YOLOv5 model to extract the main area of the preprocessed steel pipe surface image, and recording the image corresponding to the main area as the steel pipe image.
[0021] The high-speed industrial camera and the ring LED light source provide high-resolution, smear-free, and uniformly illuminated original images, laying a good data foundation for subsequent detection. The image preprocessing stage significantly enhances the image contrast and suppresses environmental noise through grayscale conversion, Gaussian filtering noise reduction, and adaptive histogram equalization.
[0022] Furthermore, extracting the morphological features and texture features of the filtered steel pipe image to obtain a feature vector also includes: performing adaptive threshold segmentation on the filtered steel pipe image and performing binarization processing to obtain a binary image; recording all white areas in the binary image as the first area, and all black areas as the second area; calculating the grayscale variance of the steel pipe images corresponding to the first area and the second area, and recording the steel pipe image corresponding to the area with a larger grayscale variance as a defective area; using the HU moment algorithm to obtain the morphological features of the defective area; using the gray level co-occurrence matrix to obtain the texture features of the defective area, and the morphological features and the texture features together constitute a feature vector.
[0023] The morphological features are extracted through the HU moment to comprehensively describe the geometric shape and symmetry of the defect, and it is invariant to rotation, scaling and translation, and adapts to complex production conditions. The texture features are extracted using the grayscale co-occurrence matrix, including energy, entropy, contrast and correlation, which comprehensively reflects the grayscale distribution characteristics of the defect area. The feature vector constructed by integrating morphological and texture features provides rich input information for the classification model and significantly improves the accuracy of classification. Traditional feature extraction methods mostly rely only on a single morphological or texture feature, with insufficient information dimension and limited classification effect. The present invention solves the problem of insufficient description capability of a single feature by combining morphological and texture features, and enhances the robustness of classification.
[0024] Furthermore, the texture features are specifically: energy, entropy, contrast and correlation of the gray level co-occurrence matrix.
[0025] Furthermore, the feature vector is input into a trained classifier to determine whether there is a defect in the steel pipe area corresponding to the actual image, and it also includes: inputting the feature vector into the trained classifier to obtain the defect degree output by the classifier; in response to the defect degree being greater than a set threshold, determining that there is a defect in the steel pipe area corresponding to the actual image.
[0026] Furthermore, the classifier is a SVM support vector machine classifier.
[0027] The technical effects of the present invention are:
[0028] The present invention aims at complex defects such as surface corrugations of steel pipes after sizing, and realizes accurate extraction of defective areas by enhancing characteristic responses through directional and frequency selectivity of adaptive filters. The HU moment and gray-level co-occurrence matrix are used to construct a comprehensive feature vector, and combined with a support vector machine classifier, the accuracy and real-time performance of defect classification are improved, thus providing an intelligent solution for quality control of steel pipe production. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0030] Figure 1 is a flow chart schematically showing a seamless steel pipe defect detection method based on image processing in an embodiment of the present invention;
[0031] Figure 2 is a grayscale schematic diagram schematically showing a plurality of sizing machines in an embodiment of the present invention placed side by side;
[0032] Figure 3 It is a three-dimensional schematic diagram schematically showing the corrugated defects on the surface of the seamless steel pipe in the embodiment of the present invention. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0034] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0035] Embodiment of seamless steel pipe defect detection method based on image processing:
[0036] like Figure 1 As shown, the seamless steel pipe defect detection method based on image processing of the present invention includes:
[0037] S1. Obtain an image of the seamless steel pipe after sizing.
[0038] In the production process of seamless steel pipes, the seamless steel pipes will be reheated after the rolling process is completed, and then the heated seamless steel pipes will be transported to the sizing machine. The seamless steel pipes will gradually reach the target outer diameter and wall thickness through multiple actions of the rollers in multiple sizing machines, such as Figure 2 As shown, the side-by-side sizing mills are arranged in descending order of central aperture, and sizing can be achieved when the seamless steel pipe passes through the center of the sizing mill in sequence. It should be noted that the steel pipes mentioned in this embodiment all refer to seamless steel pipes, which will not be described in detail later. During the sizing process, the surface of the steel pipe will be subjected to complex roller pressure and thermal stress, and deformation and the like may occur easily. An exemplary explanation is as follows: when the sizing roller is offset around the central axis, the roller will vibrate, which will cause corrugated defects on the surface of the steel pipe during the sizing process, and since the speed at which the steel pipe is transported to the sizing mill is approximately constant, the corrugated defects on the surface of the steel pipe will show a certain periodicity, such as Figure 3 These defects not only affect the surface quality of the steel pipe, but may also weaken its mechanical properties, such as tensile strength, yield strength and pressure resistance, thus affecting its application in various fields.
[0039] In this embodiment, a high-speed industrial camera with a resolution of not less than 3840×2160 pixels and a frame rate of not less than 60 frames per second is firstly selected to capture images of steel pipes containing defects, while keeping the lens perpendicular to the surface of the steel pipe to ensure that subtle surface defects can be captured; then a ring-shaped LED lighting device is used to provide uniform and stable lighting to reduce the impact of shadows and reflections on image quality; finally, the shutter speed and exposure parameters of the camera are adjusted according to the moving speed of the steel pipe to ensure that each frame of the image is clear and has no ghosting, and to avoid image blur or repeated acquisition.
[0040] After obtaining the RGB image of the steel pipe surface, for any RGB image, first use the weighted average method to grayscale it; then use a Gaussian filter to reduce the noise of the grayscale image; further use an adaptive histogram equalization algorithm to enhance the local contrast of the grayscale image; finally, use the YOLOv5 model to obtain the foreground area image, that is, the steel pipe image without the background. The input of the algorithm is the preprocessed steel pipe surface image containing the background area, and the output is the bounding box, category label and confidence score of the detection object. In this embodiment, the image in the bounding box with the highest confidence score and the category label of the steel pipe is used as the foreground area image. The training process of the above-mentioned YOLOv5 model and multiple preprocessing algorithms are all well-known technologies, and the specific implementation methods will not be repeated here.
[0041] The high-speed industrial camera and the ring LED light source provide high-resolution, smear-free, and uniformly illuminated original images, laying a good data foundation for subsequent detection. The image preprocessing stage significantly enhances the image contrast and suppresses environmental noise through grayscale conversion, Gaussian filtering noise reduction, and adaptive histogram equalization.
[0042] S2. Obtain the main gradient direction of the defect and the main spatial frequency of the defect in the steel pipe image; and construct an adaptive filter based on the main gradient direction of the defect and the main spatial frequency of the defect.
[0043] After obtaining the preprocessed steel pipe image in step S1, it is further necessary to accurately extract the features of the corrugated defect, so an adaptive filter is constructed in this embodiment. First, the Sobel operator is used to obtain the gradient amplitude and gradient direction of each pixel in the steel pipe image, and the gradient amplitude of the pixel with coordinates (x, y) is recorded as M(x, y), and the gradient direction of the pixel with coordinates (x, y) is recorded as θ(x, y); then a gradient direction histogram H(θ) is constructed, and the main direction of the edge in the image is identified by statistically analyzing the gradient direction, and then the main direction of the defect is obtained. The method for constructing the gradient direction histogram H(θ) is as follows:
[0044] ;
[0045] in It means that when the gradient direction is The value of the gradient direction histogram corresponding to ; represents the gradient magnitude of the pixel with coordinates (x, y), which is used to weight the value of the gradient direction histogram; represents the selection function, when hour, ,otherwise After constructing the gradient direction histogram H(θ), the influence of strong edges on the direction statistics can be highlighted, and it can be used to determine the gradient direction corresponding to the peak in the gradient direction histogram H(θ). Finally, the main gradient direction of the defect in the steel pipe image is determined, and the specific calculation method is as follows:
[0046] ;
[0047] in Indicates the main gradient direction of defects in the steel pipe image, providing a reference for the direction selection of the subsequent adaptive filter; argmax represents the function Find the function of the parameter, That is to say, The gradient direction corresponding to the maximum value .
[0048] Since the corrugated defect still has a certain spatial periodicity, obtaining the main spatial frequency of the corrugated defect can provide a reference for the frequency selection of the adaptive filter. First, select multiple lines perpendicular to the main gradient direction of the defect in the image. In this embodiment, a line segment perpendicular to 10 line segments with a length of 500 pixels are drawn, and the grayscale value of the pixels on each line segment is extracted along the direction of the steel pipe movement. The grayscale value sequence of the kth line segment is recorded as , where t represents the pixel position along the line segment. The number and length of the above line segments can also be selected by the implementer according to the actual situation, which will not be described here. Then, a one-dimensional Fourier transform is performed on each gray value sequence to obtain a spectrum. The specific transformation method is:
[0049] ;
[0050] in represents the spectral component of the kth line segment; N represents the length of the sequence, which is an empirical value of 500 in this embodiment; represents the gray value sequence of the kth line segment; j represents the imaginary unit. Then the average value of all spectra is calculated to obtain the overall spectrum. The specific calculation method is:
[0051] ;
[0052] in represents the average spectrum, which integrates the frequency information of multiple line segments; M represents the number of line segments, which is an empirical value of 10 in this embodiment; represents the spectrum component of the kth line segment. Finally, the main frequency of the average spectrum is obtained, and the specific method of obtaining it is:
[0053] ;
[0054] in Indicates the main spatial frequency of the defect; Indicates that The frequency f corresponding to the maximum value. So far, the main gradient direction of the defect in the steel pipe image has been obtained. and the main spatial frequency of the defect In order to enhance the response to defect characteristics, the adaptive filter should have a higher response in the main direction and main spatial frequency of the defect. and Design an adaptive filter. The design method is as follows:
[0055] ;
[0056] ;
[0057] ;
[0058] Where F(u,v) represents the adaptive filter; D(u,v) represents the response function of the directional filter; exp( ) represents the natural exponential function; , represents the direction angle corresponding to the frequency domain coordinate (u, v); Indicates the main gradient direction of the defect; Indicates the directional standard deviation, which is used to control the width of directional selectivity. In this embodiment, it can be set to an empirical value , the implementer can also select the directional standard deviation according to the actual situation to adjust the allowable deviation degree of the adaptive filter for the main direction of the defect; G(u,v) represents the response function of the frequency filter; , represents the frequency amplitude; Indicates the main spatial frequency of the defect; Indicates the frequency standard deviation, which is used to control the width of frequency selectivity. In this embodiment, it can be set to an empirical value ,The implementer can also select the frequency standard deviation according to the actual situation to reduce the response to other frequency components and improve the accuracy of feature extraction.
[0059] It should be noted that the scale parameter of the adaptive filter in this embodiment is The calculation method is:
[0060] ;
[0061] in Represents the scale parameter of the adaptive filter, which is used to control the extension degree of the filter in the spatial domain; Represents the main spatial frequency of the defect. So far, the adaptive filter F(u,v) is obtained, and the characteristic response degree of the defect area is improved based on the adaptive filter.
[0062] Through adaptive design, the problem of insufficient response of traditional fixed filters to complex surface defects is avoided, and the incidence of missed detection and false detection is reduced. In traditional methods, filters are mostly fixed designs and cannot adapt to the dynamic changes in defect direction and frequency characteristics in production. The present invention achieves targeted enhancement of defect characteristics by adaptively adjusting parameters, solving the problem that fixed filters are difficult to detect periodic defects.
[0063] S3, obtaining a steel pipe image after adaptive filtering; obtaining a defect area in the steel pipe image based on adaptive threshold segmentation and morphological operation; and constructing a feature vector according to the defect area.
[0064] The pre-processed steel pipe image obtained in step S1 is recorded as First, the steel pipe image Perform a two-dimensional fast Fourier transform to obtain the spectrum:
[0065] ;
[0066] in represents the frequency spectrum of the steel pipe image; FFT[ ] represents fast Fourier transform; represents the preprocessed steel pipe image. Then, based on the adaptive filter obtained in step S2, the main direction and frequency components of the defect are enhanced, as follows:
[0067] ;
[0068] in represents the frequency spectrum of the steel pipe image after filtering; represents the spectrum of the steel pipe image; F(u,v) represents the adaptive filter. Finally, the filtered spectrum is inversely transformed into a two-dimensional Fourier transform to obtain the steel pipe image after adaptive filtering, which is:
[0069] ;
[0070] in represents the steel pipe image after filtering; IFFT[ ] represents inverse fast Fourier transform; Represents the frequency spectrum of the steel pipe image after filtering.
[0071] So far, the steel pipe image after adaptive filtering is obtained. First, the Otsu threshold method is used to obtain the adaptive segmentation threshold, and the binarization processing is performed based on the adaptive segmentation threshold. For example, the image area greater than the adaptive segmentation threshold is marked as "1", which can also be recorded as the first area; the image area less than the adaptive segmentation threshold is marked as "0", which can also be recorded as the second area. The above Otsu threshold and binarization processing belong to the well-known technology and will not be repeated here.
[0072] Then, the grayscale variance of the steel pipe image corresponding to all the areas marked as "1" is calculated, and the grayscale variance of the steel pipe image corresponding to all the areas marked as "0" is calculated, and the marked areas with larger grayscale variance are regarded as defective areas. An exemplary explanation is as follows: there are 5 areas marked as "1", and the grayscale variance of all pixels in the steel pipe image corresponding to these 5 areas is calculated to be 10; at the same time, there are 7 areas marked as "0", and the grayscale variance of all pixels in the steel pipe image corresponding to these 7 areas is calculated to be 30. Since the reflection of the light source by the steel pipe image in the non-defective area is relatively stable, the grayscale variance in the non-defective area is relatively small, and 30>10, so all image areas marked as "0" are regarded as defective areas.
[0073] Finally, based on the binary image, a morphological closing operation is used to obtain a more coherent and complete defect area. An exemplary explanation is as follows: all areas marked as "0", that is, black areas in the binary image are initially determined to be defect areas. Further, a closing operation is used on the black areas to connect adjacent defect areas, fill in smaller gaps and eliminate isolated noise points. Accordingly, the pixels in the steel pipe image corresponding to the black areas are defect area pixels. The above morphological closing operation belongs to the well-known technology, and the specific implementation method will not be repeated here.
[0074] So far, the defect area in the steel pipe image has been obtained. Subsequently, the defect area feature vector is constructed based on the morphological features and texture features of the defect area. The specific acquisition method is as follows:
[0075] For any defect area, the morphological features are first extracted based on the HU moment algorithm to obtain its 7 HU moments. For example, for the pth defect area, the 7 HU moments extracted using the HU moment algorithm are: Then the gray level co-occurrence matrix is used to extract the texture features of the defect area, and the energy of the p-th defect area extracted by the gray level co-occurrence matrix is recorded as , entropy is recorded as , contrast is recorded as , the correlation is recorded as Finally, the feature vector of the pth defect area is recorded as , specifically:
[0076] ;
[0077] The above HU moment algorithm and gray level co-occurrence matrix are both well-known technologies, and the specific implementation methods are not described here. After obtaining the defect area and the corresponding feature vector, the relevant technicians manually annotate the defect area, and add defect degree digital labels to the defect area based on the technicians' relevant experience, such as "0.1", "0.2" and "0.3", etc., and the label of the pth defect area is recorded as .
[0078] So far, the feature vector is obtained for any defect area And tags , obtain the defect area feature vectors and labels of all steel pipe images collected in step S1, use 80% of all defect area related data as training set, and the remaining 20% as verification set. Input the training set data into the SVM support vector machine for training, and use the verification set to verify the training results, thereby completing the training process of the SVM support vector machine and obtaining a trained SVM support vector machine classifier. The above-mentioned SVM support vector machine belongs to the well-known technology, and the specific training process will not be repeated here.
[0079] The morphological features are extracted through the HU moment to comprehensively describe the geometric shape and symmetry of the defect, and it is invariant to rotation, scaling and translation, and adapts to complex production conditions. The texture features are extracted using the grayscale co-occurrence matrix, including energy, entropy, contrast and correlation, which comprehensively reflects the grayscale distribution characteristics of the defect area. The feature vector constructed by integrating morphological and texture features provides rich input information for the classification model and significantly improves the accuracy of classification. Traditional feature extraction methods mostly rely only on a single morphological or texture feature, with insufficient information dimension and limited classification effect. The present invention solves the problem of insufficient description capability of a single feature by combining morphological and texture features, and enhances the robustness of classification.
[0080] S4. Real-time defect recognition of seamless steel pipe production process is performed based on the trained SVM support vector machine classifier.
[0081] The images of steel pipes after sizing are continuously collected on the seamless steel pipe production line. First, the captured images are preprocessed. Then, the feature-enhanced steel pipe images are obtained based on the adaptive filter F(u,v). Then, the defect area is obtained by using threshold segmentation, binarization and morphological operations. The comprehensive feature vector is further extracted based on the HU moment algorithm and the gray level co-occurrence matrix. Finally, the comprehensive feature vector is input into the trained SVM support vector machine classifier, and the quality of the current sizing steel pipe is judged based on the output result of the classifier.
[0082] Exemplary explanation: There is a preprocessed steel pipe image. Four defect areas are obtained after threshold segmentation, binarization and morphological operation. The corresponding four comprehensive feature vectors are obtained based on the HU moment algorithm and gray level co-occurrence matrix. , , as well as After the four comprehensive feature vectors are input into the trained SVM support vector machine classifier, four output results are obtained: 0.1, 0.2, 0.1, 0.1, and the sum of all the above output results is 0.5. In this embodiment, the empirical value of the defect threshold can be set to 0.6. If 0.5<0.6, it can be considered that the quality of the steel pipe corresponding to the steel pipe image meets the production requirements. The implementer of the above defect threshold can also set it to 0.7, 0.8 or 0.9 according to the actual situation.
[0083] After screening out steel pipes that do not meet production requirements based on the defect threshold, professional technicians will analyze the relevant defect areas to determine the causes of the defects, and then adjust the relevant production parameters, including corresponding maintenance of the sizing machine, to ensure that the subsequent production quality of seamless steel pipes meets the requirements.
[0084] The present invention uses an adaptive filter to enhance the direction and frequency domain of the steel pipe surface image, and effectively extracts the characteristics of periodic defects such as ripples and wrinkles. Directional filters and frequency filters are introduced, and filters are dynamically constructed according to the gradient direction and spatial frequency of the defect, which improves the response capability to the target defect characteristics and overcomes the problem of insufficient direction and frequency response in traditional methods. The defect characteristic parameters are accurately determined using gradient directional histograms and spectrum analysis, and the adaptive design of the filter is realized, reducing the occurrence of missed detections and false detections. Through the comprehensive analysis of feature vectors and combined with the SVM classifier, the accuracy and real-time performance of defect classification are improved. Traditional methods mostly use fixed filters or simple image processing methods, which cannot dynamically adapt to defect characteristics. The adaptive filter of the present invention realizes dynamic adjustment through direction and frequency characteristics, which greatly improves the detection capability of complex defects.
[0085] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0086] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A seamless steel pipe defect detection method based on image processing, characterized in that: Methods include: Obtain an image of the steel pipe including surface defects after sizing; The steel pipe image is filtered based on an adaptive filter, and the morphological features and texture features of the filtered steel pipe image are extracted to obtain a feature vector, and the defect degree labels are manually annotated for training the classifier; Take the actual image of the steel pipe after sizing in production and obtain the feature vector of the actual image; input the feature vector into the trained classifier to determine whether there is a defect in the corresponding steel pipe area of the actual image; The adaptive filter includes a directional filter and a frequency filter; the directional filter is positively correlated with the difference between the directional angle corresponding to the frequency domain coordinates in the image spectrum and the main gradient direction of the defect; the frequency filter is positively correlated with the difference between the frequency amplitude in the image spectrum and the main spatial frequency of the defect; Obtain the main gradient direction of defects and the main spatial frequency of defects in the steel pipe image; construct an adaptive filter based on the main gradient direction of defects and the main spatial frequency of defects; Calculation method of adaptive filter: ; Where F(u,v) represents the adaptive filter; D(u,v) represents the response function of the directional filter; G(u,v) represents the response function of the frequency filter; Adaptive filter scale parameter calculation method: ; Where exp( ) represents the natural exponential function; , represents the direction angle corresponding to the frequency domain coordinate (u, v); Indicates the main gradient direction of the defect; Indicates the set direction standard deviation, and the value range is set to the empirical value ; Or the scale parameter calculation method of the adaptive filter: ; in , represents the frequency amplitude; Indicates the main spatial frequency of the defect; Indicates the set frequency standard deviation, and the value range is set to the empirical value ; Or the adaptive filter scale parameter calculation method: ; in represents the scale parameter of the adaptive filter; The main gradient direction of the defect is the gradient direction corresponding to the maximum value of the ordinate in the gradient direction histogram; the abscissa of the gradient direction histogram is all non-repeated gradient directions in the steel pipe image, and the ordinate is the sum of the gradient amplitudes in the same gradient direction; multiple vertical line segments are selected along the main gradient direction of the defect, and the spectrum of the gray value sequence of each vertical line segment is obtained to obtain the overall spectrum; the main frequency of the overall spectrum is recorded as the main spatial frequency of the defect.
2. The seamless steel pipe defect detection method based on image processing according to claim 1 is characterized in that: Get images of steel pipes with surface defects after sizing, including: A high-speed industrial camera is used to capture images of the steel pipe surface containing defects, and a ring-shaped LED lighting device is used to provide light source; The steel pipe surface image is grayed out using a weighted average method; The grayscale image is subjected to noise reduction using a Gaussian filter, and the contrast is enhanced using an adaptive histogram equalization algorithm. The YOLOv5 model is used to extract the main area of the preprocessed steel pipe surface image, and the image corresponding to the main area is recorded as the steel pipe image.
3. The seamless steel pipe defect detection method based on image processing according to claim 1 is characterized in that: The morphological features and texture features of the filtered steel pipe image are extracted to obtain the feature vector, including: The filtered steel pipe image is segmented by adaptive threshold and binarized to obtain a binary image; all white areas in the binary image are recorded as the first area, and all black areas are recorded as the second area; The grayscale variance of the steel pipe images corresponding to the first area and the second area is calculated, and the steel pipe image corresponding to the area with larger grayscale variance is recorded as the defect area; the HU moment algorithm is used to obtain the morphological features of the defect area; the gray level co-occurrence matrix is used to obtain the texture features of the defect area, and the morphological features and texture features together constitute a feature vector.
4. The seamless steel pipe defect detection method based on image processing according to claim 3 is characterized in that: The texture features are specifically: Energy, entropy, contrast, and correlation of the gray-level co-occurrence matrix.
5. The seamless steel pipe defect detection method based on image processing according to claim 1 is characterized in that: The feature vector is input into the trained classifier to determine whether there is a defect in the corresponding steel pipe area of the actual image, including: Inputting the feature vector into a trained classifier to obtain the defect degree output by the classifier; In response to the defect degree being greater than a set threshold, it is determined that a steel pipe region corresponding to the actual image has defects.
6. The seamless steel pipe defect detection method based on image processing according to claim 5 is characterized in that: The classifier is a SVM support vector machine classifier.
Citation Information
Patent Citations
Quality analysis system and method for seamless steel pipe production based on image processing
CN118674721A
Arc polar light detection method based on gradient direction histogram features and block brightness
CN104392235A
Bottleneck defect detection method based on gradient direction histograms
CN106952258A