Bucket straightness detection method based on machine vision

By using a machine vision-based inspection method with high-resolution cameras and image processing algorithms, the problems of low accuracy, low efficiency, and workpiece damage in the existing technology of tube straightness inspection are solved. This method achieves high-precision, automated, and non-destructive inspection, and is suitable for small-diameter tubes.

CN121632022APending Publication Date: 2026-03-10NANJING UNIV OF SCI & TECH
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-07
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing methods for testing the straightness of barrels have problems such as low accuracy, low efficiency, high labor costs, inability to test small-diameter barrels, and potential damage to the workpiece.

Method used

A machine vision-based detection method is adopted. A grayscale image of the inner bore shadow rotating around the axis of the barrel is acquired through a high-resolution camera and image processing algorithm. The image is preprocessed and the shadow triangle region is located. The straightness error is calculated through edge detection and linear regression to achieve non-contact detection.

Benefits of technology

It improves detection accuracy and efficiency, avoids manual intervention, is suitable for small-diameter tube inspection, avoids workpiece damage, and achieves automated inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121632022A_ABST
    Figure CN121632022A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of barrel straightness detection, and particularly relates to a barrel straightness detection method based on machine vision. Comprising the following steps: S1, acquiring inner bore shadow grayscale images of a barrel rotating at four circumferential angles of 0 degree, 90 degrees, 180 degrees and 270 degrees around an axis; s2, preprocessing the image obtained in the step S1; s3, positioning a barrel inner bore shadow triangular area; s4, barrel straightness quantitative calculation and judgment based on shadow triangular region morphology; s5, exchanging the head and the tail of the barrel, repeating the steps S1 to S4, and judging whether the straightness of the rear half section of the barrel is qualified or not; and the straightness detection of the whole barrel is completed. The invention provides a body tube bore straightness detection method based on machine vision for automatic body tube bore straightness detection, and non-contact, automatic and high-precision detection of small-caliber body tube bore straightness is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of barrel straightness detection, and particularly relates to a barrel straightness detection method based on machine vision. BACKGROUND

[0002] The straightness of the barrel bore not only affects the processing quality of the barrel bore, but also directly affects the shooting accuracy of the projectile. Due to the characteristics of long size and narrow space in the barrel, the detection of the straightness of the barrel bore has always been a key technical problem to be solved. At present, the detection methods for the straightness of the barrel bore commonly include the shadow triangle method, the straightness gauge detection and the high-sensitivity photoelectric position sensor (PSD) straightness detection.

[0003] The principle of the shadow triangle method is to use a light source with a light shield to form a triangular shadow with the top end at the edge of the front end of the barrel and the bottom side at the middle part of the barrel in the barrel bore. The barrel is rotated around the axis, and the bending position and direction of the full length of the barrel bore are determined by the change in the profile of the shadow triangle.

[0004] The current traditional barrel straightness detection methods such as the shadow triangle method and the straightness gauge detection have the pain points of low efficiency and high labor cost. The mainstream automatic barrel straightness detection method is the high-sensitivity photoelectric position sensor (PSD) straightness detection, which is limited by the size of the device itself and cannot detect the straightness of small-caliber barrels.

[0005] In summary, the existing problems of the prior art are as follows: 1) low detection accuracy: the traditional detection method is affected by the environment and human factors, and has low detection accuracy; 2) low efficiency: manual detection is affected by light and has a large amount of labor, and has low efficiency; 3) limited by the aperture of the barrel: the PSD straightness detection is limited by the size of the device itself; 4) contact detection damages the workpiece: the straightness gauge detection may damage the barrel bore. SUMMARY

[0006] The purpose of the present application is to provide a barrel straightness detection method based on machine vision.

[0007] The technical solution for achieving the purpose of the present application is as follows: a barrel straightness detection method based on machine vision, comprising the following steps:

[0008] S1: obtaining the inner bore shadow gray scale images of the barrel at four circumferential angles of 0°, 90°, 180° and 270° around the axis;

[0009] S2: pre-processing the images obtained in step S1;

[0010] S3: positioning the barrel inner bore shadow triangle region;

[0011] S4: straightness quantification calculation and determination of the barrel based on the shadow triangle region topography;

[0012] S5: exchange the head and tail of the barrel, repeat steps S1 to S4, and determine whether the second half of the barrel is qualified; complete the straightness detection of the whole barrel.

[0013] Further, the image is acquired by the image acquisition device in S1, and the image acquisition device includes a high-resolution camera, a light source with a light shield, and a barrel rotating and positioning mechanism; S1 specifically comprises:

[0014] The barrel is fixed by the barrel rotating and positioning mechanism, the high-resolution camera is installed at a distance of 5±1 cm from the rear end surface of the barrel, the optical axis forms an angle of 10°±1 with the barrel axis, and the light source with a light shield is placed at the front end of the barrel.

[0015] When the image is collected, the front end of the barrel is aligned with the light source, the incident light forms a bright-dark boundary line in the inner bore of the barrel, and the shadow in the inner bore appears as a shadow triangle profile with the bottom facing the camera in the camera field of view.

[0016] By controlling the barrel rotating and positioning mechanism, the barrel is rotated to 0°, 90°, 180°, and 270° in turn, and after being stabilized at each position, a corresponding inner bore shadow gray image is collected by the high-resolution camera.

[0017] Further, the image preprocessing of S2 includes smoothing processing by using a filtering algorithm, and enhancing the gray difference between the shadow triangle region and the bright background region by using a contrast enhancement algorithm; specifically comprising:

[0018] The original gray image obtained in step S1 is smoothed by using a median filtering algorithm,

[0019] The filtered image is subjected to gray scale transformation by using a scale_image operator, the gray value g of each pixel in the image is remapped by linear transformation to generate a new gray value g', and the transformation formula is:

[0020]

[0021] By adjusting the multiplier factor Mult and the offset Add, the gray difference between the shadow triangle region and the bright background region is expanded, and the multiplier factor Mult and the offset Add are calculated by the following formula:

[0022]

[0023]

[0024] G Max is the gray value of the bright background region, GMin The gray value of the shadow triangle region.

[0025] Further, step S3 positions the shadow triangle region in the bore using a template matching algorithm for rough positioning: using a standard shadow triangle region established in advance as a reference template, template matching is performed in the image to be detected to determine the region with the highest similarity, and a rectangular region containing the shadow triangle is determined as the target region based on the center of the determined region.

[0026] Further, step S4 specifically includes the following steps:

[0027] S4.1: extracting the shadow triangle side line through an edge detection algorithm;

[0028] S4.2: predicting the ideal shadow triangle side line equation;

[0029] S4.3: calculating the maximum pixel deviation of the actual shadow triangle side line from the ideal shadow side line;

[0030] S4.4: establishing the relationship between the maximum pixel deviation of the shadow side line and the straightness error;

[0031] S4.5: determining whether the straightness of the shadow region is qualified.

[0032] Further, step S4.1 specifically includes:

[0033] S4.1.1: edge scanning and gradient calculation:

[0034] In the target region determined in step S3, line-by-line scanning is performed along the preset search direction, and for each point on the scanning path, the amplitude and direction of the image gray gradient are calculated using the Sobel gradient operator. The gradient calculation formula is:

[0035]

[0036] f (u, v) represents the gray value at pixel point (u, v);

[0037] S4.1.2: setting the gradient amplitude threshold:

[0038] According to the gray value of the shadow region, the gradient amplitude threshold is set. The edge polarity is set to "from light to dark", and only points that meet both conditions of "gradient amplitude exceeding the preset threshold" and "edge polarity being 'from light to dark'" are initially determined as valid edge points, and the edge point pixel coordinates (x i , y i ) are output;

[0039] S4.1.3: edge point set generation and merging:

[0040] For the four images under different rotation angles, S4.1.1 and S4.1.2 are repeated on the same side of the shadow side line, and all the extracted edge point coordinates are combined to form a unified total edge point set.

[0041] Further, step S4.2 is specifically:

[0042] The ideal shadow triangle side line follows a linear model in the image coordinate system, and its equation is expressed as:

[0043]

[0044] The total edge point set obtained in S4.1.3 is linearly regressed by using the least square method, and the objective function L of least square fitting is as follows:

[0045]

[0046] In the formula, (x i , y i ) is a point in the total edge point set,

[0047] The function parameters (k, b) are calculated when the objective function L obtains the minimum value, and the equation of the ideal shadow triangle side line is obtained.

[0048] Further, step S4.3 is specifically:

[0049] For the shadow side line extracted in the image collected at each circumferential angle, the perpendicular distance d i of each edge point in the edge point set to the ideal shadow triangle side line is calculated, and the maximum value d max、 is found, which is recorded as d i , that is, the maximum pixel deviation.

[0050] .

[0051] Further, the relationship between the shadow side line deviation and the straightness error in step S4.4 is as follows:

[0052] The calculation model of the straightness error δ is:

[0053] Where K is a proportional coefficient, and the maximum pixel deviation d max in the image pixel coordinate system is converted into the straightness error δ in the actual physical coordinate system of the barrel by the above formula.

[0054] Further, S4.5 is specifically: comparing the calculated straightness error δ with the specified qualified straightness error threshold; if the straightness error δ of the barrel is less than or equal to the qualified straightness error threshold, it is determined that the straightness is qualified; if it exceeds the qualified straightness error, it is determined as unqualified.

[0055] Compared with the prior art, the present application has the following advantages:

[0056] 1) High detection accuracy: high-resolution cameras and advanced image processing algorithms are used to ensure the accuracy of barrel straightness detection.

[0057] 2) High efficiency: the detection process does not require manual intervention, realizing the automation of the detection process, reducing labor costs, and greatly improving the detection efficiency.

[0058] 3) Breakthrough in small-caliber barrel automated detection: the current mainstream barrel automated straightness detection method is high-sensitivity photoelectric position sensor (PSD) straightness detection, which is limited by the size of the device itself and cannot detect small-caliber barrel straightness. The present application is suitable for detecting the straightness of gun barrel bore with caliber less than 37mm.

[0059] 4) Non-contact feature avoids workpiece damage: straightness gauge detection may damage the barrel bore, and the present application uses non-contact detection to avoid workpiece damage. BRIEF DESCRIPTION OF DRAWINGS

[0060] Figure 1 It is a gray-scale image schematic diagram of the standard shadow triangle of the barrel bore.

[0061] Figure 2 It is a gray-scale image schematic diagram of the shadow triangle of the barrel around the axis at 0°, 90°, 180°, and 270°.

[0062] Figure 3 It is a schematic diagram of the ideal shadow edge line fitted by the extracted edge point set.

[0063] Figure 4 It is a flowchart of the straightness error calculation of the present application.

[0064] Figure 5 It is a flowchart of the barrel bore straightness detection method of the present application.

[0065] BRIEF DESCRIPTION OF DRAWINGS

[0066] 1-barrel front ring, 2-shadow triangle, 3-shadow triangle segmented ring, 4-barrel rear ring, 5-shadow edge point set, 6-ideal shadow edge line. DETAILED DESCRIPTION

[0067] The present application will be further described in detail below with reference to the accompanying drawings.

[0068] The embodiment provides a barrel bore straightness detection method based on machine vision, as shown in the formula (I): Figure 4 The embodiment provides a barrel bore straightness detection method based on machine vision, as shown in the formula (I):

[0069] In a first step S1, an image acquisition device is used to acquire barrel bore shadow gray images at four circumferential angles of 0°, 90°, 180° and 270°.

[0070] Specifically, the image acquisition device comprises a high-resolution camera, a light source with a light shield and a barrel rotation and positioning mechanism. The barrel is reliably fixed by the barrel rotation and positioning mechanism and can be driven to rotate to a specified angle around its own axis. The high-resolution camera is installed at a distance of 5 cm from the rear end face of the barrel, and the optical axis of the camera forms an angle of about 10° with the barrel axis. The light source with the light shield is placed at the front end of the barrel.

[0071] During image acquisition, the front end of the barrel is aligned with the light source. Since the light shield blocks part of the light, the incident light will form a bright-dark boundary line in the barrel bore. According to the far vision rule, the shadow in the barrel bore appears as a shadow triangle profile with the bottom facing the camera in the camera field of view.

[0072] By controlling the barrel rotation and positioning mechanism, the barrel is accurately rotated to four positions of 0°, 90°, 180° and 270° in turn, and after stabilization at each position, a corresponding barrel bore shadow gray image is synchronously triggered and acquired by the high-resolution camera. As shown in the formula (II): Figure 2 Four barrel bore shadow images at different circumferential angles are obtained.

[0073] In a second step S2, image preprocessing operations are performed to improve image quality.

[0074] Specifically, the image preprocessing operations include using a filtering algorithm and a contrast enhancement algorithm.

[0075] A median filtering algorithm is used to smooth the original gray image. As a nonlinear smoothing filtering technique, median filtering can effectively suppress salt and pepper noise and random noise while maximizing the sharpness of the straight edges of the shadow triangle and the detail information, and filtering out small metal debris, attached oil stains or dust and other interference in the barrel bore. A circular region is specified as the filter shape, and a filter size and boundary processing method are selected that can effectively filter out most isolated noise points without causing significant edge blurring.

[0076] To overcome the problem of low overall contrast caused by uneven illumination of the barrel bore, the scale_image operator is used to perform gray scale transformation on the filtered image to significantly enhance the gray scale difference between the shadow triangle region and the bright background region. The operator re-maps the gray scale value g of each pixel in the image through linear transformation to generate a new gray scale value g', and the transformation formula is:

[0077]

[0078] By adjusting the multiplier factor Mult and the offset Add, the gray scale difference between the shadow triangle region and the bright background region can be effectively expanded, making the feature region more prominent, that is, achieving the visual effect of "darker places are darker and brighter places are brighter". The multiplier factor Mult and the offset Add are calculated by the following formula:

[0079]

[0080]

[0081] G Max is the gray scale value of the bright background region, G Min is the gray scale value of the shadow triangle region. By adjusting the image contrast, the high-frequency regions in the image, such as the edges and corner features of the shadow triangle, are significantly enhanced, making the image look clearer.

[0082] Step 3 S3, positioning the shadow triangle region of the barrel bore;

[0083] Rough positioning based on template matching: To improve processing efficiency and exclude irrelevant background interference, a rough target region containing the shadow triangle is first determined in the original image. The specific method is as follows: a typical shadow triangle region is pre-cut from a standard image and used as a reference template; then, a template matching algorithm is used to calculate the similarity between the reference template and all possible positions in the image to be detected; finally, the center point of the region with the highest similarity is taken as the positioning point, and a rectangular frame with a size of 2 times the width and height of the template is drawn with the point as the center, defining the rectangular region as the rough target region.

[0084] Step 4 S4, barrel straightness quantification calculation and judgment based on shadow triangle morphology;

[0085] The core principle of this step is that the actual center axis of the inner bore of an ideal straight barrel coincides with the external rotation axis. When the barrel rotates around its axis, the appearance of the inner bore shadow triangle generated by the fixed light source should remain unchanged. If the barrel has straightness error, the actual center axis of the barrel will be curved, the light path will change, and the side lines of the shadow triangle will also be curved. With the rotation of the barrel, the side lines of the shadow triangle will exhibit periodic changes in the camera field of view. Therefore, the position change of the side lines of the shadow triangle is a direct mapping of the degree of curvature of the barrel axis and can be used as a quantitative evaluation index of straightness error. The specific calculation and determination steps are as follows:

[0086] S4.1, extract the side lines of the shadow triangle by edge detection algorithm;

[0087] In the gray-scale image, the edge of the shadow triangle appears as a sharp change in gray-scale value. Therefore, the two side lines of the shadow triangle can be extracted by calculating the image gray-scale gradient, and the core implementation principle and process are as follows:

[0088] a) Edge scanning and gradient calculation:

[0089] In the target area defined in step S3.1, perform line-by-line scanning along the preset search direction. For each point on the scanning path, use the Sobel gradient operator to calculate the amplitude and direction of the image gray-scale gradient, and the gradient calculation formula is:

[0090]

[0091] f (u, v) represents the gray-scale value at pixel point (u, v).

[0092] b) Set the gradient amplitude threshold: set the gradient amplitude threshold according to the gray-scale value of the shadow and the light. On the premise of not missing the real edge, effectively suppress the weak gradient response caused by image noise. According to the light and dark relationship between the shadow area and the bright area in this application scenario, the required edge polarity is set to "from light to dark". Only the points that meet both the conditions of "gradient amplitude exceeding the preset threshold" and "edge polarity being 'from light to dark'" are preliminarily determined as valid edge points, and the edge point pixel coordinates (x i , y i ) are output.

[0093] c) Edge point set generation and merging:

[0094] For images at four rotation angles (0°, 90°, 180°, 270°), repeat the operations of a) to b) on the shadow lines on the same side (all left or all right) of the images. Merge all the extracted edge point coordinates to form a unified total edge point set.

[0095] S4.2, Predict the equation of the side line of the ideal shaded triangle;

[0096] Due to the symmetry of the tube's curvature, the points in the total edge point set obtained in step S4.1 should theoretically be distributed around an "ideal shadow edge line." A linear regression is performed on the total edge point set to fit an optimal straight line equation, which is the theoretical "ideal shadow edge line" for that segment of the tube at the current detection position. This invention uses the least squares method to perform linear regression on the total edge point set obtained in S4.1.

[0097] The ideal shadow edge follows a linear model in the image coordinate system, and its equation can be expressed as:

[0098]

[0099] The core objective of least squares fitting is to find a set of parameters (k, b) such that all points (x, b) in the total edge point set are equal to the set of parameters (k, b). i , y i ) to that line The sum of squares of the perpendicular distances is minimized, which is equivalent to minimizing the following objective function L:

[0100]

[0101] Calculate the function parameters (k, b) when the objective function L reaches its minimum value, and finally obtain the equation of the side line of the ideal shaded triangle through the above fitting process.

[0102] S4.3, calculate the maximum deviation between the actual shaded triangle side line and the ideal shaded triangle side line;

[0103] For each shadow sideline in the different angle images (0°, 90°, 180°, 270°) extracted in step S4.1, calculate the vertical distance from all edge points on it to the ideal shadow sideline f(x) determined in step S4.2. Edge points (x... i , y i The perpendicular distance to the ideal edge is given by the following formula:

[0104]

[0105] After calculating the distances for all angles and all edge points, iterate through and compare all these perpendicular distances d. i Find the maximum value among them, and denote it as d. max , d max This represents the maximum deviation of the bore shading edge from the ideal shading edge during one revolution of the barrel. d max The larger the value, the more severe the curvature of the barrel's interior.

[0106] S4.4, establish the relationship between the shadow side line and straightness deviation;

[0107] The core of this step is to establish the conversion model of the shadow side line deviation and the straightness deviation, and convert the pixel deviation d max measured in the image into the straightness error δ.

[0108] The actual physical radial offset δ of the barrel axis and the maximum pixel deviation d max measured in the image has a linear proportional relationship. The mathematical relationship between the two can be established as:

[0109]

[0110] The proportional coefficient K is accurately obtained through a large number of experiments, and the calculated δ is the straightness error of the barrel. Its physical meaning is: the maximum radial offset of the actual center axis of the barrel relative to its rotation axis.

[0111] S4.5, determine whether the straightness of the shadow area barrel is qualified.

[0112] The final qualification determination is made by comparing the calculated straightness error δ with the qualified straightness error threshold [δ] specified in the product technical specification. If the straightness error of the barrel is less than or equal to the qualified straightness error threshold, it is determined to be qualified; if it exceeds the qualified straightness error, it is determined to be unqualified.

[0113] Step 5 S5, exchange the head and tail of the barrel, repeat steps S1 to S4, and determine whether the straightness of the second half of the barrel is qualified.

[0114] Specifically, the above steps S1 to S4 complete the straightness detection of the first half of the barrel. In order to realize the comprehensive detection of the full length of the barrel, the second half of the barrel needs to be detected. The barrel is taken off from the rotating detection mechanism, and the head and tail are exchanged and clamped again. After the exchange, the whole operation process of steps S1 to S4 is repeated to detect the straightness of the second half of the barrel and determine the qualification.

[0115] Step 6 S6, complete the straightness detection of the full size barrel.

[0116] Finally, the detection results of the first half of the barrel and the second half of the barrel are combined to make a general judgment on the straightness of the whole barrel: if the detection results of both directions are qualified, the straightness of the whole barrel is qualified. If the detection result of any direction is unqualified, the straightness of the whole barrel is unqualified.

[0117] The above has carried out the detailed explanation to the embodiment of the application, but the content described is only the preferred embodiment of the application, the protection scope of the application is not limited to this. Any equivalent change and improvement made by the skilled in the art within the technical scope of the application should be covered in the protection scope of the application.

Claims

1. A machine vision-based straightness detection method for a barrel, characterized by, The method comprises the following steps: S1: Obtain the inner bore shadow gray scale images of the barrel at four circumferential angles of 0°, 90°, 180° and 270° of the barrel rotation around the axis; S2: Preprocess the images obtained in step S1; S3: Locate the barrel inner bore shadow triangle region; S4: Quantitative calculation and determination of the barrel straightness based on the shadow triangle region topography; S5: Exchange the barrel head and tail, repeat steps S1 to S4, and determine whether the barrel straightness in the second half is qualified; complete the barrel straightness detection.

2. The method of claim 1, wherein, In step S1, the image is obtained by an image acquisition device, which comprises a high-resolution camera, a light source with a light shield and a barrel rotation and positioning mechanism; S1 specifically comprises: The barrel is fixed by the barrel rotation and positioning mechanism, the high-resolution camera is installed at a distance of 5±1 cm from the rear end surface of the barrel, the optical axis forms an angle of 10°±1 with the barrel axis, and the light source with a light shield is placed at the front end of the barrel; During image acquisition, the front end of the barrel is aligned with the light source, the incident light forms a bright-dark boundary line in the barrel inner bore, and the shadow in the inner bore appears as a shadow triangle profile with the bottom facing the camera in the camera field of view; By controlling the barrel rotation and positioning mechanism, the barrel is rotated to four positions of 0°, 90°, 180° and 270° in turn, and after being stabilized at each position, a corresponding inner bore shadow gray scale image is synchronously triggered and acquired by the high-resolution camera.

3. The method of claim 1, wherein, The image preprocessing of S2 comprises smoothing processing by using a filtering algorithm and enhancing the gray scale difference between the shadow triangle region and the bright background region by using a contrast enhancement algorithm; specifically: The original gray scale image obtained in step S1 is smoothed by using a median filtering algorithm, The filtered image is subjected to gray scale transformation by using a scale_image operator, the gray scale value g of each pixel in the image is remapped by linear transformation to generate a new gray scale value g', and the transformation formula is: , By adjusting the multiplier factor Mult and the offset Add, the gray scale difference between the shadow triangle region and the bright background region is expanded, and the multiplier factor Mult and the offset Add are calculated by the following formula: , , G Max G is the gray value of the light background area Min G is the gray value of the shadow triangle area.

4. The method of claim 1, wherein, Step S3 locates the barrel inner bore shadow triangle region by using a template matching algorithm: taking a standard shadow triangle region established in advance as a reference template, performing template matching in the image to be detected to determine the region with the highest similarity, taking the center of the matched region as a reference, and defining a rectangular region containing the shadow triangle as a target region.

5. The method of claim 1, wherein, Step S4 specifically comprises the following steps: S4.1: Extract the shadow triangle side edge line by an edge detection algorithm; S4.2: Predict the ideal shadow triangle side edge line equation; S4.3: Calculate the maximum pixel deviation of the actual shadow triangle side edge line from the ideal shadow side edge line; S4.4: Establish the relationship between the maximum pixel deviation of the shadow side edge line and the straightness error; S4.5: Determine whether the barrel straightness of the shadow region is qualified.

6. The method of claim 5, wherein, Step S4.1 specifically comprises: S4.1.1: Edge scanning and gradient calculation: In the target region delineated in step S3, a line-by-line scanning is performed along the preset search direction, and for each point on the scanning path, the amplitude and direction of the image gray gradient are calculated using the Sobel gradient operator, and the gradient calculation formula is: , f (u, v) represents the gray value at the pixel point (u, v); S4.1.2: Set the gradient amplitude threshold value: According to the gray value of the shadow area, a gradient amplitude threshold is set; an edge polarity is set as "from light to dark"; only the points satisfying both conditions of "gradient amplitude exceeding the preset threshold" and "edge polarity being 'from light to dark'" are preliminarily determined as effective edge points, and the edge point pixel coordinates (x i , y i ) are outputted; S4.1.3: Edge point set generation and merging: For the images under the four rotation angles, S4.1.1 and S4.1.2 are repeatedly executed on the shadow lines on the same side of the images, respectively, and all the extracted edge point coordinates are merged to form a unified total edge point set.

7. The method of claim 6, wherein, Step S4.2 is specifically: The ideal shadow triangle side line follows a linear model in the image coordinate system, and its equation is expressed as: , The total edge point set obtained in S4.1.3 is subjected to linear regression by using the least square method, and the objective function L of the least square fitting is as follows: , where (x i , y i ) is a point in the total edge point set, The function parameters (k, b) are calculated when the objective function L obtains the minimum value, and the equation of the ideal shadow triangle side line is obtained.

8. The method of claim 7, wherein, In step S4.3, the following is specifically: For the extracted shadow side line in the image collected at each circumferential angle, the perpendicular distance d of each edge point in the edge point set to the ideal shadow triangle side line is calculated respectively i The maximum value is found, denoted as d max、 That is, the maximum pixel deviation, the perpendicular distance d i It is calculated by the following formula: 。 9. The method of claim 8, wherein, In step S4.4, the relationship between the shadow side line deviation and the straightness error is as follows: The calculation model of straightness error δ is: , Wherein K is a proportional coefficient, the maximum pixel deviation d in the image pixel coordinate system is converted into the straightness error δ in the actual physical coordinate system of the barrel by the above formula max is converted into the straightness error δ in the actual physical coordinate system of the barrel.

10. The method of claim 9, wherein, S4.5 is specifically: comparing the calculated straightness error δ with the specified qualified straightness error threshold value; if the straightness error δ of the barrel is less than or equal to the qualified straightness error threshold value, it is determined that the straightness is qualified; If it exceeds the qualified straightness error, it is determined to be unqualified.

Citation Information

Cited By

  • Improved lbp-based rifling surface shape feature rapid extraction method and system

    CN122199554A