Metal pipe end edge quality detection method and system
By constructing a polar coordinate system and analyzing the notch area and grayscale differences in the edge images of metal pipes, the problem of poor metal pipe detection efficiency in the existing technology is solved, and more efficient and accurate metal pipe forming detection is achieved.
Patent Information
- Application Number
- CN202510920361.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-04
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2045-07-04
AI Technical Summary
In the prior art, when detecting the quality of metal pipes based on circular equations, there is a lack of convenience, resulting in poor detection efficiency, especially when the metal pipes have an inclination angle.
The polar coordinate system is constructed by using the ellipse of the metal pipe edge image. The notch area and grayscale difference of the port edge image are combined with the curvature change and similar arc segment analysis to screen out the suspected defect area and determine the final defect area.
It improves the scope of application and efficiency, accuracy and integrity of metal pipe forming detection, reduces the interference of light on detection, avoids the amount of calculation caused by one-by-one analysis, and improves the accuracy and efficiency of detection.
Smart Images

Figure CN120431092B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image data processing, and more particularly to a method and system for detecting edge quality of a metal pipe port. Background Art
[0002] Metal pipe fittings are pipe components made of metal materials used to connect, divert, branch, or regulate the flow of fluids such as water, gas, and electricity. They play a vital role in a variety of fields, including industry, construction, power generation, and machinery manufacturing. The material, specifications, and model of the metal pipe fittings on electrical switches must meet design requirements to ensure their suitability for specific environments. To ensure the safe, reliable, and efficient operation of metal pipe fittings in electrical systems, electrical switches require metal pipe quality inspection.
[0003] To inspect the quality of metal pipes, machine vision technology is currently commonly used to perform circular detection on the edge lines of metal pipes. Related technologies, such as Chinese patent publication CN114882044B, disclose a method for inspecting the surface quality of metal pipes. This method involves obtaining multiple circular equations for the metal pipe, performing anomaly detection on these equations, and then, based on the anomaly detection results and statistical principles, calculating the ratio of the number of abnormal circles to all circles as the circle integrity, or in other words, the port integrity.
[0004] However, in the process of detecting the quality of metal pipes based on the circular equation, there is a problem of insufficient convenience. The circular equation limits the process of metal pipe quality detection to a circular range, which requires complex pre-processing when obtaining metal pipe images. For example, all metal pipes are placed in front of the camera. When the metal pipes have an inclination angle, the detection effect will be poor, resulting in low efficiency of metal pipe quality detection. Summary of the Invention
[0005] In order to solve the above-mentioned technical problems of poor effect and insufficient applicability of the process of detecting metal pipes based on circular equations, the present invention provides solutions in the following aspects.
[0006] In a first aspect, the present invention provides a method for detecting the edge quality of a metal pipe port, comprising: obtaining an edge image of a metal pipe, obtaining an ellipse of the edge image of the metal pipe and obtaining an edge image of the port; obtaining several groups of matching gap areas of the port edge image according to the grayscale difference of the neighborhood of each gap of the port edge image in the corresponding metal pipe image; constructing a polar coordinate system with the center of the ellipse of the edge image of the metal pipe as the pole, the polar axis directly to the right of the pole and the counterclockwise direction as the positive direction of the polar angle; obtaining suspected defect areas of the port edge image according to the curvature change of the edge pixel points of the port edge image; obtaining similar arc segments of each suspected defect area according to the distance change from the arc segment of the ellipse of the edge image of the metal pipe to the center of the ellipse; obtaining the degree of abnormality of each suspected defect area according to the deformation difference between the suspected defect area and the similar arc segment, and the grayscale difference between the suspected defect area and the corresponding suspected defect area of the matching gap area in the same group; screening the suspected defect areas based on the degree of abnormality of the suspected defect areas to obtain the final defect areas.
[0007] When performing industrial inspections on metal pipe ports, the images captured by this invention do not always show circular edges; elliptical images may appear due to different shooting angles. This invention exploits the fact that the distance from a point within a port edge to a normal port edge varies relatively regularly, while the distance from that point to an abnormal port edge varies significantly. This allows detection of abnormal port edges, thus expanding the scope of metal pipe forming inspection.
[0008] Preferably, the step of obtaining a plurality of groups of matching gap regions of the port edge image comprises:
[0009] Based on the notch detection algorithm, several notch regions of the port edge image are obtained; based on the permutation and combination method, several matching schemes for all notch regions of the port edge image are obtained; the center of the ellipse of the metal pipe edge image is obtained, and each pair of notch endpoints of the port edge image is connected with the center of the ellipse of the metal pipe edge image to form an angle, which is recorded as the central angle of the corresponding notch region; the angle of the central angle of each notch region in the polar coordinate system is obtained, which is recorded as the deflection angle of each notch region;
[0010] Obtain the combination goodness of each matching solution;
[0011] The matching solution with the highest combination goodness is obtained and recorded as the final matching solution. The final matching solution includes several groups of matching gap areas.
[0012] The present invention divides the edge notch area of the metal pipe fitting and performs targeted analysis on the port of the metal pipe fitting, thereby improving the efficiency of the metal pipe fitting forming detection.
[0013] Preferably, the acquisition of the plurality of gap areas of the port edge image includes:
[0014] The find_edges operator is used to detect gaps in the port edge image to obtain several pairs of gap endpoint combinations. Each pair of gap endpoint combinations is connected and a circle is drawn as the diameter. The obtained circular area is recorded as the corresponding gap area of the gap endpoint combination, and several gap areas of the port edge image are obtained.
[0015] Preferably, the combination goodness of the matching schemes satisfies the expression:
[0016] ;
[0017] Where, Indicates the combination goodness of the i-th matching solution; Indicates the number of combined gap regions formed by gap regions; Represents the difference in the grayscale mean of the gap area of the a-th combination of the i-th matching solution; 、 It represents the difference in deflection angle between the a-th combined gap area and the b-th combined gap area of the i-th matching scheme; represents the absolute value function; Represents an exponential function with a natural constant as its base.
[0018] The present invention regards the metal pipe as a whole, obtains several matching schemes by permutation and combination, and selects the matching scheme with the best combination quality, thereby improving the integrity of the metal pipe forming detection.
[0019] Preferably, the method of obtaining the suspected defect area of the port edge image according to the curvature change of the edge pixel points of the port edge image includes: displacing the cth notch endpoint along the reverse edge of the notch on the ellipse of the metal pipe edge image to obtain the curvature of each pixel point during the displacement process; obtaining the possibility that the mth pixel point of the displacement process of the cth notch endpoint is the stopping point according to the curvature change of the displacement process of the notch endpoint; when When it is greater than the first threshold, the mth pixel point in the displacement process of the cth notch endpoint is used as the stopping point, and the arc segment between the two stopping points of a group of notch endpoints is recorded as a suspected defect area, thereby obtaining several suspected defect areas of the port edge image.
[0020] Preferably, the probability that the mth pixel point of the displacement process of the cth gap endpoint is the stopping point satisfies the expression:
[0021] ;
[0022] Where, Indicates the possibility that the mth pixel point of the displacement process of the cth gap endpoint is the stopping point; The neighborhood of the mth pixel point along the moving direction during the displacement process of the cth gap endpoint The curvature difference set of all adjacent pixels of a pixel; The neighborhood of the mth pixel point along the direction of the corresponding gap endpoint during the displacement process of the cth gap endpoint The curvature difference set of all adjacent pixels of a pixel; represents the absolute value function.
[0023] The present invention locates the edge of the suspected defect and the transition zone of the gap by moving the endpoints until the distance change stabilizes, accurately obtains the endpoints of the suspected defect, and improves the accuracy of determining the defect range in the metal pipe forming detection process.
[0024] Preferably, obtaining similar arc segments of each suspected defect area according to the change in the distance from the upper arc segment of the ellipse to the center of the ellipse in the edge image of the metal pipe includes:
[0025] Obtain a distance sequence from the pixel point of the h-th suspected defect area to the center of the ellipse of the metal pipe edge image, which is recorded as the polar center distance sequence of the h-th suspected defect area. Use the angle between the h-th suspected defect area and the center of the ellipse of the metal pipe edge image as a window, obtain several arc segments corresponding to the window movement process, which are recorded as candidate similar arc segments of the h-th suspected defect area, and obtain the polar center distance sequence of the candidate similar arc segments of the h-th suspected defect area. Obtain the DTW distance of the polar center distance sequence of the h-th suspected defect area and each candidate similar arc segment, and record the candidate similar arc segment corresponding to the minimum DTW distance of the polar center distance sequence as the similar arc segment of the h-th suspected defect area.
[0026] Preferably, obtaining the abnormality degree of each suspected defect area includes:
[0027] In a clockwise direction, generate adjacent edge pixel point vectors for the h-th suspected defect area and similar arc segment from beginning to end, obtain the angle between any two adjacent vectors, obtain the angle sequence between the h-th suspected defect area and similar arc segment, and obtain the DTW distance of the angle sequence between the h-th suspected defect area and similar arc segment; obtain the DTW distance of the grayscale sequence of the h-th suspected defect area and the corresponding suspected defect area of the matching gap area in the same group; multiply the DTW distance of the angle sequence between the h-th suspected defect area and similar arc segment with the DTW distance of the grayscale sequence of the h-th suspected defect area and the corresponding suspected defect area of the matching gap area in the same group, and perform positive correlation normalization to obtain the abnormality degree of the h-th suspected defect area.
[0028] The present invention combines similar arc segments of suspected defect areas and corresponding suspected defect areas of matching notch areas in the same group of suspected defect areas to determine the abnormality degree of the suspected defect areas, thereby improving the accuracy of metal pipe forming detection.
[0029] Preferably, the screening of the suspected defect regions based on the abnormality degree of the suspected defect regions to obtain the final defect regions includes: recording the suspected defect regions with abnormality degrees greater than a second threshold as the final defect regions.
[0030] In a second aspect, the present invention provides a metal pipe port edge quality detection system, comprising a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned metal pipe port edge quality detection method is implemented.
[0031] By adopting the above technical solution, the above-mentioned metal pipe port edge quality detection method is generated into a computer program and stored in a memory to be loaded and executed by a processor, thereby making a terminal device based on the memory and the processor for easy use.
[0032] The beneficial effects of the present invention are:
[0033] (1) The present invention indirectly analyzes the abnormality of the missing area based on the edge characteristics of the area surrounding the missing area of the metal pipe port, thereby reducing the obstacles caused by light to the detection of metal port edge defects;
[0034] (2) The present invention uses the abnormality of one gap in the combination to judge the other gap area in the combination based on the combination of gap areas formed by illumination, thus avoiding the large amount of calculation caused by analyzing the gaps one by one and improving the detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 is a flow chart schematically illustrating a method for detecting edge quality of a metal pipe port in the present invention;
[0036] Figure 2 is a schematic diagram schematically showing an image of a metal pipe;
[0037] Figure 3 is a schematic diagram schematically showing an image of the edge of a metal pipe;
[0038] Figure 4 is a diagram schematically showing a port edge image. DETAILED DESCRIPTION
[0039] The embodiment of the present invention discloses a method for detecting the edge quality of a metal pipe end. Figure 1 , including steps S1 to S4:
[0040] S1: Acquire a metal pipe edge image, acquire an ellipse of the metal pipe edge image, and acquire a port edge image.
[0041] It's important to note that when using machine vision to inspect the quality of metal pipe ports, edge detection is often used to extract the port outline. Edge detection is a fundamental technique in digital image processing. Its core goal is to identify areas within an image where significant brightness changes occur. These areas typically correspond to the boundary between an object and its background or the dividing line between different materials. The outline extracted by edge detection can be used as the port edge, and the quality of the metal pipe can be determined by analyzing the port edge shape.
[0042] Specifically, an industrial camera is used to capture an image of a metal pipe, and edge detection is performed on the image of the metal pipe to obtain an edge image of the metal pipe. The edge detection can be performed using the Canny operator. Figure 2 It is a schematic diagram of metal pipe images. Figure 3 Schematic diagram of the edge image of a metal pipe.
[0043] It should be noted that if Figure 3 The edge area of the metal pipe is not all the port edge, but also includes other structures of the metal pipe. In order to avoid interference from other pixel points and analyze the port edge more accurately, the present invention extracts the port edge based on the elliptical feature of the port edge.
[0044] Preferably, the metal pipe edge image is subjected to Hough circle detection to obtain an ellipse of the metal pipe edge image, and the edge pixels where the ellipse is not detected are removed. All the remaining edge pixels constitute the port edge, which is recorded as the port edge image, such as Figure 4 It should be noted that Hough circle detection can detect ellipses and can therefore be used for port pixel detection.
[0045] At this point, the metal pipe edge image and the port edge image of the metal pipe are acquired.
[0046] S2: obtaining a plurality of groups of matching gap regions of the port edge image according to grayscale differences of the neighborhoods of each gap of the port edge image in the corresponding metal pipe image.
[0047] It should be noted that due to the uneven illumination of the light source, there will be some shadows or highlights on the metal pipe image, resulting in some gaps on the edge of the port, such as Figure 4 The figure is a schematic diagram of the notch area at the edge of the port. Since the edge of the notch area is not detected, the quality of the notch area cannot be detected. Therefore, it is necessary to judge the quality of the notch area.
[0048] It should be noted that the defects of metal pipes include extrusion, wrinkles, etc. These defects are manifested in the port edge image in a manner different from that of normal areas. Therefore, the quality of the gap can be inferred based on the geometric consistency of the gap area, its neighborhood area, and other areas. Therefore, the present invention judges whether there are quality defects in the gap area based on the similarity between the edge changes of the neighborhood of the gap area and the edge changes of other normal areas, and locates the port defect area. The port area of a metal pipe is usually circular or elliptical. When photographing the port area, since the geometric shape of the port itself is symmetrical, when light is irradiated from any angle, a symmetrically distributed reflective area will be formed. This step utilizes the symmetrical features of the reflective and shadow areas to locate the missing port of the port edge extracted from the edge detection image.
[0049] Specifically, according to the grayscale difference of the neighborhood of each gap in the port edge image in the corresponding metal pipe image, several groups of matching gap regions in the port edge image are obtained, including:
[0050] Use the find_edges operator on the port edge image to detect gaps, obtaining several pairs of gap endpoint combinations. Connect each pair of gap endpoint combinations, using them as the diameter to draw a circle. The resulting circular area is recorded as the gap area corresponding to the gap endpoint combination, thus obtaining several gap areas in the port edge image. It should be noted that the find_edges operator can perform gap detection based on the distance between edge points and obtain the endpoints of each gap.
[0051] It should be noted that the notch areas in the port edge image exhibit certain grayscale characteristics relative to the corresponding areas in the metal pipe image. Both the direct and reflective areas have high grayscale. Therefore, the closer the grayscales of any two notch areas in the port edge image are within their corresponding areas in the metal pipe image, the greater the likelihood that they match. Furthermore, for the metal pipe as a whole, each notch area has a unique, best-matched notch area. Therefore, through pairwise matching, a possible matching solution is obtained. By comparing the matching degrees of different matching solutions, the matching solution with the highest degree of matching can be obtained, completing the matching of the notch areas in the port edge image.
[0052] Based on the permutation and combination method, several matching schemes for all gap regions of the port edge image are obtained.
[0053] Obtain the center of the ellipse of the metal pipe edge image. Connect each pair of notch endpoints in the port edge image with the center of the ellipse of the metal pipe edge image to form an angle, which is recorded as the central angle of the corresponding notch area. A polar coordinate system is constructed with the center of the ellipse of the metal pipe edge image as the pole, the polar axis directly to the right of the pole, and the counterclockwise direction as the positive direction of the polar angle. The angle of the central angle of each notch area in the polar coordinate system is obtained, which is recorded as the deflection angle of each notch area. It should be noted that the central angle of the notch area is an angular range in the polar coordinate system, and the deflection angle is the minimum value of this angular range.
[0054] The combination goodness of any matching solution satisfies the expression:
[0055] ;
[0056] Where, Indicates the combination goodness of the i-th matching solution; Indicates the number of combined gap regions formed by gap regions; Represents the difference in the grayscale mean of the gap area of the a-th combination of the i-th matching solution; 、 It represents the difference in deflection angle between the a-th combined gap area and the b-th combined gap area of the i-th matching scheme; represents the absolute value function; Represents an exponential function with a natural constant as its base.
[0057] Where, represents the difference in the grayscale mean of the gap area of the a-th combination of the i-th matching solution, It represents the sum of the differences in the grayscale mean values of the gap regions of all combinations of the i-th matching scheme. The larger the value, the greater the grayscale difference of the gap regions of all combinations of the i-th matching scheme, the weaker the overall matching situation, and the weaker the combination excellence of the i-th matching scheme. 、 It represents the difference in the deflection angle between the a-th combined gap area and the b-th combined gap area of the i-th matching scheme, It represents the difference between the deflection angles of the a-th combined gap area and the b-th combined gap area of the i-th matching scheme, indicating the relationship between the two combined gap areas. The larger the value, the weaker the consistency of the light direction. Indicates the overall light consistency of the i-th matching scheme. The larger the value, the weaker the light source direction consistency presented by the i-th matching scheme, and the weaker the combination goodness of the i-th matching scheme.
[0058] The matching solution with the highest combination goodness is obtained and recorded as the final matching solution. The final matching solution includes several groups of matching gap areas.
[0059] So far, several groups of matching gap regions have been obtained.
[0060] S3: Obtain suspected defect areas of the port edge image based on the curvature change of the edge pixel points of the port edge image; obtain similar arc segments of each suspected defect area based on the distance change from the upper arc segment of the ellipse to the center of the ellipse of the metal pipe edge image.
[0061] It should be noted that when notches appear on the edges of the cross-section of metal pipes due to reflections or shadows, these notches may not be real defects, but rather edge loss caused by lighting conditions. If the notch area is a defect, the shape of the neighboring edges of the notch area will also be abnormally deformed. Therefore, the present invention combines the shape characteristics of the neighboring edges of the notch area to determine the defect condition of the notch area.
[0062] It should be further explained that the deformation characteristics of normal edges and defective gap areas are different. Defective edges are generally more tortuous than normal edges. The tortuosity characteristics can be analyzed by the change in distance between the points on the edge and the center of the ellipse. If the distance between the point on the target edge and the center point changes significantly, it means that the target area is more tortuous. The present invention analyzes whether the gap area has defects by the change in distance between the points on the edge of the gap area and the center point.
[0063] It should be noted that since the gap area cannot fully represent a defect, the complete defect is obtained. For an ellipse, the curvature of each point varies periodically. If a defect exists, the edge curvature of the defect area will not conform to this periodic variation. Therefore, the complete suspected defect area can be obtained based on the change in curvature.
[0064] Specifically, obtaining a suspected defect area of the port edge image according to a curvature change of edge pixels of the port edge image includes:
[0065] The cth notch endpoint is displaced along the opposite edge of the notch on the ellipse of the metal pipe edge image, and the curvature of each pixel point during the displacement process is obtained.
[0066] The probability that the mth pixel point of the displacement process of the cth gap endpoint is the stopping point satisfies the expression:
[0067] ;
[0068] Where, Indicates the possibility that the mth pixel point of the displacement process of the cth gap endpoint is the stopping point; The neighborhood of the mth pixel point along the moving direction during the displacement process of the cth gap endpoint The curvature difference set of all adjacent pixels of a pixel; The neighborhood of the mth pixel point along the direction of the corresponding gap endpoint during the displacement process of the cth gap endpoint The curvature difference set of all adjacent pixels of a pixel; represents the absolute value function.
[0069] Where, 、 It represents the sum of the absolute values of the curvature differences of the neighboring pixels on both sides of the mth pixel point during the displacement of the cth notch endpoint. This value reflects the curvature change trend of the neighboring pixels on both sides of the mth pixel point during the displacement of the cth notch endpoint. The larger the value, the more significant the curvature change, and the greater the possibility of a defect. It means taking the absolute value of the difference between the curvature change trends of the neighboring pixels on both sides of the mth pixel point in the displacement process of the cth gap endpoint, reflecting the difference in the curvature change trends of the neighboring pixels on both sides of the mth pixel point in the displacement process of the cth gap endpoint. The larger the value, the more normal the edge curvature tends to be with the displacement of the pixel point, and the greater the possibility that the mth pixel point in the displacement process of the cth gap endpoint is the stopping point, and the pixel point that has been moved to is the pixel point in the defect area.
[0070] Preset the first threshold, when When the displacement is greater than the first threshold, the mth pixel point in the displacement process of the cth gap endpoint is used as the stopping point, and the arc segment between two stopping points of a set of gap endpoints is recorded as a suspected defect area, thereby obtaining several suspected defect areas in the port edge image. If the mth pixel point in the displacement process of the cth gap endpoint reaches a pixel point that does not meet the stopping point at other gap endpoints, the displacement stops. It should be noted that the first threshold is set by the implementer based on actual implementation circumstances; for example, the first threshold can be set to 0.8.
[0071] It should be noted that due to light interference, it is impossible to determine whether there are differences in the gap edges, and direct repair cannot be performed. To avoid light interference, the determination of the invisible gap area is converted into a quantitative analysis of the visible edge, which can indirectly achieve the quality analysis of the gap edge. Therefore, similar arc segments are found for each suspected defect area and compared with similar arc segments. This can determine the defect degree of the suspected defect area and thus the final defect area of the metal pipe.
[0072] Preferably, obtaining similar arc segments of each suspected defect area according to the change in the distance from the upper arc segment of the ellipse to the center of the ellipse in the edge image of the metal pipe includes:
[0073] Obtain a distance sequence from the pixel point of the h-th suspected defect area to the center of the ellipse of the metal pipe edge image, which is recorded as the polar center distance sequence of the h-th suspected defect area. Use the angle between the h-th suspected defect area and the center of the ellipse of the metal pipe edge image as a window, obtain several arc segments corresponding to the window movement process, which are recorded as candidate similar arc segments of the h-th suspected defect area, and obtain the polar center distance sequence of the candidate similar arc segments of the h-th suspected defect area.
[0074] The DTW distances of the polar center distance sequence between the h-th suspected defect region and each candidate similar arc segment are obtained, and the candidate similar arc segment corresponding to the minimum polar center distance sequence DTW distance is recorded as the similar arc segment of the h-th suspected defect region.
[0075] At this point, similar arc segments of each suspected defect area are obtained.
[0076] S4: Obtain the abnormality degree of each suspected defect area based on the deformation difference between the suspected defect area and similar arc segments, and the grayscale difference between the suspected defect area and the corresponding suspected defect area in the same group of matching gap areas; screen the suspected defect areas based on the abnormality degree of the suspected defect areas to obtain the final defect area.
[0077] It should be noted that the similar arc segments of the suspected defect area have similar shape changes as the suspected defect area, and the matching notch areas in the same group as the suspected defect area have similar grayscale expressions as the suspected defect area. By comparing the suspected defect area with the similar arc segments and the matching notch areas in the same group, the defect degree of the suspected defect area can be obtained, thereby ultimately detecting the defects of the metal pipe fittings.
[0078] It should be further explained that because the degree of distortion at the defect edge is smaller than the diameter of the metal pipe, the present invention measures the difference between the suspected defect region and similar arc segments based on the variation characteristics of the arc segments to characterize the degree of abnormality of the suspected defect region. Furthermore, the greater the grayscale difference between the suspected defect region and the corresponding suspected defect region in the same group of matching notch regions, the greater the degree of abnormality of the suspected defect region.
[0079] Specifically, the abnormality degree of each suspected defect area is obtained based on the deformation difference between the suspected defect area and similar arc segments, and the grayscale difference between the suspected defect area and the corresponding suspected defect area of the same group of matching gap areas, including:
[0080] In a clockwise direction, generate adjacent edge pixel vectors for the hth suspected defect region and similar arc segments from beginning to end, obtain the angle between any two adjacent vectors, and obtain the angle sequence between the hth suspected defect region and similar arc segments. The DTW distance of the angle sequence between the hth suspected defect region and similar arc segments is then obtained. It should be noted that due to the gap in the middle of the suspected defect region, the DTW distance is represented by the mean DTW distance of the angle sequence between all segments of the hth suspected defect region and similar arc segments.
[0081] Obtain the DTW distance between the grayscale sequences of the hth suspected defect region and the corresponding suspected defect region of the same group of matching gap regions. It should be noted that due to the presence of gaps in the middle of the suspected defect region, the DTW distance is represented by the mean DTW distance of all segmented grayscale sequences of the hth suspected defect region and the corresponding suspected defect region of the same group of matching gap regions.
[0082] The DTW distance of the angle sequence between the h-th suspected defect area and similar arc segments is multiplied by the DTW distance of the grayscale sequence between the h-th suspected defect area and the corresponding suspected defect area in the same group of matching gap areas, and positive correlation normalization is performed to obtain the abnormality degree of the h-th suspected defect area.
[0083] A second threshold is set, and suspected defect areas with an abnormality greater than the second threshold are recorded as final defect areas. It should be noted that the second threshold is set by the implementer based on actual implementation conditions, for example, the second threshold can be set to 0.8.
[0084] At this point, the final defect area of the metal pipe is obtained.
[0085] An embodiment of the present invention further discloses a metal pipe port edge quality detection system, comprising a processor and a memory, wherein the memory stores computer program instructions. When the computer program instructions are executed by the processor, a metal pipe port edge quality detection method according to the present invention is implemented.
[0086] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface. The configuration and functions of these components are known in the art and will not be described in detail here.
[0087] While several embodiments of the present invention have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Numerous modifications, variations, and alternatives will occur to those skilled in the art without departing from the concept and spirit of the present invention. It should be understood that various alternatives to the embodiments of the present invention described herein may be employed in practicing the present invention.
Claims
1. A method for detecting the edge quality of a metal pipe end, characterized in that: include: Acquire a metal pipe edge image, acquire an ellipse of the metal pipe edge image, and acquire a port edge image; According to the grayscale difference of the neighborhood of each notch in the port edge image in the corresponding metal pipe image, several groups of matching notch areas of the port edge image are obtained, including: obtaining several notch areas of the port edge image based on a notch detection algorithm; obtaining several matching schemes for all notch areas of the port edge image based on a permutation and combination method; obtaining the center of the ellipse of the metal pipe edge image, connecting each pair of notch endpoints of the port edge image with the center of the ellipse of the metal pipe edge image to form an angle, which is recorded as the central angle of the corresponding notch area; obtaining the angle of the central angle of each notch area in a polar coordinate system, which is recorded as the deflection angle of each notch area; and obtaining the combination goodness of each matching scheme, wherein the combination goodness of each matching scheme satisfies the expression: ; Where, Indicates the combination goodness of the i-th matching solution; Indicates the number of combined gap regions formed by gap regions; Represents the difference in the grayscale mean of the gap area of the a-th combination of the i-th matching solution; 、 It represents the difference in deflection angle between the a-th combined gap area and the b-th combined gap area of the i-th matching scheme; represents the absolute value function; represents an exponential function with a natural constant as its base; Obtain the matching solution with the highest combination goodness, which is recorded as the final matching solution. The final matching solution contains several groups of matching gap areas. A polar coordinate system is constructed with the center of the ellipse of the metal pipe edge image as the pole, the polar axis directly to the right of the pole, and the counterclockwise direction as the positive polar angle direction. The suspected defect area of the port edge image is obtained based on the curvature change of the edge pixel points of the port edge image. Similar arc segments of each suspected defect area are obtained based on the distance change from the upper arc segment of the ellipse of the metal pipe edge image to the center of the ellipse. The abnormality degree of each suspected defect area is obtained based on the deformation difference between the suspected defect area and similar arc segments, and the grayscale difference between the suspected defect area and the corresponding suspected defect area in the same group of matching gap areas. The suspected defect areas are screened based on the abnormality degree of the suspected defect areas to obtain the final defect areas.
2. A metal pipe end edge quality detection method according to claim 1, characterized in that: The step of obtaining the plurality of gap areas of the port edge image includes: The find_edges operator is used to detect gaps in the port edge image to obtain several pairs of gap endpoint combinations. Each pair of gap endpoint combinations is connected and a circle is drawn as the diameter. The obtained circular area is recorded as the corresponding gap area of the gap endpoint combination, and several gap areas of the port edge image are obtained.
3. A metal pipe end edge quality detection method according to claim 1, characterized in that: The step of obtaining a suspected defect area of the port edge image according to a curvature change of edge pixels of the port edge image includes: The cth notch endpoint is displaced along the opposite edge of the notch on the ellipse of the metal pipe edge image to obtain the curvature of the displacement process at each pixel point; based on the change in the curvature of the displacement process of the notch endpoint, the possibility of the mth pixel point of the displacement process of the cth notch endpoint being the stopping point is obtained; When the probability that the mth pixel point in the displacement process of the cth notch endpoint is the stopping point is greater than a first threshold, the mth pixel point in the displacement process of the cth notch endpoint is taken as the stopping point, and the arc segment between the two stopping points of a group of notch endpoints is recorded as a suspected defect area, thereby obtaining several suspected defect areas of the port edge image.
4. A metal pipe end edge quality detection method according to claim 3, characterized in that: The probability that the mth pixel point of the cth gap endpoint displacement process is the stopping point satisfies the expression: ; Where, Indicates the possibility that the mth pixel point of the displacement process of the cth gap endpoint is the stopping point; The neighborhood of the mth pixel point along the moving direction during the displacement process of the cth gap endpoint The curvature difference set of all adjacent pixels of a pixel; The neighborhood of the mth pixel point along the direction of the corresponding gap endpoint during the displacement process of the cth gap endpoint The curvature difference set of all adjacent pixels of a pixel; represents the absolute value function.
5. The metal pipe end edge quality detection method according to claim 1, characterized in that: The method of obtaining similar arc segments of each suspected defect area according to the change in the distance from the upper arc segment of the ellipse to the center of the ellipse in the edge image of the metal pipe includes: Obtain a distance sequence from the pixel point of the h-th suspected defect area to the center of the ellipse of the metal pipe edge image, which is recorded as the polar center distance sequence of the h-th suspected defect area. Use the angle between the h-th suspected defect area and the center of the ellipse of the metal pipe edge image as a window, obtain several arc segments corresponding to the window movement process, which are recorded as candidate similar arc segments of the h-th suspected defect area, and obtain the polar center distance sequence of the candidate similar arc segments of the h-th suspected defect area. Obtain the DTW distance of the polar center distance sequence of the h-th suspected defect area and each candidate similar arc segment, and record the candidate similar arc segment corresponding to the minimum DTW distance of the polar center distance sequence as the similar arc segment of the h-th suspected defect area.
6. A metal pipe end edge quality detection method according to claim 1, characterized in that: The obtaining of the abnormality degree of each suspected defect area includes: In a clockwise direction, generate adjacent edge pixel point vectors for the h-th suspected defect area and similar arc segment from beginning to end, obtain the angle between any two adjacent vectors, obtain the angle sequence between the h-th suspected defect area and similar arc segment, and obtain the DTW distance of the angle sequence between the h-th suspected defect area and similar arc segment; obtain the DTW distance of the grayscale sequence of the h-th suspected defect area and the corresponding suspected defect area of the matching gap area in the same group; multiply the DTW distance of the angle sequence between the h-th suspected defect area and similar arc segment with the DTW distance of the grayscale sequence of the h-th suspected defect area and the corresponding suspected defect area of the matching gap area in the same group, and perform positive correlation normalization to obtain the abnormality degree of the h-th suspected defect area.
7. A metal pipe end edge quality detection method according to claim 1, characterized in that: The screening of the suspected defect regions based on the abnormality degree of the suspected defect regions to obtain the final defect regions includes: recording the suspected defect regions with abnormality degrees greater than a second threshold as the final defect regions.
8. A metal pipe end edge quality detection system, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a metal pipe port edge quality detection method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Methods for inspecting the surface quality of metal pipe fittings
CN114882044B
Vision-based silica gel forming effect detection method
CN116030061A
Copper pipe production defect detection method and system
CN118037722A