Quality inspection method of seamless steel pipe based on image processing
By performing image processing on seamless steel pipes, calculating the direction and damage convergence index within sub-blocks, and constructing feature vectors and binary images, the problem of low detection accuracy is solved and more efficient scratch defect detection and quality assessment are achieved. .
Patent Information
- Application Number
- CN202410758067.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-06-13
AI Technical Summary
The existing technology has low accuracy in detecting scratch defects in seamless steel pipes, and is prone to missed detections and misdetections, resulting in high rework rates and affecting production efficiency.
Using a method based on image processing, the seamless steel pipe grayscale image is divided into sub-blocks, and the intra-block direction convergence index and steel pipe damage convergence index of each sub-block are calculated to construct a scratch defect feature vector and distinguish the scratch-damaged sub-blocks. and scratch-free sub-blocks to construct a binary image of defects, reduce interference from color spots and stains, and improve detection accuracy.
It improves the accuracy of seamless steel pipe scratch defect detection, reduces rework rate, improves production efficiency, and ensures steel pipe quality through grading.
Smart Images

Figure CN118334028B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image processing, and in particular to a method for detecting the quality of seamless steel pipes based on image processing. Background Art
[0002] As an important industrial raw material, seamless steel pipe is widely used in petroleum, chemical, electric power, shipbuilding, automobile and other industries. In the process of steel pipe production, however, due to the influence of factors such as material quality, production process and environmental conditions, scratch defects may appear on its surface, which will seriously affect the service life of seamless steel pipes and the performance and safety of finished products. In addition, the use of inferior steel pipes in important positions of equipment will have great safety hazards, seriously threatening people's lives and causing property losses to enterprises.
[0003] In order to control the quality of seamless steel pipes, relevant companies will conduct scratch defect detection on them. Due to the presence of color spots, stains and uneven grayscale distribution on the surface of seamless steel pipes, the accuracy of scratch defect detection in the grayscale image of seamless steel pipes is not high, and it is easy to miss detection and misdetection, resulting in a high rework rate and affecting production efficiency. Therefore, how to quickly and accurately detect scratch defects in seamless steel pipes is a technical problem that technicians in this field need to solve urgently. Summary of the invention
[0004] In view of the above, it is necessary to provide a seamless steel pipe quality inspection method based on image processing. Compared with the traditional seamless steel pipe quality inspection method, it reduces the interference of color spots and stains on the quality inspection of seamless steel pipes and improves the accuracy of scratch defect detection of seamless steel pipes.
[0005] An embodiment of the present application provides a method for detecting quality of a seamless steel pipe based on image processing, the method comprising the following steps:
[0006] Collecting a grayscale image of a seamless steel pipe; dividing the grayscale image of the seamless steel pipe into sub-blocks;
[0007] Obtain the rectangular direction of each approximate rectangular area and the pericentric distance of each corner point according to each sub-block; obtain the intra-block direction convergence index of each sub-block according to the rectangular directions of all approximate rectangular areas in each sub-block; obtain the steel pipe damage convergence index of each sub-block according to the intra-block direction convergence index of each sub-block and the pericentric distance of all corner points; construct the scratch defect feature vector according to the steel pipe damage convergence index and the grayscale values of all pixels in each sub-block;
[0008] Obtain the scratch defect distinction index of each sub-block according to the scratch defect feature vectors of all sub-blocks and the steel pipe damage convergence index; obtain the scratch-damaged sub-block and the scratch-free sub-block according to the scratch defect distinction index of all sub-blocks;
[0009] According to the scratch-damaged sub-block, the scratch-free sub-block and the grayscale image of the seamless steel pipe, a defect binary image is constructed; the scratch damage area is obtained according to the defect binary image, and the quality of the seamless steel pipe is graded;
[0010] The specific method of obtaining the rectangular direction of each approximate rectangular area and the pericentric distance of each corner point according to each sub-block includes:
[0011] The LSD line detection algorithm is used to obtain the rectangular direction of each approximately rectangular area in each sub-block;
[0012] A corner point detection algorithm is used to obtain all corner points of each sub-block. The average value of the distance between each corner point in each sub-block and all other corner points in the sub-block is recorded as the key point sparse index of each corner point in each sub-block. The corner point with the smallest key point sparse index in each sub-block is recorded as the pericentric corner point. The distance between each corner point and the pericentric corner point is recorded as the pericentric distance of each corner point.
[0013] The obtaining of the intra-block directional convergence index of each sub-block includes:
[0014] The average value of the rectangular directions of all approximate rectangular areas in each sub-block is recorded as the linear main direction, and the absolute value of the difference between the rectangular direction of each approximate rectangular area in each sub-block and the linear main direction of each sub-block is recorded as the direction deviation of each approximate rectangular area in each sub-block. The intra-block direction convergence index of each sub-block is negatively correlated with the direction deviation of all approximate rectangular areas in each sub-block.
[0015] In one embodiment, the method of dividing the sub-blocks according to the grayscale image of the seamless steel pipe is:
[0016] The pixel point at the upper left corner of the grayscale image of the seamless steel pipe is taken as the starting point, and the grayscale image of the seamless steel pipe is divided into square sub-blocks with a side length of W starting from the starting point, where W is a preset sub-block side length.
[0017] In one embodiment, the steel pipe damage convergence index of each sub-block is positively correlated with the intra-block directional convergence index and negatively correlated with the proximal distance of all corner points in each sub-block.
[0018] In one embodiment, the method of constructing the scratch defect feature vector includes:
[0019] The variance of the grayscale values of all pixels in each sub-block is recorded as the grayscale dispersion index of each sub-block, and the vector composed of the grayscale dispersion index of each sub-block and the steel pipe damage convergence index is taken as the scratch defect feature vector.
[0020] In one embodiment, obtaining the scratch defect distinction index of each sub-block includes:
[0021] The sum of the absolute values of the differences between the steel pipe damage convergence indexes of each sub-block and the rest of the sub-blocks is recorded as the damage feature difference index of each sub-block, and the vector similarity between the scratch defect feature vectors of each sub-block and the rest of the sub-blocks is recorded as the feature similarity index of each sub-block;
[0022] The scratch defect distinction index of each sub-block is positively correlated with the damage feature difference index and negatively correlated with the feature similarity index.
[0023] In one embodiment, obtaining the scratch-damaged sub-block and the scratch-free sub-block includes:
[0024] The product of the average value of the scratch defect distinction index of all sub-blocks and the preset determination coefficient is recorded as the scratch determination threshold;
[0025] The sub-blocks whose scratch defect distinction index is greater than the scratch determination threshold are determined as scratch-damaged sub-blocks, and the sub-blocks other than the scratch-damaged sub-blocks are determined as scratch-free sub-blocks.
[0026] In one embodiment, the constructing of the defect binary image includes the following specific methods:
[0027] Assign the pixel values of all pixels in each scratch-free sub-block in the seamless steel pipe grayscale image to 0;
[0028] For the grayscale values of all pixels in each scratch-damaged sub-block, the threshold segmentation algorithm is used to obtain the segmentation threshold of each scratch-damaged sub-block, and the pixel values of the pixels whose grayscale values in each scratch-damaged sub-block are greater than the segmentation threshold are assigned to 1, otherwise, the pixel values of the pixels are assigned to 0;
[0029] Accordingly, all scratch-free sub-blocks and scratch-damaged sub-blocks in the grayscale image of the seamless steel pipe are processed to construct a defect binary image.
[0030] In one embodiment, the method for obtaining the scratch damage area and grading the quality of the seamless steel pipe is:
[0031] The connected domain with a pixel value of 1 in the defect binary image is recorded as a suspected scratch area, the suspected scratch area with a number of pixels greater than a preset scratch defect area threshold is recorded as a scratch damage area, and the ratio of the sum of the number of pixels in all scratch damage areas to the total number of pixels in the defect binary image is recorded as the scratch damage ratio;
[0032] The quality grade of seamless steel pipe is determined based on the scratch damage ratio and preset threshold.
[0033] This application has the following beneficial effects:
[0034] The embodiment of the present application provides a seamless steel pipe quality detection method based on image processing, the method comprising: considering that in the grayscale image of the seamless steel pipe, the scratch defect is close to the grayscale value of interference such as some color spots and stains, and the overall threshold segmentation of the image will misjudge some color spots and stains as scratch defects, the grayscale image of the seamless steel pipe is divided into multiple sub-blocks, the shape characteristics, corner point distribution characteristics and grayscale distribution characteristics of the scratch defect are comprehensively analyzed, the intra-block direction convergence index of each sub-block is calculated, the steel pipe damage convergence index is obtained, and the scratch defect feature vector is constructed to represent the image feature of each sub-block, thereby improving the accuracy of the image feature description of each sub-block; the difference between the features of each sub-block is analyzed. The scratch defect distinction index of each sub-block is calculated, the scratch-damaged sub-block and the scratch-free sub-block are determined, the sub-blocks with scratch defects are distinguished from the sub-blocks without defects, and each scratch-damaged sub-block is segmented separately to construct a defect binary image, thereby reducing the interference of color spots and stains in the remaining sub-blocks on the image segmentation of a single sub-block, thereby improving the accuracy of scratch defect detection on seamless steel pipes; the scratch damage area is obtained according to the defect binary image, and the stains and color spots with grayscale values similar to the scratches but smaller in area are eliminated, thereby further improving the accuracy of scratch defect detection on seamless steel pipes, and the quality of seamless steel pipes is graded to complete the quality inspection of seamless steel pipes. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0036] Figure 1 A schematic flow chart of a seamless steel pipe quality inspection method based on image processing provided in one embodiment of the present application;
[0037] Figure 2 Schematic diagram of obtaining the scratch damage area. DETAILED DESCRIPTION
[0038] In the description of the embodiments of the present application, words such as "exemplary", "or", "for example" and the like are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "or", "for example" and the like is intended to present related concepts in a concrete manner.
[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by technicians in the technical field in this application. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. It should be understood that, unless otherwise specified in this application, " / " means or. For example, A / B can represent A or B. "And / or" in this application is only a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. "At least one" means one or more. "Multiple" means two or more than two. For example, at least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, a, b and c seven situations.
[0040] It should also be noted that the terms "first" and "second" in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence. The method disclosed in the embodiments of this application or the method shown in the flowchart includes one or more steps for implementing the method. Without departing from the scope of the claims, the execution order of multiple steps can be interchanged with each other, and some steps can also be deleted.
[0041] See also Figure 1 , which shows a flow chart of a seamless steel pipe quality detection method based on image processing provided by an embodiment of the present application, the method comprising the following steps:
[0042] Step S001, collecting a grayscale image of a seamless steel pipe.
[0043] For the acquisition of the grayscale image of the seamless steel pipe, in some embodiments of the present application, the acquisition process is as follows: use a CCD camera to shoot the seamless steel pipe, acquire the color image of the seamless steel pipe, and convert the color image of the seamless steel pipe into the grayscale image of the seamless steel pipe. Since the environment in which the seamless steel pipe is located is usually complex, in order to retain the boundary information in the grayscale image of the seamless steel pipe while reducing the influence of noise and some external interference, so as to enhance the accuracy of subsequent analysis, this embodiment uses a bilateral filtering algorithm to denoise the grayscale image of the seamless steel pipe.
[0044] It should be noted that the bilateral filtering algorithm is a well-known technology and will not be described in detail in this embodiment. As for the selection of the camera and the denoising algorithm, as other implementation methods, the implementer can choose them at will, and this embodiment does not impose any special restrictions on this.
[0045] Step S002: Divide the seamless steel pipe grayscale image into sub-blocks, calculate the intra-block directional convergence index, obtain the steel pipe damage convergence index, and construct a scratch defect feature vector.
[0046] Considering that in the grayscale image of seamless steel pipe, the scratch defect is close to the grayscale value of some interferences such as spots and stains, the overall threshold segmentation of the image will misjudge some spots and stains as scratch defects. In order to accurately obtain the scratch defect area in the grayscale image of seamless steel pipe, the pixel point in the upper left corner of the grayscale image of seamless steel pipe is taken as the starting point, and the grayscale image of seamless steel pipe is divided into square sub-blocks with a side length of W from the starting point, and the different features of each sub-block in the grayscale image of seamless steel pipe are analyzed respectively.
[0047] It should be noted that the side length W of the sub-block is a manually preset value. In this embodiment, the side length W of the sub-block is 15, and the number of sub-blocks is recorded as N.
[0048] The LSD straight line detection algorithm obtains straight lines by searching for approximate rectangular areas, and can realize automatic straight line detection in the image. Since scratch defects are mostly linear, the shape characteristics of scratch defects are analyzed. Specifically, the LSD straight line detection algorithm is used to obtain the rectangular direction of each approximate rectangular area in each sub-block, wherein the LSD straight line detection algorithm is a well-known technology and is not described in detail in this embodiment. The average value of the rectangular directions of all approximate rectangular areas in each sub-block is recorded as the linear main direction, and the absolute value of the difference between the rectangular direction of each approximate rectangular area in each sub-block and the linear main direction of each sub-block is recorded as the direction deviation of each approximate rectangular area in each sub-block. The intra-block direction convergence index of each sub-block is negatively correlated with the direction deviation of all approximate rectangular areas in each sub-block.
[0049] As an embodiment of the present application, the inverse of the average value of the directional deviations of all approximate rectangular regions in each sub-block is used as the intra-block directional convergence index of each sub-block.
[0050] It should be noted that the negative correlation relationship indicates that the dependent variable will decrease as the independent variable increases, and the dependent variable will increase as the independent variable decreases. It can be a subtraction relationship, a division relationship, etc., which is determined by practical applications. Since the spots and stains on the surface of seamless steel pipes are mostly in the form of spots, the greater the difference between the rectangular direction of each approximate rectangular area in each sub-block and the linear main direction, the more dispersed the direction distribution of each approximate rectangular area in the sub-block is, the more likely it is a spot such as a spot or stain, and the smaller the value of the direction convergence index within the block is.
[0051] Furthermore, for each sub-block of the seamless steel pipe grayscale image, a corner point detection algorithm is used to obtain all corner points of each sub-block, and the average value of the distance between each corner point in each sub-block and all other corner points in the sub-block is recorded as the key point sparse index of each corner point in each sub-block, and the corner point with the smallest key point sparse index in each sub-block is recorded as the pericentric corner point, and the distance between each corner point and the pericentric corner point is recorded as the pericentric distance of each corner point. The steel pipe damage convergence index of each sub-block is positively correlated with the intra-block directional convergence index and negatively correlated with the pericentric distance of all corner points in the sub-block.
[0052] As an embodiment of the present application, the average value of the proximal distances of all corner points in each sub-block is used as the corner point proximal index of each sub-block, and the ratio of the intra-block direction convergence index of each sub-block to the corner point proximal index is used as the steel pipe damage convergence index of each sub-block.
[0053] It should be noted that the corner detection algorithm and the calculation of the distance between corner points are well-known technologies. This embodiment selects the Harris corner detection algorithm for corner detection and the Euclidean distance for the calculation of the distance between corner points. The selection of the corner detection algorithm and the calculation of the distance between corner points are other implementation methods that can be selected by the implementer, and this embodiment does not impose any special restrictions on this. A positive correlation relationship means that the dependent variable will increase as the independent variable increases, and the dependent variable will decrease as the independent variable decreases. The specific relationship can be a multiplication relationship, an addition relationship, or the idempotence of an exponential function, which is determined by actual applications and is not specifically limited in this application.
[0054] It should be further explained that, since the side length of the sub-block is set to be small and the scratch is long, the endpoints of the scratch are usually not in the same sub-block. Therefore, the distribution of the corner points of the color spots and stains in the sub-block is relatively scattered relative to the scratch area. The pericentric distance of each corner point in the sub-block represents the distance between the corner point and the pericentric corner point. When the distance between each corner point and the pericentric corner point in each sub-block is larger and the direction convergence index within the block is smaller, it means that the distribution of the corner points in the sub-block and the distribution of the directions of each approximate rectangular area are more scattered, the less likely it is a scratch defect, and the smaller the value of the steel pipe damage convergence index is.
[0055] In addition, the grayscale value distribution range of the sub-block containing scratch defects is larger, the shape is mostly straight lines, and the number of corners is small, while the grayscale value distribution range of the surface spots and stains of the seamless steel pipe without defects is smaller, the shape is irregular, mostly spot-like, and the number of corners is large. Based on this, the scratch defect feature vector of each sub-block is constructed. .in, Represents the scratch defect feature vector of the i-th sub-block of the seamless steel pipe grayscale image, Represents the variance of the grayscale values of all pixels in the ith sub-block of the seamless steel pipe grayscale image. Represents the steel pipe damage convergence index of the i-th sub-block of the seamless steel pipe grayscale image.
[0056] Step S003: Calculate the scratch defect distinction index according to the scratch defect feature vectors of all sub-blocks and the steel pipe damage convergence index, determine the scratch-damaged sub-block and the scratch-free sub-block, and construct a defect binary image.
[0057] It should be noted that since the straight lines in the sub-blocks with scratch defects account for a large proportion, the distribution of corner points is relatively scattered, and the similarity with the sub-blocks without defects is low, the difference in the steel pipe damage convergence index between the two is large. The scratch defect distinction index of each sub-block is calculated based on the scratch defect feature vectors of all sub-blocks and the steel pipe damage convergence index.
[0058] Specifically, the sum of the absolute values of the differences between the steel pipe damage convergence index of each sub-block and the remaining sub-blocks is recorded as the damage feature difference index of each sub-block, and the vector similarity of the scratch defect feature vector of each sub-block and the remaining sub-blocks is taken as the feature similarity index of each sub-block. The scratch defect distinction index of each sub-block is positively correlated with the damage feature difference index and negatively correlated with the feature similarity index.
[0059] As an embodiment of the present application, the ratio of the damage feature difference index to the feature similarity index of each sub-block is used as the scratch defect distinction index of each sub-block.
[0060] It should be noted that the calculation of vector similarity is a well-known technology. This implementation selects cosine similarity to calculate vector similarity. For the calculation of vector similarity, as other implementation methods, the implementer can select them at will, and this embodiment does not impose any special restrictions on this.
[0061] It should be further explained that the scratch defect distinction index of each sub-block is used to measure the feature difference between the sub-block and the other sub-blocks. When the steel pipe damage convergence index of each sub-block is larger and the vector similarity value of the scratch defect feature vector with the other sub-blocks is smaller, it means that the features of the sub-block are more different from those of the other sub-blocks, the more likely scratch defects are, and the larger the scratch defect distinction index value is.
[0062] According to the scratch defect distinction index of all sub-blocks of the seamless steel pipe grayscale image, the scratch judgment threshold is expressed as , where the coefficient of determination is is a preset value. In this embodiment, the determination coefficient The value is 2, N represents the number of sub-blocks in the grayscale image of seamless steel pipe. Represents the scratch defect distinction index of the i-th sub-block of the seamless steel pipe grayscale image.
[0063] The sub-blocks in the grayscale image of seamless steel pipe whose scratch defect distinction index is greater than the scratch judgment threshold are judged as scratch-damaged sub-blocks, and the sub-blocks other than the scratch-damaged sub-blocks are judged as scratch-free sub-blocks. The pixel values of all pixels in each scratch-free sub-block in the grayscale image of seamless steel pipe are assigned to 0.
[0064] For the grayscale values of all pixels in each scratch-damaged sub-block, the threshold segmentation algorithm is used to obtain the segmentation threshold of each scratch-damaged sub-block. The pixel values of the pixels in each scratch-damaged sub-block whose grayscale values are greater than the segmentation threshold are assigned to 1, otherwise, the pixel values of the pixels are assigned to 0.
[0065] Accordingly, all scratch-free sub-blocks and scratch-damaged sub-blocks in the grayscale image of the seamless steel pipe are processed to construct a defect binary image.
[0066] The threshold segmentation method is a well-known technology. This embodiment selects a two-dimensional maximum entropy threshold segmentation algorithm. The implementer may also use other threshold segmentation algorithms according to actual conditions.
[0067] Thus, the segmentation of the whole seamless steel pipe image is obtained. Because the image is divided into blocks before image segmentation, the scratch defect distinction index of each sub-block is calculated according to the shape characteristics, corner point distribution characteristics, grayscale distribution characteristics and the difference of characteristics between each sub-block, the scratch defect sub-block is determined, and each scratch defect sub-block is segmented separately, reducing the interference of color spots and stains in the remaining sub-blocks on the image segmentation of a single sub-block, thereby improving the detection accuracy of scratch defects.
[0068] Step S004: Obtain the scratch damage area according to the defect binary image, classify the quality of the seamless steel pipe, and complete the quality inspection of the seamless steel pipe.
[0069] Since some stains and spots on the surface of the seamless steel pipe have similar grayscale values to scratches, but the scratch defect is larger in area than the stains and spots with similar grayscale values, in order to avoid misjudging stains and spots as scratches, the connected domain with a pixel value of 1 in the defect binary image is recorded as the suspected scratch area, and the suspected scratch area with a number of pixels greater than the scratch defect area threshold is recorded as the scratch damage area.
[0070] The ratio of the sum of the number of pixels in all scratch damage areas to the total number of pixels in the defect binary image is recorded as the scratch damage ratio. The quality grade of the seamless steel pipe is determined based on the scratch damage ratio combined with a preset threshold.
[0071] In some embodiments of the present application, the quality grade of the seamless steel pipe is determined based on the scratch damage ratio combined with a preset threshold value. Specifically, when the scratch damage ratio is less than a first threshold value, the quality of the seamless steel pipe is judged to be excellent; when the scratch damage ratio is greater than or equal to the first threshold value and less than the second threshold value, the quality of the seamless steel pipe is judged to be good; when the scratch damage ratio is greater than or equal to the second threshold value, the quality of the seamless steel pipe is judged to be unqualified.
[0072] It should be noted that the scratch defect area threshold, the first threshold, and the second threshold are all artificially preset values. In this embodiment, the scratch defect area threshold is 50, the first threshold is 0.3, and the second threshold is 0.7. In one embodiment of the present application, the schematic diagram of obtaining the scratch damage area is as follows: Figure 2 shown.
[0073] The embodiment of the present application provides a seamless steel pipe quality detection method based on image processing, the method comprising: considering that in the grayscale image of the seamless steel pipe, the scratch defect is close to the grayscale value of interference such as some color spots and stains, and the overall threshold segmentation of the image will misjudge some color spots and stains as scratch defects, the grayscale image of the seamless steel pipe is divided into multiple sub-blocks, the shape characteristics, corner point distribution characteristics and grayscale distribution characteristics of the scratch defect are comprehensively analyzed, the intra-block direction convergence index of each sub-block is calculated, the steel pipe damage convergence index is obtained, and the scratch defect feature vector is constructed to represent the image feature of each sub-block, thereby improving the accuracy of the image feature description of each sub-block; the difference between the features of each sub-block is analyzed. The scratch defect distinction index of each sub-block is calculated, the scratch-damaged sub-block and the scratch-free sub-block are determined, the sub-blocks with scratch defects are distinguished from the sub-blocks without defects, and each scratch-damaged sub-block is segmented separately to construct a defect binary image, thereby reducing the interference of color spots and stains in the remaining sub-blocks on the image segmentation of a single sub-block, thereby improving the accuracy of scratch defect detection on seamless steel pipes; the scratch damage area is obtained according to the defect binary image, and the stains and color spots with grayscale values similar to the scratches but smaller in area are eliminated, thereby further improving the accuracy of scratch defect detection on seamless steel pipes, and the quality of seamless steel pipes is graded to complete the quality inspection of seamless steel pipes.
[0074] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
[0075] It is obvious to those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the spirit or basic features of the present application. Therefore, no matter from which point of view, the above embodiments of the present application should be regarded as exemplary and non-restrictive, and the scope of the present application is defined by the attached claims rather than the above description, and therefore it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present application.
Claims
1. A seamless steel pipe quality inspection method based on image processing, characterized in that: The method comprises the following steps: Collecting a grayscale image of a seamless steel pipe; dividing the grayscale image of the seamless steel pipe into sub-blocks; Obtain the rectangular direction of each approximate rectangular area and the pericentric distance of each corner point according to each sub-block; obtain the intra-block direction convergence index of each sub-block according to the rectangular directions of all approximate rectangular areas in each sub-block; obtain the steel pipe damage convergence index of each sub-block according to the intra-block direction convergence index of each sub-block and the pericentric distance of all corner points; construct the scratch defect feature vector according to the steel pipe damage convergence index and the grayscale values of all pixels in each sub-block; Obtain the scratch defect distinction index of each sub-block according to the scratch defect feature vectors of all sub-blocks and the steel pipe damage convergence index; obtain the scratch-damaged sub-block and the scratch-free sub-block according to the scratch defect distinction index of all sub-blocks; According to the scratch-damaged sub-block, the scratch-free sub-block and the grayscale image of the seamless steel pipe, a defect binary image is constructed; the scratch damage area is obtained according to the defect binary image, and the quality of the seamless steel pipe is graded; The specific method of obtaining the rectangular direction of each approximate rectangular area and the pericentric distance of each corner point according to each sub-block includes: The LSD line detection algorithm is used to obtain the rectangular direction of each approximately rectangular area in each sub-block; A corner point detection algorithm is used to obtain all corner points of each sub-block. The average value of the distance between each corner point in each sub-block and all other corner points in the sub-block is recorded as the key point sparse index of each corner point in each sub-block. The corner point with the smallest key point sparse index in each sub-block is recorded as the pericentric corner point. The distance between each corner point and the pericentric corner point is recorded as the pericentric distance of each corner point. The obtaining of the intra-block directional convergence index of each sub-block includes: The average value of the rectangular directions of all approximate rectangular areas in each sub-block is recorded as the linear main direction, and the absolute value of the difference between the rectangular direction of each approximate rectangular area in each sub-block and the linear main direction of each sub-block is recorded as the direction deviation of each approximate rectangular area in each sub-block. The intra-block direction convergence index of each sub-block is negatively correlated with the direction deviation of all approximate rectangular areas in each sub-block.
2. The seamless steel pipe quality detection method based on image processing according to claim 1 is characterized in that: The method for dividing sub-blocks according to the grayscale image of seamless steel pipe is: The pixel point at the upper left corner of the grayscale image of the seamless steel pipe is taken as the starting point, and the grayscale image of the seamless steel pipe is divided into square sub-blocks with a side length of W starting from the starting point, where W is a preset sub-block side length.
3. The seamless steel pipe quality detection method based on image processing according to claim 1 is characterized in that: The steel pipe damage convergence index of each sub-block is positively correlated with the direction convergence index within the block, and negatively correlated with the pericentric distance of all corner points in each sub-block.
4. The seamless steel pipe quality detection method based on image processing according to claim 1 is characterized in that: The specific method of constructing the scratch defect feature vector includes: The variance of the grayscale values of all pixels in each sub-block is recorded as the grayscale dispersion index of each sub-block, and the vector composed of the grayscale dispersion index of each sub-block and the steel pipe damage convergence index is taken as the scratch defect feature vector.
5. The seamless steel pipe quality detection method based on image processing according to claim 1 is characterized in that: The step of obtaining the scratch defect distinction index of each sub-block includes: The sum of the absolute values of the differences between the steel pipe damage convergence indexes of each sub-block and the rest of the sub-blocks is recorded as the damage feature difference index of each sub-block, and the vector similarity between the scratch defect feature vectors of each sub-block and the rest of the sub-blocks is recorded as the feature similarity index of each sub-block; The scratch defect distinction index of each sub-block is positively correlated with the damage feature difference index and negatively correlated with the feature similarity index.
6. The seamless steel pipe quality detection method based on image processing according to claim 1 is characterized in that: The step of obtaining the scratch-damaged sub-block and the scratch-free sub-block comprises: The product of the average value of the scratch defect distinction index of all sub-blocks and the preset determination coefficient is recorded as the scratch determination threshold; The sub-blocks whose scratch defect distinction index is greater than the scratch determination threshold are determined as scratch-damaged sub-blocks, and the sub-blocks other than the scratch-damaged sub-blocks are determined as scratch-free sub-blocks.
7. The seamless steel pipe quality detection method based on image processing according to claim 1 is characterized in that: The specific method of constructing the defect binary image includes: Assign the pixel values of all pixels in each scratch-free sub-block in the grayscale image of the seamless steel pipe to 0; For the grayscale values of all pixels in each scratch-damaged sub-block, the threshold segmentation algorithm is used to obtain the segmentation threshold of each scratch-damaged sub-block, and the pixel values of the pixels whose grayscale values in each scratch-damaged sub-block are greater than the segmentation threshold are assigned to 1, otherwise, the pixel values of the pixels are assigned to 0; Accordingly, all scratch-free sub-blocks and scratch-damaged sub-blocks in the grayscale image of the seamless steel pipe are processed to construct a defect binary image.
8. The seamless steel pipe quality inspection method based on image processing according to claim 1 is characterized in that: The method for obtaining the scratch damage area and grading the quality of the seamless steel pipe is as follows: The connected domain with a pixel value of 1 in the defect binary image is recorded as a suspected scratch area, the suspected scratch area with a number of pixels greater than a preset scratch defect area threshold is recorded as a scratch damage area, and the ratio of the sum of the number of pixels in all scratch damage areas to the total number of pixels in the defect binary image is recorded as the scratch damage ratio; The quality grade of seamless steel pipe is determined based on the scratch damage ratio and preset threshold.
