An Image Acquisition and Analysis Method Based on a Five-Axis Dispensing Machine

By establishing a multi-coordinate system spatial transformation model and visual template matching, the problem of insufficient accuracy in three-dimensional path acquisition, vision system and machine tool calibration, and dynamic offset compensation of five-axis dispensing machines was solved, realizing high-precision automated dispensing and online quality monitoring of complex curved surface workpieces.

CN121921380BActive Publication Date: 2026-05-26VISION XIAMEN AUTOMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
VISION XIAMEN AUTOMATION TECH CO LTD
Filing Date
2026-03-27
Publication Date
2026-05-26

Smart Images

  • Figure CN121921380B_ABST
    Figure CN121921380B_ABST
Patent Text Reader

Abstract

This invention discloses an image acquisition and analysis method based on a five-axis dispensing machine. The method is applied to a five-axis dispensing machine equipped with a camera and includes the following steps: Step 1: Establishing a spatial transformation model; controlling the machine tool movement to drive the camera to capture images, performing global optimization, and obtaining the transformation matrix; Step 2: Acquiring a multi-view image sequence of the workpiece; performing 3D reconstruction to obtain a 3D point cloud model; Step 3: Generating a dispensing path point set; Step 4: Calculating the offset of the current workpiece relative to a standard position, and using the offset to correct the coordinates of the dispensing path point set generated in Step 3; Step 5: Calculating the glue path deviation; if the deviation exceeds a preset threshold, automatically adjusting the dispensing process parameters. This invention achieves automatic 3D path planning, high-precision vision and machine tool calibration, dynamic offset compensation, and closed-loop feedback in image acquisition and analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to an image acquisition and analysis method based on a five-axis dispensing machine. Background Technology

[0002] Five-axis dispensing machines are widely used for precision dispensing operations on complex curved surfaces due to their flexible attitude control capabilities. However, the following technical bottlenecks still exist in practical applications:

[0003] First, obtaining 3D paths is difficult. Traditional teach-and-write programming methods are inefficient at obtaining 3D spatial curve paths and struggle to accurately represent the normal vector information of the workpiece surface. This results in the dispensing head not being perpendicular to the workpiece surface, affecting the consistency of the adhesive width. Although offline programming methods based on 3D models exist, the deviation between the model and the actual object cannot be effectively eliminated.

[0004] Secondly, the decoupling between the vision system and the machine tool coordinates is insufficient. In existing technologies, the image coordinate system acquired by the camera and the motion coordinate system of the five-axis machine tool lack a high-precision unified spatial transformation model, resulting in a systematic error between "where the view is" and "where the point is located." Conventional hand-eye calibration methods struggle to take into account the kinematic constraints of the rotation axes, leading to insufficient calibration accuracy.

[0005] Secondly, dynamic offset compensation is insufficient. Workpieces experience slight positional and angular shifts during multiple clamping or assembly line transport. If a pre-stored standard trajectory is used, cumulative positioning errors will occur. Especially under high-magnification microscopy, even minor shifts can lead to dispensing position deviations. Existing vision guidance methods mostly use two-dimensional planar compensation, which cannot adapt to the three-dimensional offsets of curved workpieces.

[0006] Finally, there is a lack of a closed-loop correction mechanism. The actual glue path shape after dispensing lacks real-time acquisition and feedback, making it impossible to adaptively adjust dispensing parameters and meet the stability requirements of high-precision processes. Operators can only perform random checks after dispensing, and by the time problems are discovered, a batch of defective products has already been produced.

[0007] Therefore, there is an urgent need for an image acquisition and analysis method that can achieve automatic 3D path planning, high-precision vision and machine tool calibration, dynamic offset compensation, and closed-loop feedback. Summary of the Invention

[0008] The purpose of this invention is to provide an image acquisition and analysis method based on a five-axis dispensing machine, aiming to solve the above-mentioned problems and realize an image acquisition and analysis method with automatic three-dimensional path planning, high-precision vision and machine tool calibration, dynamic offset compensation and closed-loop feedback.

[0009] To achieve the above objectives, the present invention adopts the following technical solution:

[0010] An image acquisition and analysis method based on a five-axis dispensing machine is applied to a five-axis dispensing machine including linear axes X, Y, and Z and rotary axes B and C. The dispensing machine is equipped with a camera, comprising:

[0011] Step 1: Establish a spatial transformation model between the pixel coordinate system, image coordinate system, camera coordinate system, machine tool coordinate system, and workpiece coordinate system; obtain intrinsic parameters through camera calibration, and drive the camera to take multi-angle pictures of the calibration plate by controlling the machine tool movement; use the LM algorithm to globally optimize the pose of the rotation axis and obtain the transformation matrix between the camera coordinate system and the machine tool coordinate system.

[0012] Step 2: Control the five-axis machine tool to drive the camera to move along the preset trajectory and acquire a multi-view image sequence of the workpiece; Based on the multi-view image sequence, combined with the camera intrinsic and extrinsic parameters calibrated in Step 1, use the SFM algorithm to perform three-dimensional reconstruction of the workpiece and obtain a three-dimensional point cloud model.

[0013] Step 3: Extract the feature region to be dispensed from the 3D point cloud model, obtain the unit normal vector of the path point by calculating the micro-tangent plane of the point cloud neighborhood, and generate the position coordinates by combining the five-axis machine tool structure. and posture angle The set of dots along the dispensing path;

[0014] Step 4: Before actual dispensing, capture a real-time image of the current workpiece using a camera, match it with a pre-stored standard workpiece visual template, and calculate the offset of the current workpiece relative to the standard position. And use the offset to correct the coordinates of the dispensing path point set generated in step 3;

[0015] Step 5: After dispensing is completed, the glue path image is captured again by the camera, the actual contour of the glue path is extracted and the glue path deviation is calculated. If the deviation exceeds the preset threshold, the dispensing process parameters are automatically adjusted.

[0016] Furthermore, the objective function for global optimization using the LM algorithm in step 1 is: ,in, The optimized camera pose Lie algebra; For the Lie algebra of the camera pose to be optimized, p i To determine the pixel coordinates of the i-th feature on the calibration board, P i Let be the three-dimensional coordinates of the i-th feature on the calibration board in the machine tool coordinate system, K be the intrinsic parameter matrix of the camera, exp(ξ^) be the exponential mapping from Lie algebra to Lie group, represent the transformation matrix, s be the scale factor, and O be the total number of feature points involved in the optimization.

[0017] Furthermore, the SFM algorithm in step 2 uses the machine coordinates provided by the machine tool as the strong constraint initial values ​​for the camera pose, and its optimization objective is to minimize the reprojection error, the reprojection error function being: Where E is the total global reprojection error; X t Let t be the coordinates of the t-th point in three-dimensional space; Let π be the observed pixel coordinates of the t-th 3D point in the j-th image; j (·) is the projection function of the j-th camera; V j Let be the set of all 3D points visible in the j-th image; ρ(·) is the robust kernel function; H is the covariance matrix of the observation noise.

[0018] Furthermore, the formula for calculating the unit normal vector of the path point and converting it into B and C axis angles in step 3 is as follows: , , where q k Let N(q) be the path point in the 3D point cloud whose normal vector is to be calculated. k ) represents the point cloud and q k The set of points in the neighborhood; For q k and its neighboring points q m The normal vector of the fitted micro-tangent plane; ω m A weighting coefficient that is inversely proportional to the distance; The final calculated q k The unit normal vector of a point has components (n) x , n y , n z ); B k C is the B-axis angle of rotation of a five-axis machine tool around the Y-axis; k The C-axis angle is the rotation angle of a five-axis machine tool around the Z-axis.

[0019] Furthermore, in step 4, the offset is used. The formula for correcting path points is: Where (X,Y,Z) are the coordinates of the standard trajectory point, and (X',Y',Z') are the corrected coordinates. This represents the translational offset of the workpiece in the X and Y directions. This represents the rotational offset of the workpiece around the Z-axis.

[0020] Furthermore, the formula for evaluating adhesive path deviation in step 5 is: , where D RMS d represents the root mean square deviation of the adhesive path, N is the total number of sampling points on the adhesive path, and d represents the root mean square deviation of the adhesive path. theory (g) represents the theoretical glue width or location value at the g-th sampling point, and d actual (g) represents the actual glue width or location value of the g-th sampling point.

[0021] Furthermore, in step 1, the calibration board is a ChArUco board, which is used to perform sub-pixel level feature point detection within the calibration space.

[0022] Furthermore, in step 3, when generating the dispensing path, the method also includes projecting the three-dimensional point cloud onto a two-dimensional plane to extract the edge contours, collecting all the edge contours to obtain the contour point set, and offsetting the normal direction to obtain the actual contact path that compensates for the extrusion deformation of the adhesive.

[0023] Furthermore, the process parameters adjusted in step 5 include dispensing pressure, dispensing valve opening time, rotational speed of the B-axis and C-axis, and movement speed of the linear axes X-axis, Y-axis, and Z-axis.

[0024] Furthermore, the visual template matching in step 4 employs a shape-based template matching algorithm, calculating the similarity between the real-time image and the standard template using normalized cross-correlation or Hausdorff distance to obtain the offset. .

[0025] By adopting the above technical solution, the present invention has the following advantages compared with the prior art:

[0026] This invention achieves fully automated and high-precision control of dispensing on complex curved workpieces through a five-step integrated process. First, the LM algorithm is used for optimization calibration, establishing a high-precision coordinate transformation between vision and machine tool, eliminating systematic errors. Second, based on the SFM algorithm and machine tool coordinate constraints, dense 3D reconstruction of the workpiece surface is achieved, solving the problem of obtaining 3D paths in traditional teach-programming. Third, dispensing path points perpendicular to the curved surface are generated through normal vector calculation and attitude transformation, ensuring consistent dispensing paths. Furthermore, visual template matching is used to compensate for workpiece clamping offsets in real time, eliminating the need for re-teaching and improving production line flexibility. Finally, image feedback after dispensing allows for closed-loop adjustment of process parameters, enabling online quality monitoring. Attached Figure Description

[0027] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be 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 illustrative and not intended to limit the invention.

[0029] It should be noted that in this invention, the terms "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are all based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this invention and simplifying the description, and are not intended to indicate or imply that the device or element of this invention must have a specific orientation, and therefore should not be construed as a limitation of this invention.

[0030] Example

[0031] refer to Figure 1 As shown, this invention discloses an image acquisition and analysis method based on a five-axis dispensing machine, applicable to a five-axis dispensing machine including linear axes X, Y, and Z and rotary axes B and C. The five-axis dispensing machine in this embodiment is prior art. The five-axis dispensing machine includes a five-axis machine bed, on which are mounted X-axis linear guides, Y-axis linear guides, Z-axis linear guides, a B-axis rotary mechanism, and a C-axis rotary mechanism. The camera and dispensing valve are fixed on the spindle and can move in conjunction with the five axes. The workpiece is placed on the worktable, and a calibration plate is used to calibrate the camera fixed on the dispensing machine, including:

[0032] Step 1: Establish a spatial transformation model between the pixel coordinate system, image coordinate system, camera coordinate system, machine tool coordinate system, and workpiece coordinate system; obtain intrinsic parameters through camera calibration, and drive the camera to take multi-angle pictures of the calibration plate by controlling the machine tool movement; use the LM algorithm (Levenberg-Marquardt) to globally optimize the pose of the rotation axis and obtain the transformation matrix between the camera coordinate system and the machine tool coordinate system.

[0033] The coordinate systems in this embodiment are established as follows: Pixel coordinate system (u, v): originating from the top left corner of the image, with units in pixels; Image coordinate system (x, y): originating from the principal point of the image, with units in millimeters. The transformation between the pixel coordinate system and the image coordinate system is determined by the principal point coordinates (u0, v0) in the intrinsic parameter matrix K and the pixel size d. x ,d y Determine; Camera coordinate system (X) c ,Y c Z c ): With the camera's optical center as the origin, Z c The axis is along the optical axis, X c Y c The axis is parallel to the x and y axes of the image coordinate system; the machine tool coordinate system (X... m ,Y m Z m ): Absolute coordinates fed back by the machine tool's linear scale, with the origin of the five-axis dispensing machine as the reference; workpiece coordinate system (X w ,Y w Z w ): A relative coordinate system fixed on the workpiece, used to describe the geometric features of the workpiece.

[0034] Step 2: Control the five-axis machine tool to drive the camera to move along the preset trajectory and acquire a multi-view image sequence of the workpiece; Based on the multi-view image sequence, combined with the camera intrinsic and extrinsic parameters calibrated in Step 1, use the SFM algorithm to perform three-dimensional reconstruction of the workpiece and obtain a three-dimensional point cloud model.

[0035] Step 3: Extract the feature region to be dispensed from the 3D point cloud model, obtain the unit normal vector of the path point by calculating the micro-tangent plane of the point cloud neighborhood, and generate the position coordinates by combining the five-axis machine tool structure. and posture angle The set of dots along the dispensing path;

[0036] Step 4: Before actual dispensing, capture a real-time image of the current workpiece using a camera, match it with a pre-stored standard workpiece visual template, and calculate the offset of the current workpiece relative to the standard position. And use the offset to correct the coordinates of the dispensing path point set generated in step 3;

[0037] Step 5: After dispensing is completed, the glue path image is captured again by the camera, the actual contour of the glue path is extracted and the glue path deviation is calculated. If the deviation exceeds the preset threshold, the dispensing process parameters are automatically adjusted.

[0038] Step 1 specifically involves obtaining the camera's intrinsic parameter matrix K independently in advance using the Zhang Zhengyou calibration method: using a high-precision checkerboard calibration board, acquiring 15-20 images from different angles, and calculating the focal length f using the calibration toolbox. x f y The principal point coordinates u0 and v0, and the radial distortion coefficients k1 and k2 are determined. Then, using the high-precision motion of the five-axis machine tool as an external reference, the transformation relationship between the camera coordinate system and the machine tool coordinate system is calibrated. The industrial camera uses a high-resolution CCD camera equipped with a telecentric lens and a ring LED light source. The linear axis repeatability of the five-axis dispensing machine is ±0.002mm, and the rotary axis repeatability is ±0.005°. The calibration board uses a ChArUco board with a grid size of 3mm × 3mm and a recognition accuracy of 0.1 pixels. The rotary axis pose is globally optimized using the LM algorithm.

[0039] Specifically, step 1 involves calibrating the camera's intrinsic parameters. The Zhang Zhengyou calibration method is used, employing a ChArUco calibration board with a grid size of 3mm × 3mm, and 15 images are acquired from different angles. The camera intrinsic parameter matrix K is then calculated using the OpenCV calibration toolbox. The distortion coefficients are k1 = -0.042 and k2 = 0.123.

[0040] Then, extrinsic parameter calibration was performed. The ChArUco calibration board was fixed on the worktable, and the five-axis machine tool was controlled to move the camera to 20 different poses. The machine tool coordinates for each pose were recorded, and images of the calibration board were acquired. The objective function was optimized using the LM algorithm to solve for the transformation matrix of the camera coordinate system relative to the machine tool coordinate system.

[0041] The objective function for global optimization using the LM algorithm in step 1 is: ,in, The optimized camera pose Lie algebra; For the Lie algebra of the camera pose to be optimized, p i To determine the pixel coordinates of the i-th feature on the calibration board, P i Let be the 3D coordinates of the i-th feature on the calibration board in the machine coordinate system, K be the intrinsic parameter matrix of the camera, exp(ξ^) be the exponential mapping from Lie algebra to Lie group, represent the transformation matrix, and s be the scale factor. This represents the total number of feature points participating in the optimization.

[0042] Step 2 of the SFM reconstruction process includes: first, extracting SIFT or ORB feature points from the image sequence, performing feature matching using a FLANN matcher, and then using the RANSAC algorithm to remove mismatched points. Using the initial camera extrinsic parameters provided by the camera intrinsic parameters calibrated in Step 1 and the machine tool coordinates, the 3D point coordinates and camera pose are optimized using bundle adjustment (BA) to finally generate a sparse point cloud. Dense reconstruction uses the CMVS / PMVS algorithm to densify the sparse point cloud, obtaining a 3D point cloud model.

[0043] Specifically, the five-axis machine tool was controlled to move along the planned scanning path, acquiring multi-view images of the workpiece at a speed of 5 mm / s, for a total of 60 images. The SIFT algorithm was used to extract feature points, and a FLANN matcher was used for feature matching. The RANSAC algorithm was used to remove mismatched points and retain valid matching pairs. Using the extrinsic parameters calibrated in step 1 as initial values, bundle adjustment optimization was performed to obtain a sparse point cloud (approximately 5000 points). The CMVS / PMVS algorithm was then used for dense reconstruction to obtain a dense point cloud (approximately 500,000 points), with a point cloud density that met the requirements for subsequent path planning.

[0044] The SFM (Structure from Motion) algorithm in step 2 uses the machine coordinates provided by the machine tool as the strong constraint initial values ​​for the camera pose. Its optimization objective is to minimize the reprojection error, and the reprojection error function is: Where E is the total global reprojection error; X t Let t be the coordinates of the t-th point in three-dimensional space; Let π be the observed pixel coordinates of the t-th 3D point in the j-th image; j(·) is the projection function of the j-th camera; V j Let be the set of all 3D points visible in the j-th image; ρ(·) is the robust kernel function; H is the covariance matrix of the observation noise.

[0045] The intrinsic parameter matrix K calibrated in step 1 is used to backproject the image feature points into 3D spatial rays, while the extrinsic parameters serve as strong constraint initial values ​​for bundle adjustment, ensuring that the reconstructed 3D point cloud coordinate system is aligned with the machine tool coordinate system. Specifically, in the SFM algorithm, the pose of each camera is obtained from the machine tool coordinates through extrinsic parameter transformation, so that the coordinates of the final point cloud directly correspond to the true position in the machine tool coordinate system.

[0046] Step 3: Project the 3D point cloud onto a 2D plane, extract the 2D contour, and then offset the normal vector of the contour point set. Determine the normal offset amount d based on the adhesive viscosity and preset adhesive height. offset Its value ranges from 0.05 to 0.2 mm. The two-dimensional projected contour points are translated by d along their normal vector direction. offset The corrected 3D path points are obtained to compensate for the adhesive extrusion deformation when the needle contacts the workpiece during dispensing. The 2D projection points are mapped back to the 3D point cloud, and the unit normal vector for each path point is calculated. The formula for normal vector calculation and attitude transformation is as follows.

[0047] The formula for calculating the unit normal vector of the path point and converting it into B and C axis angles in step 3 is as follows: , , where q k Let N(q) be the path point in the 3D point cloud whose normal vector is to be calculated. k ) represents the point cloud and q k The set of points in the neighborhood; For q k and its neighboring points q m The normal vector of the fitted micro-tangent plane; ω m A weighting coefficient that is inversely proportional to the distance; The final calculated q k The unit normal vector of a point has components (n) x , n y , n z ); B k C is the B-axis angle of rotation of a five-axis machine tool around the Y-axis; k Let C be the C-axis angle of a five-axis machine tool rotating around the Z-axis. arctan2 is a bivariate arctangent function used to determine the quadrant of the angle based on its sign.

[0048] Extract the edge contour of the adhesive to be applied from the 3D point cloud model. Project the point cloud onto the XY plane and extract the 2D contour point set. Determine the normal offset d based on the adhesive viscosity (8000 cps) and the target adhesive height of 0.15 mm. offset=0.1mm. The 2D contour points are translated along the normal vector direction and then mapped back to the 3D point cloud. For each path point q... k Select the point set N(q) within a neighborhood radius of 2 mm. k Calculate the normal vector of the micro-tangent plane. Use the inverse distance weight ω. m =1 / |q k -q m | This yields the unit normal vector. Convert this to B and C axis angles:

[0049] like =(0.12, 0.85, 0.51), then B=arctan2(√(0.12²+0.51²), 0.85)=32.7°, C=arctan2(0.51, 0.12)=76.8°;

[0050] Generate a point set P containing 500 path points. path ={(X,Y,Z,B,C)}.

[0051] The transformation relationship between the machine tool coordinate system and the workpiece coordinate system established in step 1 forms the basis for the path point coordinates. Since the reconstructed point cloud has been aligned to the machine tool coordinate system in step 2, the extracted path points (X, Y, Z) are directly located in the machine tool coordinate system and can be used for machine tool motion control without additional transformation. The calculation of the attitude angles (B, C) depends on the normal vector of the path points, and the direction of the normal vector is defined on the workpiece surface. The known relationship between the machine tool coordinate system and the workpiece coordinate system ensures that the attitude is consistent with the workpiece normal.

[0052] Step 4 employs a shape-based template matching algorithm to extract the workpiece's edge contour as template features. The similarity between the real-time image and the template is calculated using normalized cross-correlation (NCC) or Hausdorff distance to obtain translational offsets ΔX and ΔY (unit: pixels) and rotational offset Δθ (unit: degrees). Subsequently, the pixel offsets are converted into physical offsets in the machine tool coordinate system based on pixel equivalents (mm / pixel).

[0053] In step 4, the offset is used The formula for correcting path points is: Where (X,Y,Z) are the coordinates of the standard trajectory point, and (X',Y',Z') are the corrected coordinates. This represents the translational offset of the workpiece in the X and Y directions. This represents the rotational offset of the workpiece around the Z-axis.

[0054] In this embodiment, the matched offsets are ΔX = 3.2 pixels, ΔY = -1.5 pixels, and Δθ = 0.8°. Based on a pixel equivalent of 0.0125 mm / pixel, these are converted to physical offsets ΔX = 0.04 mm, ΔY = -0.01875 mm, and Δθ = 0.8°. A homogeneous transformation matrix is ​​then used to correct all 500 path points.

[0055] The offset (ΔX, ΔY, Δθ) represents the transformation of the current workpiece coordinate system relative to the standard workpiece coordinate system. This transformation directly updates the relationship between the machine tool coordinate system and the workpiece coordinate system in step 1. The homogeneous transformation matrix in the correction formula is the specific implementation of this relationship. The corrected path point coordinates (X', Y', Z') remain in the machine tool coordinate system, ensuring consistency with the machine tool motion.

[0056] The formula for evaluating adhesive path deviation in step 5 is: , where D RMS d represents the root mean square deviation of the adhesive path, N is the total number of sampling points on the adhesive path, and d represents the root mean square deviation of the adhesive path. theory (g) represents the theoretical glue width or location value at the g-th sampling point, and d actual (g) represents the actual glue width or location value of the g-th sampling point.

[0057] In step 1, the calibration board used is the ChArUco board, which is used to perform sub-pixel level feature point detection within the calibration space.

[0058] In step 3, when generating the dispensing path, the method further includes projecting the three-dimensional point cloud onto a two-dimensional plane to extract the edge contours, collecting all the edge contours to obtain the contour point set, and offsetting the normal direction to obtain the actual contact path that compensates for the deformation of the adhesive extrusion.

[0059] The process parameters adjusted in step 5 include dispensing pressure, dispensing valve opening time, rotational speeds of the B and C axes, and movement speeds of the linear axes X, Y, and Z. After dispensing is completed, an image of the glue path is acquired. The centerline of the glue path is extracted through image processing and compared with the theoretical path. A threshold T is set. width =±0.03mm, T pos =±0.05mm. In this embodiment, D is calculated to be... RMS =0.042mm, exceeding the position deviation threshold. The system adjusted parameters via the PID controller: dispensing pressure increased from 0.25MPa to 0.27MPa, and B-axis rotation speed decreased from 5° / s to 4.5° / s. After adjustment, the dispensing test was repeated, D RMS The thickness was reduced to 0.031 mm, which meets the requirements.

[0060] Calculating adhesive path deviation requires converting the pixel coordinates of the adhesive path extracted from the image into their actual positions in the machine tool coordinate system for comparison with the theoretical path (the standard trajectory in the machine tool coordinate system). This conversion relies on step 1: first, the pixel coordinates are converted into camera coordinates using the intrinsic parameter matrix K, and then the camera coordinates are converted into machine tool coordinates using the extrinsic parameters calibrated in step 1. Therefore, the spatial transformation model is the mathematical basis for closed-loop feedback, ensuring the accuracy of deviation assessment.

[0061] In this embodiment, the linear axis repeatability of the five-axis dispensing machine is ±0.002mm, and the rotary axis repeatability is ±0.005°. The camera is a 5-megapixel CCD camera equipped with a 2x telecentric lens, a field of view of 20mm × 15mm, and an image acquisition frame rate of 30fps. The dispensing valve is a pneumatic jet valve with a dispensing pressure adjustment range of 0.1-0.6MPa and a valve opening time adjustment range of 1-10ms.

[0062] The visual template matching in step 4 employs a shape-based template matching algorithm. It calculates the similarity between the real-time image and the standard template using normalized cross-correlation or Hausdorff distance to obtain the offset. .

[0063] This embodiment solves the problem of programming complex curved workpieces by deeply integrating the SFM algorithm with the five-axis machine tool coordinate system. The generated path point cloud can accurately reflect the surface normal of the workpiece, ensuring that the dispensing head is always perpendicular to the curved surface and improving the consistency of the glue path.

[0064] This embodiment uses the LM algorithm to perform global optimization calibration of the rotation axis, establishing a high-precision vision-machine tool transformation model, which fundamentally ensures the accuracy of image guidance.

[0065] This embodiment combines visual template matching and coordinate correction algorithms to solve the problem of inconsistent workpiece clamping positions in mass production. It eliminates the need to re-teach each product, significantly improving the flexibility and debugging efficiency of the production line.

[0066] In this embodiment, the image acquisition and analysis process after dispensing forms a complete closed-loop feedback loop. It can not only detect the dispensing quality of the current product, but also optimize subsequent production parameters through data-driven optimization, realizing an intelligent upgrade from "open-loop control" to "perception-decision-execution".

[0067] A five-step integrated approach achieves full automation and high-precision control of dispensing on complex curved workpieces. First, the LM algorithm is used for optimized calibration, establishing a high-precision coordinate transformation between vision and machine tool, eliminating systematic errors. Second, based on the SFM algorithm and machine tool coordinate constraints, dense 3D reconstruction of the workpiece surface is achieved, solving the problem of obtaining 3D paths in traditional teach-programming. Third, through normal vector calculation and attitude transformation, dispensing path points perpendicular to the curved surface are generated, ensuring consistent dispensing paths. Furthermore, visual template matching is used to compensate for workpiece clamping offsets in real time, eliminating the need for re-teaching and improving production line flexibility. Finally, post-dispensing image feedback is used to adjust process parameters in a closed loop, enabling online quality monitoring.

[0068] The spatial transformation model in this embodiment specifically involves establishing a spatial transformation model between multiple coordinate systems. This includes the following sub-steps:

[0069] 1.1 Camera Intrinsic Parameter Calibration: The Zhang Zhengyou calibration method was adopted. By photographing a checkerboard calibration board in different poses, the camera's intrinsic parameter matrix was solved, including the equivalent focal lengths fx and fy, principal point coordinates u0 and v0, and radial distortion coefficients k1 and k2. This intrinsic parameter matrix established the transformation relationship between the pixel coordinate system and the camera coordinate system.

[0070] 1.2 Hand-eye calibration: Utilizing the high-precision motion of a five-axis machine tool as an external reference, the machine tool is controlled to drive the camera to take multi-angle photos of the calibration board. The LM algorithm is used to globally optimize the pose of the rotation axes, solving for the extrinsic parameter matrices (rotation matrix R and translation vector T) between the camera coordinate system and the machine tool coordinate system, thus completing the hand-eye calibration.

[0071] 1.3 Workpiece coordinate system setting: Through the visual template matching in step 4, the offset of the current workpiece relative to the standard position is determined in real time, and the dynamic transformation relationship between the workpiece coordinate system and the machine tool coordinate system is established.

[0072] The above three sub-steps together construct a complete coordinate system transformation chain from pixel coordinate system to image coordinate system to camera coordinate system to machine tool coordinate system to workpiece coordinate system, providing a unified coordinate reference for subsequent 3D reconstruction, path planning, and online compensation.

[0073] A visual template is a pre-created and stored data model used to describe the features of a standard workpiece image. It typically includes the following:

[0074] Image features: These can be grayscale images of the workpiece, edge contours, corner points, SIFT / SURF feature point sets, or shape-based templates (such as Hausdorff distance templates).

[0075] Coordinate reference: The template image defines the position and orientation of the workpiece in the ideal clamping state, which serves as a reference reference for subsequent matching.

[0076] Matching Algorithm: In actual production, algorithms such as normalized cross-correlation (NCC), shape matching, and feature matching are used to compare the real-time acquired workpiece image with the visual template, thereby calculating the translational offset (ΔX, ΔY) and rotational offset (Δθ) of the current workpiece relative to the template.

[0077] In this embodiment, the visual template is used for online offset compensation in step 4 to realize real-time correction of workpiece clamping deviation without re-teaching the dispensing path. The dispensing path in this embodiment is the glue path.

[0078] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. An image acquisition and analysis method based on a five-axis dispenser, applied to a five-axis dispenser comprising linear axes X, Y, Z and rotary axes B, C, the dispenser being provided with a camera, characterized in that, include: Step 1: Establish a spatial transformation model between the pixel coordinate system, image coordinate system, camera coordinate system, machine tool coordinate system, and workpiece coordinate system; obtain intrinsic parameters through camera calibration, and drive the camera to take multi-angle pictures of the calibration plate by controlling the machine tool movement; use the LM algorithm to globally optimize the pose of the rotation axis and obtain the transformation matrix between the camera coordinate system and the machine tool coordinate system. Step 2: Control the five-axis machine tool to drive the camera to move along the preset trajectory and acquire a multi-view image sequence of the workpiece; Based on the multi-view image sequence, combined with the camera intrinsic and extrinsic parameters calibrated in Step 1, use the SFM algorithm to perform three-dimensional reconstruction of the workpiece and obtain a three-dimensional point cloud model. Step 3: Extract the feature region to be dispensed from the 3D point cloud model, obtain the unit normal vector of the path point by calculating the micro-tangent plane of the point cloud neighborhood, and generate the position coordinates by combining the five-axis machine tool structure. and posture angle The set of dots along the dispensing path; Step 4: Before actual dispensing, capture a real-time image of the current workpiece using a camera, match it with a pre-stored standard workpiece visual template, and calculate the offset of the current workpiece relative to the standard position. And use the offset to correct the coordinates of the dispensing path point set generated in step 3; Step 5: After dispensing is completed, the glue path image is captured again by the camera, the actual contour of the glue path is extracted and the glue path deviation is calculated. If the deviation exceeds the preset threshold, the dispensing process parameters are automatically adjusted.

2. The image acquisition and analysis method based on a five-axis dispensing machine as described in claim 1, characterized in that, The objective function for global optimization using the LM algorithm in step 1 is: ,in, The optimized camera pose Lie algebra; For the Lie algebra of the camera pose to be optimized, p i To determine the pixel coordinates of the i-th feature on the calibration board, P i Let be the three-dimensional coordinates of the i-th feature on the calibration board in the machine tool coordinate system, K be the intrinsic parameter matrix of the camera, exp(ξ^) be the exponential mapping from Lie algebra to Lie group, represent the transformation matrix, s be the scale factor, and O be the total number of feature points involved in the optimization.

3. The image acquisition and analysis method based on a five-axis dispensing machine as described in claim 1, characterized in that, The SFM algorithm in step 2 uses the machine coordinates provided by the machine tool as the strong constraint initial values ​​for the camera pose. Its optimization objective is to minimize the reprojection error, and the reprojection error function is: Where E is the total global reprojection error; X t Let t be the coordinates of the t-th point in three-dimensional space; Let π be the observed pixel coordinates of the t-th 3D point in the j-th image; j (·) is the projection function of the j-th camera; V j Let be the set of all 3D points visible in the j-th image; ρ(·) is the robust kernel function; H is the covariance matrix of the observation noise.

4. The image acquisition and analysis method based on a five-axis dispensing machine as described in claim 3, characterized in that, The formula for calculating the unit normal vector of the path point and converting it into B and C axis angles in step 3 is as follows: , , where q k Let N(q) be the path point in the 3D point cloud whose normal vector is to be calculated. k ) represents the point cloud and q k The set of points in the neighborhood; For q k and its neighboring points q m The normal vector of the fitted micro-tangent plane; ω m A weighting coefficient that is inversely proportional to the distance; The final calculated q k The unit normal vector of a point has components (n) x , n y , n z ); B k C is the B-axis angle of rotation of a five-axis machine tool around the Y-axis; k The C-axis angle is the rotation angle of a five-axis machine tool around the Z-axis.

5. The image acquisition and analysis method based on a five-axis dispensing machine as described in claim 4, characterized in that, In step 4, the offset is used The formula for correcting path points is: Where (X,Y,Z) are the coordinates of the standard trajectory point, and (X',Y',Z') are the corrected coordinates. This represents the translational offset of the workpiece in the X and Y directions. This represents the rotational offset of the workpiece around the Z-axis.

6. The image acquisition and analysis method based on a five-axis dispensing machine as described in claim 5, characterized in that: The formula for evaluating adhesive path deviation in step 5 is as follows: , where D RMS d represents the root mean square deviation of the adhesive path, N is the total number of sampling points on the adhesive path, and d represents the root mean square deviation of the adhesive path. theory (g) represents the theoretical glue width or location value at the g-th sampling point, and d actual (g) represents the actual glue width or location value of the g-th sampling point.

7. The image acquisition and analysis method based on a five-axis dispensing machine as described in claim 1, characterized in that: In step 1, the calibration board used is the ChArUco board, which is used to perform sub-pixel level feature point detection within the calibration space.

8. The image acquisition and analysis method based on a five-axis dispensing machine as described in claim 1, characterized in that: In step 3, when generating the dispensing path, the method further includes projecting the three-dimensional point cloud onto a two-dimensional plane to extract the edge contours, collecting all the edge contours to obtain the contour point set, and offsetting the normal direction to obtain the actual contact path that compensates for the deformation of the adhesive extrusion.

9. The image acquisition and analysis method based on a five-axis dispensing machine as described in claim 1, characterized in that: The process parameters adjusted in step 5 include dispensing pressure, dispensing valve opening time, rotational speed of the B-axis and C-axis, and movement speed of the linear axes X-axis, Y-axis, and Z-axis.

10. The image acquisition and analysis method based on a five-axis dispensing machine as described in claim 1, characterized in that: The visual template matching in step 4 employs a shape-based template matching algorithm. It calculates the similarity between the real-time image and the standard template using normalized cross-correlation or Hausdorff distance to obtain the offset. .