Round part notch angle measuring method based on image processing technology
Through the method based on image processing technology, the circular parts are preprocessed and feature extraction, and the gap angle is calculated, which solves the problems of low efficiency and large error in traditional measurement methods, and achieves high-precision and high-efficiency gap angle measurement.
Patent Information
- Application Number
- CN202510168028.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-17
- Publication Date
- 2025-06-06
AI Technical Summary
The gap angle measurement method of traditional circular notched parts has low efficiency and large human error, making it difficult to meet modern high-precision and high-efficiency production needs.
Using an image processing technology method, the gap angle is calculated by pre-processing the circular part images, contour search, limit endpoint screening and indentation circle generation using image processing technology.
It realizes efficient and non-contact measurement of the notch angle of the part, improves measurement accuracy and efficiency, and is suitable for online inspection of large-scale production, avoiding secondary damage that may be caused by traditional contact measurement methods.
Smart Images

Figure CN120107191A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to an angle measurement method, in particular to a circular part notch angle measurement method based on image processing technology. Background Art
[0002] Circular notched parts are widely used in engineering. The notch design can be used for positioning, fixing or transmitting motion. The accuracy of the notch angle directly affects the performance and reliability of the parts. Accurate measurement of the angle of circular notched parts is not only a technical requirement, but also an important guarantee to ensure product quality, performance and safety. Therefore, accurate measurement of the notch angle is an indispensable part of the dimensional measurement of circular notched parts.
[0003] Traditional notch angle measurement methods mainly include projection method, mechanical measurement method, optical measurement method and three-coordinate measurement method, etc. They generally have problems such as low efficiency and large human errors, and it is difficult to meet the modern high-precision and high-efficiency production needs.
[0004] The measurement method based on image processing technology can use a camera to obtain part images and calculate the notch angle. This method has the advantages of non-contact, high precision, high efficiency, and is suitable for mass production environments. Summary of the invention
[0005] The purpose of the present invention is to provide a circular part notch angle measurement method based on image processing technology, by processing the circular part image, to achieve non-contact and efficient measurement of the notch angle in the part.
[0006] In order to achieve the above object, the present invention provides a circular part notch angle measurement method based on image processing technology, which comprises the following steps:
[0007] Step S1: preprocessing the original image, including threshold segmentation and denoising, to obtain a binary image;
[0008] Step S2: searching for contours on the binary image to obtain the longest contour;
[0009] Step S3: Obtain the four extreme endpoints of the longest contour, and select three of them to construct a circle that can reflect the outer contour of the circular part;
[0010] Step S4: indent the circle obtained in step S3 radially inward to obtain an indented circle, and at the same time create a completely black image of the same size as the original image, and draw the indented circle in white in this image to obtain an indented circle image;
[0011] Step S5: performing a bitwise AND operation on the binary image obtained in step S1 and the indented circle image obtained in step S4 to obtain an arc image that can reflect the notch of the part;
[0012] Step S6: Calculate the circumference of the indented circle in step S4 and the length of the arc in the arc image in step S5, and calculate the ratio r of the arc length to the circumference of the indented circle;
[0013] Step S7: Calculate the circular part notch angle θ using the following formula, in degrees:
[0014] θ=360×(1-r)
[0015] Wherein r is the ratio of the arc length to the circumference of the indented circle calculated in step S6.
[0016] Compared with the background technology, the gain effect of the present invention is as follows: the circular part notch angle measurement method based on image processing technology disclosed by the present invention uses the three extreme points of the maximum contour to quickly construct a circle that can reflect the outer contour of the circular part, generates an indentation circle by indentation, and uses the indentation circle image and the pre-processed binary image to perform bitwise AND operation to generate an arc image that can reflect the notch in the part, and the ratio of the arc length to the circumference of the indentation circle can be calculated to achieve accurate calculation of the notch angle. This method can achieve efficient, non-contact measurement, improve measurement accuracy and efficiency, avoid secondary damage that may be caused by traditional contact measurement methods, is suitable for online detection of mass production, and effectively solves the problems of low efficiency and large errors in manual measurement. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a flow chart of the measurement method;
[0018] Figure 2 is the original image of the part;
[0019] Figure 3 is the preprocessing result image;
[0020] Figure 4 is the longest contour;
[0021] Figure 5 It is a schematic diagram of the four extreme endpoints of the longest contour;
[0022] Figure 6 This is a schematic diagram of the final three endpoints and the circle they form;
[0023] Figure 7 is an indented circle image;
[0024] Figure 8 is an arc image. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0026] For example, please refer to Figures 1 to 8 : Figure 1 The overall process of the circular part notch angle measurement method based on image processing technology disclosed in the present invention is schematically given; Figure 2 The original image of the part of the present invention is schematically given; Figure 3 The preprocessing result image of the present invention is schematically given; Figure 4 The longest outline of the invention is given schematically; Figure 5 The four extreme endpoints of the longest contour of the present invention are schematically given; Figure 6 The final three endpoints and the formed circle of the present invention are schematically shown; Figure 7 The indented circle image of the present invention is schematically given; Figure 8 The circular arc image of the present invention is schematically given.
[0027] in accordance with Figure 1 The process shown in the figure is to measure the notch angle of the input part image according to the following steps:
[0028] Step S1: Preprocess the original image, including threshold segmentation and denoising, to obtain a binary image
[0029] The original image of the part is obtained as Figure 2 As shown in Figure 1, the image is preprocessed, including threshold segmentation and denoising. The threshold segmentation uses a fixed threshold, and the specific threshold is determined based on experiments. In this embodiment, the threshold is selected as 90. The denoising process is median filtering, and the filter window size is 3×3. The original image is segmented using a fixed threshold, and then the binary image after median filtering using a 3×3 window is shown in Figure 1. Figure 3 shown.
[0030] Step S2: Find the contour of the binary image and obtain the longest contour
[0031] In such Figure 3 The contour is searched in the binary image shown in FIG. 1 , and then the longest contour is obtained. In this embodiment, a total of 64 contours are found, and the last contour is the longest contour, such as Figure 4 As shown, its length is 4130px.
[0032] Step S3: Get the four extreme endpoints of the longest contour, select three of them to construct a circle that can reflect the outer contour of the circular part
[0033] Get Figure 4The four extreme endpoints of the longest contour shown are the leftmost endpoint pt, the bottom endpoint pb, the leftmost endpoint pl and the rightmost endpoint pr of the longest contour, as shown in Figure 5 As shown. Then select three extreme endpoints of the circle that can reflect the outer contour of the circular part from the four extreme endpoints. The specific method of screening the three extreme endpoints is: calculate the square of the distance tbDist between the uppermost endpoint pt and the lowermost endpoint pb and the square of the distance lrDist between the leftmost endpoint pl and the rightmost endpoint pr; if tbDist>lrDist, then the uppermost endpoint pt and the lowermost endpoint pb are the two extreme points screened out, and the third extreme point is the leftmost endpoint pl and the rightmost endpoint pr, whichever has the smaller distance to the line connecting the uppermost endpoint pt and the lowermost endpoint pb; otherwise, the leftmost endpoint pl and the rightmost endpoint pr are the two extreme points screened out, and the third extreme point is the uppermost endpoint pt and the lowermost endpoint pb, whichever has the smaller distance to the line connecting the leftmost endpoint pl and the rightmost endpoint pr. The three extreme endpoints screened out in this embodiment are the lowermost endpoint pb, the leftmost endpoint pl, and the rightmost endpoint pr, which are marked with "×", as shown in FIG. Figure 6 Finally, a circle that can reflect the outer contour of the circular part is constructed based on the three selected extreme endpoints. The center coordinates (xc, yc) and radius R of the circle can be calculated by equations (1) to (3).
[0034]
[0035] R=(xc-x1) 2 +(yc-y1) 2 (3)
[0036] Among them, x1 and y1 are the horizontal and vertical coordinates of the first limit point p1; x2 and y1 are the horizontal and vertical coordinates of the second limit point p2; x3 and y3 are the horizontal and vertical coordinates of the third limit point p3.
[0037] In this embodiment, the first limit point p1 is the leftmost endpoint pl, and its coordinates are (106,355); the second limit point p2 is the rightmost endpoint pr, and its coordinates are (801,390); the third limit point p3 is the bottommost endpoint pb, and its coordinates are (427,734). The coordinates of the center of the constructed circle are (452.78,386.72) and the radius is 348.23. The result of superimposing the constructed circle and the center of the circle marked with "+" on the longest contour image is shown in the figure below. Figure 6 shown.
[0038] Step S4: Indent the circle obtained in step S3 radially inward to obtain an indented circle, and at the same time create a completely black image of the same size as the original image, and draw the indented circle in white in this image to obtain an indented circle image.
[0039] The circle that can reflect the outer contour of the circular part constructed in step S3 is radially inwardly indented to obtain an indented circle. The indentation amount is determined according to the experiment, and the principle of indentation is to make the indented circle between the inner and outer edges of the longest contour. In this embodiment, the indentation amount is 5px, the coordinates of the center of the indented circle are (452.78,386.72), and the radius is 343.23. After obtaining the indented circle, create a completely black image of the same size as the original image, and draw the indented circle in this image with a width of 1px and a white color to obtain an indented circle image, such as Figure 7 shown.
[0040] Step S5: Perform a bitwise AND operation on the binary image obtained in step S1 and the indented circle image obtained in step S4 to obtain an arc image that can reflect the part gap.
[0041] The result obtained in step S1 is Figure 3 The binary image shown in FIG. 1 is the same as the binary image obtained in step S4. Figure 7 The indented circle image shown is bitwise operated according to formula (4) to obtain an arc image that can reflect the gap, as shown in Figure 8 shown.
[0042]
[0043] Among them, I1 is a binary image, I2 is an indented circle image, I3 is an arc image, and (x, y) is the pixel position coordinate.
[0044] Step S6: Calculate the circumference of the indented circle in step S4 and the length of the arc in the arc image in step S5, and calculate the ratio r of the arc length to the circumference of the indented circle
[0045] Calculate as Figure 7 The circumference L1 of the indentation circle obtained in step S4 shown in FIG. Figure 8 The length L2 of the arc obtained in step S5 is shown. The circumference L1 of the indented circle is obtained by counting the number of non-zero pixels in the indented circle image, and the length L2 of the arc is also obtained by counting the number of non-zero pixels in the arc image. Finally, the ratio r of the arc length L2 to the circumference L1 of the indented circle is calculated by formula (5):
[0046] r=L2 / L1 (5)
[0047] In this embodiment, the arc length L2=1882px, the indented circumference L1=1940px, and the ratio r=0.97.
[0048] Step S7: Calculate the notch angle in the circular part using the ratio r
[0049] The angle θ of the notch of the circular part is calculated by formula (6), in degrees:
[0050] θ=360×(1-r) (6)
[0051] Wherein, r is the ratio calculated in step S6.
[0052] In this embodiment, the measured angle θ of the notch of the circular part is 10.76°.
[0053] Although the above describes the specific implementation of the present invention in conjunction with the drawings, it does not limit the scope of protection of the present invention. It should be understood by those skilled in the art that various modifications or variations made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A circular part notch angle measurement method based on image processing technology, characterized in that: The collected original image of the circular part is processed, including the following steps: S1: preprocessing the original image, including threshold segmentation and denoising, to obtain a binary image; S2: perform contour search on the binary image to obtain the longest contour; S3: Obtain the four extreme endpoints of the longest contour, and select three of them to construct a circle that can reflect the outer contour of the circular part; S4: indent the circle obtained in step S3 radially inward to obtain an indented circle, and at the same time create a completely black image of the same size as the original image, and draw the indented circle in white in this image to obtain an indented circle image; S5: performing a bitwise AND operation on the binary image obtained in step S1 and the indented circle image obtained in step S4 to obtain an arc image that can reflect the part gap; S6: Calculate the circumference of the indented circle in step S4 and the length of the arc in the arc image in step S5, and calculate the ratio r of the arc length to the circumference of the indented circle; S7: Calculate the notch angle θ of the circular part using the following formula, in degrees: θ=360×(1-r) Wherein r is the ratio of the arc length to the circumference of the indented circle calculated in step S6; The four extreme endpoints of the longest contour in step S3 are the uppermost endpoint, the lowermost endpoint, the leftmost endpoint and the rightmost endpoint; the specific method for selecting the three extreme endpoints in step S3 is: calculate the square of the distance between the uppermost endpoint and the lowermost endpoint tbDist and the square of the distance between the leftmost endpoint and the rightmost endpoint lrDist; if tbDist>lrDist, the uppermost endpoint and the lowermost endpoint are the two extreme points obtained by screening, and the third extreme point is the endpoint of the leftmost endpoint and the rightmost endpoint that has a smaller distance to the line connecting the uppermost endpoint and the lowermost endpoint; otherwise, the leftmost endpoint and the rightmost endpoint are the two extreme points obtained by screening, and the third extreme point is the endpoint of the uppermost endpoint and the lowermost endpoint that has a smaller distance to the line connecting the leftmost endpoint and the rightmost endpoint.
2. The circular part notch angle measurement method based on image processing technology according to claim 1 is characterized in that: The threshold segmentation in step S1 adopts a fixed threshold, and the specific threshold is determined according to experiments; the denoising process in step S1 is median filtering, and the filter window size is 3×3.
3. The circular part notch angle measurement method based on image processing technology according to claim 1 is characterized in that: In step S4, the amount of radial inward indentation of the circle obtained in step S3 is determined according to experiments, and the principle of indentation is to make the indented circle between the inner and outer edges of the longest contour.
4. The circular part notch angle measurement method based on image processing technology according to claim 1 is characterized in that: In step S6, the circumference of the indented circle is obtained by counting the number of non-zero pixels in the indented circle image obtained in step S4, and the length of the arc is obtained by counting the number of non-zero pixels in the arc image obtained in step S5.