Laser focusing method, device, laser marking machine and computer-readable storage medium
By acquiring the average grayscale value and contour area of multiple images to be scored in a laser marking machine, and combining them with weighted processing, the focusing working distance of the laser marking machine is determined. This solves the problem of unsatisfactory laser pattern effect caused by inaccurate laser focusing and improves the yield.
Patent Information
- Application Number
- CN202511539060.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2045-10-27
AI Technical Summary
When existing laser marking machines are not focused accurately, the laser pattern effect is not ideal, which affects the workpiece yield. Furthermore, due to the differences in control parameters of laser marking machines, the existing methods reduce the efficiency of determining the laser focusing working distance.
By acquiring multiple images to be scored, calculating the average gray value and the outline area of the laser pattern for each image, and combining weighted processing, the processing height corresponding to the image with the highest score is determined as the focusing working distance of the laser marking machine.
This improves the efficiency and accuracy of determining the focusing working distance of the laser marking machine, thereby enhancing the quality of the laser pattern and the yield of finished products.
Smart Images

Figure CN121010599B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electrical control technology, and more specifically, to a laser focusing method, apparatus, laser marking machine, and computer-readable storage medium. Background Technology
[0002] If the laser focus is not set to the optimal value before the laser marking machine engraves a pattern on the workpiece, the effect of the laser pattern on the workpiece will be unsatisfactory, and may even cause irreversible damage to the workpiece, thereby affecting the yield of the finished product.
[0003] In related technologies, a judgment model is constructed to compare multiple images to be scored with a reference image, thereby selecting the image that is closest to the reference image from among the multiple images to be scored as the optimal image to be scored, so as to determine the working distance of laser focusing based on the optimal image to be scored.
[0004] However, due to variations in the control parameters of laser marking machines (e.g., laser type, power, etc.), the laser marking patterns can differ (e.g., colors appearing too white or too yellow, spot sizes too large or too small). Therefore, it is necessary to determine the most suitable reference image in real-time based on the laser marking machine's control parameters, and then further determine the laser focusing distance based on the determined reference image. This reduces the efficiency of determining the laser marking machine's focusing distance. Summary of the Invention
[0005] In view of the above problems, this application proposes a laser focusing method, apparatus, laser marking machine and computer-readable storage medium, which can improve the efficiency of determining the focusing working distance of the laser marking machine in a timely and effective manner.
[0006] In a first aspect, embodiments of this application provide a laser focusing method applied to a laser marking machine. The laser marking machine includes a worktable and an image acquisition module. The worktable is used to place the workpiece to be laser-marked, and the image acquisition module is used to acquire images of the workpiece with laser patterns. The laser focusing method includes: acquiring multiple images to be scored at different processing heights; averaging the grayscale values of each pixel in each of the multiple images to be scored to determine the average grayscale value of each image to be scored; determining the contour area of the laser pattern in each image to be scored based on the contour coordinate information of the laser pattern contained in each image to be scored; weighting the contour area and the normalized value of the largest contour area based on the closeness between the average grayscale value and a preset reference grayscale value to determine the score value of each image to be scored; and determining the processing height corresponding to the image to be scored with the highest score as the working distance for focusing of the laser marking machine.
[0007] Secondly, embodiments of this application also provide a laser focusing device applied to a laser marking machine. The laser marking machine includes a worktable and an image acquisition module. The worktable is used to place the workpiece to be laser-marked, and the image acquisition module is used to acquire images of the workpiece with laser patterns. The laser focusing device includes: an acquisition module for acquiring multiple images to be scored at different processing heights; a first determination module for averaging the grayscale values of each pixel in each of the multiple images to be scored to determine the average grayscale value of each image to be scored; a second determination module for determining the contour area of the laser pattern contained in each image to be scored based on the contour coordinate information of the laser pattern contained in each of the multiple images to be scored; a third determination module for weighting the contour area and the normalized value of the largest contour area based on the closeness between the average grayscale value and a preset reference grayscale value to determine the score value of each image to be scored; and a fourth determination module for determining the processing height corresponding to the image to be scored with the highest score as the working distance for focusing of the laser marking machine.
[0008] Thirdly, embodiments of this application also provide a laser marking machine, including a processor, a memory, and one or more application programs; the one or more application programs are stored in the memory and configured to be executed by the processor to implement the above-described laser focusing method.
[0009] Fourthly, embodiments of this application also provide a computer-readable storage medium storing program code, wherein the above-described laser focusing method is executed when the program code is run by a processor.
[0010] The technical solution provided in this application is applied to a laser marking machine. The laser marking machine includes a worktable and an image acquisition module. The worktable is used to place the workpiece to be laser-marked, and the image acquisition module is used to acquire images of the workpiece with laser patterns. The laser focusing method includes: acquiring multiple images to be scored at different processing heights; averaging the grayscale values of each pixel in each of the multiple images to be scored to determine the average grayscale value of each image to be scored; determining the contour area of the laser pattern in each image to be scored based on the contour coordinate information of the laser pattern contained in each image to be scored; weighting the contour area and the normalized value of the largest contour area based on the closeness between the average grayscale value and the preset reference grayscale value to determine the score value of each image to be scored; and determining the processing height corresponding to the image to be scored with the highest score as the working distance for focusing of the laser marking machine. Therefore, the average gray value and the contour area are fused to obtain the score values corresponding to multiple images to be scored. The average gray value is closest to the preset reference gray value and the contour area is closest to the standard size among the multiple images to be scored, so as to determine the working distance for the laser marking machine to focus. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments and drawings obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0012] Figure 1 A schematic diagram of the structure of a laser marking machine according to an embodiment of this application is shown.
[0013] Figure 2 A schematic flowchart of a laser focusing method provided in an embodiment of this application is shown.
[0014] Figure 3 This illustration shows a structural diagram of an image to be scored according to an embodiment of this application.
[0015] Figure 4 A schematic diagram of the structure of a laser focusing device provided in an embodiment of this application is shown.
[0016] Figure 5 A schematic diagram of another laser marking machine provided in an embodiment of this application is shown.
[0017] Figure 6 This illustration shows a schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of this application. Detailed Implementation
[0018] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0019] If the laser focus is not set to the optimal value during the operation of a laser marking machine, the effect of the laser pattern on the workpiece will be unsatisfactory, and may even cause irreversible damage to the workpiece, thereby affecting the yield of finished products.
[0020] For example, the quality of laser markings on workpieces is poor: uneven pattern distribution, low pattern clarity, discontinuous pattern lines, or pattern deformation.
[0021] For example, the marking depth of laser patterns on a workpiece may be inconsistent: Since the energy density of the laser is highest at the focal point, if the focus is not accurate, the laser energy will be dispersed, resulting in inconsistent marking depths on the material. Some parts of the pattern may be too shallow, while other parts of the pattern may be too deep.
[0022] For example, the color change of the laser pattern on the workpiece is not ideal: For some applications that require changing the color of the workpiece surface by laser, inaccurate focusing may result in poor color change effect, failing to achieve the expected color contrast or aesthetics.
[0023] For example, incorrect focusing may cause laser energy to be too concentrated in a certain area, resulting in excessive ablation or thermal damage to the workpiece. This damage may be irreversible, especially for some workpieces made of sensitive materials.
[0024] Based on the above, in related technologies, a judgment model is constructed to compare multiple images to be scored with a reference image, thereby selecting the optimal image to be scored from among the multiple images to be scored, and determining the working distance of laser focusing based on the optimal image to be scored.
[0025] However, due to variations in the control parameters of laser marking machines (e.g., laser type, power, etc.), the laser marking patterns can differ (e.g., colors appearing too white or too yellow, spot sizes too large or too small). Therefore, it is necessary to determine the most suitable reference image in real-time based on the laser marking machine's control parameters, and then further determine the laser focusing distance based on the determined reference image. This reduces the efficiency of determining the laser marking machine's focusing distance.
[0026] To address the aforementioned issues, this application provides a laser focusing method, apparatus, laser marking machine, and computer-readable storage medium. The laser focusing method is applied to a laser marking machine, which includes a worktable and an image acquisition module. The worktable is used to place the workpiece to be laser-marked, and the image acquisition module is used to acquire images of the workpiece with laser patterns. The method includes: acquiring multiple images to be scored at different processing heights; averaging the grayscale values of each pixel in each of the multiple images to determine the average grayscale value of each image; determining the contour area of the laser pattern in each image based on the contour coordinate information of the laser pattern contained in each image; weighting the contour area with the normalized value of the largest contour area based on the closeness between the average grayscale value and a preset reference grayscale value to determine the score value of each image; and determining the processing height corresponding to the image with the highest score as the working distance for laser marking machine focusing.
[0027] Therefore, the average gray value and the contour area are fused to obtain the score values corresponding to multiple images to be scored. The average gray value is closest to the preset reference gray value and the contour area is closest to the standard size among the multiple images to be scored, so as to determine the working distance for the laser marking machine to focus.
[0028] The application environment of the laser focusing method provided in the embodiments of the present invention will be described below.
[0029] Please see Figure 1 , Figure 1 A schematic diagram of the structure of a laser marking machine according to an embodiment of this application is shown, as follows: Figure 1 As shown, the laser marking machine 100 includes a worktable 110 and an image acquisition module 120. The worktable 110 is used to place the workpiece to be laser-marked, and the image acquisition module 120 is used to acquire images of the workpiece with the laser pattern.
[0030] In some implementations, the image acquisition module 120 can be a camera.
[0031] In some embodiments, the laser marking machine 100 may include a laser that can engrave laser images onto a workpiece located on a worktable 110. The laser marking machine 100 may adjust the position of the laser along a first direction, a second direction, and a third direction.
[0032] In some embodiments, the first direction, the second direction, and the third direction are perpendicular to each other. For example, the first direction can be the X-axis direction of the laser marking machine 100. The second direction can be the Y-axis direction of the laser marking machine 100. The third direction can be the Z-axis direction of the laser marking machine 100. The X-axis direction can be along the length of the worktable 110. The Y-axis direction can be along the width of the worktable 110. The Z-axis direction can be along the vertical direction of the laser marking machine 100.
[0033] It is understood that this application does not impose specific restrictions on the first direction, the second direction, and the third direction, and users can flexibly adjust the specific directions of the first direction, the second direction, and the third direction according to the actual situation.
[0034] In some embodiments, the workpiece can be ink-coated paper. In some embodiments, the workpiece can be a circuit board.
[0035] The user places the workpiece on the worktable 110 and controls the laser to move in the first, second, and third directions to adjust its specific position. After the laser is positioned, it laser-etches the workpiece on the worktable 110, and the image acquisition module 120 acquires an image of the laser-etched workpiece. Specifically:
[0036] Please see Figure 2 , Figure 2 A schematic flowchart of a laser focusing method provided in an embodiment of this application is shown, which can be applied to the aforementioned laser marking machine. For example... Figure 2 As shown, the laser focusing method may include steps 210 to 250.
[0037] In step 210, multiple images to be scored are acquired at different processing heights.
[0038] In some implementations, the processing height can be the distance between the laser and the worktable 110.
[0039] In some implementations, after the laser marking machine controls the laser to move to a new processing height, the laser marking machine controls the laser to engrave an image on the workpiece, and the engraved image is acquired by an image acquisition module.
[0040] In some implementations, the laser marking machine controls the laser to be positioned at different processing heights, laser-marking images of the same size onto a workpiece located on the worktable. This results in multiple images of the same laser size but at different processing heights, which are then to be scored.
[0041] Because the image acquisition module uses a non-telecentric lens for imaging, the edges of multiple images to be evaluated will be distorted, affecting the accuracy of the working distance for laser marking machine focus determined in subsequent steps. Based on this, in some implementations, the image size etched by the laser controlled by the laser marking machine is relatively small, and the laser pattern contained in the multiple images to be evaluated is located in the central region of the image. Since the laser pattern is relatively centered in the multiple images to be evaluated, the impact of edge distortion is reduced.
[0042] It is understandable that when the image acquisition module is subjected to interference, abnormal images may appear among the multiple images to be scored acquired by the module. If subsequent steps determine the focusing working distance of the laser marking machine based on images containing abnormal images, the accuracy of the determined working distance will be affected, thus impacting the laser marking effect and consequently the workpiece yield. Based on the above, in some embodiments, the laser pattern is a regular shape. The laser focusing method may further include the following steps:
[0043] (1) Determine the theoretical outline area of the laser pattern.
[0044] (2) Determine the target image to be scored from multiple images to be scored; the difference between the contour area corresponding to the target image to be scored and the theoretical contour area is greater than the second preset value.
[0045] (3) The target image to be scored is filtered out from the multiple images to be scored, and the final multiple images to be scored are determined.
[0046] In some implementations, the theoretical contour area can be the contour area of the pattern formed by the laser on the workpiece by the laser marking machine. For example, the user can input the drawing corresponding to the pattern to be laser-marked into the laser marking machine, and the laser marking machine can calculate the contour area corresponding to the image after laser is applied to the workpiece based on the input drawing, thereby obtaining the theoretical contour area.
[0047] In one specific implementation, please refer to Figure 3 , Figure 3 A schematic diagram of the structure of an image to be scored, provided in an embodiment of this application, is shown. For example... Figure 3 As shown, the laser pattern is a rectangular pattern (the white area in the figure). The step "Determine the theoretical outline area of the laser pattern" may include: determining the theoretical outline area based on the theoretical length and theoretical width of the laser pattern.
[0048] In some implementations, the second preset value is used to assess the degree of difference between the outline area of the laser pattern contained in each image to be scored and the theoretical outline area. If the difference between the outline area of the laser pattern contained in the image to be scored and the theoretical outline area is greater than the second preset value, it indicates that the difference between the image to be scored and the theoretical outline area is large, and thus the image to be scored can be determined to be an abnormal image. It is understood that the opposite is also true.
[0049] This application does not impose any restrictions on the specific value of the second preset value. A smaller second preset value can filter out images to be scored that are closer to the theoretical contour area.
[0050] In other embodiments, the image acquisition module can acquire multiple images to be scored at the same processing height, and identify abnormal images to be scored from the multiple images to be scored at the same processing height in the manner described above. From the images to be scored after filtering out the abnormal images, one image to be scored is randomly selected as the image to be scored at that processing height, thereby ensuring that the final multiple images to be scored contain the image to be scored corresponding to each processing height, so as to improve the accuracy of the working distance determined in subsequent steps.
[0051] For example, the image acquisition module acquires images A, B, and C corresponding to the processing height h, and the theoretical contour area D of the laser pattern. Specifically, the contour areas d1, d2, and d3 of the laser pattern in image A, image B, and image C are defined. If the difference between contour area d1 and the theoretical contour area D is greater than a second preset value, and the differences between contour areas d2 and d3 and the theoretical contour area D are less than the second preset value, then image A is determined to be an abnormal image, while images B and C are considered acceptable images. Therefore, one of the images B and C can be used as one of the multiple images to be evaluated in step 210.
[0052] By filtering out abnormal images from multiple images to be scored, the accuracy of the laser marking machine's focusing distance determined in subsequent steps is further ensured, thereby improving the laser marking effect. Specifically:
[0053] In step 220, the average gray value of each image to be scored is determined by averaging the gray values of each pixel in each of the multiple images to be scored.
[0054] The gray values of each pixel in the image to be rated are added together to obtain the sum, and then the sum is divided by the total number of pixels in the image to be rated to obtain the average gray value of the image to be rated.
[0055] By determining the average gray value of each of the multiple images to be scored, subsequent steps can compare the average gray value of each image with a preset gray value to determine the image that is closest to the preset gray value among the multiple images to be scored.
[0056] In step 230, the contour area of the laser pattern contained in each of the multiple images to be scored is determined based on the contour coordinate information of the laser pattern contained in each image to be scored.
[0057] In some implementations, after the image acquisition module has acquired multiple images to be scored, the laser marking machine extracts the contour of the laser pattern contained in each image to be scored, and traverses each extracted contour to obtain the contour coordinate information of each contour.
[0058] In some implementations, the step "determining the contour area of the laser pattern in each image to be scored based on the contour coordinate information of the laser pattern contained in each of the multiple images to be scored" may include the following steps:
[0059] (1) Obtain the set of contour points of the laser pattern contained in each image to be scored.
[0060] (2) Model the contour formed by the contour point set using the shoelace formula, and determine the contour area of the laser pattern contained in each image to be scored.
[0061] In some implementations, after the image acquisition module has acquired multiple images to be scored, the laser marking machine extracts the contour of the laser pattern contained in each image to be scored, traverses each extracted contour, and obtains the contour coordinate information in each contour. This contour coordinate information constitutes the contour point set of the laser pattern.
[0062] For example, the set of contour points of the image A to be rated can be represented as C, and the expression for the set of contour points C can be: ,in, , and Points on the contour of the image A to be scored are represented by these points.
[0063] The laser marking machine can determine the outline area of the laser pattern contained in each image to be scored using the following formula:
[0064]
[0065] Among them, point These are the coordinates of the i-th point on the extracted contour; point Here are the coordinates of the (i+1)th point on the extracted contour; "This represents the outline area of the laser pattern."
[0066] By determining the contour area corresponding to the laser pattern in each of the multiple images to be scored, subsequent steps can compare the contour area of each image with the largest contour area to determine the image to be scored that has the closest contour area to the largest among the multiple images. Specifically:
[0067] In step 240, the contour area is weighted by the normalized value of the largest contour area based on the closeness between the average gray value and the preset reference gray value, and the score value of each image to be scored is determined.
[0068] In some implementations, the preset reference grayscale value can be 255.
[0069] In some implementations, the maximum contour area is the maximum value of the contour areas corresponding to the laser patterns contained in the multiple images to be scored.
[0070] The laser marking machine obtains evaluation parameters, i.e., the score value of each image, by fusing the average grayscale value of each image to be scored with the outline area of the laser pattern contained in each image. The score value of each image reflects the closeness between the average grayscale value of each image and the preset reference grayscale value, as well as the difference between the outline area of each image and the largest outline area.
[0071] In the embodiments of this application, the scoring value is constructed by normalizing the contour area of each image to be scored to the maximum contour area. This ensures that the contour areas of different images to be scored can be compared on the same scale. Furthermore, since the contour area of an image to be scored may be smaller than the theoretical contour area, this application normalizes the contour area of the images to be scored to the maximum contour area so that all contour areas can be compared on the same scale. Then, by using the difference between the contour area of each image to be scored and the maximum contour area, the image to be scored whose contour area is closest to the theoretical contour area is determined from among multiple images to be scored.
[0072] In some implementations, the step of determining a score for each image to be scored by weighting the contour area with the normalized value of the largest contour area based on the closeness between the average gray value and a preset reference gray value may include the following steps:
[0073] (1) Determine the standard value of each image to be scored based on the relative distance between the average gray value and the preset reference gray value of each image to be scored.
[0074] (2) Normalize the difference between the contour area and the theoretical contour area of the laser pattern to the target range to obtain the difference value of each image to be scored; the target range is the range formed by the largest contour area and the smallest contour area.
[0075] (3) Construct a feature matrix based on the standard value and difference value of each image to be scored.
[0076] (4) Determine the first weight value and the second weight value corresponding to each image to be scored based on the feature matrix and the least squares method.
[0077] (5) Determine the score of each image to be scored based on the average gray value, the first weight value, the contour area and the second weight value.
[0078] A laser marking machine acquires N images to be scored, each image having a corresponding average grayscale value. and outline area To identify the image among N images to be rated that has an average gray value closest to 255 and an outline size closest to the standard size, we can use the corresponding rating values of the N images. The scoring value corresponding to each of N images to be scored by a laser marking machine can be determined by the following formula:
[0079]
[0080] in," " is the first weight value and " " is the second weight value.
[0081] In some implementations, the sum of the first weight value and the second weight value is a first preset value. In some implementations, the first preset value can be 1.
[0082] To ensure that the values of the first and second weights are most reasonable, the most suitable values for the first and second weights are determined based on the actual situation of each image to be scored or the laser marking machine.
[0083] First, the average gray value corresponding to each image to be scored is calculated separately. and outline area The transformation is performed to obtain the standard value and difference value for each image to be scored:
[0084]
[0085]
[0086] in," "This represents the theoretical contour area;" "The maximum area of the contour contained in multiple images to be scored;" "This represents the minimum area of the contour contained in multiple images to be scored."
[0087] Based on the average gray value corresponding to each converted image to be scored and outline area Constructing the feature matrix , characteristic matrix It can be represented as:
[0088]
[0089] Based on the feature matrix and the least squares method, the first and second weight values corresponding to each image to be scored are determined, which can be expressed as:
[0090]
[0091] in," " is the target vector. The target vector can be represented as:
[0092]
[0093] in," "It contains a vector that solves for the first weight and the second weight, i.e. “ "It is the intercept."
[0094] The expression for determining the first and second weight values for each image to be scored based on the feature matrix and the least squares method can be calculated as follows:
[0095]
[0096]
[0097] By solving " "and" ”, then you can get “ "and" Thus, the first and second weights are determined.
[0098] In other implementations, the first weight value and the second weight value can be preset values. For example, the first weight value is 0.7 and the second weight value is 0.3.
[0099] In step 250, the processing height corresponding to the image to be scored with the highest score is determined as the working distance for the laser marking machine to focus.
[0100] The image with the highest score is the one among multiple images whose average grayscale value is close to 255 and whose contour area is close to the theoretical contour area. The processing height corresponding to this image is the working distance for laser focusing, thus enabling the laser marking machine to focus the laser and achieve a more ideal pattern, thereby improving the yield of the workpiece.
[0101] The image to be scored with the highest score determined in this application is not affected by other factors (such as laser type, power, ink thickness of ink paper, etc.), but is only related to the processing height of the laser, which can make the determined working distance more accurate.
[0102] Please see Figure 4 , Figure 4 This illustration shows a schematic diagram of a laser focusing device provided in an embodiment of this application, which can be applied to the aforementioned laser marking machine. The laser focusing device 300 includes: an acquisition module 310, a first determination module 320, a second determination module 330, a third determination module 340, and a fourth determination module 350. Specifically:
[0103] The acquisition module 310 is used to acquire multiple images to be scored located at different processing heights.
[0104] The first determining module 320 is used to determine the average gray value of each image to be scored by averaging the gray values of each pixel in each image to be scored.
[0105] The second determining module 330 is used to determine the contour area of the laser pattern contained in each of the multiple images to be scored based on the contour coordinate information of the laser pattern contained in each image to be scored.
[0106] The third determining module 340 is used to determine the score value of each image to be scored by weighting the contour area and the normalized value of the largest contour area based on the closeness between the average gray value and the preset reference gray value.
[0107] The fourth determining module 350 is used to determine the processing height corresponding to the image to be scored with the highest score as the working distance for the laser marking machine to focus.
[0108] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0109] In the several embodiments provided in this application, the coupling or direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication connection through some interface, device or module, and may be electrical, mechanical or other forms.
[0110] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0111] Please see Figure 5 , Figure 5 The diagram shows another laser marking machine provided in the embodiments of this application. The laser marking machine in this application may include one or more of the following components: processor 410, memory 420 and one or more application programs, wherein the one or more application programs may be stored in memory 420 and configured to be executed by one or more processors 410, and the one or more programs are configured to perform the laser focusing method as described in the foregoing method embodiments.
[0112] The processor 410 may include one or more processing cores. The processor 410 connects to various parts of the laser marking machine using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 420, and by calling data stored in the memory 420. Optionally, the processor 410 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 410 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 410 and may be implemented separately using a communication chip.
[0113] The memory 420 may include random access memory (RAM) or read-only memory (ROM). The memory 420 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 420 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described below, etc. The data storage area may also store data created during the use of the laser marking machine.
[0114] Please see Figure 6 , Figure 6 This illustration shows a schematic diagram of a computer-readable storage medium 500 provided in an embodiment of this application. The computer-readable storage medium 500 stores program code, which can be called by a processor to execute the laser focusing method described in the above method embodiment.
[0115] The computer-readable storage medium 500 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 500 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 500 has storage space for program code 510 that performs any of the method steps described above. This program code can be read from or written to one or more computer program devices. The program code 510 may, for example, be compressed in a suitable form.
[0116] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A laser focusing method, characterized by, The method is applied to a laser marking machine, the laser marking machine comprising a workbench and an image acquisition module, the workbench being used for placing a workpiece to be marked, and the image acquisition module being used for acquiring an image of the workpiece with a marking pattern, the method comprising: Obtaining a plurality of images to be scored at different processing heights; According to the gray value of each pixel in each image to be scored, the average gray value of each image to be scored is determined by average processing; According to the contour coordinate information of the marking pattern contained in each image to be scored, the contour area of the marking pattern contained in each image to be scored is determined; According to the contour coordinate information of the marking pattern contained in each image to be scored, the contour area of the marking pattern contained in each image to be scored is determined, comprising: Obtaining the contour point set of the marking pattern contained in each image to be scored; By the shoelace formula, the contour area of the marking pattern contained in each image to be scored is determined by modeling the contour formed by the contour point set; According to the proximity between the average gray value and the preset reference gray value, the contour area is normalized to the maximum contour area, and the scoring value of each image to be scored is determined by weighted processing; According to the proximity between the average gray value and the preset reference gray value, the contour area is normalized to the maximum contour area, and the scoring value of each image to be scored is determined by weighted processing, comprising: According to the relative distance between the average gray value and the preset reference gray value corresponding to each image to be scored, the standard value of each image to be scored is determined; The difference between the contour area and the theoretical contour area of the marking pattern is normalized to a target range to obtain the difference value of each image to be scored; the target range is the range formed by the maximum contour area and the minimum contour area; According to the standard value and the difference value of each image to be scored, a feature matrix is constructed; According to the feature matrix and the least square method, the first weight value and the second weight value corresponding to each image to be scored are determined; According to the average gray value, the first weight value, the contour area and the second weight value, the scoring value of each image to be scored is determined; The processing height corresponding to the image to be scored with the highest scoring value is determined as the working distance of the laser marking machine.
2. The laser focusing method of claim 1, wherein, The sum of the first weight value and the second weight value is a first preset value.
3. The laser focusing method of claim 1, wherein, The marking pattern is a regular pattern, and the method further comprises: Determining the theoretical contour area of the marking pattern; Determining a target image to be scored in the plurality of images to be scored; the difference between the contour area corresponding to the target image to be scored and the theoretical contour area is greater than a second preset value; The target image to be scored is excluded from the plurality of images to be scored to determine the final plurality of images to be scored.
4. The laser focusing method of claim 3, wherein, The laser pattern is a rectangular pattern, and the theoretical profile area of the laser pattern is determined by: According to the theoretical length and the theoretical width of the laser pattern, the theoretical profile area is determined.
5. The laser focusing method of claim 1, wherein, The laser pattern contained in the plurality of images to be scored is located in the middle region of the image.
6. A laser focusing device, characterized by, Applied to a laser marking machine, the laser marking machine includes a workbench and an image acquisition module, the workbench is used to place a workpiece to be laser marked, and the image acquisition module is used to acquire an image of the workpiece with a laser pattern, and the device includes: An acquisition module is configured to acquire a plurality of images to be scored at different machining heights; A first determination module is configured to determine an average gray value of each of the plurality of images to be scored by performing average processing on the gray value of each pixel in each of the plurality of images to be scored; A second determination module is configured to determine the profile area of the laser pattern contained in each of the plurality of images to be scored according to the profile coordinate information of the laser pattern contained in each of the plurality of images to be scored; The determination of the profile area of the laser pattern contained in each of the plurality of images to be scored according to the profile coordinate information of the laser pattern contained in each of the plurality of images to be scored includes: Obtaining a set of profile points of the laser pattern contained in each of the plurality of images to be scored; Modeling the profile formed by the set of profile points through a shoelace formula to determine the profile area of the laser pattern contained in each of the plurality of images to be scored; A third determination module is configured to determine a score value of each of the plurality of images to be scored by performing weighted processing on the closeness between the average gray value and a preset reference gray value and the normalized value of the profile area relative to the largest profile area; The determination of the score value of each of the plurality of images to be scored according to the closeness between the average gray value and the preset reference gray value and the normalized value of the profile area relative to the largest profile area includes: Determining a standard value of each of the plurality of images to be scored according to the relative distance between the average gray value and the preset reference gray value corresponding to each of the plurality of images to be scored, respectively; Normalizing the difference between the profile area and the theoretical profile area of the laser pattern to a target range to obtain a difference value of each of the plurality of images to be scored; the target range is a range formed by the largest profile area and the smallest profile area; Constructing a feature matrix according to the standard value and the difference value of each of the plurality of images to be scored; Determining a first weight value and a second weight value corresponding to each of the plurality of images to be scored according to the feature matrix and the least square method; Determining a score value of each of the plurality of images to be scored according to the average gray value, the first weight value, the profile area, and the second weight value; A fourth determination module is configured to determine a machining height corresponding to the image to be scored with the highest score value as a working distance of the laser marking machine in focus.
7. A laser marking machine characterized by, includes: one or more processors; a memory; one or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the one or more processors, one or more programs configured to perform the laser focusing method of any one of claims 1-5.
8. A computer readable storage medium, characterized in that, The computer readable storage medium stores program codes, and the program codes can be invoked by the processor to execute the laser focusing method of any one of claims 1-5.
Citation Information
Patent Citations
Automatic focusing method, device, equipment and system of laser processing equipment and medium
CN120395111A
Automatic laser focusing method, system and equipment for multi-height plane and medium
CN120742519A