Visual measurement system and method for irregular workpiece
Through the combination of industrial cameras and laser rangefinders, a comprehensive detection system of machine vision and laser ranging is constructed, which solves the problem of traditional methods of workpiece size measurement relying on manual labor and high-cost equipment, and achieves rapid and accurate measurement of workpiece size and volume. , improving the automation level of industrial production.
Patent Information
- Application Number
- CN202410634929.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-08-30
AI Technical Summary
Traditional methods of measuring the dimensions of workpieces with irregular industrial surfaces require manual operation and rely on high-cost equipment, making it difficult to achieve fast and effective automated monitoring and affecting the automation level of industrial processing.
Industrial cameras are combined with laser rangefinders, and edge detection technology and image processing technology are used to build a comprehensive detection system of machine vision and laser ranging to achieve accurate measurement and volume calculation of workpiece dimensions, and use multi-sensor information fusion to reduce computational complexity.
It achieves fast and accurate dimensional measurement and volume calculation of workpieces with irregular industrial surfaces, improves measurement efficiency and accuracy, reduces the computational complexity of the visual measurement system, and is suitable for industrial production and quality control.
Smart Images

Figure CN118570288A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automated production, and in particular to a method and system for realizing size measurement, weight estimation, and appearance quality detection of solid workpieces with irregular industrial surfaces. Background Art
[0002] Mechanical workpieces have various shapes, sizes and complex functions. Their processing and assembly accuracy have a great impact on the performance and quality of mechanical equipment. The manufacturing process of small parts has high requirements, and often requires inspection links to ensure that the processing quality meets the requirements. In the scene where the size, shape and position of the workpiece are precisely controlled, traditional dimensional measurement methods often require manual use of calipers and micrometers to perform multiple measurements and take the average value. The three-dimensional dimensions of the workpiece are measured by machine vision, and currently most of them use high-cost equipment and calculations such as three-dimensional scanners. In the automated production process supported by digital manufacturing, the rapid and effective monitoring process of workpiece visual inspection and measurement is undoubtedly an important link in improving the level of industrial processing automation. The camera is used to output the collected object as an image signal, and the signal is processed by the host computer for analysis and measurement. Image processing technology and photogrammetric geometry are used to extract target feature information and size information, and scale restoration is performed. Then, statistical analysis and other judgments and classification feature information are fed back to the controller to realize the motion control of mechanical equipment and realize intelligent industrial processing.
[0003] Industrial cameras have high resolution, fast image acquisition capabilities, and customizability for different scenarios, and have been widely used in a variety of tasks such as inspection, measurement, and quality control. A laser rangefinder is a device used to measure distances. It determines the distance between the object being measured and the rangefinder by sending a laser and measuring the laser's echo time.
[0004] By using industrial cameras to capture stable, high-quality images, using the classic Zhang Zhengyou calibration method for camera calibration, using laser ranging sensors to obtain workpiece depth data, combining image processing technology to extract key features, and using pinhole imaging photography geometry principles to define the concept of single-pixel restoration area and perform calculations and analysis, real-time measurement of the volume of physical workpieces with irregular surfaces can be completed, which will bring higher efficiency and accuracy to industrial production and quality control. Summary of the invention
[0005] The core technology of dimension measurement based on machine vision is to determine the dimension boundary of the workpiece through edge detection technology. The present invention provides a method and corresponding device for accurately measuring the dimension of a solid workpiece with a flat bottom by taking an image with an industrial camera and combining it with a laser rangefinder. By constructing a comprehensive detection system of machine vision and laser ranging, the edge position of the workpiece and the height information of the workpiece are accurately located by using the coupling relationship between the laser ranging sensor data and the height difference at the edge of the workpiece on the basis of accurately measuring the plane information of the workpiece with an industrial camera. The information fusion of the two types of sensors uses different principles to repeatedly locate the edge of the workpiece and measure the height difference, so as to reduce the computational complexity of the visual measurement system and improve the accuracy and efficiency of workpiece dimension measurement and processing quality monitoring.
[0006] The present invention discloses a method and system platform for measuring the volume of a workpiece based on visual information and camera height information, comprising the following steps:
[0007] Step 1: Obtain the camera intrinsic parameter matrix K and extrinsic parameter matrix P through camera calibration;
[0008] Step 2: Establish the hardware configuration of the industrial camera based on monocular vision, including the industrial camera, background plate, linear slide, rotary joint, laser rangefinder and workpiece to be measured; photograph an object of known size, obtain the initial height D of the camera from the object of known size, and use the laser rangefinder to measure the height difference dis between the camera and the laser rangefinder; calculate the actual size of the object and the pixel size conversion factor t through the camera focal length f, sensor size r and height D;
[0009] Step 3: The laser rangefinder and the camera are coupled to collect the workpiece size data; the irregular workpiece to be measured is moved to the center of the camera field of view, the laser angle is adjusted, and the height change and the corresponding angle of the laser rangefinder from the edge of one side of the object to the edge of the other side are recorded to obtain the shape function; the height difference of the workpiece is measured according to the principle of trigonometric height difference ranging; during the movement of the laser beam, when the ranging height difference produces an obvious mutation, the camera is triggered to take a photo to collect an image, and then the laser spot in the image is compared to see whether it overlaps with the edge position of the workpiece; if it overlaps, it is judged that the outer edge contour has been scanned, and it should be further judged whether all areas have been scanned. If all areas have been scanned, the scan is ended and the height data is counted for scale recovery calculation; if there are still unscanned areas, the scanned data is recorded, and the laser rangefinder is moved on the linear slide rail to switch to another area for scanning; if it is judged that the outer edge of the workpiece has not been reached, the laser ranging scan is continued;
[0010] Step 4: Calculate the three-dimensional size of the workpiece through scale recovery calculation; extract the image target information, segment the image to obtain the workpiece pixel area Wp, and restore the area A through single pixel rcv, shape function and conversion factor t are used to calculate the actual size of the workpiece. Combining the laser ranging data and the edge data of the camera image, the surface area and depth information of the workpiece can be measured, and the volume of the workpiece can be obtained by integral calculation.
[0011] Based on the image information and camera height information, a workpiece measurement device and its system platform are constructed, including:
[0012] Hardware configuration: industrial camera, background plate, linear slide, rotary joint, laser rangefinder.
[0013] Functional modules: target affine matrix determination module, used to implement steps 1-3 of the above method; spatial scale information restoration module, used to implement the relevant operations in step 4 of the above method; image processing module, which performs preprocessing such as denoising and edge detection on the acquired image.
[0014] Beneficial effects: The present invention utilizes image processing technology and knowledge in the field of photogrammetric geometry, and can be used to measure the size, area, and volume of irregular planar workpieces through multi-sensor information fusion and data calculation, and then complete the calculation of workpiece weight. The coupling analysis of laser ranging data and camera-collected image edge data can effectively make up for the inaccurate edge extraction position of collected images in natural scenes. Through image edge positioning technology, the signal drift effect that may occur when the ranging sensor works for a long time can be reduced to a certain extent, which can provide technical support for real-time measurement of irregular workpiece sizes on industrial surfaces, visual weighing, weld appearance quality, and workpiece riveting quality inspection. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A diagram showing the steps of a method for visually measuring the size of an irregular workpiece according to an embodiment of the present invention.
[0016] Figure 2 A schematic diagram of the hardware structure of the irregular workpiece machine vision and laser ranging detection system according to an embodiment of the present invention is shown.
[0017] Figure 3 A schematic diagram showing the relationship between the workpiece surface and the image according to an embodiment of the present invention.
[0018] Figure 4 A flow chart showing the process of measuring the size of irregular workpieces by coupling machine vision and laser ranging.
[0019] Figure 5 A schematic diagram showing the calculation of the single-pixel restoration area of the artifact.
[0020] Figure 6 A schematic diagram showing the principle of calculating the volume of a workpiece based on three-dimensional measurement.
[0021] See also Figure 2, 201 is a camera, 202 is a background plate, 203 is a connecting bracket, a workpiece to be measured 204, a rotating joint 205, a laser rangefinder 206, and a slide rail 207.
[0022] See also Figure 3 , A p is the corresponding area of the “small block” on the workpiece surface in the image, and A is the actual area of the “small block” on the workpiece surface.
[0023] See also Figure 5 , in the length and width of the local dimensions of the workpiece, it can be reflected as a single pixel straight line on the image. The number of pixels contained in the two straight lines is NUM_LENGTH and NUM_WIDTH respectively. Then a single pixel represents the area, that is, the single pixel restores the area A rcv for:
[0024]
[0025] The surface of the workpiece in the image is composed of several pixels. Image segmentation is used to obtain the total number of pixels corresponding to the surface area of the workpiece in the image to measure the actual surface area of the irregular workpiece. DETAILED DESCRIPTION
[0026] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0027] See also Figure 1 As shown in the step diagram, a workpiece size measurement method based on visual information and camera height proposed by the present invention comprises the following steps:
[0028] Step S101: Obtain camera intrinsic parameters (intrinsic parameter matrix K) and extrinsic parameters (extrinsic parameter matrix P) through camera calibration.
[0029] Specifically, the camera takes multiple chessboard pictures at different angles, directions, and distances, extracts feature points of known patterns through image extraction algorithms, and matches these feature points between different images; optimizes parameters through feature points, and obtains camera intrinsic and extrinsic parameters based on the conversion relationship between pixel coordinates and camera coordinate system. The specific conversion relationship is:
[0030]
[0031] Where (u, v) is the pixel coordinate, s is the scale factor, (X, Y, Z) is the 3D point coordinate in the camera coordinate system, f is the focal length, c x and c y are the principal point coordinates;
[0032] The internal parameter matrix is:
[0033]
[0034] The distortion model formula used to correct camera lens distortion is:
[0035]
[0036] Among them, (x d ,y d ) is the coordinate after correction, (x, y) is the coordinate before distortion, k1, k2, k3 are the radial distortion coefficients, r 2 =x 2 +y 2 ; The external parameters are divided into rotation matrix and translation matrix: describing the transformation relationship between the camera coordinate system and the world coordinate system; the rotation matrix and translation matrix formula are:
[0037]
[0038] Among them, R is the rotation matrix and T is the translation matrix, which are combined to form the external parameter matrix P.
[0039] Step S102: Establishing a hardware configuration of an industrial camera based on monocular vision, measuring the actual height of the camera by photographing a known object, and calculating a conversion factor.
[0040] like Figure 2 As shown, the industrial camera 201, the background plate 202 and the connecting bracket 203, the workpiece 204 to be measured, the rotating joint 205, the laser rangefinder 206 and the slide rail 207 are installed in predetermined positions to ensure that the workpiece to be measured is completely located in the field of view. The laser rangefinder 206 is installed on the slide rail 207 so that the laser beam can move along the surface of the workpiece and adjust its posture by rotating the joint 205.
[0041] Perform initial measurement, correct the captured image using the distortion coefficient obtained in step S101, and obtain the distance D between the camera and the image plane according to the following formula:
[0042]
[0043] Where W is the actual width of the workpiece, W p is the pixel width occupied by the workpiece in the image, and high is the height of the workpiece;
[0044] The laser rangefinder is made to emit laser light perpendicular to the background plate 202, and the distance between the laser rangefinder and the background plate is measured to be D', then the vertical distance between the camera and the laser rangefinder is dis = D-D';
[0045] Therefore, the conversion factor formula is:
[0046]
[0047] Among them, r is the pixel size of the camera, D1 is the workpiece distance measured by the laser rangefinder in actual measurement, α is the angle between the laser rangefinder and the horizontal plane, and sin is the sine function.
[0048] Step S103: The laser rangefinder and the camera are coupled to collect workpiece size data; the workpiece 204 to be measured is moved to the middle of the camera field of view, and the angle of the laser rangefinder is adjusted to align it with the center of the workpiece. The position of the workpiece ranging laser spot in the field of view is recorded as (x m ,y m ).
[0049] Rotate the laser rangefinder so that the laser beam falls on the edge of the workpiece, record the edge position as (x1, y1), the distance value of the laser rangefinder is D2, and the angle with the horizontal plane is α2;
[0050] During the continuous rotation of the laser rangefinder, the laser spot position, distance value and rotation angle are continuously recorded until the value changes drastically. At this time, the laser rangefinder value is D n , the center position of the laser spot is (x n ,y n ), the rotation angle is α n ; The laser rangefinder sends a signal, and the camera automatically takes a picture. Through image processing, the corrected picture is obtained, and the pixel set of the workpiece surface area in the picture is A p , and (x n ,y n ) The coordinates are substituted into the image and compared with the outer contour data of the workpiece to determine whether it is the outer edge of the workpiece. If so, it should be further determined whether all areas have been scanned. If all areas have been scanned, the scanning is ended and the height data is counted for scale recovery calculation; if there are still unscanned areas, the scanning data is recorded, and the laser rangefinder is moved on the linear slide rail to switch to another area for scanning; if it is determined that the outer edge of the workpiece has not been reached, the scanning data is recorded and the laser ranging scanning is continued;
[0051] Since the present invention is aimed at a solid workpiece with a flat bottom, the height matrix H of the entire workpiece can be obtained by measuring the height change matrix of the object and the corresponding angle matrix using a laser rangefinder:
[0052]
[0053] Where D is the distance between the camera and the background plate, D2...D n is the height data measured by the laser rangefinder, and dis is the distance between the camera and the laser rangefinder.
[0054] The corresponding measurement point position matrix in the image is:
[0055]
[0056] The shape function f(x, y) of the workpiece in the plane is obtained through surface fitting.
[0057] Step S104: Calculate the three-dimensional size of the workpiece through scale recovery calculation. Extract the image target information and segment the image to obtain the workpiece pixel area A p The actual size of the workpiece is calculated by the pixel area, shape function f(x, y) and the conversion factor t obtained in step S102. The plane area and depth information of the workpiece can be measured by combining the laser ranging data and the edge data of the camera image. The actual surface area of the workpiece is A = A p *t 2 In step S103, the function describing the shape of the workpiece is obtained by fitting, which can reflect the overall depth information of the workpiece. At the same time, the top surface area is extracted from the workpiece image captured by the camera. In the given surface area, the depth information function f(x, y) is integrated in the x and y directions to calculate the volume of the workpiece:
[0058] V = ∫∫ A f(x,y)dxdy
[0059] Furthermore, if Figure 5 As shown in the figure, the present invention proposes a method for measuring the actual area of an irregular workpiece based on a single pixel restoration area. In an image, the surface area of a workpiece can be composed of the total number of pixel points, that is, the total number of pixel points SET_job corresponding to the surface area of the workpiece in the image is obtained by image segmentation. According to the actual local size Length, Width of the workpiece and the number of pixel points, the surface area of the workpiece corresponding to a single pixel point can be inferred, which is defined as the single pixel restoration area A rcv . The actual surface area of the irregular workpiece is calculated based on the single pixel restored area:
[0060] A=A rcv ×SET_job
[0061] The relationship between the pixel area Size_pix of the workpiece area on the image and the actual area A of the workpiece to be measured is as follows:
[0062]
[0063] Among them, r is the camera pixel size, D is the distance between the camera and the workpiece, f is the focal length, and Size_pix is the area of the regional pixels.
[0064] The present invention combines monocular vision measurement with a laser ranging sensor, and uses the principles of camera calibration, image segmentation data analysis, triangulation height difference measurement, etc. to perform non-contact, automated measurement of solid workpieces with irregular surfaces in the field of automation, providing a solution. The measurement method has the advantages of low cost, high accuracy, and easy installation. Its non-contact, real-time, and flexibility characteristics make it have broad application prospects in the fields of industrial automation processing, quality monitoring, and the like.
Claims
1. A visual measurement method for irregular workpieces, characterized in that: The following steps are involved: Step 1: Obtain the camera intrinsic parameter matrix K and extrinsic parameter matrix P through camera calibration; Step 2: Establish the hardware configuration of the industrial camera based on monocular vision, including the industrial camera, background plate, linear slide, rotary joint, laser rangefinder and workpiece to be measured; shoot an object of known size, obtain the initial height D of the camera from the background plane, and use the laser rangefinder to measure the height difference dis between the camera and the laser rangefinder; calculate the actual size of the object and the pixel size conversion factor t through the camera focal length f, sensor size r and height D; Step 3: The laser rangefinder and the camera are coupled to collect the workpiece size data; the irregular workpiece to be measured is moved to the center of the camera field of view, the laser angle is adjusted, and the height change and the corresponding angle of the laser rangefinder from the edge of one side of the object to the edge of the other side are recorded to obtain the shape function; the height difference of the workpiece is measured according to the principle of trigonometric height difference ranging; during the movement of the laser beam, when the ranging height difference produces an obvious mutation, the camera is triggered to take a photo to collect an image, and then the laser spot in the image is compared to see whether it overlaps with the edge position of the workpiece; if it overlaps, it is judged that the outer edge contour has been scanned, and it should be further judged whether all areas have been scanned. If all areas have been scanned, the scan is ended and the height data is counted for scale recovery calculation; if there are still unscanned areas, the scanned data is recorded, and the laser rangefinder is moved on the linear slide rail to switch to another area for scanning; if it is judged that the outer edge of the workpiece has not been reached, the laser ranging scan is continued; Step 4: Calculate the three-dimensional size of the workpiece through scale recovery calculation; extract the image target information and segment the image to obtain the workpiece pixel area W p , the actual size of the workpiece is calculated by single-pixel restoration area, shape function and conversion factor t. Combining laser ranging data and camera image edge data, the surface area and depth information of the workpiece will be measured, and the volume of the workpiece can be obtained by integral calculation.
2. A visual measurement method for irregular workpieces according to claim 1, characterized in that In step 3, the laser rangefinder and the camera are coupled to collect workpiece size data; the workpiece to be measured is moved to the middle of the camera field of view, and the angle of the laser rangefinder is adjusted to align it with the center of the workpiece, and the position of the ranging laser beam spot in the field of view is recorded as (x m ,y m ); Rotate the laser rangefinder so that the laser beam falls on the edge of the workpiece, record the edge position as (x1, y1), the laser rangefinder value is D2, and the angle with the horizontal plane is α2; Keep rotating the laser rangefinder, and continuously record the light spot position, laser rangefinder value, and rotation angle during this process until the value changes dramatically. At this time, the laser rangefinder value is D n , the center position of the laser spot is (x n ,y n ), the rotation angle is α n ; The laser rangefinder sends a signal, and the camera automatically takes a picture. After image processing, a corrected picture is obtained. The surface area of the object in the picture is pixel A. p , and (x n ,y n ) into the picture, and replace (x n ,y n ) coordinates are substituted into the picture and compared with the outer contour data of the picture to determine whether it is the outer edge of the workpiece. If so, it is determined that this is the outer edge of the workpiece, and it should be further determined whether all areas have been scanned. If all areas have been scanned, the scanning is ended and the height data is counted for scale recovery calculation; if there are still unscanned areas, the scanning data is recorded, and the laser rangefinder is moved on the linear slide rail to switch to another area for scanning; if it is determined that the outer edge of the workpiece has not been reached, the scanning data is recorded and the laser ranging scanning is continued; According to the height change matrix and corresponding angle matrix of the object measured by the laser rangefinder, the workpiece height matrix H is calculated: Where D is the distance between the camera and the background plate, and dis is the distance between the camera and the laser rangefinder; The corresponding measurement point position matrix in the image is: The shape function f(x, y) of the workpiece in the plane is obtained by surface fitting.
3. A visual measurement method for irregular workpieces according to claim 1, characterized in that In step 1, the camera is calibrated to obtain corrected parameters, including: The camera takes multiple chessboard pictures at different angles, directions, and distances, extracts feature points of known patterns through image extraction algorithms, and matches these feature points between different images; optimizes parameters through feature points, and obtains camera intrinsic and extrinsic parameters based on the conversion relationship between pixel coordinates and camera coordinate system. The specific conversion relationship is: Where (u, v) is the pixel coordinate, s is the scale factor, (X, Y, Z) is the 3D point coordinate in the camera coordinate system, f is the focal length, c x and c y are the principal point coordinates; The internal parameter matrix is: The distortion model formula used to correct camera lens distortion is: Among them, (x d ,y d ) is the coordinate after correction, (x, y) is the coordinate before distortion, k1, k2, k3 are the radial distortion coefficients, r 2 =x 2 +y 2 ; The external parameters are divided into rotation matrix and translation matrix: describing the transformation relationship between the camera coordinate system and the world coordinate system; the rotation matrix and translation matrix formula are: Among them, R is the rotation matrix and T is the translation matrix, which are combined to form the external parameter matrix P.
4. The visual measurement method for irregular workpieces according to claim 1, characterized in that In the step 2, the visual measurement platform is constructed, and the industrial camera is installed on a fixed bracket parallel to the background plate, ensuring that the imaging plane is parallel to the background plate, ensuring that the workpiece is completely in the field of view of the monocular vision measurement device during the system operation and photography, and that the ranging scanning range of the laser rangefinder is consistent with the visual range of the camera; Perform initial measurement, take pictures by using the distortion coefficient correction described in claim 3, and obtain the distance D between the camera and the image plane according to the following formula: Where W is the actual width of the workpiece, W p is the width of the workpiece area in the image, and high is the height of the workpiece; The laser rangefinder is made to emit laser perpendicular to the background plate, and the vertical distance between the laser rangefinder and the background plate is measured to be D', then the vertical distance between the camera and the laser rangefinder is dis = D-D'; therefore, the conversion factor formula is: Among them, s is the pixel size of the camera, D1 is the workpiece distance measured by the laser rangefinder in actual measurement, and α is the angle between the laser rangefinder and the horizontal plane.
5. The visual measurement method for irregular workpieces according to claim 1, characterized in that The step 4 of measuring the volume of the irregular workpiece includes: The three-dimensional size of the workpiece is calculated through scale recovery calculation; the image target information is extracted and the image is segmented to obtain the pixel area A of the workpiece p , the actual size of the workpiece is calculated through the pixel area, shape function and conversion factor t. Combining the laser ranging data and the edge data of the camera-collected image, the plane area and depth information of the workpiece will be measured, and the volume of the workpiece will be calculated; The actual surface area of the workpiece is A = A p *t 2 ; In step 3, the overall depth information of the workpiece can be obtained by fitting the function that describes the shape of the workpiece. At the same time, the pixel area of the workpiece extracted from the workpiece image captured by the camera represents the top surface area of the workpiece. With this information, the volume of the workpiece can be roughly calculated using the following formula: The volume of the workpiece is estimated by integrating the depth information function f(x, y) in the x and y directions within a given area A.
6. A method for measuring the actual area of a workpiece based on single-pixel restored area, characterized in that: include: In the acquired image, the workpiece surface area can be composed of the total number of pixel points, that is, the total number of pixels corresponding to the workpiece surface area in the image is obtained by image segmentation, SET_job. According to the actual local size Length, Width of the workpiece and the number of pixels, the workpiece surface area corresponding to a single pixel can be calculated, which is defined as the single pixel restoration area A. rcv , based on the single pixel restored area, the actual surface area of the irregular workpiece is calculated. The actual surface area of the workpiece is: A=A rcv ×SET_job The relationship between the size Size_pix represented by a single pixel in the image plane and the actual area A is as follows: Among them, r is the camera pixel size, D is the distance between the camera and the imaging plane, and f is the focal length.
7. A visual measurement system for irregular workpieces, characterized in that The system establishes a hardware configuration, including: Industrial cameras are used to capture workpiece images for size measurement. The camera’s intrinsic parameter matrix K and extrinsic parameter matrix P are obtained through camera calibration. Background plate, placed at the bottom, used as the workpiece imaging back plate to help the camera clearly distinguish the edges and features of the workpiece; The linear slide provides a smooth linear movement function. The laser distance meter is fixed to the rotary joint, and the rotary joint is placed on the linear slide. The laser distance meter moves on the linear slide to ensure that the workpiece size can be measured from a controllable viewing angle. The rotating joint provides rotational motion, so that the laser rangefinder installed on it can rotate to complete data measurement; Laser rangefinder, used to measure distance, used with industrial cameras to determine relative height differences, and also as a trigger for the camera to take pictures; The workpiece to be measured, the object to be measured, is placed in the middle of the field of view of the camera and the laser rangefinder for imaging and measurement.
Citation Information
Cited By
Intelligent factory inspection system for gas meter reading device
CN119665819A
Riveted joint quality detection method, system and device
CN120525852A
