Method and device for measuring bending angle of CNC bending workpiece based on binocular camera
Through the non-contact measurement method based on binocular camera, the accuracy and efficiency problems of angle measurement of CNC bending workpieces are solved, and high-precision online measurement is achieved, which is suitable for angle detection during the cold processing of metal thin plates.
Patent Information
- Application Number
- CN202210907206.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-29
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2042-07-29
AI Technical Summary
The existing CNC bending workpiece angle measurement has the problems of low accuracy, low efficiency and easy scratching, making it difficult to achieve high-precision online measurement.
A non-contact measurement method based on a binocular camera is adopted. By calibrating the internal and external parameters of the binocular camera, a line laser is introduced to obtain point cloud data, calculate the angle between the workpiece and the lower mold surface, and use multi-line structured light and a rotating platform to adjust the viewing angle to achieve high-precision angle measurement.
It achieves efficient and accurate workpiece angle measurement, overcomes the inefficiency and low precision of traditional manual inspection, and meets the needs of modern production.
Smart Images

Figure CN115330845B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field related to photoelectric detection, and more specifically, relates to a method and device for measuring the bending angle of a CNC bending workpiece based on a binocular camera. Background Art
[0002] CNC bending is a commonly used cold working process for thin metal sheets. It boasts high utilization rates, stable product functionality, and low costs. Consequently, bent workpieces are widely used in key economic sectors such as automobiles, home appliances, and construction. The bending process utilizes the plastic deformation properties of metal. A sheet is placed between the upper and lower dies of a CNC bending machine, and the two dies squeeze the sheet to create a workpiece with a specific angle.
[0003] However, the metal sheets obtained by cold bending are elastic. When the external force applied by the bending machine disappears, the sheet will rebound, resulting in a deviation between the actual bending angle and the expected bending angle, affecting product quality. At present, most CNC system angle control adopts an open-loop control method with offline measurement, quantitative compensation, and multiple corrections. Among them, the workpiece angle measurement link mostly adopts manual mechanical measurement, which has the disadvantages of low measurement accuracy, low efficiency, and easy scratching of the measured workpiece. Some scholars are committed to studying the metal bending rebound model and using it to predict the amount of sheet rebound and then compensate for the bending parameters of the CNC system. However, there are many factors that affect the amount of sheet rebound, including: sheet size, shape, thickness, material, and the shape and structure of the mold, etc. It is difficult for the rebound model to cover all factors. A more reliable solution is to perform high-precision online angle measurement of the metal bending workpiece to provide a basis for bending compensation parameters for subsequent secondary or multiple bending.
[0004] In summary, the purpose of the present invention is to propose a non-contact measurement method to complete the efficient and accurate measurement of bent workpieces to meet the production requirements of modern enterprises. Summary of the Invention
[0005] In response to the above defects or improvement needs of the prior art, the present invention provides a method and device for measuring the bending angle of a CNC bending workpiece based on a binocular camera, which solves the problems of low accuracy, low efficiency and easy scratches on the workpiece in the angle measurement of the bending workpiece.
[0006] To achieve the above object, according to one aspect of the present invention, a method for measuring the bending angle of a CNC bending workpiece based on a binocular camera is provided, the method comprising:
[0007] S1 calibrates the binocular camera to obtain the intrinsic and extrinsic parameters of the binocular camera;
[0008] S2 introduces two line lasers on a bending surface α of the bent workpiece to be inspected and the lower die of the machine tool, uses a binocular camera to respectively capture images of the two line lasers, and processes the images to obtain point cloud data of the two line lasers;
[0009] S3 selects three points from the point cloud data and determines whether the three points are collinear. If so, reselects points. Otherwise, calculates the equation of the plane containing the three points, calculates the distance from the remaining points in the point cloud data to the plane, compares the distance with a preset threshold, and defines points smaller than the preset threshold as points within the plane. Counts the number of points within the plane.
[0010] S4 repeats step S3 for a preset number of times to obtain multiple planes and the number of points contained in each plane, retains the plane containing the most points as the desired plane, fits the points outside the desired plane to another plane equation, and calculates the angle between the plane and the desired plane, which is the angle between a surface α of the bent part and the lower die surface of the machine tool;
[0011] S5 repeats steps S2 to S4 for the other surface β of the bent part to obtain the angle between the other surface β of the bent part and the lower die surface of the machine tool, and calculates the angle between the bent part surfaces α and β using the angles between the bent part surfaces α and β and the lower die surface of the machine tool respectively.
[0012] Further preferably, in step S2, the image is processed according to the following steps:
[0013] S21 uses the intrinsic and extrinsic parameters of the binocular camera obtained in step S1 to perform stereo correction on the images captured by the binocular camera so that the same point in space is on the same horizontal line in the two images;
[0014] S22 matches the feature points of the two images captured by the binocular camera and calculates the depth information of each feature point.
[0015] Further preferably, in step S22, after the feature points are matched, the disparity of the spatial midpoint in the two images of the binocular camera needs to be calculated.
[0016] Further preferably, in step S22, the depth information is calculated according to the following expression:
[0017]
[0018] Among them, Z is the depth information of the spatial point q, that is, the Z-axis coordinate, x ql is the coordinate of the spatial point q in the X-axis direction in the image obtained by the left camera in the binocular camera, x qr is the Y-axis coordinate of the spatial point q in the image obtained by the right camera in the binocular camera, b is the baseline distance between the two cameras, and f is the focal length of the binocular camera.
[0019] Further preferably, before step S21, the image obtained by the binocular camera needs to be preprocessed, and the preprocessing includes filtering out noise and thresholding, so as to filter out reflected light outside the linear laser light strip.
[0020] Further preferably, in step S21, the NCC algorithm is used to perform stereoscopic correction on the image.
[0021] Further preferably, in step S5, the angle θ between the bending part surfaces α and β is calculated according to the following expression:
[0022] θ=360-θ1-θ2
[0023] Among them, θ1 is the angle between surface α and the lower mold surface, and θ2 is the angle between surface β and the lower mold surface.
[0024] Further preferably, the angle θ1 between the surface α and the lower mold surface is calculated according to the following expression:
[0025]
[0026] Where a1 and b1 are the coefficients of the plane equation fitted to the points within the plane, and a2 and b2 are the coefficients of the plane equation fitted to the points outside the plane.
[0027] Further preferably, in step S3, the distance d from the remaining points in the point cloud data to the plane is calculated. i Follow the following expression:
[0028] d i =|a0x i +b0y i +z i -d0|
[0029] Among them, x i ,y i and z i are the coordinates of point i along the three coordinate axes, a0, b0, z0 and d0, and the coefficients of the plane a0x+b0y+z=d0 fitted by it.
[0030] According to another aspect of the present invention, a measuring device for the above-mentioned measuring method is provided, the device comprising a binocular camera, a laser, a base and a rotating platform, wherein:
[0031] The rotating platform is arranged on the base and can rotate up and down along the Y-axis direction. The laser and the binocular camera are arranged on the rotating platform. At the same time, the binocular camera and the laser can both rotate along the Z-axis direction.
[0032] In general, the above technical solutions conceived by the present invention have the following beneficial effects compared with the prior art:
[0033] 1. This invention provides a method for measuring the parameters of bent workpieces based on multi-line structured light. First, laser light stripe features are assigned to the smooth workpiece surface. Then, through a series of steps including image preprocessing, centerline extraction, and point cloud reconstruction, the two-dimensional image information of the left and right light stripes is converted into three-dimensional spatial information, indirectly enabling non-contact angle measurement of the bent workpiece. This method overcomes the shortcomings of traditional manual inspection methods, such as inefficiency, low precision, and susceptibility to scratches, while meeting the requirements for measurement accuracy and time. It has considerable application value in CNC bending workpiece parameter measurement.
[0034] 2. The present invention proposes a bending workpiece parameter measurement device based on multi-line structured light. The laser beam projection path can be adjusted through the laser bracket, and the camera shooting angle can be adjusted through the rotating platform and camera bracket. It can provide an image with an ideal laser light strip distribution position for the point cloud generation step, thereby achieving more accurate angle measurement. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 This is a flow chart of a method for measuring the bending angle of a CNC bending workpiece based on a binocular camera constructed according to a preferred embodiment of the present invention;
[0036] Figure 2 is a flow chart of processing point cloud data after acquiring point cloud data constructed according to a preferred embodiment of the present invention;
[0037] Figure 3 It is a schematic diagram of the laser introduction line on the bending part and the lower mold surface constructed according to the preferred embodiment of the present invention;
[0038] Figure 4 is an image captured by a binocular camera constructed according to a preferred embodiment of the present invention;
[0039] Figure 5 is a schematic diagram of the principle of stereo correction constructed according to a preferred embodiment of the present invention;
[0040] Figure 6 It is a structural schematic diagram of a device for measuring the bending angle of a CNC bending workpiece based on a binocular camera constructed according to a preferred embodiment of the present invention.
[0041] Throughout the drawings, the same reference numerals are used to denote the same elements or structures, wherein:
[0042] 1- Camera bracket, 2- Right camera, 3- Laser, 4- Laser bracket, 5- Left camera, 6- Rotating platform, 7- Base. DETAILED DESCRIPTION
[0043] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
[0044] See also Figure 6 As shown, the bending workpiece parameter measurement device based on multi-line structured light provided by an embodiment of the present invention includes:
[0045] The rotating platform 6 is connected to the base 7 via an optical axis and a locking sleeve. The rotating platform can rotate along the Y-axis and is pressed against the side of the base by bolts to fix the tilt angle.
[0046] The camera bracket 1 and the laser bracket are fixed to the rotating platform 6 by bolt connection to achieve angle adjustment along the Z-axis direction.
[0047] The left camera 5 and the right camera 2 are fixed to the camera bracket 1 by bolt connection, and the laser 3 is fixed to the laser bracket 4 by bolt compression.
[0048] According to the above-mentioned bending workpiece parameter measurement device based on multi-line structured light, the bending workpiece parameter measurement method based on multi-line structured light includes the following steps: Figure 1 As shown:
[0049] 1) Calibrate the binocular camera detection system. Specifically, first, use the left camera 5 and the right camera 2 to shoot a 7*7 dot calibration plate in different postures, forming a set of image sequences from the left and right perspectives.
[0050] Then, single-target positioning calculation is performed on the left and right view image sequences to obtain the camera intrinsic parameters, and dual-target positioning calculation is performed on the left and right view calibration plate images to obtain the camera extrinsic parameters, that is, the translation vector T and rotation matrix R of the right camera 2 relative to the left camera 5;
[0051] 2) Considering that most workpieces have smooth surfaces and no obvious feature points, such as Figure 3 As shown, two lines of laser are introduced on the bent workpiece to participate in the reconstruction as auxiliary features of the bent workpiece. Furthermore, in order to filter out the interference of other wavelengths of light, a filter is installed on the camera lens, and the image of the workpiece with the laser light strip is collected, as shown in FIG. Figure 4 Shown is the collected image with laser light stripes.
[0052] 3) Use OpenCV library functions to preprocess the light stripe image. First, use the 3*3 median filter function medianBlur to filter out noise in the image. Then, use thresholding to set the brightness of pixels below the brightness threshold to 0 and the brightness of pixels above the brightness threshold to 255, thereby filtering out reflected light outside the target light stripe.
[0053] 4) If Figure 5 As shown, the captured left and right perspective light strip images are stereo-rectified. The internal and external parameters of the left camera 5 and the right camera 2 obtained in step 2) are used to map the images captured from the left and right perspectives to the same plane, and converted into an ideal binocular vision system, which is represented by: a feature point in space is imaged in the same row of the left and right imaging planes.
[0054] 5) Feature point matching: The Normalized Cross Correlation (NCC) algorithm is used to match feature points of the left and right view images after stereo correction. The basic principle of the algorithm is: for a pixel in the left view, the pixel with the highest correlation with it in the same row in the right view is matched.
[0055] 6) Calculate the parallax and match the feature points of the left and right views using the NCC algorithm. Suppose there is a spatial point p, and the feature point of p on the left view is q1, and the feature point on the right view that matches it is q r , x ql -x qr That is the disparity, which is calculated between each feature point on the left view and the matching point on the right view.
[0056] 7) Calculate depth information based on the triangle similarity principle:
[0057]
[0058] The depth of p relative to the left camera 5 can be obtained as:
[0059]
[0060] Where x ql 、y ql is the coordinate of q1 in the left view image coordinate system, x qr 、y QR q r The coordinate in the right view image coordinate system. Ql 、Y Ql , Z is the coordinate of point p relative to the left camera coordinate system, that is, the world coordinate system, b is the baseline distance between the two cameras, and then the depth information is converted into point cloud data.
[0061] 8) Since the 3D point cloud data obtained by binocular reconstruction often contains error points and abnormal points, the point cloud segmentation method is used to divide the point cloud data with the same distribution characteristics into parts to filter out error points and abnormal points. The process of screening point cloud data using the random consistency algorithm is as follows:
[0062] (1) Figure 2 As shown in the figure, three points are randomly selected from the initial point cloud to determine whether these three points are collinear. If they are collinear, new points are selected. If they are not collinear, the equation of the plane λ where these three points are located is calculated: a0x+b0y+z=d0. Then the distance from the remaining point cloud to the plane λ is calculated:
[0063] d i =|a0x i +b0y i +z i -d0|
[0064] (2) Set the threshold t to satisfy d i Points ≤ t are classified as interior points, and all interior points of the plane are counted;
[0065] (3) Iterate steps (1) and (2) k times to calculate the plane containing the most interior points and retain all the interior points of the plane;
[0066] The plane fitting and angle calculation process first uses the aforementioned random consistency algorithm to select interior points. The plane equation for the interior points is recorded as: a1x + b1y + z = d1. The random consistency algorithm is then applied to the outer points again. The plane equation for this portion is recorded as: a2x + b2y + z = d2. These two plane equations represent the lower die surface of the machine tool and the surface of the bent workpiece, respectively. The angle between the workpiece plane and the lower die surface is then:
[0067]
[0068] Assume that the angle between the other workpiece plane and the lower die surface plane is θ2, then the angle of the workpiece is:
[0069] θ=360-θ1-θ2
[0070] It will be easily understood by those skilled in the art that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for measuring the bending angle of a CNC bending workpiece based on a binocular camera, characterized in that: The measurement method includes: S1 calibrates the binocular camera to obtain the intrinsic and extrinsic parameters of the binocular camera; S2 introduces two line lasers on a bending surface α of the bent workpiece to be inspected and the lower die of the machine tool, uses a binocular camera to respectively capture images of the two line lasers, and processes the images to obtain point cloud data of the two line lasers; S3 selects three points from the point cloud data and determines whether the three points are collinear. If so, reselects points. Otherwise, calculates the equation of the plane containing the three points, calculates the distance from the remaining points in the point cloud data to the plane, compares the distance with a preset threshold, and defines points smaller than the preset threshold as points within the plane. Counts the number of points within the plane. S4 repeats step S3 for a preset number of times to obtain multiple planes and the number of points contained in each plane, retains the plane containing the most points as the desired plane, fits the points outside the desired plane to another plane equation, and calculates the angle between the plane and the desired plane, which is the angle between a surface α of the bent part and the lower die surface of the machine tool; S5 repeats steps S2 to S4 for the other surface β of the bent part to obtain the angle between the other surface β of the bent part and the lower die surface of the machine tool, and calculates the angle between the bent part surfaces α and β using the angles between the bent part surfaces α and β and the lower die surface of the machine tool respectively.
2. The method for measuring the bending angle of a CNC bending workpiece based on a binocular camera according to claim 1, wherein: In step S2, the image is processed according to the following steps: S21 uses the intrinsic and extrinsic parameters of the binocular camera obtained in step S1 to perform stereo correction on the images captured by the binocular camera so that the same point in space is on the same horizontal line in the two images; S22 matches the feature points of the two images captured by the binocular camera and calculates the depth information of each feature point.
3. The method for measuring the bending angle of a CNC bending workpiece based on a binocular camera according to claim 2, wherein: In step S22, after the feature points are matched, the disparity of the spatial midpoint in the two images of the binocular camera needs to be calculated.
4. The method for measuring the bending angle of a CNC bending workpiece based on a binocular camera as claimed in claim 3, characterized in that: In step S22, the depth information is calculated according to the following expression: Among them, Z is the depth information of the spatial point q, that is, the Z-axis coordinate, x ql is the coordinate of the spatial point q in the X-axis direction in the image obtained by the left camera in the binocular camera, x qr is the coordinate of the spatial point q in the X-axis direction in the image obtained by the right camera in the binocular camera, b is the baseline distance between the two cameras, and f is the focal length of the binocular camera.
5. The method for measuring the bending angle of a CNC bending workpiece based on a binocular camera according to claim 2, wherein: Before step S21 , the image obtained by the binocular camera needs to be preprocessed. The preprocessing includes filtering out noise points and thresholding, so as to filter out reflected light outside the linear laser strip.
6. The method for measuring the bending angle of a CNC bending workpiece based on a binocular camera according to claim 1, wherein: In step S21, the NCC algorithm is used to perform stereoscopic correction on the image.
7. The method for measuring the bending angle of a CNC bending workpiece based on a binocular camera according to claim 1, wherein: In step S5, the angle θ between the bending part surfaces α and β is calculated according to the following expression: θ=360-θ1-θ2 Among them, θ1 is the angle between surface α and the lower mold surface, and θ2 is the angle between surface β and the lower mold surface.
8. The method for measuring the bending angle of a CNC bending workpiece based on a binocular camera according to claim 6, wherein: The angle θ1 between the surface α and the lower die surface is calculated according to the following expression: Where a1 and b1 are the coefficients of the plane equation fitted to the points within the plane, and a2 and b2 are the coefficients of the plane equation fitted to the points outside the plane.
9. The method for measuring the bending angle of a CNC bending workpiece based on a binocular camera according to claim 1, wherein: In step S3, the distance d from the remaining points in the point cloud data to the plane is calculated. i Follow the following expression: d i =|a0x i +b0y i +z i -d0| Among them, x i ,y i and z i are the coordinates of point i along the three coordinate axes, and a0, b0 and d0 are the coefficients of the fitted plane a0x+b0y+z=d0.
10. The measuring device of the measuring method according to any one of claims 1 to 9, characterized in that: The device includes a binocular camera, a laser, a base and a rotating platform, wherein: The rotating platform is arranged on the base and can rotate up and down along the Y-axis direction. The laser and the binocular camera are arranged on the rotating platform. At the same time, the binocular camera and the laser can both rotate along the Z-axis direction.
Citation Information
Patent Citations
Binocular stereo vision three-dimensional measurement method based on line structured light scanning
CN107907048A