Method and system for measuring verticality of non-contact flexible joint
By employing a non-contact flexible joint perpendicularity measurement method, utilizing an electric rotary table and machine vision technology, the problem of the influence of flexible joint deformation during contact measurement is solved, achieving high-precision and high-efficiency perpendicularity measurement, suitable for the detection of complex and micro-sized objects.
Patent Information
- Application Number
- CN202510943467.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2025-10-31
AI Technical Summary
Existing machine vision measurement methods have shortcomings in terms of accuracy and stability, especially in contact measurements where the deformation of flexible joints due to pressure affects the measurement results.
A non-contact method for measuring the perpendicularity of flexible joints is adopted. The flexible joint under test is fixed by a clamp and rotated by an electric rotary table. Images are acquired by a camera and lens. Noise points are filtered out using an adaptive edge region localization algorithm and the RANSAC algorithm. The edge line is fitted by iterative weighted least squares method. The image after correction is calculated by combining affine transformation matrix and bicubic interpolation. The end face and thin rod contour are extracted, and the perpendicularity of virtual feature points is calculated.
It achieves high-precision, non-contact, and automated measurement of the perpendicularity of flexible joints, suitable for rapid detection of complex shapes and micro-sized objects, improving measurement accuracy and production inspection efficiency.
Smart Images

Figure CN120868974A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision technology, and in particular to a non-contact method and system for measuring the perpendicularity of flexible joints. Background Technology
[0002] In industrial manufacturing and quality control, accurately measuring the perpendicularity of object surfaces is a crucial task. Traditional perpendicularity measurement methods typically rely on contact measuring tools such as micrometers and dial indicators. These methods are not only inefficient but also have limitations in measuring the perpendicularity of complex shapes and miniature object surfaces. In recent years, with the development of machine vision technology, non-contact measurement methods based on machine vision have gradually gained attention. However, existing machine vision measurement methods still need improvement in terms of accuracy and stability, and there is a problem that the deformation of flexible joints due to pressure during contact measurements can affect the measurement results. Summary of the Invention
[0003] This invention provides a non-contact method and system for measuring the verticality of flexible joints, which can solve the technical problem that the deformation of the flexible joint due to pressure affects the measurement results during contact measurement in the prior art.
[0004] According to one aspect of the present invention, a non-contact method for measuring the perpendicularity of a flexible joint is provided. The method includes: Step 1, fixing the flexible joint to be tested using a fixture mounted on an electric rotary table, controlling a motor to drive the rotary platform and thus rotating the flexible joint around a rotation center, and acquiring local images of the flexible joint multiple times at certain time intervals using a camera and lens; the camera then sends the acquired workpiece images to an image processing unit; Step 2, the image processing unit uses an adaptive edge region localization algorithm to obtain the end face contour edge search region and the thin rod contour edge search region; Step 3, based on the thin rod contour edge search region in Step 1, extracting the sub-pixel edges of the thin rod region, using the RANSAC algorithm, defining points whose distance from the ideal straight line is less than a set distance threshold as inliers, and defining points whose distance from the ideal straight line is greater than or equal to the set distance threshold as noise points, filtering out noise points to obtain inlier data, and then... Two edge lines are generated by fitting interior points using iterative weighted least squares method; the virtual centerline is calculated based on the fitted edge lines, and then the image is corrected to the standard position using affine transformation matrix, and the gray value after correction is calculated using bicubic interpolation to obtain the corrected image; step four, based on the corrected image, step three two is repeated, and the end face contour edge search area is obtained using an adaptive edge region localization algorithm; step five, based on the end face contour edge search area in step four, the end face edge contour is extracted; step six, the contour points of the end face edge contour are reordered; step seven, based on the reordered contour points, contour lines are generated by fitting using iterative weighted least squares method, and the intersection of the two lines is a virtual feature point. N virtual feature points are obtained from N images collected after one rotation of the flexible joint, and the difference between the maximum and minimum values of the Y coordinate of the virtual feature points is calculated as the pixel distance representing the verticality. The pixel distance is converted into the real physical distance to obtain the verticality of the flexible joint end face.
[0005] Further, step two specifically includes: (2.1) For the horizontal contour, Gaussian derivative is calculated in the Y-axis direction, and for the vertical contour, Gaussian derivative is calculated in the X-axis direction; convolution operation is performed to obtain edge features, the floating-point format image is converted to integer format, and the grayscale is scaled to [0, 255] to enhance the contrast of the image edge region; (2.2) The ROI image is segmented using the OTSU algorithm, the segmented binary image is isolated as a non-connected domain, the corresponding area threshold is set to filter out the impurity region, all non-connected regions are merged and the minimum bounding rectangle of the end face is calculated, the edge region to be tested is limited to the minimum bounding rectangle of the end face, and the area to be tested is expanded to a set range based on the minimum bounding rectangle of the end face to determine the ROI search area of the end face contour edge; (2.3) The two bottom regions of the ROI image are selected and the row and column coordinates of the minimum bounding rectangle of the thin rod are calculated. A rectangular region is generated according to the row and column coordinates, and the upper and lower regions of the rectangular region boundary are trimmed to obtain the two edge regions of the thin rod. The area to be tested is expanded to a set range based on the minimum bounding rectangle of the thin rod to finally determine the search area of the thin rod contour edge.
[0006] Furthermore, in step three, the affine transformation matrix is: Where (x,y) are the coordinates of the center of the thin rod region, θ is the deflection angle, and (x m y m () represents the coordinates of the rotation center.
[0007] Further, step five specifically includes: (5.1) For horizontal contours, the ROI needs to be expanded and the width set along the Y direction; for vertical contours, the ROI needs to be expanded and the width set along the X direction; (5.2) The edge of the expanded end face contour is smoothed using the closing operation smoothing method, and the edge contour is detected using the sub-pixel Canny operator to complete the extraction of the edge contour.
[0008] Further, in step (5.2), the subpixel Canny operator is used to detect the edge contour. For the double ROI features of the flexible joint end face, the adjacent endpoints of the two contours in the horizontal direction of the middle and the side are extracted respectively. The two endpoints are connected to fill the contour gap and merge the double ROI contours into a single continuous contour. When processing a single ROI, contour merging is not required.
[0009] Furthermore, in step six, for the horizontal contour, the contour points are sorted in ascending order according to the Y direction. For the vertical contour, the contour points are sorted in ascending order according to the X direction.
[0010] According to another aspect of the present invention, a non-contact flexible joint verticality measurement system is provided, which uses the non-contact flexible joint verticality measurement method described above to measure verticality.
[0011] Furthermore, the non-contact flexible joint perpendicularity measurement system includes: the flexible joint to be tested (1), a clamp (2), an electric rotary table (3), a light source (4), a lens (5), a camera (6), and a computer (7); the clamp (2) is used to fix the sample to be tested and is connected to the electric rotary table (3); the electric rotary table (3) is used to carry the sample to be tested and rotate it at a uniform speed, and is connected to the computer (7) through a connecting line; the light source (4) provides illumination for the sample to be tested and is connected to the computer (7) through a connecting line; the lens (5) and the camera (6) are connected by assembly and are used to acquire images of the sample to be tested; the computer (7) is used to associate and control the operation of the electric rotary table (3) and the light source (4), the acquisition of images by the lens (5) and the camera (6), and to process the acquired images to calculate the perpendicularity of the flexible joint.
[0012] Furthermore, the electric rotary table (3) is a rotary mechanism and can adjust the rotation speed, direction and accuracy.
[0013] Furthermore, lens (5) is a double telecentric lens.
[0014] This invention provides a non-contact method for measuring the perpendicularity of flexible joints. The method first performs camera calibration to obtain intrinsic and extrinsic parameters and correct distortion. A computer-controlled electric rotary table rotates, and LED backlight illumination is used. A CMOS camera captures the edge contour image of the flexible joint to be measured during one rotation. Then, a perpendicularity detection algorithm obtains virtual feature points where the extended lines of the contour edges intersect. By processing and calculating the maximum deviation of the Y-coordinate of these feature points, the perpendicularity of the flexible joint is obtained. This invention uses visual calibration and image processing algorithms to preprocess images, including noise reduction, segmentation, and mathematical morphology operations, extracting ROI region features and edge contours. It employs iterative weighted least squares to fit lines, thereby acquiring the coordinates of the virtual feature points to be measured on the product. The Random Sample Consensus Algorithm (RANSAC) is used for point set registration, which can handle situations where low precision of the rotating mechanism leads to increased errors, improving measurement accuracy. It can automatically detect the perpendicularity of a large number of flexible joints, improving product manufacturing inspection efficiency. The perpendicularity measurement method of the present invention has the advantages of being non-contact, high precision, high efficiency, and highly automated. It is suitable for rapid detection of the perpendicularity of objects with various complex shapes, especially for the surface perpendicularity measurement of micro-sized workpieces and complex structures. It is also suitable for the perpendicularity detection of flexible joints that cannot be measured by contact, and has broad application prospects. Attached Figure Description
[0015] The accompanying drawings, which form part of this specification, are provided to further illustrate embodiments of the invention and, together with the textual description, explain the principles of the invention. It is obvious that the drawings described below are merely some embodiments of the invention, and those skilled in the art can obtain other drawings based on these drawings without any creative effort.
[0016] Figure 1 A schematic diagram of a non-contact flexible joint verticality measurement system according to a specific embodiment of the present invention is shown.
[0017] Figure 2 A flowchart of a non-contact flexible joint verticality measurement method according to a specific embodiment of the present invention is shown;
[0018] Figure 3a A schematic diagram of end face ROI positioning (single ROI) provided according to a specific embodiment of the present invention is shown;
[0019] Figure 3b A schematic diagram of end face ROI positioning (double ROI) provided according to a specific embodiment of the present invention is shown;
[0020] Figure 4 A magnified view of the area surrounding the feature point to be measured, provided according to a specific embodiment of the present invention, is shown.
[0021] The above figures include the following reference numerals:
[0022] 1. Flexible joint under test; 2. Fixture; 3. Electric rotary table; 4. Light source; 5. Lens; 6. Camera; 7. Computer. Detailed Implementation
[0023] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the present invention or its application or use. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] It should be noted that the terminology used herein is for the purpose of describing particular embodiments and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0025] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of the invention. It should also be understood that, for ease of description, the dimensions of the various parts shown in the drawings are not drawn to actual scale. Techniques, methods, and devices known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and devices should be considered part of the specification. In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values. It should be noted that similar reference numerals and letters in the following figures denote similar items; therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0026] like Figures 1 to 4As shown, a non-contact flexible joint perpendicularity measurement method is provided according to a specific embodiment of the present invention. This method includes: Step 1, fixing the flexible joint to be tested using a fixture mounted on an electric rotary table, controlling a motor to drive the rotary platform and thus rotating the flexible joint around a rotation center; acquiring local images of the flexible joint to be tested multiple times at certain time intervals using a camera and lens; and sending the acquired workpiece images to an image processing unit. Step 2, the image processing unit uses an adaptive edge region localization algorithm to obtain the end face contour edge search region and the thin rod contour edge search region. Step 3, based on the thin rod contour edge search region in Step 2, extracting the sub-pixel edges of the thin rod region; using the RANSAC algorithm, defining points whose distance from the ideal straight line is less than a set distance threshold as inliers, and defining points whose distance from the ideal straight line is greater than or equal to the set distance threshold as noise points; and obtaining the number of inliers after filtering out noise points. According to the steps, the following steps are performed: Step 1: Using iterative weighted least squares method to fit the interior points and generate two edge lines; 2: Calculate the virtual centerline based on the fitted two edge lines, then correct the image to the standard position using the affine transformation matrix, and calculate the corrected grayscale value using bicubic interpolation to obtain the corrected image; Step 2: Based on the corrected image, repeat Step 2 to obtain the end face contour edge search area using an adaptive edge region localization algorithm; Step 3: Based on the end face contour edge search area in Step 4, extract the end face edge contour; Step 4: Reorder the contour points of the end face edge contour; Step 5: Based on the reordered contour points, use iterative weighted least squares method to fit and generate contour lines, with the intersection of the two lines being virtual feature points. N virtual feature points are obtained from N images collected after the flexible joint rotates one revolution. The difference between the maximum and minimum values of the Y coordinate of the virtual feature points is calculated as the pixel distance representing the verticality. Converting the pixel distance to the real physical distance yields the verticality of the flexible joint end face.
[0027] This configuration provides a non-contact method for measuring the perpendicularity of flexible joints. The method first calibrates the camera to obtain intrinsic and extrinsic parameters and correct distortion. A computer controls the rotation of an electric rotary table and LED backlight illumination. A CMOS camera captures the edge contour image of the flexible joint to be measured during one rotation. Then, a perpendicularity detection algorithm obtains virtual feature points where the extended lines of the contour edges intersect. By processing and calculating the maximum deviation of the Y-coordinate of these feature points, the perpendicularity of the flexible joint is obtained. This invention uses visual calibration and image processing algorithms to preprocess images, including noise reduction, segmentation, and mathematical morphology operations, extracting ROI region features and edge contours. It uses iterative weighted least squares to fit lines, thereby obtaining the coordinates of the virtual feature points to be measured on the product. The Random Sample Consensus Algorithm (RANSAC) is used for point set registration, which can handle situations where low precision of the rotating mechanism leads to increased errors, improving measurement accuracy. It can automatically detect the perpendicularity of a large number of flexible joints, improving product manufacturing inspection efficiency. The perpendicularity measurement method of the present invention has the advantages of being non-contact, high precision, high efficiency, and highly automated. It is suitable for rapid detection of the perpendicularity of objects with various complex shapes, especially for the surface perpendicularity measurement of micro-sized workpieces and complex structures. It is also suitable for the perpendicularity detection of flexible joints that cannot be measured by contact, and has broad application prospects.
[0028] Specifically, in order to achieve perpendicularity measurement, the flexible joint to be tested is first fixed by a fixture. The fixture is installed on an electric rotary table. The rotating platform is driven by a motor, which in turn drives the flexible joint to rotate around the rotation center. Local images of the flexible joint to be tested are captured multiple times at certain time intervals by a camera and lens. The camera sends the captured workpiece images to the image processing unit.
[0029] Next, the image processing unit uses an adaptive edge region localization algorithm to obtain the end face contour edge search region and the thin rod contour edge search region.
[0030] As a specific embodiment of the present invention, step two specifically includes: (2.1) For the horizontal contour, Gaussian derivative is calculated in the Y-axis direction, and for the vertical contour, Gaussian derivative is calculated in the X-axis direction; convolution operation is performed to obtain edge features, the floating-point format image is converted into an integer format, and the grayscale is scaled to [0, 255] to enhance the contrast of the image edge region; (2.2) The ROI image is segmented using the OTSU algorithm, the segmented binary image is isolated as a non-connected domain, the corresponding area threshold is set to filter out the impurity region, all non-connected regions are merged and the minimum bounding rectangle of the end face is calculated, the edge region to be tested is limited to the minimum bounding rectangle of the end face, and the area to be tested is expanded to a set range based on the minimum bounding rectangle of the end face to determine the ROI search area of the end face contour edge; (2.3) The two bottom regions of the ROI image are selected and the row and column coordinates of the minimum bounding rectangle of the thin rod are calculated. A rectangular region is generated according to the row and column coordinates, and the upper and lower regions of the rectangular region boundary are trimmed to obtain the two edge regions of the thin rod. The area to be tested is expanded to a set range based on the minimum bounding rectangle of the thin rod to finally determine the search area of the thin rod contour edge.
[0031] Furthermore, after obtaining the end face contour edge search region and the thin rod contour edge search region, image correction can be performed based on the thin rod contour edge search region. Specifically, based on the thin rod contour edge search region in step two, sub-pixel edges of the thin rod region are extracted. Using the RANSAC algorithm, points whose distance from the ideal straight line is less than a set distance threshold are defined as inliers, and points whose distance from the ideal straight line is greater than or equal to the set distance threshold are defined as noise. After filtering out noise, the inlier data is obtained. Iterative weighted least squares method is used to fit the inliers to generate two edge lines. The virtual central axis is calculated based on the two fitted edge lines. Then, the image is corrected to the standard position using the affine transformation matrix, and the corrected grayscale value is calculated using bicubic interpolation to obtain the corrected image.
[0032] In step three, the affine transformation matrix is Where (x,y) are the coordinates of the center of the thin rod region, θ is the deflection angle, and (x m y m () represents the coordinates of the rotation center.
[0033] Furthermore, after image correction is completed, step two can be repeated based on the corrected image to obtain the end face contour edge search area using the adaptive edge region localization algorithm.
[0034] Furthermore, after obtaining the end face contour edge search area, the end face edge contour can be extracted based on the end face contour edge search area in step four.
[0035] In this invention, step five specifically includes: (5.1) For horizontal contours, the ROI needs to be expanded along the Y direction to set the width, and for vertical contours, the ROI needs to be expanded along the X direction to set the width; (5.2) The edge of the expanded end face contour is smoothed using the closing operation smoothing method, and the edge contour is detected using the sub-pixel Canny operator to complete the extraction of the edge contour.
[0036] As a specific embodiment of the present invention, in step (5.2), the sub-pixel Canny operator is used to detect the edge contour. For the double ROI features of the flexible joint end face, the adjacent endpoints of the two contours in the horizontal direction of the middle and the side are extracted respectively. The two endpoints are connected to fill the contour gap and merge the double ROI contours into a single continuous contour. When processing a single ROI, contour merging is not required.
[0037] Furthermore, after extracting the end face edge contour, the contour points of the end face edge contour can be reordered. Specifically, in step six, for the horizontal contour, the contour points are sorted in ascending order according to the Y direction. For the vertical contour, the contour points are sorted in ascending order according to the X direction.
[0038] Furthermore, after reordering the contour points of the end face edge contour, an iterative weighted least squares method can be used to fit and generate contour lines based on the reordered contour points. The intersection of two lines is a virtual feature point. N virtual feature points are obtained from N images acquired after the flexible joint rotates one revolution. The difference between the maximum and minimum values of the Y coordinate of the virtual feature points is calculated as the pixel distance representing the perpendicularity. Converting the pixel distance to the actual physical distance yields the perpendicularity of the flexible joint end face. (Steps two through six are performed for each image to complete image correction, locate the area to be tested, extract edge contours, and reorder contour points, thereby obtaining the virtual feature points of the image.)
[0039] According to another aspect of the present invention, a non-contact flexible joint verticality measurement system is provided, which uses the non-contact flexible joint verticality measurement method described above to measure verticality. The non-contact flexible joint verticality measurement system includes: a flexible joint to be tested (1), a clamp (2), an electric rotary table (3), a light source (4), a lens (5), a camera (6), and a computer (7); the clamp (2) is used to fix the sample to be tested and is connected to the electric rotary table (3); the electric rotary table (3) is used to carry the sample to be tested and rotate it at a uniform speed, and is connected to the computer (7) through a connecting line; the light source (4) provides illumination for the sample to be tested and is connected to the computer (7) through a connecting line; the lens (5) and the camera (6) are connected by assembly and are used to acquire images of the sample to be tested; the computer (7) is used to associate and control the operation of the electric rotary table (3) and the light source (4), the acquisition of images by the lens (5) and the camera (6), and to process the acquired images to calculate the verticality of the flexible joint.
[0040] This configuration provides a non-contact flexible joint perpendicularity measurement system. The system first performs camera calibration to obtain intrinsic and extrinsic parameters and correct distortion. A computer-controlled electric rotary table rotates, and an LED backlight illuminates the surface. A CMOS camera captures the edge contour image of the flexible joint under test during one rotation. Then, a perpendicularity detection algorithm obtains virtual feature points where the extended lines of the contour edge intersect. By processing and calculating the maximum deviation of the Y-coordinate of these feature points, the perpendicularity of the flexible joint is obtained. This invention uses visual calibration and image processing algorithms to automatically detect the perpendicularity of a large number of flexible joints, improving product manufacturing inspection efficiency. The system combines an electric rotary table, a high-resolution camera, a low-distortion telecentric high-precision lens, an LED light source, and a computer control system to achieve rapid and accurate perpendicularity measurement. The advantages of this invention are high-precision measurement, high automation, good repeatability, strong adaptability, and ease of operation and maintenance.
[0041] Furthermore, in this invention, the electric rotary table (3) is a rotary mechanism, and its rotation speed, direction and accuracy can be adjusted.
[0042] As a specific embodiment of the present invention, the lens (5) is a double telecentric lens.
[0043] To gain a further understanding of the present invention, the following description is provided in conjunction with... Figures 1 to 4 The non-contact flexible joint verticality measurement method and system provided by the present invention will be described in detail.
[0044] like Figures 1 to 4As shown, a non-contact flexible joint perpendicularity measurement method is provided according to a specific embodiment of the present invention, which relates to the field of machine vision technology measurement and uses image processing and machine vision technology to measure the perpendicularity of the flexible joint.
[0045] The measurement system mainly includes an industrial camera, lens, light source, electric rotary table, and computer, and relates to a computer-controlled automatic measurement device for measuring the perpendicularity of flexible joint components. The device includes lighting, clamping, a rotation mechanism, a CMOS image detection system, and a computer control unit. The flexible joint to be tested is fixed by a specially designed clamping mechanism, with the clamp mounted on the electric rotary table. A control motor drives the rotation platform, which in turn drives the flexible joint to rotate around a rotation center. The computer controls start, pause, speed, forward and reverse rotation, and acceleration / deceleration settings. One rotation of the flexible joint completes the visual inspection process. During the perpendicularity detection experiment, the brightness of the backlight is adjusted to ensure a high-quality image of the flexible joint's edge contour. Under computer control, the rotation mechanism rotates continuously, and a high-precision CMOS camera and lens repeatedly acquire local images of the flexible joint at certain time intervals. The CMOS camera sends the captured workpiece image to the image processing unit (i.e., computer). The image features are processed using machine vision technology to obtain the edge contour information of the flexible joint. The coordinates of the feature points in each image are obtained by fitting the edge contour line. The longitudinal spacing of the feature points in the image is calculated to obtain the maximum spacing. The actual distance of each pixel is calculated through pixel equivalent calibration. The perpendicularity of the flexible joint can be obtained by converting the pixel distance into the real physical distance. The entire detection process is completed automatically under the control of the computer.
[0046] Due to installation errors between the camera and the flexible joint workpiece, the central axis of the flexible joint is not perfectly perpendicular to the plane of the rotary table. This causes the central axis to rotate within the cylinder, resulting in a deviation of the actual axis from the ideal axis. This angular deviation causes end face skew, leading to vertical offset of the measured feature points and measurement errors. This invention employs a correction algorithm to reduce this detection error. The CMOS camera sends the acquired workpiece image to the image processing unit. Based on an adaptive edge ROI localization algorithm, the image processing unit detects the edge contour of the thin rod and obtains the contour point coordinates after locating the edge region using the sub-pixel Canny operator. The RANSAC algorithm is used to filter out contour noise. By setting a threshold, points less than the ideal straight line are defined as inliers. After noise filtering, inlier data is obtained. Iterative weighted least squares is used to fit the inliers to generate two edge lines. Finally, a virtual central axis is calculated based on the fitted two lines. Through affine transformation and bicubic interpolation, the image is corrected so that the virtual central axis (which is the workpiece's central axis in the image) is perpendicular to the horizontal line, and the corrected grayscale value is obtained. The perpendicularity of the end face is detected using the corrected image, thereby reducing the visual measurement error caused by axis skew.
[0047] The beneficial effects of this invention are: the perpendicularity measurement system of this invention has the advantages of being non-contact, high-precision, high-efficiency, and highly automated, and is suitable for rapid detection of the perpendicularity of objects with various complex shapes, especially for the surface perpendicularity measurement of micro-sized workpieces and complex structures; in addition, this system also has the advantages of being easy to integrate and highly scalable, and can be customized and optimized according to actual needs; it is suitable for the perpendicularity detection of flexible joints that cannot be measured by contact, and has broad application prospects.
[0048] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.
[0049] Step S1: Image acquisition. For example... Figure 1 As shown, a computer-controlled electric rotary table rotates at a constant speed for one revolution, thereby rotating the sample under test for one revolution. During one revolution, backlighting is used for illumination. A camera equipped with a telecentric lens takes multiple photos at regular time intervals to acquire local images of the sample under test. The image acquisition system works in conjunction with the electric rotary table. After the flexible joint is installed, the system automatically acquires the first image. The rotary table drives the flexible joint to rotate. Each time the rotary table reaches a new position, it sends an image acquisition signal to the camera. The camera asynchronously acquires and processes the images until the rotary table has completed one revolution and acquired a set of N images.
[0050] Step S2: Locate the region to be tested. The region to be tested is obtained using an adaptive edge region localization algorithm. For the horizontal contour, Gaussian derivative is calculated along the Y-axis (X-axis is horizontal, Y-axis is vertical). For the vertical contour, Gaussian derivative is calculated along the X-axis. Then, convolution is performed to obtain edge features. The floating-point image is then converted to integer format, and the grayscale is scaled to [0, 255] to enhance the contrast of the image edge regions and improve localization accuracy. The OTSU algorithm is used to segment the ROI (Region of Interest) image, and the segmented binary image is then separated into independent disconnected regions. Appropriate area thresholds are set to filter out impurity regions. Next, all disconnected regions are merged, and the minimum bounding rectangle is calculated to confine the edge region to be tested within the minimum bounding rectangle. Based on the minimum bounding rectangle, the region to be tested is expanded by a certain range to finally determine the range of the edge search ROI, as shown in Figure 3.
[0051] Select the two bottommost regions of the ROI image and calculate the row and column coordinates of the minimum bounding rectangle of the thin rod. Generate a rectangular region based on the row and column coordinates. Trim the upper and lower regions of the rectangular region boundary to obtain the two edge regions of the thin rod. Based on the minimum bounding rectangle of the thin rod, expand the area to be tested to a set range to finally determine the search area for the outline edge of the thin rod.
[0052] Step S3: Based on the thin rod contour edge search region in Step 2, extract the sub-pixel edges of the thin rod region. Using the RANSAC algorithm, points whose distance from the ideal straight line is less than a set distance threshold are defined as inliers, and points whose distance from the ideal straight line is greater than or equal to the set distance threshold are defined as noise. After filtering out noise, obtain the inlier data. Use iterative weighted least squares to fit the inliers to generate two edge lines. Calculate the virtual central axis based on the fitted two edge lines, then correct the image to the standard position using the affine transformation matrix, and use bicubic interpolation to calculate the corrected grayscale value to obtain the corrected image.
[0053] The center coordinates of the thin rod region are (x, y), the deflection angle relative to the y-axis is θ, and the coordinates of the rotation center are (xm, ym). Rotating by -θ degrees relative to the rotation center achieves the correction angle. The corrected center coordinates (x′, y′) can be calculated using the following formula:
[0054]
[0055] Step S4: Based on the corrected image, repeat step two to obtain the end face contour edge search area using an adaptive edge region localization algorithm.
[0056] Step S5: Edge Contour Extraction. After obtaining the end faces in Step 2, for the horizontal contour, the ROI needs to be expanded by a certain width along the Y direction; for the vertical contour, the ROI needs to be expanded along the X direction to prevent contour discontinuities. Smoothing is performed using a closing operation to obtain the horizontal and vertical edge ROIs of the final end face to be processed. The sub-pixel Canny operator is used to detect the edge contours. For the dual ROI features of the flexible joint end face, adjacent endpoints of the two horizontal contours in the middle and side are extracted respectively. The two endpoints are connected to fill the contour gaps, merging the dual ROI contours into a single continuous contour. Contour merging is not necessary when processing a single ROI.
[0057] Step S6: Reorder the contour points. For the horizontal contour, sort the contour points in ascending order of the Y direction. For the vertical contour, sort the contour points in ascending order of the X direction.
[0058] Step S7: Perpendicularity Calculation. Based on the reordered contour points, iterative weighted least squares fitting is used to generate contour lines. The intersection of two lines is a virtual feature point (e.g., D1, D2 in Figure 3). N virtual feature points are obtained from N images acquired after the flexible joint rotates one revolution. The difference between the maximum and minimum Y-coordinate values of the virtual feature points is calculated as the pixel distance representing the perpendicularity. Finally, the pixel distance is converted into the actual physical distance to obtain the perpendicularity of the flexible joint end face.
[0059] In this invention, the electric rotary table and clamping tool, camera and lens, etc., can all be replaced with other alternatives.
[0060] The inventive point of this invention:
[0061] 1. Select the virtual feature points of the flexible joint as the intersection of the straight lines extending from the contour edge.
[0062] 2. Error compensation is performed for the insufficient precision of the electric rotary table, the assembly error between the product under test and the fixture, and the relative planar position deviation between the product under test and the camera lens light source.
[0063] Feasibility and beneficial effects:
[0064] Image processing algorithms based on machine vision principles can perform preprocessing such as noise reduction, segmentation, and mathematical morphological operations on images, extract ROI region features and edge contours, and fit lines using the least squares method, thereby obtaining the coordinates of virtual feature points of the product under test. The Random Sample Consensus (RANSAC) algorithm is used for point set registration, which can handle situations where low precision of the rotary mechanism leads to increased errors, thus improving measurement accuracy.
[0065] In summary, this invention discloses a method and apparatus for measuring the perpendicularity of flexible joints using a dynamically tuned gyroscope based on machine vision. This method relates to the field of machine vision measurement technology and utilizes image processing and machine vision techniques to measure the perpendicularity of flexible joints. The method first performs camera calibration to obtain intrinsic and extrinsic parameters and correct distortion. A computer controls the rotation of an electric rotary table and LED backlight illumination. An edge contour image of the measured part of the flexible joint is acquired using a CMOS camera during one rotation. Then, a perpendicularity detection algorithm obtains virtual feature points where the extended lines of the contour edges intersect. The perpendicularity of the flexible joint is obtained by processing and calculating the maximum deviation of the Y-coordinate of these feature points. This invention uses visual calibration and image processing algorithms to automatically detect the perpendicularity of a large number of flexible joints, improving product manufacturing inspection efficiency. The system combines an electric rotary table, a high-resolution camera, a low-distortion telecentric high-precision lens, an LED light source, and a computer control system to achieve rapid and accurate perpendicularity measurement. The advantages of this invention are high-precision measurement, high automation, good repeatability, strong adaptability, and ease of operation and maintenance.
[0066] For ease of description, spatial relative terms such as "above," "on top of," "on the upper surface of," "above," etc., are used herein to describe the spatial positional relationship of a device or feature as shown in the figures to other devices or features. It should be understood that spatial relative terms are intended to encompass different orientations in use or operation beyond the orientation of the device as described in the figures. For example, if the device in the figures were inverted, a device described as "above" or "on top of" other devices or structures would subsequently be positioned as "below" or "under" other devices or structures. Thus, the exemplary term "above" can include both "above" and "below." The device may also be positioned in other different ways (rotated 90 degrees or in other orientations), and the spatial relative descriptions used herein will be interpreted accordingly.
[0067] Furthermore, it should be noted that the use of terms such as "first" and "second" to define components is merely for the purpose of distinguishing the corresponding components. Unless otherwise stated, the above terms have no special meaning and therefore should not be construed as limiting the scope of protection of this invention.
[0068] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A non-contact method for measuring the perpendicularity of a flexible joint, characterized in that, The method for measuring the perpendicularity of the non-contact flexible joint includes: Step 1: Fix the flexible joint to be tested with a fixture. The fixture is installed on an electric rotary table. The motor drives the rotary platform, which in turn drives the flexible joint to rotate around the rotation center. The camera and lens acquire local images of the flexible joint to be tested multiple times at certain time intervals. The camera sends the acquired workpiece images to the image processing unit. Step 2: The image processing unit uses an adaptive edge region localization algorithm to obtain the end face contour edge search region and the thin rod contour edge search region; Step 3: Based on the thin rod contour edge search region in Step 2, extract the sub-pixel edges of the thin rod region. Using the RANSAC algorithm, points whose distance from the ideal straight line is less than a set distance threshold are defined as inliers, and points whose distance from the ideal straight line is greater than or equal to the set distance threshold are defined as noise. After filtering out noise, obtain the inlier data. Use iterative weighted least squares to fit the inliers and generate two edge lines. Calculate the virtual centerline based on the fitted two edge lines, then correct the image to the standard position using the affine transformation matrix, and use bicubic interpolation to calculate the corrected grayscale value to obtain the corrected image. Step 4: Based on the corrected image, repeat step 2 and use the adaptive edge region localization algorithm to obtain the end face contour edge search region; Step 5: Extract the end face edge contour based on the end face contour edge search area in Step 4; Step 6: Reorder the contour points of the end face edge contour; Step 7: Based on the reordered contour points, use iterative weighted least squares method to fit and generate contour lines. The intersection of two lines is a virtual feature point. N virtual feature points are obtained from N images collected after the flexible joint rotates one revolution. The difference between the maximum and minimum values of the Y coordinate of the virtual feature points is calculated as the pixel distance representing the perpendicularity. The perpendicularity of the flexible joint end face can be obtained by converting the pixel distance into the real physical distance.
2. The method for measuring the perpendicularity of a non-contact flexible joint according to claim 1, characterized in that, Step two specifically includes: (2.1) For the horizontal contour, Gaussian derivative is taken in the Y-axis direction, and for the vertical contour, Gaussian derivative is taken in the X-axis direction; convolution operation is performed to obtain edge features, the floating-point format image is converted into integer format, and then the grayscale is scaled to [0, 255] to enhance the contrast of the image edge region; (2.2) The OTSU algorithm is used to segment the ROI image. The segmented binary image is isolated as a non-connected domain. The corresponding area threshold is set to filter out the impurity region. After merging all non-connected regions, the minimum bounding rectangle of the end face is calculated. The edge region to be tested is limited to the minimum bounding rectangle of the end face. Based on the minimum bounding rectangle of the end face, the area to be tested is expanded to a set range to determine the ROI search area of the end face contour edge. (2.3) Select the two bottom regions of the ROI image and calculate the row and column coordinates of the minimum bounding rectangle of the thin rod. Generate a rectangular region based on the row and column coordinates. Trim the upper and lower regions of the rectangular region boundary to obtain the two edge regions of the thin rod. Based on the minimum bounding rectangle of the thin rod, expand the range of the region to be tested to finally determine the search area of the thin rod contour edge.
3. The method for measuring the perpendicularity of a non-contact flexible joint according to claim 1, characterized in that, In step three, the affine transformation matrix is Where (x,y) are the coordinates of the center of the thin rod region, θ is the deflection angle, and (x m y m () represents the coordinates of the rotation center.
4. The method for measuring the perpendicularity of a non-contact flexible joint according to any one of claims 1 to 3, characterized in that, Step five specifically includes: (5.1) For horizontal contours, the ROI needs to be expanded and its width set along the Y direction; for vertical contours, the ROI needs to be expanded and its width set along the X direction. (5.2) The edge of the expanded end face contour is smoothed by using the closing operation smoothing method, and the edge contour is extracted by using the sub-pixel Canny operator.
5. The method for measuring the perpendicularity of a non-contact flexible joint according to claim 4, characterized in that, In step (5.2), the subpixel Canny operator is used to detect the edge contour. For the double ROI features of the flexible joint end face, the adjacent endpoints of the two contours in the horizontal direction of the middle and the side are extracted respectively. The two endpoints are connected to fill the contour gap and merge the double ROI contours into a single continuous contour. When processing a single ROI, contour merging is not required.
6. The method for measuring the perpendicularity of a non-contact flexible joint according to any one of claims 1 to 5, characterized in that, In step six, for the horizontal contour, the contour points are sorted in ascending order according to the Y direction. For the vertical contour, the contour points are sorted in ascending order according to the X direction.
7. A non-contact flexible joint perpendicularity measurement system, characterized in that, The non-contact flexible joint verticality measurement system uses the non-contact flexible joint verticality measurement method as described in any one of claims 1 to 6 to measure verticality.
8. The non-contact flexible joint perpendicularity measurement system according to claim 7, characterized in that, The non-contact flexible joint verticality measurement system includes: a flexible joint to be tested (1), a clamp (2), an electric rotary table (3), a light source (4), a lens (5), a camera (6), and a computer (7); the clamp (2) is used to fix the sample to be tested and is connected to the electric rotary table (3); the electric rotary table (3) is used to carry the sample to be tested and make it rotate at a constant speed, and is connected to the computer (7) through a connecting line; the light source (4) provides illumination for the sample to be tested and is connected to the computer (7) through a connecting line; the lens (5) and the camera (6) are connected by assembly and are used to acquire images of the sample to be tested; the computer (7) is used to associate and control the operation of the electric rotary table (3) and the light source (4), the acquisition of images by the lens (5) and the camera (6), and to process the acquired images to calculate the verticality of the flexible joint.
9. The non-contact flexible joint perpendicularity measurement system according to claim 8, characterized in that, The electric rotary table (3) is a rotary mechanism and can adjust the rotation speed, direction and accuracy.
10. The non-contact flexible joint perpendicularity measurement system according to claim 8, characterized in that, The lens (5) is a double telecentric lens.