Laser processing method and device, laser machine and computer readable storage medium
By obtaining the material thickness of the workpiece and finding the image calibration parameters in the matching relationship table, the workpiece image is calibrated and the mechanical coordinates are determined, which solves the laser processing accuracy problem caused by lens distortion, and achieves high-precision and convenient laser processing.
Patent Information
- Application Number
- CN202510253106.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-03
- Publication Date
- 2025-04-29
AI Technical Summary
Due to lens distortion and other reasons, the workpiece images captured by the camera may not accurately reflect the workpiece position, affecting the laser processing accuracy.
By obtaining the material thickness of the workpiece, finding the image calibration parameters in the matching relationship table, and calibrating the workpiece image based on these parameters, determining the mechanical coordinates of the workpiece, thereby performing precise laser processing.
It improves the accuracy of laser processing, reduces the cumbersome operation of image calibration parameters, lowers the operating threshold, and improves the convenience of processing.
Smart Images

Figure CN119897577A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of laser technology, and in particular to a laser processing method, device, laser machine and computer-readable storage medium. Background Art
[0002] Laser machine is a device that uses the thermal effect generated by projecting a laser beam onto the surface of a workpiece to complete the processing process. During the laser processing process, the laser machine can use a camera to locate and identify the contour of the workpiece, as well as monitor the workpiece condition during the processing. For example, the camera can take an image of the workpiece, and based on the image, it can obtain information such as the position of the workpiece. Then, the laser machine calculates the angle and position that the laser beam needs to be adjusted based on this information, thereby controlling the laser beam to accurately irradiate the target position on the object to ensure the accuracy of the processing position.
[0003] However, due to various reasons such as lens distortion, the workpiece image taken by the camera may not accurately reflect the position of the workpiece, thus affecting the laser processing accuracy. Summary of the invention
[0004] In view of the above, embodiments of the present application provide a laser processing calibration method, device, laser machine and computer-readable storage medium.
[0005] In a first aspect, an embodiment of the present application provides a laser processing method, which is applied to a laser machine, wherein the laser machine includes a camera and a working platform, and the laser processing method includes: In response to a laser processing request for a workpiece, obtaining a first material thickness, where the first material thickness is the material thickness of the workpiece; Searching for a first image calibration parameter in a pre-stored matching relationship table of material thickness and image calibration parameters, where the first image calibration parameter is an image calibration parameter that matches the first material thickness; When the workpiece is placed on the work platform, controlling the camera to photograph the work platform to obtain an image of the workpiece; The mechanical coordinates of the workpiece are determined based on the first image calibration parameters and the workpiece image, and laser processing is performed on the workpiece based on the mechanical coordinates.
[0006] When performing laser processing on a workpiece, the embodiment of the present application can select image calibration parameters that are suitable for the workpiece based on the material thickness of the workpiece, thereby performing image calibration on the workpiece image, which is beneficial to accurately detect the mechanical coordinates of the workpiece, thereby improving the processing accuracy. In addition, the embodiment of the present application can automatically search for image calibration parameters based on a matching relationship table, reduce the tedious operations of determining image calibration parameters, improve the convenience of laser processing, and help lower the operational threshold of laser processing.
[0007] In some embodiments, the laser processing method further comprises: In response to a configuration request of an image calibration parameter, obtaining a second material thickness, where the second material thickness is a material thickness of the image calibration parameter to be configured; Determine a second image calibration parameter based on the second material thickness, wherein the second image calibration parameter is an image calibration parameter that matches the second material thickness; The second image calibration parameter and the second material thickness are stored in the matching relationship table according to a corresponding relationship.
[0008] In some embodiments, determining a second image calibration parameter based on the second material thickness includes: When a calibration plate of a calibration table is placed on the working platform, controlling the camera to shoot the working platform to obtain an image of the calibration plate; Wherein, the calibration plate image displays the calibration plate, and the thickness of the calibration plate is the same as the thickness of the second material; The second image calibration parameter is determined based on the calibration plate image.
[0009] In some embodiments, the second image calibration parameter includes a distortion correction parameter, and the calibration plate includes a first calibration plate, in which a first geometric pattern is drawn; The determining of the second image calibration parameter based on the calibration plate image comprises: determining a first coordinate based on the plurality of first calibration images; The first coordinates are coordinates of corner points of the first geometric pattern in the image coordinate system of the camera, and the multiple first calibration images are calibration plate images obtained by photographing the work platform by the camera when the first calibration plate is placed at different positions of the work platform; Acquire second coordinates, where the second coordinates are coordinates of a corner point of the first geometric pattern in a mechanical coordinate system; The distortion correction parameter is determined based on the first coordinate and the second coordinate.
[0010] In some embodiments, the second image calibration parameter includes an alignment parameter, and the alignment parameter is used to indicate the mapping relationship between the mechanical coordinate system of the laser machine and the image coordinate system of the camera; the calibration plate includes a second calibration plate, and at least four non-collinear second geometric patterns are drawn on the second calibration plate; The determining of the second image calibration parameter based on the calibration plate image comprises: Determining pixel coordinates of the second geometric pattern in a second calibration image, where the second calibration image is an image of the calibration plate obtained by photographing the work platform by the camera when the second calibration plate is placed in a preset area of the work platform; Acquire the mechanical coordinates of the second geometric pattern when the second calibration plate is placed in a preset area of the working platform; The alignment parameters are determined based on the pixel coordinates and the machine coordinates.
[0011] In some embodiments, the second image calibration parameter includes a compensation value, and determining the second image calibration parameter based on the second material thickness includes: Controlling the laser machine to perform laser processing on a processing template placed on the working platform, wherein the thickness of the processing template is the same as the thickness of the second material, and a position to be processed is marked on the processing template; Controlling the camera to photograph the working platform to obtain a sample image; Identifying the to-be-processed position and the actual processing position in the sample image; The compensation value is determined based on the to-be-processed position and the actual processing position.
[0012] In some embodiments, the laser processing method further comprises: If the image calibration parameter matching the first material thickness is not found in the matching relationship table, a configuration prompt for the image calibration parameter is issued.
[0013] In a second aspect, an embodiment of the present application further provides a laser processing device, which is applied to a laser machine, wherein the laser machine includes a camera and a working platform, and the laser processing device includes: A thickness acquisition module, configured to acquire a first material thickness in response to a laser processing request for a workpiece, wherein the first material thickness is the material thickness of the workpiece; A parameter search module, used to search for a first image calibration parameter in a pre-stored matching relationship table of material thickness and image calibration parameters, wherein the first image calibration parameter is an image calibration parameter that matches the first material thickness; A shooting module, used for controlling the camera to shoot the work platform to obtain an image of the work platform when the workpiece is placed on the work platform; The laser processing module is used to determine the mechanical coordinates of the workpiece based on the first image calibration parameters and the workpiece image, and to perform laser processing on the workpiece based on the mechanical coordinates.
[0014] In a third aspect, an embodiment of the present application further provides a laser machine, comprising a processor and a memory, wherein the memory is used to store instructions, and the processor is used to call the instructions in the memory so that the laser machine executes the laser processing method described in the first aspect.
[0015] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on a laser machine, the laser machine executes the laser processing method as described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A flowchart of the steps of a laser processing method provided in one embodiment of the present application.
[0017] Figure 2 A flowchart of the steps of maintaining a matching relationship table provided in an embodiment of the present application.
[0018] Figure 3 A schematic diagram of the configuration of distortion correction parameters provided in one embodiment of the present application.
[0019] Figure 4 A schematic diagram of the configuration of alignment parameters provided in an embodiment of the present application.
[0020] Figure 5 A schematic diagram of the configuration of compensation values provided in one embodiment of the present application.
[0021] Figure 6 A schematic structural diagram of a laser processing device provided in one embodiment of the present application.
[0022] Figure 7 A schematic diagram of the structure of a laser machine provided in one embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that the implementation methods of the present application and the features in the implementation methods can be combined with each other without conflict.
[0024] In the following description, many specific details are set forth to facilitate a full understanding of the present application. The described implementations are only part of the implementations of the present application, rather than all the implementations.
[0025] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0026] It should be further noted that, in this article, the terms "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0027] In this application, "at least one" means one or more, and "more" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0028] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0029] During the laser processing process, the camera can capture an image of the workpiece and obtain information such as the position of the workpiece based on the image. Then, the laser machine calculates the angle and position of the laser beam that needs to be adjusted based on this information, thereby controlling the laser beam to accurately irradiate the target position on the object to ensure the accuracy of the processing position.
[0030] However, due to various factors such as lens distortion, processing materials, camera installation, etc., the workpiece image taken by the camera may not accurately reflect the position of the workpiece, affecting the workpiece processing accuracy.
[0031] In view of the above, embodiments of the present application provide a laser processing method, device, laser machine and computer-readable storage medium.
[0032] The laser processing method of the present application can be applied to a laser machine. The laser machine is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a processor, a microprogrammed control unit (MCU), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital processor (DSP), an embedded device, a camera, a work platform, etc. The laser machine can be a laser cutting machine, or a laser engraving machine, etc., but is not limited thereto.
[0033] The laser processing method of the embodiment of the present application may include: a laser obtains a first material thickness in response to a laser processing request for a workpiece, where the first material thickness is the material thickness of the workpiece; in a pre-stored matching relationship table of material thickness and image calibration parameters, a first image calibration parameter is searched, where the first image calibration parameter is an image calibration parameter that matches the first material thickness; when the workpiece is placed on the work platform, the camera is controlled to photograph the work platform to obtain a workpiece image; the mechanical coordinates of the workpiece are determined based on the first image calibration parameter and the workpiece image, and laser processing is performed on the workpiece based on the mechanical coordinates.
[0034] When laser processing is performed on a workpiece, the embodiment of the present application can select image calibration parameters that are suitable for the workpiece based on the material thickness of the workpiece, thereby calibrating the workpiece image, which is beneficial for accurately detecting the mechanical coordinates of the workpiece and further improving the processing accuracy.
[0035] In addition, compared to performing camera calibration on the workpiece material before each laser operation, the embodiment of the present application can automatically search for image calibration parameters based on the matching relationship table, reduce the tedious operations of determining image calibration parameters, improve the convenience of laser processing, and help lower the operational threshold of laser processing.
[0036] Figure 1 This is a flowchart of the steps of an embodiment of the laser processing method of the present application. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
[0037] See also Figure 1 As shown, the laser processing method may include the following steps.
[0038] Step 101 : acquiring a first material thickness in response to a laser processing request for a workpiece.
[0039] The first material thickness is the material thickness of the workpiece.
[0040] For example, when a workpiece requires laser processing, the user can trigger a laser processing request on the human-computer interaction interface. After the laser machine detects the laser processing request, it can obtain the first material thickness.
[0041] In some embodiments, the laser can scan the workpiece to obtain the first material thickness. For example, a two-dimensional code is printed on the workpiece, and the two-dimensional code includes information such as the first material thickness. The laser can determine the first material thickness by scanning the two-dimensional code.
[0042] In other embodiments, the user may input the first material thickness in the human-computer interaction interface, so that the user obtains the first material thickness from the human-computer interaction interface.
[0043] Step 102: Searching for a first image calibration parameter in a pre-stored matching relationship table of material thickness and image calibration parameters.
[0044] The matching relationship table stores material thickness and image calibration parameters that match the material thickness. The matching relationship table can be stored in a remote database, such as a cloud, or locally in the laser.
[0045] In some embodiments, the matching relationship table may also store camera height, camera model, camera resolution, etc. The camera height is the height between the camera and the work platform during shooting. The laser may search for corresponding image calibration parameters based on the camera height, camera model, material thickness, and camera resolution.
[0046] The image calibration parameters in the matching relationship table may include at least one of a distortion correction parameter, an alignment parameter, and a compensation parameter.
[0047] The distortion correction parameters are used to eliminate the distortion in the workpiece image. The distortion correction parameters may include camera intrinsic parameters, camera extrinsic parameters, distortion parameters, etc., but are not limited thereto.
[0048] The alignment parameters are used to indicate the mapping relationship between the mechanical coordinate system of the laser machine and the image coordinate system of the camera, that is, the alignment parameters can convert the image coordinates of each position in the workpiece image into the mechanical coordinates in the laser machine. The alignment parameters can be the affine transformation matrix between the image coordinate system and the mechanical coordinate system, but are not limited to this.
[0049] Among them, the mechanical coordinates can reflect the physical position of the workpiece in the actual environment. For example, the mechanical coordinates can be the coordinates of the workpiece in the mechanical coordinate system of the laser. The Z axis of the mechanical coordinate system can be consistent with the laser emission direction of the laser or the axial direction of the laser light path, the X axis is in a plane perpendicular to the Z axis, which is related to the lateral movement direction of the laser processing head or the work platform, and the Y axis is perpendicular to the plane where the X axis and the Z axis are located.
[0050] For example, when the laser is a laser engraving machine, the Z axis may be along the up and down movement direction of the laser head, the X axis may be along the left and right movement direction of the working platform, and the Y axis may be along the front and back movement direction of the working platform. Image coordinates can reflect the pixel position of the workpiece in the workpiece image. For example, taking a certain point on the workpiece image plane as the origin, an image coordinate system is established in the workpiece image plane, and the position of the pixel where the workpiece is located in the image coordinate system is the image coordinate.
[0051] The compensation value is used to characterize the offset of the mechanical coordinate. For example, when a workpiece needs to be processed, the planned processing position of the workpiece is the mechanical coordinate B. After the workpiece is processed according to the planned processing position, the processed position is the mechanical coordinate A, and the compensation value is the offset between the mechanical coordinate A and the mechanical coordinate B.
[0052] The first image calibration parameter is an image calibration parameter that matches the first material thickness. The first image calibration parameter can accurately perform image calibration on the workpiece image corresponding to the workpiece of the first material thickness to accurately reflect the mechanical coordinates of the workpiece.
[0053] Step 103 , when the workpiece is placed on the work platform, the camera is controlled to shoot the work platform to obtain an image of the workpiece.
[0054] Workpieces are displayed in the workpiece image.
[0055] Step 104 : determining the mechanical coordinates of the workpiece based on the first image calibration parameters and the workpiece image.
[0056] In some embodiments, when the first image calibration parameters include: distortion correction parameters, alignment parameters and compensation parameters, the laser machine can use distortion correction parameters (for example, camera intrinsic parameters, distortion coefficients, etc.) to remove the distortion of the workpiece image, and then use alignment parameters (such as affine transformation matrix) to convert the image coordinates of the workpiece in the workpiece image into mechanical coordinates. Next, the compensation values are used to compensate the mechanical coordinates to obtain the mechanical coordinates of the workpiece.
[0057] Step 105 , laser processing the workpiece based on the mechanical coordinates.
[0058] The laser machine can calculate the angle and position of the laser beam that needs to be adjusted based on the mechanical coordinates, thereby controlling the laser beam to accurately irradiate the target position on the object to ensure the accuracy of the processing position, for example, to ensure the accuracy of the laser engraving or laser cutting position.
[0059] The above is the step of laser processing the workpiece by the laser machine when the image calibration parameters are found in the matching relationship table. In other embodiments, if the image calibration parameters matching the first material thickness are not found in the matching relationship table, the laser can issue a configuration prompt for the image calibration parameters.
[0060] The user can enter the first material thickness and the image calibration parameter matched thereto into the matching relationship table according to the configuration prompt of the image calibration parameter.
[0061] That is, the laser machine can also configure a matching relationship table, and the laser machine can store material thickness and image calibration parameters in the matching relationship table, so as to determine corresponding image calibration parameters for workpieces with different material thicknesses.
[0062] refer to Figure 2 As shown, Figure 2 A flowchart of the steps for configuring a matching relationship table provided in an embodiment of the present application.
[0063] Step 201 : acquiring a second material thickness in response to a configuration request for image calibration parameters.
[0064] The second material thickness is the material thickness for which the image calibration parameters are to be configured.
[0065] For example, the user may input a second material thickness into the laser.
[0066] For another example, a QR code or other mark may be printed on the workpiece, and the mark may record information related to the material thickness. The laser may scan the mark to obtain the material thickness.
[0067] The above-mentioned method of using the laser to obtain the material thickness is only a limitation and is not limited to this in actual application. The embodiments of the present application are not limited to this.
[0068] Step 202: determining a second image calibration parameter based on a second material thickness.
[0069] The second image calibration parameter is an image calibration parameter that matches the second material thickness.
[0070] That is, the laser can detect the image calibration parameter that matches the second material thickness to obtain the second image calibration parameter.
[0071] In some embodiments, step 202 may include: the laser machine may control the camera to photograph the work platform when the calibration plate is placed on the work platform to obtain a calibration plate image; and determine the second image calibration parameters based on the calibration plate image.
[0072] The calibration plate image shows the calibration plate, and the thickness of the calibration plate is the same as the thickness of the second material.
[0073] The calibration and marking plate may be an integrally formed calibration and marking plate.
[0074] The calibration and marking plate may also include a pad and a pattern plate, the pattern plate being drawn with a geometric pattern (such as a checkerboard) for calibration and marking, and the pad can be used to supplement the thickness of the pattern plate, that is, when the thickness of the pattern plate is less than the thickness of the second material, the pad can be placed on the work platform, the pattern plate can be placed on the pad, and the total thickness of the pad and the pattern plate is equal to the thickness of the second material.
[0075] Taking into account the different material thicknesses of the workpiece, the distance between the camera and the workpiece will also be different. The embodiment of the present application simulates the height between the workpiece and the camera when the camera shoots the workpiece of the second material thickness through a calibration plate with the same thickness as the second material, thereby accurately simulating the camera's shooting scenario of workpieces of different material thicknesses and improving the accuracy of the calculation of the second image calibration parameters.
[0076] Further, in some embodiments, when the second image calibration parameter includes a distortion correction parameter, the calibration plate may include a first calibration plate, and a first geometric pattern, such as a checkerboard, is drawn on the first calibration plate.
[0077] The step of determining the distortion correction parameter based on the second material thickness by the laser may include: Determine a first coordinate based on a plurality of first calibration images; wherein the first coordinate is the coordinate of a corner point of the first geometric pattern in the image coordinate system of the camera, and the plurality of first calibration images are calibration plate images obtained by photographing the work platform by the camera when the first calibration plate is placed at different positions of the work platform; obtain a second coordinate, wherein the second coordinate is the coordinate of a corner point of the first geometric pattern in the mechanical coordinate system; determine the distortion correction parameter based on the first coordinate and the second coordinate.
[0078] For example, refer to Figure 3 As shown, the first geometric pattern is a checkerboard. The first calibration plate 31 is placed at different positions of the working platform 32. The camera takes pictures of the first calibration plate at different positions to obtain multiple first calibration images. Figure 3In the figure, the first calibration plate 31 is located at the upper left of the working platform 32. In actual application, the first calibration plate can also be placed at other positions indicated by the dotted line, that is, it can be placed at the upper center, upper right, middle left, center, middle right, lower left, lower center, and lower right of the working platform, so as to obtain the first calibration images corresponding to the above nine positions.
[0079] The laser can obtain the coordinates of the corner points of the chessboard in each first calibration image (i.e., the first coordinates), and obtain the second coordinates according to the placement position of the first calibration plate on the work platform. The laser can call the calibrateCamera function of OpenCV and input the first coordinates and the second coordinates into the function to obtain the distortion correction parameters.
[0080] For example, the code for the laser to call the calibrateCamera function can be as follows: void genCamerMatirx() { calibrateCamera(objpoints,imgpoints,imgSize,cameraConfig.cameraMatirx, cameraConfig.distCoeffs, rvecs, tvecs, cv::CALIB_FIX_K3); } In the above code, genCamerMatirx() refers to the function of laser camera calibration.
[0081] calibrateCamera() is a function in OpenCV that solves the camera's intrinsic parameters, extrinsic parameters for each viewing angle, and distortion coefficients.
[0082] objpoints: The coordinates of the object points in the laser mechanical coordinate system. When using a chessboard to calibrate the camera, these points are the coordinates of the chessboard corners in the mechanical coordinate system.
[0083] Imgpoints: The pixel coordinates of the checkerboard corner points in the image coordinate system.
[0084] imgSize: The size of the image, including the width and height information of the image.
[0085] cameraConfig.cameraMatirx: used to represent the camera's internal parameters.
[0086] cameraConfig.distCoeffs: used to represent the distortion coefficients of the camera.
[0087] rvecs: used to calibrate the rotation vector corresponding to each first calibration image.
[0088] Tvecs: used to represent the translation vector corresponding to each first calibration image.
[0089] In some embodiments, when the second image calibration parameters include alignment parameters, the calibration mark plate includes a second calibration plate having at least four non-collinear second geometric patterns drawn therein, wherein the alignment parameters are used to indicate a mapping relationship between a mechanical coordinate system of the laser machine and an image coordinate system of the camera.
[0090] The step of using a laser to determine alignment parameters based on the calibration plate image may include: Determining pixel coordinates of the second geometric pattern in a second calibration image, where the second calibration image is an image of the calibration plate obtained by photographing the work platform by the camera when the second calibration plate is placed in a preset area of the work platform; Acquire the mechanical coordinates of the second geometric pattern when the second calibration plate is placed in a preset area of the working platform; The alignment parameters are determined based on the pixel coordinates and the machine coordinates.
[0091] For example, refer to Figure 4 As shown, Figure 4 is a schematic diagram of the second calibration plate. When the second calibration plate is placed on the work platform, the camera can shoot the second calibration plate, and the camera can present a shooting picture, in which a preset position where the second calibration plate needs to appear can be framed, and the user can observe whether the second calibration plate is displayed at the preset position. If the second calibration plate is displayed at the preset position, the user can adjust the actual position of the second calibration plate on the work platform until the second calibration plate appears at the preset position.
[0092] When the laser machine is a laser cutting machine, the laser cutting machine can control the cutting machine to cut on the second calibration board to obtain the cut second calibration board; use a camera to shoot the cut wooden board to obtain a second calibration image; the user clicks on the second geometric pattern in the second calibration image in a certain order, and the laser can record the coordinates of the position clicked by the user to obtain pixel coordinates; the laser machine can obtain the alignment parameters based on the pixel coordinates and the mechanical coordinates of the second geometric pattern. For example, the estimateAffine2D function in OpenCV can be called to calculate the alignment parameters. The alignment parameters may include an affine transformation matrix. The estimateAffine2D function is used to calculate the affine transformation matrix between the pixel coordinates and the mechanical coordinates of the second geometric pattern.
[0093] For example, the above code can be implemented as follows: void genWorldMatirx() { cv::Mat tmpMat; cameraConfig.worldMatrix = estimateAffine2D(world_position,pixel_position, tmpMat, cv::RANSAC, 10, 2000, 0.99, 100); } genWorldMatirx() represents the function used in the laser to calculate the alignment parameters.
[0094] “cv::Mat tmpMat” declares a variable tmpMat of type cv::Mat. cv::Mat is used to represent a matrix, which can store data of various dimensions.
[0095] The code “cameraConfig.worldMatrix = estimateAffine2D(world_position, pixel_position, tmpMat, cv::RANSAC, 10, 2000, 0.99, 100)” calls the estimateAffine2D function to calculate the affine transformation matrix and assigns the result to the cameraConfig.worldMatrix variable.
[0096] world_position is the coordinate of the second geometric pattern in the mechanical coordinate system of the laser.
[0097] Pixel_position is the pixel coordinate of the second geometric pattern in the image coordinate system of the camera.
[0098] tmpMat is the cv::Mat type variable declared above, which can be used internally by the estimateAffine2D function and can be used to store intermediate calculation results, etc.
[0099] "cv::RANSAC" is used to specify that the estimateAffine2D function uses the Random Sample Consensus (RANSAC) algorithm to estimate the affine transformation matrix.
[0100] “10” is the maximum number of iterations parameter of the cv::RANSAC algorithm.
[0101] "2000" is usually used as the distance threshold parameter in the cv::RANSAC algorithm.
[0102] “0.99” is the confidence parameter of the cv::RANSAC algorithm.
[0103] "100" is a parameter related to the internal optimization of the RANSAC algorithm, which usually indicates the minimum number of points randomly selected for estimating the model at each iteration. For a two-dimensional affine transformation, theoretically, at least three non-collinear points are required to determine an affine transformation model, but the setting of 100 here may be due to considerations such as algorithm stability and reducing the impact of outliers, so that relatively more points are selected for model estimation at each iteration, and then the optimal model is screened out through subsequent verification and other steps.
[0104] In some embodiments, the second image calibration parameter includes a compensation value, and the step of determining the compensation value based on the second material thickness by the laser may include: refer to Figure 5 As shown, the laser can control the laser machine to perform laser processing on a processing template placed on the working platform, wherein the thickness of the processing template is the same as the thickness of the second material, and the processing template is marked with a position to be processed; Controlling the camera to photograph the working platform to obtain a sample image 51; Identify a to-be-processed position 511 and an actual processing position 512 in the template image 51; The compensation value is determined based on the to-be-processed position 511 and the actual processing position 512 .
[0105] For example, the laser can calculate the coordinate deviation between the to-be-processed position 511 and the actual processing position 512 to obtain an offset, and use the offset as the compensation value.
[0106] Step 203: store the second image calibration parameter and the second material thickness in a matching relationship table.
[0107] In the embodiment of the present application, the corresponding second image calibration parameters can be determined for the second material thickness, so that the matching relationship table can be dynamically maintained, which facilitates accurate search for image calibration parameters that match the material thickness of the workpiece when the workpiece is lasered.
[0108] Based on the same idea as the laser processing method in the above embodiment, the present application also provides a laser processing device, which can be used to perform the above laser processing method. For ease of explanation, the structural schematic diagram of the laser processing device embodiment only shows the parts related to the embodiment of the present application. It can be understood by those skilled in the art that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than shown in the diagram, or combine certain components, or arrange the components differently.
[0109] like Figure 6 As shown, the laser processing device is applied to a laser machine, and the laser machine includes a camera and a working platform. The laser processing device includes a thickness acquisition module 601, a parameter search module 602, a shooting module 603 and a laser processing module 604. In some embodiments, the above modules can be programmable software instructions stored in a memory and can be called and executed by a processor. It is understood that in other embodiments, the above modules can also be program instructions or firmware solidified in the processor.
[0110] A thickness acquisition module 601 is used to acquire a first material thickness in response to a laser processing request for a workpiece, where the first material thickness is the material thickness of the workpiece; A parameter search module 602 is used to search for a first image calibration parameter in a pre-stored matching relationship table of material thickness and image calibration parameters, where the first image calibration parameter is an image calibration parameter that matches the first material thickness; A shooting module 603 is used to control the camera to shoot the work platform to obtain an image of the work platform when the workpiece is placed on the work platform; The laser processing module 604 is used to determine the mechanical coordinates of the workpiece based on the first image calibration parameters and the workpiece image, and to perform laser processing on the workpiece based on the mechanical coordinates.
[0111] Figure 7 This is a schematic diagram of an embodiment of a laser machine of the present application.
[0112] The laser machine 100 includes a memory 20, a processor 30, and a computer program 40 stored in the memory 20 and executable on the processor 30. When the processor 30 executes the computer program 40, the steps in the above-mentioned laser processing method embodiment are implemented, for example Figure 1 Steps 101 to 105 are shown.
[0113] Exemplarily, the computer program 40 can also be divided into one or more modules / units, which are stored in the memory 20 and executed by the processor 30. The one or more modules / units can be a series of computer program instruction segments that can perform specific functions, and the instruction segments are used to describe the execution process of the computer program 40 in the laser machine 100. For example, it can be divided into Figure 6 The thickness acquisition module 601, the parameter search module 602, the shooting module 603 and the laser processing module 604 are shown.
[0114] Those skilled in the art will appreciate that the schematic diagram is merely an example of the laser machine 100 and does not constitute a limitation of the laser machine 100. The laser machine 100 may include more or fewer components than shown in the diagram, or a combination of certain components, or different components. For example, the laser machine 100 may also include input and output devices, network access devices, buses, etc.
[0115] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, a single-chip microcomputer, or the processor 30 may also be any conventional processor, etc.
[0116] The memory 20 can be used to store the computer program 40 and / or the module / unit. The processor 30 realizes various functions of the laser machine 100 by running or executing the computer program and / or the module / unit stored in the memory 20 and calling the data stored in the memory 20. The memory 20 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data (such as audio data) created according to the use of the laser machine 100, etc. In addition, the memory 20 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
[0117] If the modules / units integrated in the laser machine 100 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media does not include electrical carrier signals and telecommunication signals.
[0118] In the several embodiments provided in this application, it should be understood that the disclosed laser machine and method can be implemented in other ways. For example, the laser machine embodiment described above is only illustrative, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation.
[0119] In addition, each functional unit in each embodiment of the present application may be integrated into the same processing unit, each unit may exist physically separately, or two or more units may be integrated into the same unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0120] It is obvious to those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the spirit or basic features of the present application. Therefore, no matter from which point of view, the embodiments should be regarded as exemplary and non-restrictive. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or laser machines stated in the laser machine claim can also be implemented by the same unit or laser machine through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0121] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the above embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.
Claims
1. A laser processing method, characterized in that: Applied to a laser machine, the laser machine includes a camera and a working platform, and the laser processing method includes: In response to a laser processing request for a workpiece, obtaining a first material thickness, where the first material thickness is the material thickness of the workpiece; Searching for a first image calibration parameter in a pre-stored matching relationship table of material thickness and image calibration parameters, where the first image calibration parameter is an image calibration parameter that matches the first material thickness; When the workpiece is placed on the work platform, controlling the camera to photograph the work platform to obtain an image of the workpiece; The mechanical coordinates of the workpiece are determined based on the first image calibration parameters and the workpiece image, and laser processing is performed on the workpiece based on the mechanical coordinates.
2. The laser processing method according to claim 1, characterized in that: The laser processing method further comprises: In response to a configuration request of an image calibration parameter, obtaining a second material thickness, where the second material thickness is a material thickness of the image calibration parameter to be configured; Determine a second image calibration parameter based on the second material thickness, wherein the second image calibration parameter is an image calibration parameter that matches the second material thickness; The second image calibration parameter and the second material thickness are stored in the matching relationship table according to a corresponding relationship.
3. The laser processing method according to claim 2, characterized in that: The determining a second image calibration parameter based on the second material thickness comprises: When a calibration plate is placed on the work platform, controlling the camera to shoot the work platform to obtain an image of the calibration plate; The calibration plate image shows the calibration plate, and the thickness of the calibration plate is the same as the thickness of the second material; and the second image calibration parameter is determined based on the calibration plate image.
4. The laser processing method according to claim 3, characterized in that: The second image calibration parameter includes a distortion correction parameter, and the calibration plate includes a first calibration plate, wherein a first geometric pattern is drawn on the first calibration plate; The determining of the second image calibration parameter based on the calibration plate image comprises: determining a first coordinate based on the plurality of first calibration images; The first coordinates are coordinates of corner points of the first geometric pattern in the image coordinate system of the camera, and the multiple first calibration images are calibration plate images obtained by photographing the work platform by the camera when the first calibration plate is placed at different positions of the work platform; Acquire second coordinates, where the second coordinates are coordinates of a corner point of the first geometric pattern in a mechanical coordinate system; The distortion correction parameter is determined based on the first coordinate and the second coordinate.
5. The laser processing method according to claim 3, characterized in that: The second image calibration parameters include alignment parameters, and the alignment parameters are used to indicate the mapping relationship between the mechanical coordinate system of the laser machine and the image coordinate system of the camera; the calibration plate includes a second calibration plate, and at least four non-collinear second geometric patterns are drawn on the second calibration plate; The determining of the second image calibration parameter based on the calibration plate image comprises: Determining pixel coordinates of the second geometric pattern in a second calibration image, where the second calibration image is an image of the calibration plate obtained by photographing the work platform by the camera when the second calibration plate is placed in a preset area of the work platform; Acquire the mechanical coordinates of the second geometric pattern when the second calibration plate is placed in a preset area of the working platform; The alignment parameters are determined based on the pixel coordinates and the machine coordinates.
6. The laser processing method according to any one of claims 2 to 5, characterized in that: The second image calibration parameter includes a compensation value, and determining the second image calibration parameter based on the second material thickness includes: Controlling the laser machine to perform laser processing on a processing template placed on the working platform, wherein the thickness of the processing template is the same as the thickness of the second material, and a position to be processed is marked on the processing template; Controlling the camera to photograph the working platform to obtain a sample image; Identifying the to-be-processed position and the actual processing position in the sample image; The compensation value is determined based on the to-be-processed position and the actual processing position.
7. The laser processing method according to any one of claims 1 to 5, characterized in that: The laser processing method further comprises: If the image calibration parameter matching the first material thickness is not found in the matching relationship table, a configuration prompt for the image calibration parameter is issued.
8. A laser processing device, characterized in that: Applied to a laser machine, the laser machine includes a camera and a working platform, and the laser processing device includes: A thickness acquisition module, configured to acquire a first material thickness in response to a laser processing request for a workpiece, wherein the first material thickness is the material thickness of the workpiece; A parameter search module, used to search for a first image calibration parameter in a pre-stored matching relationship table of material thickness and image calibration parameters, wherein the first image calibration parameter is an image calibration parameter that matches the first material thickness; A shooting module, used for controlling the camera to shoot the work platform to obtain an image of the work platform when the workpiece is placed on the work platform; The laser processing module is used to determine the mechanical coordinates of the workpiece based on the first image calibration parameters and the workpiece image, and to perform laser processing on the workpiece based on the mechanical coordinates.
9. A laser machine, comprising a processor and a memory, characterized in that: The memory is used to store instructions, and the processor is used to call the instructions in the memory, so that the laser machine executes the laser processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a laser machine, the laser machine executes the laser processing method according to any one of claims 1 to 7.