A machine vision-based part turning displacement detection method
The machine vision-based method for detecting part turning displacement solves the problems of scratching parts by contact sensors and high material requirements of non-contact sensors. It achieves non-contact, high-precision detection of part displacement and is applicable to parts made of various materials.
Patent Information
- Application Number
- CN202311462947.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-06
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2043-11-06
AI Technical Summary
In existing technologies, contact sensors are prone to scratching the surface of parts when detecting part displacement, while non-contact sensors have high requirements for the material of the parts and cannot meet the needs of high precision and non-contact detection.
A machine vision-based method for detecting part turning displacement is adopted. Through vision acquisition system calibration, image preprocessing, subpixel contour detection, actual size contour conversion, segmented contour fitting, and three-dimensional coordinate acquisition, non-contact and accurate detection of part displacement is achieved.
It enables non-contact measurement of part displacement, improves detection accuracy, does not affect part processing, is applicable to parts of various materials, and does not require markings to be affixed to the parts.
Smart Images

Figure CN118357480B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of visual measurement and part turning displacement detection technology. Specifically, this invention relates to a method for detecting part turning displacement based on machine vision. Background Technology
[0002] Turning is an important means of machining parts. Monitoring the displacement of different areas of turned parts is of great significance for improving the quality of turned products and adjusting process parameters.
[0003] Currently, the detection of part displacement can be mainly divided into two types: contact and non-contact. Contact methods use contact sensors to measure the part's position; however, these sensors need to be in contact with the part being measured. When the part is moving, these sensors are not suitable as they can scratch the part's surface. Non-contact methods mainly use non-contact sensors, primarily electromagnetic sensors, but they have high requirements for the material of the parts.
[0004] For example, patent document CN112517940A discloses an in-situ detection device and its application method for ultra-precision turning. The in-situ detection device for ultra-precision turning includes a three-dimensional precision adjustment stage, a five-dimensional precision adjustment stage, a fixture, a small-aperture interferometer assembly, and a computational hologram plate. The five-dimensional precision adjustment stage and the fixture are respectively mounted on the three-dimensional precision adjustment stage. The small-aperture interferometer assembly is mounted on the fixture, and the computational hologram plate is mounted on the five-dimensional precision adjustment stage. The application method of this invention is an in-situ detection method for optical elements under test that exceed the measurement aperture of the small-aperture interferometer assembly. This invention can achieve in-situ detection of wavefront interferometry, improve the accuracy of wavefront interferometry detection, and further improve the efficiency of ultra-precision turning, especially suitable for in-situ detection of large-aperture optical elements. However, the technical solution disclosed in this patent document cannot solve the aforementioned technical problems. Summary of the Invention
[0005] This invention aims to solve at least one of the technical problems existing in the prior art. To this end, this invention provides a machine vision-based method for detecting part turning displacement, with the goal of achieving non-contact and accurate detection of part displacement, providing a data foundation for adjusting and optimizing part turning process parameters.
[0006] To achieve the above objectives, the technical solution adopted by the present invention is: a machine vision-based method for detecting the turning displacement of parts, comprising the following steps:
[0007] S1. Calibrate the vision acquisition system;
[0008] S2. Use a vision acquisition system to acquire motion images of the turned parts;
[0009] S3. Preprocess the motion image of the turned part obtained in step S2;
[0010] S4. Subpixel contour detection of machined parts;
[0011] S5. Convert the subpixel contour of the machined part into the actual size contour.
[0012] S6. Divide the actual size contour into segments and obtain the segmented contour;
[0013] S7. Find the center point by fitting the segmented contour straight line to obtain the marker point of the segmented region;
[0014] S8. Obtain the three-dimensional coordinates of the marker point;
[0015] S9. Extract the displacement information of the machined part.
[0016] Furthermore, the visual acquisition system includes a camera. In step S1, a checkerboard calibration plate is used to calibrate the camera distortion parameters using the Zhang Zhengyou calibration method. Based on the camera imaging model and the geometry of the machined part, the imaging plane of the machined part is determined. Based on the homography matrix, the dimensional transformation relationship between the imaging plane and the image plane is determined.
[0017] Furthermore, in step S1, a checkerboard is used for calibration, and the distortion coefficient of the camera is obtained using the Zhang Zhengyou camera calibration method. The checkerboard calibration plate is placed on the imaging plane of the mechanical spindle, and the homography matrix between the image plane and the imaging plane of the camera is obtained based on the corner points on the checkerboard. The conversion between the pixel coordinate system and the world coordinate system is realized through the homography matrix.
[0018] Furthermore, in step S5, the obtained sub-pixel contour coordinates of the part are transformed into the contour coordinates of the part in the real world coordinate system based on the camera imaging model and the homography matrix obtained in step S1.
[0019] Furthermore, in step S3, distortion correction and image filtering are performed on the motion image of the machined part, and grayscale is converted to obtain a grayscale image of the machined part. Then, ROI extraction is performed to remove irrelevant regions of the image.
[0020] Furthermore, step S3 includes determining the detection area. Since the visual inspection device is fixedly installed and the mechanical spindle vibration range is small, a fixed area is selected as the detection area. Taking into account both the efficiency and effect of filtering, a 5×5 Gaussian filter is used for filtering. In each pixel, the gray value with the largest gray value in the R, G, and B color spaces is taken as the gray value of the grayscale image, thereby realizing the grayscale conversion of the color image.
[0021] Furthermore, step S4 includes the extraction of the sub-pixel edge contour of the mechanical spindle. First, the pixel contour of the mechanical spindle is obtained using Canny edge detection. Based on this, the pixel contour is further refined using local area effect sub-pixel edge detection to obtain the sub-pixel contour of the mechanical spindle.
[0022] Furthermore, in step S5, the two-dimensional coordinates of the subpixel contour image of the mechanical spindle are converted into two-dimensional coordinates in the world coordinate system. Through the homography matrix between the imaging plane and the image plane calibrated in step (1), the pixel two-dimensional coordinates are converted into actual two-dimensional coordinates (the unit of contour point coordinates is converted from pixel to mm).
[0023] Furthermore, step S6 includes segmenting the actual two-dimensional contour points, selecting an appropriate segmentation distance based on different detection accuracy requirements, and segmenting from a unified starting point and the same axial direction.
[0024] Furthermore, step S7 includes performing straight line fitting on the segmented contours, performing straight line fitting on the left and right contours of the part respectively, and obtaining the center coordinates of the segmented contours based on this, which are used as the marker points of the segmented regions.
[0025] In step S7, the line segment equations of the discrete edge contours of the principal axis are obtained by using least squares linear fitting. Based on symmetry, the center coordinates of the two line segment equations are obtained as marker points of the segmented regions.
[0026] Furthermore, step S8 includes obtaining the three-dimensional coordinates of the segmented contour center by using the coordinates of the corresponding segmented contour marker points obtained from two mutually perpendicular cameras to obtain the three-dimensional coordinates of the marker points.
[0027] In step S8, the X-axis is taken as the axis of the machined part. The xy plane position of the machined part is obtained by the first set of cameras, and the xz plane position of the machined part is obtained by the second set of cameras. The coordinates of the segmented contour marker points are (x, y, z).
[0028] Furthermore, step S9 includes extracting part displacement information. Using the frequency of camera photography, i.e. the order in which the camera captures images, as a time metric, the three-dimensional coordinates of the center corresponding to each image are extracted, and the coordinate changes of the center point are calculated to obtain displacement information of different regions of the part.
[0029] In step S9, frames are extracted from a group of captured video streams according to the time sequence of the video, and the three-dimensional coordinates t1=(x1,y1,z1) and t2=(x2,y2,z2) of the same marker point in different frame images are extracted. Then the displacement of the marker point is (x2-x1,y2-y1,z2-z1).
[0030] The machine vision-based method for detecting turning displacement of parts has the following advantages:
[0031] 1) Use binocular vision to measure the displacement data of each area of the part in real time during turning, without contacting the part being measured, and without affecting the turning process of the part;
[0032] 2) Extract the pixel contours in the image, transform them to the real world coordinate system for contour segmentation, and take the center points of the two line segments of the segmented contour fitting as the marker points. This will not be affected by the asymmetry of the light source or the non-coincidence of the imaging plane and the axis of rotation.
[0033] 3) It is not necessary to affix markings to the inspection object, but rather to combine the characteristic points inherent in the rotary turning part itself. Attached Figure Description
[0034] This manual includes the following figures, which illustrate the following:
[0035] Figure 1 This is a flowchart of the machine vision-based part turning displacement detection method of the present invention;
[0036] Figure 2 This is the front view of the vision acquisition system;
[0037] Figure 3 This is a side view of the vision acquisition system;
[0038] Figure 4 This is a schematic diagram of image acquisition;
[0039] Figure 5 This is a schematic diagram of the chessboard pattern used for calibration;
[0040] Figure 6 It is a schematic image of the machined part;
[0041] Figure 7 This is a schematic diagram of the outline of a solid of revolution;
[0042] Figure 8 This is a schematic diagram of contour segmentation and marker point extraction;
[0043] The diagram is labeled as follows: 1. Camera; 2. Plane light source; 3. Part. Detailed Implementation
[0044] The specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings, in order to help those skilled in the art to have a more complete, accurate and in-depth understanding of the concept and technical solutions of the present invention, and to facilitate its implementation.
[0045] like Figure 1As shown, the present invention provides a machine vision-based method for detecting the turning displacement of parts, comprising the following steps:
[0046] S1. Calibrate the vision acquisition system;
[0047] S2. Use a vision acquisition system to acquire motion images of the turned parts;
[0048] S3. Preprocess the motion image of the turned part obtained in step S2;
[0049] S4. Subpixel contour detection of machined parts;
[0050] S5. Convert the subpixel contour of the machined part into the actual size contour.
[0051] S6. Divide the actual size contour into segments and obtain the segmented contour;
[0052] S7. Find the center point by fitting the segmented contour straight line to obtain the marker point of the segmented region;
[0053] S8. Obtain the three-dimensional coordinates of the marker point;
[0054] S9. Extract the displacement information of the machined part.
[0055] Specifically, such as Figure 2 and Figure 3 As shown, the vision acquisition system consists of two sets of backlit image acquisition devices. Each backlit image acquisition device comprises a planar light source and a camera. The spindle of the machine under test is located between the planar light source and the camera. The workpiece being machined is a rotating body, mounted on the machine spindle of the lathe. The two sets of backlit image acquisition devices are arranged perpendicularly to each other, with the axis of the camera in one set perpendicular to the axis of the camera in the other set.
[0056] In step S2 above, a set of backlight image acquisition devices are used to acquire images of the turning motion of the part. The edge contour of the turned part is obtained through image processing. Then, the pixel size is converted into the actual size through the camera imaging model and calibration parameters. The center coordinates are obtained by segmenting the actual size contour and using them as marker points. The three-dimensional coordinates of the marker points in the corresponding segmented areas are obtained by combining the two sets of part images. The mechanical spindle vibration information is obtained through multiple frames of images.
[0057] In this invention, the vision acquisition system is first calibrated to obtain the camera distortion coefficients and the imaging plane of the part under test. Then, the vision acquisition system acquires turning images of the part in real time. Next, the acquired part images are preprocessed to eliminate camera distortion and image noise, determine the region of interest, and convert it to grayscale to obtain a grayscale image of the part under test. Then, the sub-pixel edge contours of the part are extracted, the edge contours in the image coordinate system are transformed to the actual coordinate system, and the edge contours are segmented. Line segment fitting is performed on the two contours of the segment, and the center point of the line segment is used as the marker point of the segmented region of the part. Combined with the two-dimensional coordinates of the same center point calculated from images taken by two cameras, the three-dimensional coordinates of the center point are obtained. Finally, based on the changes in the three-dimensional coordinates of the marker points of the same segmented region in the images at different times, the turning displacement information of the part is extracted. This machine vision-based part turning displacement detection method can achieve non-contact measurement of turned parts and simultaneously acquire the motion deformation of different areas of the spindle.
[0058] In step S1 above, a checkerboard calibration plate is used to calibrate the camera distortion parameters using the Zhang Zhengyou calibration method. Based on the camera imaging model and the geometry of the machined part, the imaging plane of the machined part is determined. Then, based on the homography matrix, the dimensional transformation relationship between the imaging plane and the image plane is determined. Specifically, using... Figure 5 The checkerboard calibration board shown is used to calibrate camera distortion parameters and the conversion relationship between the pixel plane and the actual plane. Twenty calibration images are taken, and the distortion coefficients are calculated using Zhang Zhengyou's calibration method. Distortion correction is then applied to each acquired image. Based on the camera's field of view and distance from the mechanical spindle, the imaging plane is determined. The calibration board is placed on the imaging plane, and the homography matrix H is calculated based on the one-to-one correspondence between corner points in the image and corner points on the calibration board. Pixel coordinates = H × actual coordinates.
[0059] In step S3 above, distortion correction and image filtering are performed on the acquired motion image of the machined part, and grayscale conversion is performed to obtain a grayscale image of the machined part. Then, ROI extraction is performed to remove irrelevant regions of the image. Figure 6 The image shown is a schematic diagram of the machined part. A 5×5 Gaussian filter was used for filtering, and the maximum gray value in the R, G, B color space was used as the gray value of the corresponding gray image pixel. At the same time, the mechanical spindle image was extracted using a fixed position method.
[0060] In steps S4, S5, and S6 above, the actual contour of the turned part is detected and segmented. The edge contour of the part is obtained using edge detection methods. Based on this, sub-pixel edge detection is used to further improve the accuracy of contour detection. In order to determine the detection marker points and achieve the matching of marker points in the binocular camera detection, the image edge contour is transformed into the real world coordinate system to obtain the contour coordinates of the part in the real world coordinate system. According to the displacement detection accuracy requirements in the world coordinate system, the contour coordinates are segmented from the end of the part.
[0061] Specifically, in step S4 above, the edge contours of the image are extracted, such as... Figure 7 The image shows the extracted edge contour of the part. The edge contour of the image is extracted based on the grayscale gradient, and the Canny edge detection algorithm is used to obtain the part contour. Based on this, a sub-pixel edge detection method based on local area effect is used to perform sub-pixel edge detection, improving measurement accuracy. In step S5 above, based on the camera imaging model and the homography matrix obtained in step S1, the obtained sub-pixel contour coordinates of the part are transformed into part contour coordinates in the real world coordinate system. In step S5 above, the homography matrix is used to convert the pixel size into the actual size, and the actual edge contour point = H. -1 × pixel edge contour points.
[0062] Steps S6 and S7 above include segmentation and fitting of the principal axis edge contour points. For example... Figure 8 As shown, starting from the end point of the part, segments are numbered a, b, c, ... according to a fixed distance D. Least-squares line fitting is performed on the contour data points of a single region to obtain the center points Pa, Pb, Pc, ...
[0063] In step S7 above, the line segment equations of the discrete edge contour of the principal axis are obtained by using least squares linear fitting. Based on symmetry, the center coordinates of the two line segment equations are obtained as the marker points of the segmented region.
[0064] In step S8 above, the X-axis is taken as the axis of the machined part. The xy plane position of the machined part is obtained by the first set of cameras, and the xz plane position of the machined part is obtained by the second set of cameras. The coordinates of the segmented contour marker points are (x, y, z).
[0065] Step S8 above includes fusing the two-dimensional coordinates of corresponding segmented data points from a set of images (images taken by two cameras) to obtain three-dimensional data points for the segmented regions. Specifically, the first set of cameras extracts the xy coordinates (x, y) of the center point of the segmented region, and the second set of cameras extracts the xz coordinates (x, z) of the corresponding center point of the segmented region. The two are then merged to obtain the three-dimensional coordinates (x, y, z) of the center point of the segmented region.
[0066] Step S9 above includes using multiple frames of images to extract the three-dimensional coordinate points of the corresponding segmented regions of each frame, comparing the changes in data between consecutive frames, and obtaining the displacement of the part in the segmented regions. The three-dimensional coordinates of the same marker point in different frames are t1 = (x1, y1, z1) and t2 = (x2, y2, z2), so the displacement of the marker point is (x2-x1, y2-y1, z2-z1), thus obtaining the three-dimensional movement of different regions of the turned part.
[0067] The present invention has been described above by way of example with reference to the accompanying drawings. Obviously, the specific implementation of the present invention is not limited to the above-described manner. Any non-substantial improvements made using the inventive concept and technical solution; or the direct application of the inventive concept and technical solution to other situations without modification, are all within the protection scope of the present invention.
Claims
1. A machine vision-based method for detecting the turning displacement of parts, characterized in that, Including the following steps: S1. Calibrate the vision acquisition system to obtain the camera distortion coefficient and the imaging plane of the part under test; S2. Use a vision acquisition system to acquire motion images of the turned parts; S3. Preprocess the motion image of the turned part obtained in step S2 to eliminate camera distortion and image noise, determine the region of interest and convert it to grayscale to obtain a grayscale image of the part to be tested. S4. Subpixel contour detection of machined parts; S5. Convert the subpixel contour of the machined part into the actual size contour. S6. Segment the actual dimension contour along the axial direction to obtain the axial segmented contour; S7. Find the center point by fitting the segmented contour straight line to obtain the marker point of the segmented region; The least squares line fitting method is used to obtain the line segment equations of the discrete edge contours of the principal axis. Based on symmetry, the center coordinates of the two line segment equations are obtained as the marker points of the segmented regions. S8. Using the two-dimensional coordinates of the same center point calculated by two cameras, obtain the three-dimensional coordinates of the marker point; With the axis of the machined part as the X-axis, the first set of cameras obtains the xy plane position of the machined part, and the second set of cameras obtains the xz plane position of the machined part. The coordinates of the segmented contour marker points are (x, y, z). S9. Extract the displacement information of the turned part based on the changes in the three-dimensional coordinates of the marker points in the same segmented area of the image at different times.
2. The machine vision-based part turning displacement detection method according to claim 1, characterized in that, The visual acquisition system includes a camera. In step S1, a checkerboard calibration plate is used to calibrate the camera distortion parameters using the Zhang Zhengyou calibration method. Based on the camera imaging model and the geometry of the machined part, the imaging plane of the machined part is determined. Based on the homography matrix, the size transformation relationship between the imaging plane and the image plane is determined.
3. The machine vision-based part turning displacement detection method according to claim 2, characterized in that, In step S5, the obtained sub-pixel contour coordinates of the part are transformed into part contour coordinates in the real world coordinate system based on the camera imaging model and the homography matrix obtained in step S1.
4. The machine vision-based part turning displacement detection method according to any one of claims 1 to 3, characterized in that, In step S3, distortion correction and image filtering are performed on the motion image of the machined part, and grayscale is converted to obtain a grayscale image of the machined part. Then, ROI extraction is performed to remove irrelevant regions of the image.
5. The machine vision-based part turning displacement detection method according to claim 4, characterized in that, In step S3, a 5×5 Gaussian filter is used for image filtering.
6. The machine vision-based part turning displacement detection method according to claim 4, characterized in that, In step S3, when preprocessing the motion image of the machined part, for each pixel, the largest gray value among the three color spaces R, G, and B is taken as the gray value of the grayscale image, thus realizing the grayscale conversion of the color image.
7. The machine vision-based part turning displacement detection method according to any one of claims 1 to 3, characterized in that, In step S9, frames are extracted from a set of video streams according to the time sequence of the video, and the three-dimensional coordinates of the same marker point in different frame images are extracted: t1=(x1, y1, z1) and t2=(x2, y2, z2). Then the displacement of the marker point is (x2-x1, y2-y1, z2-z1).
Citation Information
Patent Citations
Ultra-precision turning in-place detection device and application method thereof
CN112517940A
Dam body surface displacement non-contact measuring method based on binocular vision
CN110332894A
ArUco code-based structure plane displacement visual monitoring method
CN115289982A