A method for extracting image geometric features for visual inspection of open circlip dimensions

By binarizing and convex hull processing the open spring image and extracting key dimensional features, the problems of low efficiency and poor accuracy of manual inspection are solved, and automatic and accurate spring dimension inspection is achieved, which reduces costs and improves compatibility.

CN116934783BActive Publication Date: 2025-10-03TIANJIN UNIVERSITY OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311003251.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-10
Publication Date
2025-10-03
Estimated Expiration
2043-08-10

AI Technical Summary

Technical Problem

In the existing technology, the size detection of open retaining springs mainly relies on manual detection, which has the problems of low efficiency, poor accuracy and high cost. In addition, different types of retaining springs require separate detection equipment, which lacks compatibility.

Method used

The image geometric feature extraction method is adopted to perform binarization on the open spring image, extract the contour and convex hull, calculate the center and outer diameter, obtain the inner diameter and opening distance by convex defect detection, obtain the bayonet width by adaptive segmentation, and compare it with the standard data to determine whether it is qualified.

Benefits of technology

It realizes the automatic visual inspection of the size of the open circlip, improves the accuracy and efficiency of the inspection, adapts to the inspection environment of different postures and different placement directions, and reduces the manual intervention and equipment costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116934783B_ABST
    Figure CN116934783B_ABST
Patent Text Reader

Abstract

The present invention relates to an image geometric feature extraction method for visual inspection of the size of an open clip. The specific steps are as follows: S1: binarizing an open clip image to obtain a binary image with a clear outline; S2: extracting a contour set from the binary image to obtain a contour point set; S3: extracting a convex hull from the contour point set, and calculating the minimum enclosing circle of the convex hull point set to obtain the center and outer diameter; S4: extracting inner arc feature points using the contour point set and the convex hull point set, calculating the distance between the center and the inner arc feature points to obtain the inner diameter; S5: adaptively segmenting the contour point set to calculate the opening distance; S6: searching and determining a bayonet straight line based on the opening feature points, searching for edge points, and calculating the bayonet width; S7: comparing the outer diameter, inner diameter, opening distance, and bayonet width obtained in S2 to S6 with the corresponding data of a standard open clip to determine whether the clip is qualified. The method can realize automatic measurement of the inner diameter, outer diameter, opening distance, and bayonet width of an open clip.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of image processing methods, and in particular to an image geometric feature extraction method for visual detection of open retaining spring dimensions. Background Art

[0002] Open circlips are a type of fastener that is installed in the shaft groove or hole groove of a machine or equipment to prevent the axial movement of parts on the shaft or hole. As a basic mechanical part, it is used in a wide range of industries. Its use environment, occasions, and functions vary, resulting in a wide variety of shapes and sizes of circlips. Figure 1 As shown in the figure, the key dimensions of the open circlip, such as the inner diameter, outer diameter, opening distance, and bayonet width, have an important influence on the fastening effect of shaft parts such as bearings.

[0003] Currently, key dimensions of open circlips are still primarily inspected manually. The opening distance is inspected using the "go / no-go" method, using the upper and lower limits of the opening tolerance band as two shaft diameter segments. A stepped measuring rod of unequal diameters is formed, connected end to end. The circlip is considered acceptable if it can be inserted radially onto the shaft at the lower diameter limit but not the upper diameter limit. Internal and external diameters are inspected using a vernier caliper, with measurements taken manually at several selected locations, and the maximum value is used as the diameter. The width of the circlip is inspected using a vernier caliper, with measurements taken manually at corresponding locations. Because gauge inspection is time-consuming and labor-intensive, and manual inspection suffers from poor accuracy and inefficiency, circlips are currently only inspected on a spot basis, a practice that is incompatible with the rapid production of circlips. Furthermore, there are numerous circlip models, and different manufacturers have varying tolerance requirements for the same model. This necessitates dedicated equipment for each model, which is costly and incompatible.

[0004] To address the challenges of manual inspection, the use of machine vision for automated inspection of the geometric dimensions of retaining springs is inevitable. By acquiring image information of the retaining spring being inspected, processing and analyzing it, extracting the image geometric features corresponding to key dimensions, and comparing them with known standards, the retaining spring's morphological characteristics and dimensions can be determined. The extraction of the image geometric features corresponding to the dimensions is crucial, requiring the design of a dedicated image processing algorithm. The accuracy of the algorithm determines the precision of inspection, while the algorithm's degree of automation determines its efficiency. In summary, the invention of a method for extracting geometric features from images of open retaining spring dimensions plays a decisive role in the automated visual inspection of open retaining spring dimensions.

[0005] After searching, the following existing patent technologies have been discovered:

[0006] A method for automatically locating turnover boxes based on image geometric features includes: S1: obtaining vertical and horizontal edges from the original image to obtain a region of interest (ROI image); S2: performing binarization processing; S3: removing noise points; S4: performing line detection on the binary image using the Hough transform strategy to obtain several approximate lines, and then using a line fusion method to fuse the several approximate lines into a fused line; S5: obtaining candidate edges. If the number of candidate edges is zero, returning to step S2, reducing the offset C, and continuing iteration until at least one candidate edge is obtained; S6: determining the color of the local image to filter out false edges; S7: integrating the edges, calculating the center point and rotation angle for positioning. The present invention can locate turnover boxes in visible light images in a short time and without human intervention.

[0007] After comparison, the technical problem solved by this patent application is quite different from that of the comparative document, so the specific extraction method and calculation method used are obviously different. The comparative document does not affect the novelty of the patent application solution. Summary of the Invention

[0008] The purpose of the present invention is to provide a stable image geometric feature extraction method for automatic detection of open retaining spring dimensions based on machine vision, so as to realize automatic measurement of the inner diameter, outer diameter, opening distance and bayonet width of the open retaining spring.

[0009] The present invention solves the technical problem by adopting the following technical solutions:

[0010] A method for extracting image geometric features for visual inspection of open retaining spring dimensions, characterized by the following specific steps:

[0011] S1: Binarize the open spring image to obtain a binary image with clear outline;

[0012] S2: Extract the contour set from the binary image, extract the contour with the largest area, and obtain the contour point set P i ;

[0013] S3: Contour point set P i Perform convex hull extraction to obtain the convex hull point set H i , for the convex hull point set H i Calculate the minimum enclosing circle to get the center P c and outer diameter R outer ;

[0014] S4: Using the contour point set P i and the convex hull point set H i Extract inner arc feature points P far , calculate the center P c and inner arc feature point P farThe inner diameter R inner ;

[0015] S5: contour point set P i Adaptive segmentation, extracting opening feature points P gap1 and P gap2 , calculate the opening distance D gap ;

[0016] S6: According to the opening feature point P gap1 and P gap2 Search and determine the bayonet straight line, search for edge points, and calculate the bayonet width W bay ;

[0017] S7: The outer diameter R obtained by dividing S2 to S6 outer 、Inner diameter R inner , opening distance D gap 、Bayonet width W bay Compare them with the corresponding data of standard open circlips to determine whether they are qualified.

[0018] Moreover, the specific steps of S1 are:

[0019] The maximum inter-class variance method is used to obtain the optimal binarization threshold and the open spring image is binarized.

[0020] Moreover, the specific steps of S2 are:

[0021] The Canny algorithm is used to extract the contour set P from the binarized image. i , sort the area of ​​the set and extract the pixel coordinates P of all points on the maximum area contour i (u i ,v i ).

[0022] Moreover, the specific steps of S3 are:

[0023] 1) For the contour set P i Perform convex hull extraction to obtain the pixel coordinates H of all points on the convex hull i (u hi ,v hi );

[0024] 2) For the convex hull point set H i Calculate the minimum enclosing circle and get the center P c (u c ,v c ) and outer diameter R outer .

[0025] Moreover, the specific steps of S4 are:

[0026] 1) Using the contour point set Pi and the convex hull point set H i Perform convex defect detection and find the deepest point of the convex defect, which is the inner arc feature point P far (u far ,v far ), the starting point P of the convex defect connected to the deepest point start (u start ,v start ) and the end point P end (u end ,v end ) are the initial feature points on both sides of the opening;

[0027] 2) Calculate the center P c and inner arc feature point P far The inner diameter R inner .

[0028] Moreover, the specific steps of S5 are:

[0029] 1) According to the convex defect detection principle, the center P c and inner arc feature point P far The line connecting the two will pass through the opening area, and this line is recorded as L through ;

[0030] 2) Using the convex defect starting point P start and the end point P end Construct a straight line, denoted as L Segment ;

[0031] 3) Calculate each P i To L Segment The absolute value distance is less than R. inner All points of the , which are the contour points close to the opening side, are denoted as S i (u i ,v i );

[0032] 4) Calculate each S i To L through The signed distance of S is calculated based on the sign of the distance. i Divided into the distance positive point set Spos i (u i ,v i ) and the distance negative point set Sneg i (u i ,v i );

[0033] 5) In Spos i Find the point with the minimum distance, denoted as P gap1 (u g1,v g1 );

[0034] 6) In Sneg i Find the point with the maximum distance, and record it as P gap2 (u g2 ,v g2 );

[0035] 7)P gap1 and P gap2 The final extracted opening feature point is the opening distance D. gap .

[0036] Moreover, the specific steps of S6 are:

[0037] 1) Use opening feature point P gap1 and the center P c Create straight line L cg1 , using the opening feature point P gap2 and P c Create straight line L cg2 ;

[0038] 2) With the center P c As the center, the straight line L cg1 and L cg2 Rotate 5° in the direction of the expansion opening to form a new straight line L N1 and L N2 ;

[0039] 3) From the center P c and radius (R outer +5) Establish the outer circle equation and calculate the straight line L N1 Two intersection points with the outer circle, calculate the distance from the two intersection points to L Segment The absolute value distance is less than R. inner The point is the intersection point on the opening side, denoted as I outer1 (u out1 ,v out1 ); Similarly, L N2 The two intersection points with the outer circle, and the intersection point on the opening side is selected and recorded as I outer2 (u out2 ,v out2 );

[0040] 4) From the center P c and radius (R inner -5) Establish the inner circle equation and calculate the straight line L N1 Two intersection points with the inner circle, calculate the distance from the two intersection points to L Segment The absolute value distance is less than R. inner The point is the intersection point on the opening side, denoted as Iinner1 (u in1 ,v in1 ); Similarly, L N2 The two intersection points with the inner circle are selected, and the inner circle intersection point on the opening side is recorded as I inner2 (u in2 ,v in2 );

[0041] 5) Calculation point I outer1 and I inner1 To line L Segment The signed distance of and the product is D1; ​​calculate point I outer2 and I inner2 To line L Segment The signed distance of and product D2;

[0042] 6) According to the principle of convex defect detection and the structural characteristics of the open spring, the line passes through the intersection of the inner and outer circles of the bayonet to L Segment The sign of the signed distance will be opposite. Therefore, if D1 is a negative value, the bayonet search line segment is I outer1 and I inner1 Otherwise, the bayonet search line segment is I outer2 and I inner2 The line of the determined bayonet search line segment is recorded as L Search ;

[0043] 7) On the binary image output from the first step, along L Search , search for edge points with grayscale equal to 255 from inside to outside, denoted as P bay1 (u b1 ,v b1 ), and then search from the outside to the inside for the edge point with grayscale equal to 255, recorded as P bay2 (u b2 ,v b2 ), calculate the distance between the two points to get the bayonet width W bay .

[0044] The advantages and positive effects of the present invention are:

[0045] The method of the present invention is suitable for extracting geometric features of images in visual inspection of the size of open circlips, and can accurately extract the center of the circlip. Specifically, it has the following advantages:

[0046] (1) The method of the present invention has no strict requirements on the position and opening direction of the spring in the image. The spring can be placed arbitrarily, and the method will adaptively extract structural features;

[0047] (2) The method of the present invention does not require manual setting of reference frames and lines for image processing, but relies entirely on the structural characteristics of the open spring to automatically identify and extract geometric feature points;

[0048] (3) The method of the present invention can independently determine the area where the checkpoint is located in the image, and can search for feature points along the straight line passing through the checkpoint, without requiring the search line to be a horizontal line or a vertical line in the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 is a flow chart of a method in an embodiment of the present invention.

[0050] Figure 2 This is an image of an open retaining spring and its key dimension markings.

[0051] Figure 3 This is a diagram showing the processing results of the third step of the method in the example of the present invention.

[0052] Figure 4 This is a diagram showing the processing results of the fourth step of the method in the example of the present invention.

[0053] Figure 5 This is a diagram showing the processing results of the fifth step of the method in the example of the present invention.

[0054] Figure 6 This is a diagram showing the extraction results of the straight line segment search in the sixth step of the method in the example of the present invention.

[0055] Figure 7 This is a diagram showing the final processing result of the sixth step of the method in the example of the present invention.

[0056] Figure 8 (a\b\c\d\e\f\g\h\i) is a diagram showing the processing results of the method in the example of the present invention on 9 open retaining springs in different directions. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solutions and advantages of this application clearer and easier to understand, the present invention is further described below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0058] Figure 2The flowchart shows an image geometric feature extraction method for visual inspection of open spring dimensions according to an embodiment of the present invention. First, the open spring image is binarized. Subsequently, the binarized image is contour extracted to obtain the largest-area contour point set. The convex hull of the contour point set is then extracted, and the minimum enclosing circle method is used to calculate the center and outer diameter of the open spring. Convex defect detection is then performed on the contour point set and the convex hull to obtain a feature point on the inner arc and two initial feature points on either side of the opening, and the inner diameter of the open spring is calculated. The contour point set is then adaptively segmented using the line formed by the inner arc point and the center, and the line formed by the two initial feature points at the opening. Two feature points corresponding to the opening distance are extracted, and the opening distance is calculated. Finally, a search line at the bayonet is autonomously determined, and a feature point search is performed along this line passing through the bayonet, obtaining two edge points and calculating the bayonet width.

[0059] Combine Figure 2 As shown in FIG, a low-quality welding image enhancement method for preserving structure and balancing brightness of the present invention is described in detail, and the specific implementation steps are as follows:

[0060] (1) Image binarization: The maximum inter-class variance method is used to obtain the optimal binarization threshold and the open spring image is binarized. The maximum inter-class variance method, also known as the Otsu algorithm, is a widely used method for adaptively obtaining the binarization threshold. According to the grayscale characteristics of the image, the image is divided into two parts: foreground and background. When the optimal threshold is taken, the difference between the two parts should be the largest. The standard used in the Otsu algorithm to measure the difference is the more common maximum inter-class variance.

[0061] (2) Maximum area contour extraction: Use the Canny algorithm to extract the contour set from the binarized image, sort the set by area, and extract the pixel coordinates of all points on the maximum area contour, denoted as P i (u i ,v i ). u and v refer to the horizontal and vertical pixel coordinates of point i respectively.

[0062] (3) Get the center and outer diameter of the circle:

[0063] 1) P i Perform convex hull extraction to obtain the pixel coordinates of all points on the convex hull, denoted as H i (u hi ,v hi ); Convex hull is a term in computational geometry. Extracting the convex hull of a set of points refers to a minimum convex polygon that satisfies all points on or within its polygon edge. The convex hull point set refers to the points on its polygon edge.

[0064] 2) H i Calculate the minimum enclosing circle and get the center P c (u c ,v c ) and outer diameter R outer The processing result of this step is as follows Figure 3 shown.

[0065] (4) Extract the initial feature points of the inner arc and opening and calculate the inner diameter:

[0066] 1) Using the contour point set P i and the convex hull point set H i Perform convex defect detection and find the deepest point of the convex defect (i.e. the point with the largest distance from the contour point to the convex hull). The deepest point is the inner arc feature point P. far (u far ,v far ), the starting point P of the convex defect connected to the deepest point start (u start ,v start ) and the end point P end (u end ,v end ) are the initial feature points on both sides of the opening.

[0067] 2) Calculate the center P c and inner arc feature point P far The inner diameter R inner The processing result of this step is as follows Figure 4 shown.

[0068] (5) Adaptive segmentation of contour point set, extraction of opening feature points, and calculation of opening distance:

[0069] 1) According to the convex defect detection principle, the center P c and inner arc feature point P far The line connecting the two will pass through the opening area, and this line is recorded as L through ;

[0070] 2) Using the convex defect starting point P start and the end point P end Construct a straight line, denoted as L Segment ;

[0071] 3) Calculate each P i to L Segment The absolute value distance is less than R. inner All points of the , which are the contour points close to the opening side, are denoted as S i (u i ,v i );

[0072] 4) Calculate each Si To L through The signed distance of S is calculated based on the sign of the distance. i Divided into the distance positive point set Spos i (u i ,v i ) and the distance negative point set Sneg i (u i ,v i );

[0073] 5) In Spos i Find the point with the minimum distance, denoted as P gap1 (u g1 ,v g1 );

[0074] 6) In Sneg i Find the point with the maximum distance, and record it as P gap2 (u g2 ,v g2 );

[0075] 7)P gap1 and P gap2 The final extracted opening feature point is the opening distance D. gap The processing result of this step is as follows Figure 5 shown.

[0076] (6) The bayonet search line is automatically determined, the edge point is searched, and the bayonet width is calculated:

[0077] 1) Use opening feature point P gap1 and the center P c Create straight line L cg1 , using the opening feature point P gap2 and P c Create straight line L cg2 ;

[0078] 2) With the center P c As the center, the straight line L cg1 and L cg2 Rotate 5° in the direction of the expansion opening to form a new straight line L N1 and L N2 ;

[0079] 3) From the center P c and radius (R outer +5) Establish the outer circle equation and calculate the straight line L N1 Two intersection points with the outer circle, calculate the distance from the two intersection points to L Segment The absolute value distance is less than R. inner The point is the intersection point on the opening side, denoted as I outer1(u out1 ,v out1 ); Similarly, L N2 The two intersection points with the outer circle, and the intersection point on the opening side is selected and recorded as I outer2 (u out2 ,v out2 );

[0080] 4) From the center P c and radius (R inner -5) Establish the inner circle equation and calculate the straight line L N1 Two intersection points with the inner circle, calculate the distance from the two intersection points to L Segment The absolute value distance is less than R. inner The point is the intersection point on the opening side, denoted as I inner1 (u in1 ,v in1 ); Similarly, L N2 The two intersection points with the inner circle are selected, and the inner circle intersection point on the opening side is recorded as I inner2 (u in2 ,v in2 );

[0081] 5) Calculation point I outer1 and I inner1 To line L Segment The signed distance of and the product is D1; ​​calculate point I outer2 and I inner2 To line L Segment The signed distance of and product D2;

[0082] 6) According to the principle of convex defect detection and the structural characteristics of the open spring, the line passes through the intersection of the inner and outer circles of the bayonet to L Segment The sign of the signed distance will be opposite. Therefore, if D1 is a negative value, the bayonet search line segment is I outer1 and I inner1 Otherwise, the bayonet search line segment is I outer2 and I inner2 The line of the determined bayonet search line segment is recorded as L Search The processing result of this step is as follows Figure 6 shown.

[0083] 7) On the binary image output from the first step, along L Search , search for edge points with grayscale equal to 255 from inside to outside, denoted as P bay1 (u b1 ,v b1 ), and then search from the outside to the inside for the edge point with grayscale equal to 255, recorded as P bay2 (u b2 ,vb2 ), calculate the distance between the two points to get the bayonet width W bay The processing result of this step is as follows Figure 7 shown.

[0084] The patented method of this invention is used to extract the geometric features of the open springs in 9 different directions. The processing results are as follows: Figure 8 Experimental results show that this method is stable and reliable. It has no strict requirements on the position and opening direction of the spring in the image, and does not require manual setting of reference frames and lines for image processing. It relies entirely on the structural characteristics of the open spring to automatically identify and extract geometric feature points.

[0085] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.

Claims

1. A method for extracting image geometric features for visual inspection of open retaining spring dimensions, characterized by: The specific steps are: S1: Binarize the open spring image to obtain a binary image with clear outline; S2: Extract the contour set from the binary image, extract the contour with the largest area, and obtain the contour point set P i ; S3: Contour point set P i Perform convex hull extraction to obtain the convex hull point set H i , for the convex hull point set H i Calculate the minimum enclosing circle to get the center P c and outer diameter R outer ; S4: Using the contour point set P i and the convex hull point set H i Extract inner arc feature points P far , calculate the center P c and inner arc feature point P far The inner diameter R inner ; S5: contour point set P i Adaptive segmentation, extracting opening feature points P gap1 and P gap2 , calculate the opening distance D gap ; The specific steps of S5 are: 1) According to the convex defect detection principle, the center P c and inner arc feature point P far The line connecting the two will pass through the opening area, and this line is recorded as L through ; 2) Using the convex defect starting point P start and the end point P end Construct a straight line, denoted as L Segment ; 3) Calculate each P i to L Segment The absolute value distance is less than R. inner All points of the , which are the contour points close to the opening side, are denoted as S i (u i ,v i ); 4) Calculate each S i to L through The signed distance of S is calculated based on the sign of the distance. i Divided into the distance positive point set Spos i (u i ,v i ) and the negative distance point set Sneg i (u i ,v i ); 5) In Spos i Find the point with the minimum distance, denoted as P gap1 (u g1 ,v g1 ); 6) In Sneg i Find the point with the maximum distance, and record it as P gap2 (u g2 ,v g2 ); 7)P gap1 and P gap2 The final extracted opening feature point is the opening distance D. gap ; S6: According to the opening feature point P gap1 and P gap2 Search and determine the bayonet straight line, search for edge points, and calculate the bayonet width W bay ; S7: The outer diameter R obtained by dividing S2 to S6 outer 、Inner diameter R inner , opening distance D gap 、Bayonet width W bay Compare them with the corresponding data of standard open circlips to determine whether they are qualified.

2. The image geometric feature extraction method for visual inspection of open retaining spring dimensions according to claim 1, characterized in that: The specific steps of S1 are: The maximum inter-class variance method is used to obtain the optimal binarization threshold and the open spring image is binarized.

3. The image geometric feature extraction method for visual inspection of open retaining spring dimensions according to claim 1, characterized in that: The specific steps of S2 are: The Canny algorithm is used to extract the contour set P from the binarized image. i , sort the area of ​​the set and extract the pixel coordinates P of all points on the maximum area contour i (u i ,v i ).

4. The image geometric feature extraction method for visual inspection of open retaining spring dimensions according to claim 1, characterized in that: The specific steps of S3 are: 1) For the contour set P i Perform convex hull extraction to obtain the pixel coordinates H of all points on the convex hull i (u hi ,v hi ); 2) For the convex hull point set H i Calculate the minimum enclosing circle and get the center P c (u c ,v c ) and outer diameter R outer .

5. The image geometric feature extraction method for visual inspection of open retaining spring dimensions according to claim 1, characterized in that: The specific steps of S4 are: 1) Using the contour point set P i and the convex hull point set H i Perform convex defect detection and find the deepest point of the convex defect, which is the inner arc feature point P far (u far ,v far ), the starting point P of the convex defect connected to the deepest point start (u start ,v start ) and the end point P end (u end ,v end ) are the initial feature points on both sides of the opening; 2) Calculate the center P c and inner arc feature point P far The inner diameter R inner .

6. The image geometric feature extraction method for visual inspection of open retaining spring dimensions according to claim 1, characterized in that: The specific steps of S6 are: 1) Use opening feature point P gap1 and the center P c Create straight line L cg1 , using the opening feature point P gap2 and P c Create straight line L cg2 ; 2) With the center P c As the center, the straight line L cg1 and L cg2 Rotate 5° in the direction of the expansion opening to form a new straight line L N1 and L N2 ; 3) From the center P c and radius (R outer +5) Establish the outer circle equation and calculate the straight line L N1 Two intersection points with the outer circle, calculate the distance from the two intersection points to L Segment The absolute value distance is less than R. inner The point is the intersection point on the opening side, denoted as I outer1 (u out1 ,v out1 ); Similarly, L N2 The two intersection points with the outer circle, and the intersection point on the opening side is selected and recorded as I outer2 (u out2 ,v out2 ); 4) From the center P c and radius (R inner -5) Establish the inner circle equation and calculate the straight line L N1 Two intersection points with the inner circle, calculate the distance from the two intersection points to L Segment The absolute value distance is less than R. inner The point is the intersection point on the opening side, denoted as I inner1 (u in1 ,v in1 ); Similarly, L N2 The two intersection points with the inner circle are selected, and the inner circle intersection point on the opening side is recorded as I inner2 (u in2 ,v in2 ); 5) Calculation point I outer1 and I inner1 To line L Segment The signed distance of and the product is D1; ​​calculate point I outer2 and I inner2 To line L Segment The signed distance of and product D2; 6) According to the principle of convex defect detection and the structural characteristics of the open spring, the line passes through the intersection of the inner and outer circles of the bayonet to L Segment The sign of the signed distance will be opposite, so if D1 is a negative value, the bayonet search line segment is I outer1 and I inner1 Otherwise, the bayonet search line segment is I outer2 and I inner2 The line of the determined bayonet search line segment is recorded as L Search ; 7) On the binary image output from the first step, along L Search , search for edge points with grayscale equal to 255 from inside to outside, denoted as P bay1 (u b1 ,v b1 ), and then search from the outside to the inside for the edge point with grayscale equal to 255, recorded as P bay2 (u b2 ,v b2 ), calculate the distance between the two points to get the bayonet width W bay .