Template generation method, template generation device and readable storage medium

By acquiring vector parameters from engineering files and surface images, and automating the drawing and processing of repetitive units, the problem of low accuracy and manual dependence in template generation in existing technologies is solved, achieving efficient and low-cost template generation.

CN117709001BActive Publication Date: 2026-11-17HANS CNC SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211031978.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-26
Publication Date
2026-11-17
Estimated Expiration
2042-08-26

AI Technical Summary

Technical Problem

Existing technologies in laser processing suffer from low accuracy in template generation due to the influence of light factors, and rely on manual operation, resulting in low automation and efficiency, and high labor costs.

Method used

By acquiring the engineering files and surface images of the product to be processed, querying the vector parameters of the basic graphics, automatically drawing repeating units and performing noise reduction processing, and generating templates.

Benefits of technology

It improves the accuracy and efficiency of template generation, reduces labor costs, and achieves automated processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117709001B_ABST
    Figure CN117709001B_ABST
Patent Text Reader

Abstract

This application relates to a template generation method, apparatus, and storage medium. The method includes: acquiring an engineering file corresponding to a product to be laser-processed, and a surface image of the product; querying basic graphics contained in the engineering file, and vector parameters corresponding to each basic graphic; drawing repeating units in the engineering file into a first image based on the vector parameters corresponding to each basic graphic, wherein each repeating unit contains at least one basic graphic; extracting an image portion corresponding to the repeating unit in the surface image of the product, and performing noise reduction processing on the extracted image portion to generate the template. This application can automatically generate templates, reducing labor costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of laser processing technology, and in particular to a template generation method, a template generation device, and a readable storage medium. Background Technology

[0002] With the development of automation technology, laser processing is being used more and more widely. For example, laser processing can be applied to the production process of PCB products.

[0003] In production practice, multiple identical PCB products are usually set on a large area of ​​board material for processing. The laser processing equipment uses a matching industrial camera to capture surface images of the board material, processes the surface images to obtain template files, and uses the templates to match and position the products in the surface images, thereby performing laser processing on each product on the board material.

[0004] However, the inventors of this application discovered in their research that the existing technology directly processes the surface image of the board to obtain a template. Due to the influence of real-world factors such as lighting, the data is unstable and not easy to segment accurately, resulting in low template accuracy. Moreover, the existing technology relies on manual operation, which requires high skill levels from personnel, has low automation, and high labor costs. Summary of the Invention

[0005] The present invention provides a template generation method, apparatus and storage medium, which can automatically generate templates, reduce labor costs and improve template accuracy.

[0006] Firstly, this application provides a template generation method, the method comprising:

[0007] Obtain the engineering files corresponding to the product to be laser-processed, as well as the surface image of the product to be laser-processed;

[0008] Query the basic graphics contained in the project file, and the vector parameters corresponding to each basic graphic;

[0009] Based on the vector parameters corresponding to each basic graphic, the repeating unit in the project file is drawn in the first image, and the repeating unit contains at least one basic graphic.

[0010] Based on the repeating unit in the first image, the image portion corresponding to the repeating unit in the surface image of the product is extracted, and the extracted image portion is subjected to noise reduction processing to generate the template.

[0011] In conjunction with the first aspect, in one feasible implementation, drawing the repeating units in the project file into the first image based on the vector parameters corresponding to each of the basic graphics includes:

[0012] Arrange all basic graphics in the project file in a directional order;

[0013] Compare all sorted basic shapes, identify the common basic shapes, and classify the common basic shapes into a preset category;

[0014] Based on the distance variation characteristics between the basic graphics in each major category, each major category is divided into multiple subcategories;

[0015] Select a basic graphic from the outermost edge of each subclass in a preset direction as a basic graphic belonging to the repeating unit, and draw it in the first image.

[0016] In conjunction with the first aspect, in one feasible implementation, the basic graphic includes a circle, line segment, arc, or point; the vector parameters include center coordinates, vector length, angle, or radian.

[0017] In conjunction with the first aspect, in one feasible implementation, all basic graphics in the project file are ordered directionally, including:

[0018] Based on the center coordinates of all basic graphics, the basic graphics are sorted to achieve a left-to-right and top-to-bottom sorting of all basic images.

[0019] In conjunction with the first aspect, in one feasible implementation, the comparison of all sorted basic shapes to identify identical basic shapes and the categorizing of identical basic shapes into a preset major category includes:

[0020] All basic shapes are compared pairwise in the sorted order. The vector parameters other than the center coordinates are compared. If the vector parameters of the same type being compared are within the preset error range, the two basic shapes being compared are considered to be the same basic shape. The basic shapes are then added to the preset category in the sorted order.

[0021] In conjunction with the first aspect, in one feasible implementation, the division of each major category into multiple subcategories based on the distance variation characteristics between the basic graphics within each major category includes:

[0022] Based on the sorting order of the basic shapes in each major category, the distance between the center coordinates of two adjacent basic shapes is compared. Basic shapes whose distance changes do not exceed the threshold are classified into the same sub-category, while basic shapes whose distance changes exceed the threshold are classified into different sub-categories.

[0023] In conjunction with the first aspect, in one feasible implementation, extracting the image portion corresponding to the repeating unit in the surface image of the product based on the repeating unit in the first image includes:

[0024] Determine the coordinate transformation matrix between the first image and the surface image;

[0025] According to the coordinate transformation matrix, the first boundary coordinates of the repeating unit are replaced with the second boundary coordinates in the surface image, and the image portion within the second boundary coordinates is extracted.

[0026] In conjunction with the first aspect, in one feasible implementation, the project file is a dxf file; the surface image of the product is obtained by an industrial camera capturing the surface of the product.

[0027] Secondly, this application provides a template generation apparatus, the apparatus comprising:

[0028] The acquisition unit is used to acquire the engineering file corresponding to the product to be laser-processed, and the surface image of the product to be laser-processed;

[0029] The query unit is used to query the basic graphics contained in the project file, and the vector parameters corresponding to each basic graphic.

[0030] The file conversion unit is used to draw the repeating units in the project file in the first image according to the vector parameters corresponding to each basic graphic, wherein the repeating units contain at least one basic graphic.

[0031] An image processing unit is configured to extract an image portion corresponding to the repeating unit in the surface image of the product based on the repeating unit in the first image, and to perform noise reduction processing on the extracted image portion to generate the template.

[0032] Thirdly, this application provides a computer-readable storage medium storing a computer program, wherein the computer program, when running, controls the device where the computer-readable storage medium is located to execute the template generation method described in the first aspect.

[0033] The template generation method, apparatus, and storage medium provided in this application obtain the engineering file corresponding to the product to be laser-processed and the surface image of the product, query the basic graphics and corresponding vector parameters contained in the engineering file, draw the repeating units in the engineering file in the first image, and then extract the corresponding image part in the surface image of the product based on the repeating units in the first image, perform noise reduction processing, thereby generating the template. Compared with the prior art, there is no need for manual processing of the surface graphics based on experience, which not only reduces labor costs but also improves the efficiency of template generation. Attached Figure Description

[0034] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0035] Figure 1 This is a flowchart illustrating a template generation method provided in an embodiment of this application;

[0036] Figure 2 This is a functional block diagram of a template generation device according to an embodiment of this application;

[0037] Figure 3 This is a schematic diagram of the structure of a computer device according to an embodiment of this application. Detailed Implementation

[0038] To better understand the technical solution of the present invention, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0039] It should be understood that the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0040] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0041] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0042] It should be understood that although the terms first, second, third, etc., may be used to describe terminals in the embodiments of the present invention, these terminals should not be limited to these terms. These terms are only used to distinguish terminals from each other. For example, without departing from the scope of the embodiments of the present invention, a first terminal may also be referred to as a second terminal, and similarly, a second terminal may also be referred to as a first terminal.

[0043] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."

[0044] See Figure 1 This is a flowchart illustrating a template generation method provided in an embodiment of this application.

[0045] The template generation method in this application embodiment can be applied to the processing of products by laser processing equipment. More specifically, the template generated in the template generation method can be used for machine vision image processing of the laser processing device to realize the identification and positioning of the unit or module to be processed.

[0046] In this application embodiment, a template generation method includes:

[0047] S11, Obtain the engineering file corresponding to the product to be laser-processed, and the surface image of the product to be laser-processed;

[0048] S12, query the basic graphics contained in the project file, and the vector parameters corresponding to each basic graphic;

[0049] S13, according to the vector parameters corresponding to each basic graphic, the repeating unit in the project file is drawn in the first image, and the repeating unit contains at least one basic graphic;

[0050] S14, based on the repeating unit in the first image, extract the image portion corresponding to the repeating unit in the surface image of the product, and perform noise reduction processing on the extracted image portion to generate the template.

[0051] The template generation method provided in the above-described embodiments of this application obtains the engineering file corresponding to the product to be laser-processed and the surface image of the product, queries the basic graphics and corresponding vector parameters contained in the engineering file, draws the repeating units in the engineering file in the first image, and then extracts the corresponding image part in the surface image of the product based on the repeating units in the first image, performs noise reduction processing, thereby generating the template. Compared with the prior art, it eliminates the need for manual processing of the surface graphics based on experience, reduces labor costs, and improves the efficiency of template generation.

[0052] The above steps S11-S14 are further described below in a more detailed embodiment of this application.

[0053] In step S11, the engineering file corresponding to the product to be laser-processed, as well as the surface image of the product, are obtained.

[0054] Specifically, in the existing template creation process, technicians directly create the templates based on the surface images of the product, which requires certain skills from the technicians and results in high labor costs. In contrast, this application generates templates based on the product's engineering files and surface images, using automated processing methods.

[0055] Specifically, the product can be, but is not limited to, a PCB product. During the product development process, engineering files are usually pre-defined, which draw and describe the structural features of the product as a whole.

[0056] In this embodiment, the final template file is an image file. To facilitate data exchange and processing, the engineering file is preferably in DXF format. DXF (Drawing Exchange Format) is a data format that facilitates data exchange between CAD software and other software. In this embodiment, the DXF file records the structural features of the product in vector data format.

[0057] In the embodiments of this application, the surface of the product can be captured by an industrial camera. Typically, industrial cameras are used in conjunction with laser processing equipment and can be area scan cameras or line scan cameras. For example, with a line scan camera, line images of the product during movement are captured, and then the line images are stitched together to obtain the surface image of the product.

[0058] S12, query the basic graphics contained in the project file, and the vector parameters corresponding to each basic graphic.

[0059] Specifically, in the embodiments of this application, the vector features of the product are recorded in the engineering file. For data processing needs, the required basic graphics can be defined, such as circles, line segments, arcs, or points. The vector parameters corresponding to the basic graphics include center coordinates, vector length, angle, or radians. The engineering file contains a predefined coordinate system, where the center coordinates are the coordinates of the center point of the basic image within that coordinate system. A vector is defined as a directed vector from the start point to the end point of the basic graphic; the vector length is the magnitude of the vector; the angle is the angle of the vector relative to a certain coordinate axis of the coordinate system; and the radians are vector parameters for arcs, representing the degree measure of the arc.

[0060] It's easy to understand that different basic shapes have different vector parameters. However, for the same shape, the vector length, angle, or radians of its vector parameters should be the same.

[0061] S13, according to the vector parameters corresponding to each basic graphic, the repeating unit in the project file is drawn in the first image, and the repeating unit contains at least one basic graphic.

[0062] Specifically, to facilitate automated processing by computers, the processing procedure includes:

[0063] (1) Sort all the basic graphics in the project file in a directional order;

[0064] Specifically, in the embodiments of this application, the center coordinates of the basic graphic are identified by the position of the center point in the coordinate system of the engineering file. This application sorts all basic graphics based on the center coordinates. Specifically, the basic graphics are sorted according to their center coordinates, achieving a left-to-right and top-to-bottom order. That is, in terms of sorting order, in the coordinate system of the engineering file, the basic graphic with a center coordinate further to the left should be sorted earlier, and the graphic with a center coordinate further to the top should also be sorted with higher priority.

[0065] (2) Compare all sorted basic shapes, identify the same basic shapes, and classify the same basic shapes into the preset major categories.

[0066] Specifically, the sorting structure indicates the spatial order of the basic shapes. Comparisons are also made according to the sorting order. The comparisons described in this application are pairwise comparisons; for example, first select the first-ranked basic shape and compare it with the second-ranked basic shape, then compare it with the third-ranked basic shape, and so on, until all the basic shapes have been compared, and so on.

[0067] In this embodiment, all basic graphics are compared pairwise in the sorted order. The remaining vector parameters, except for the center coordinates, are compared. If the vector parameters of the same type being compared are within a preset error range, the two basic graphics being compared are considered to be the same basic graphics, and the basic graphics are added to a preset category in the sorted order.

[0068] For example, starting with basic shape 1, the comparison is made with basic shape 2, basic shape 3, and so on. The order following the basic shape indicates the sorting order of the basic shape.

[0069] Starting with basic shape 1, which can be any basic shape such as a line segment, circle, or arc, create a category ID1. Basic shape 1 is a basic element of ID1. Compare basic shape 1 with basic shape 2. If they are not the same shape, further compare basic shape 1 with basic shape 3. If they have the same vector length, angle, and radian, then basic shape 3 is considered the same basic shape as basic shape 1 and is added to ID1... This continues until basic shape 1 has been compared with all other basic shapes. At this point, select basic shape 2 again to start the comparison and create a category ID2. Compare basic shape 2 with basic shapes that do not belong to ID1 in sequence... until all basic shapes are classified into their respective categories.

[0070] (3) Based on the distance variation characteristics between the basic figures in each major category, each major category is divided into multiple minor categories;

[0071] Specifically, basic graphics belonging to the same major category are identical basic graphics; however, these basic graphics may belong to one repeating unit or to multiple different repeating units. In the embodiments of this application, in order to realize the same repeating unit, it should contain as many basic graphics as possible. Here, basic graphics belonging to different repeating units are divided according to the distance variation characteristics between basic graphics, that is, major categories are divided into minor categories.

[0072] It's easy to understand that basic figures belonging to the same repeating unit should exhibit relatively small abrupt changes in distance between each pair of elements. However, for different repeating units, the distance changes may be relatively large.

[0073] For example, the major category ID1 includes {basic graphic 1, basic graphic 3, basic graphic 6, basic graphic 9, basic graphic 11, basic graphic 14...}.

[0074] To calculate the distance between basic graphic 1 and basic graphic 3, the distance between the center coordinates of the basic graphics can be taken as the distance between the basic graphics. For example, in the coordinate system of the engineering file, the distance can be 2.

[0075] Similarly, calculate the distances between basic figures 3 and 6, 6 and 9, 9 and 11, and 11 and 14. For example, the distances can be 3, 8, 2, and 3 respectively. It can be seen that basic figures 1, 3, and 6 have the same distance variation pattern as basic figures 9, 11, and 14, and there is a significant abrupt change in distance between basic figures 6 and 9. Therefore, basic figures 1, 3, and 6 can be classified into a subclass ID11, while basic figures 9, 11, and 14 can be classified into another subclass ID12.

[0076] Therefore, in this embodiment of the application, the distance between the center coordinates of two adjacent basic graphics can be compared according to the sorting order of the basic graphics in each major category. Basic graphics whose distance changes do not exceed the threshold are classified into the same sub-category, and basic graphics whose distance changes exceed the threshold are classified into different sub-categories.

[0077] (4) Select a basic graphic from the outermost edge of each subclass in a preset direction as a basic graphic belonging to the repeating unit, and draw it in the first image.

[0078] Specifically, the basic graphic in each sub-category is a basic graphic belonging to the same repeating unit. In this embodiment, one or more basic graphics with the outermost edge in a preset direction can be selected and drawn into the first graphic, thereby facilitating the determination of the boundary of the repeating unit. The preset direction may include upper left, lower left, upper right, or lower right.

[0079] The first image is the created image file, which can be, but is not limited to, a BMP file.

[0080] Furthermore, during the drawing process, certain coordinate system transformations can be performed, that is, converting the coordinate system of the project file to the coordinate system of the first image. For example, to reduce the file size of the first image, the basic graphics can be scaled down proportionally during the drawing process.

[0081] S14, based on the repeating unit in the first image, extract the image portion corresponding to the repeating unit in the surface image of the product, and perform noise reduction processing on the extracted image portion to generate the template.

[0082] Specifically, the first image and the product surface are descriptions of the product in different coordinate systems. During processing, it is necessary to determine the coordinate transformation matrix between the first image and the surface image. Based on the coordinate transformation matrix, the first boundary coordinates of the repeating unit are replaced with the second boundary coordinates in the surface image, and the image portion within the second boundary coordinates is extracted. The extracted graphic portion undergoes noise reduction processing and can be used as a template for further machine vision processing.

[0083] Figure 2 This is a functional block diagram of a template generation device provided in an embodiment of this application.

[0084] The template generation device 200 mentioned above includes:

[0085] The acquisition unit 201 is used to acquire the engineering file corresponding to the product to be laser-processed, and the surface image of the product;

[0086] The query unit 202 is used to query the basic graphics contained in the project file, and the vector parameters corresponding to each basic graphic.

[0087] The file conversion unit 203 is used to draw the repeating unit in the project file in the first image according to the vector parameters corresponding to each basic graphic, wherein the repeating unit contains at least one basic graphic.

[0088] The image processing unit 204 is configured to extract the image portion corresponding to the repeating unit in the surface image of the product based on the repeating unit in the first image, and to perform noise reduction processing on the extracted image portion to generate the template.

[0089] The acquisition unit 201 is used to acquire the engineering file corresponding to the product to be laser-processed, as well as the surface image of the product.

[0090] Specifically, the product can be, but is not limited to, a PCB product. During the product development process, engineering files are usually pre-defined, which draw and describe the structural features of the product as a whole.

[0091] In this embodiment, the final template file is an image file. To facilitate data exchange and processing, the engineering file is preferably in DXF format. DXF (Drawing Exchange Format) is a data format that facilitates data exchange between CAD software and other software. In this embodiment, the DXF file records the structural features of the product in vector data format.

[0092] In the embodiments of this application, the surface of the product can be captured by an industrial camera. Typically, industrial cameras are used in conjunction with laser processing equipment and can be area scan cameras or line scan cameras. For example, with a line scan camera, line images of the product during movement are captured, and then the line images are stitched together to obtain the surface image of the product.

[0093] The query unit 202 is used to query the basic graphics contained in the project file, and the vector parameters corresponding to each basic graphic.

[0094] Specifically, in the embodiments of this application, the vector features of the product are recorded in the engineering file. For data processing needs, the required basic graphics can be defined, such as circles, line segments, arcs, or points. The vector parameters corresponding to the basic graphics include center coordinates, vector length, angle, or radians. The engineering file contains a predefined coordinate system, where the center coordinates are the coordinates of the center point of the basic image within that coordinate system. A vector is defined as a directed vector from the start point to the end point of the basic graphic; the vector length is the magnitude of the vector; the angle is the angle of the vector relative to a certain coordinate axis of the coordinate system; and the radians are vector parameters for arcs, representing the degree measure of the arc.

[0095] It's easy to understand that different basic shapes have different vector parameters. However, for the same shape, the vector length, angle, or radians of its vector parameters should be the same.

[0096] The file conversion unit 203 is used to draw the repeating units in the project file into a first image according to the vector parameters corresponding to each basic graphic.

[0097] Specifically, to facilitate automated processing by computers, the processing procedure includes:

[0098] (1) Sort all the basic graphics in the project file in a directional order;

[0099] Specifically, in the embodiments of this application, the center coordinates of the basic graphic are identified by the position of the center point in the coordinate system of the engineering file. This application sorts all basic graphics based on the center coordinates. Specifically, the basic graphics are sorted according to their center coordinates, achieving a left-to-right and top-to-bottom order. That is, in terms of sorting order, in the coordinate system of the engineering file, the basic graphic with a center coordinate further to the left should be sorted earlier, and the graphic with a center coordinate further to the top should also be sorted with higher priority.

[0100] (2) Compare all sorted basic shapes, identify the same basic shapes, and classify the same basic shapes into the preset major categories.

[0101] Specifically, the sorting structure indicates the spatial order of the basic shapes. Comparisons are also made according to the sorting order. The comparisons described in this application are pairwise comparisons; for example, the first-ranked basic shape is selected and compared with the second-ranked basic shape, and so on, until all basic shapes have been compared, and so on.

[0102] In this embodiment, all basic graphics are compared pairwise in the sorted order. The remaining vector parameters, except for the center coordinates, are compared. If the vector parameters of the same type being compared are within a preset error range, the two basic graphics being compared are considered to be the same basic graphics, and the basic graphics are added to a preset category in the sorted order.

[0103] (3) Based on the distance variation characteristics between the basic figures in each major category, each major category is divided into multiple minor categories;

[0104] Specifically, basic graphics belonging to the same major category are identical basic graphics; however, these basic graphics may belong to one repeating unit or to multiple different repeating units. In the embodiments of this application, in order to realize the same repeating unit, it should contain as many basic graphics as possible. Here, basic graphics belonging to different repeating units are divided according to the distance variation characteristics between basic graphics, that is, major categories are divided into minor categories.

[0105] In this embodiment of the application, the distance between the center coordinates of two adjacent basic graphics can be compared according to the sorting order of the basic graphics in each major category. Basic graphics whose distance changes do not exceed the threshold are classified into the same sub-category, while basic graphics whose distance changes exceed the threshold are classified into different sub-categories.

[0106] (4) Select a basic graphic from the outermost edge of each subclass in a preset direction as a basic graphic belonging to the repeating unit, and draw it in the first image.

[0107] Specifically, the basic graphic in each sub-category is a basic graphic belonging to the same repeating unit. In this embodiment, one or more basic graphics with the outermost edge in a preset direction can be selected and drawn into the first graphic, thereby facilitating the determination of the boundary of the repeating unit. The preset direction may include upper left, lower left, upper right, or lower right.

[0108] The first image is the created image file, which can be, but is not limited to, a BMP file.

[0109] Furthermore, during the drawing process, certain coordinate system transformations can be performed, that is, converting the coordinate system of the project file to the coordinate system of the first image. For example, to reduce the file size of the first image, the basic graphics can be scaled down proportionally during the drawing process.

[0110] The image processing unit 204 is configured to extract the image portion corresponding to the repeating unit in the surface image of the product based on the repeating unit in the first image, and to perform noise reduction processing on the extracted image portion to generate the template.

[0111] Specifically, the first image and the product surface are descriptions of the product in different coordinate systems. During processing, it is necessary to determine the coordinate transformation matrix between the first image and the surface image. Based on the coordinate transformation matrix, the first boundary coordinates of the repeating unit are replaced with the second boundary coordinates in the surface image, and the image portion within the second boundary coordinates is extracted. The extracted graphic portion undergoes noise reduction processing and can be used as a template for further machine vision processing.

[0112] The template generation device provided in the above-described embodiments of this application obtains the engineering file corresponding to the product to be laser-processed and the surface image of the product, queries the basic graphics and corresponding vector parameters contained in the engineering file, draws the repeating units in the engineering file in the first image, and then extracts the corresponding image part in the surface image of the product based on the repeating units in the first image, performs noise reduction processing, thereby generating the template. Compared with the prior art, it eliminates the need for manual processing of the surface graphics based on experience, reduces labor costs, and improves the efficiency of template generation.

[0113] This application also provides a computer-readable storage medium, which includes a stored program, wherein the program controls the device where the storage medium is located to execute the above-described template generation method when it is running.

[0114] This application embodiment also provides a computer device 800, such as... Figure 3 As shown. The computer device 800 of this embodiment includes: a processor 801, a memory 802, and a computer program 803 stored in the memory and executable on the processor 801. When the processor 801 executes the computer program 803, it implements the method of the laser illumination device in the embodiment. To avoid repetition, it will not be described in detail here. Alternatively, when the computer program is executed by the processor 801, it implements the functions of each model / unit in the template generation device in the embodiment. To avoid repetition, it will not be described in detail here.

[0115] Computer device 800 can be a desktop computer, laptop, handheld computer, cloud server, laser processing equipment, or other computing device. The computer device may include, but is not limited to, processor 301 and memory 302. Those skilled in the art will understand that... Figure 3 This is merely an example of computer device 800 and does not constitute a limitation on computer device 800. It may include more or fewer components than shown, or combine certain components, or different components. For example, computer device may also include input / output devices, network access devices, buses, etc.

[0116] The processor 801 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0117] The memory 802 can be an internal storage unit of the computer device 800, such as a hard disk or RAM of the computer device 800. The memory 802 can also be an external storage device of the computer device 800, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device 800. Furthermore, the memory 802 can include both internal and external storage units of the computer device 800. The memory 802 is used to store computer programs and other programs and data required by the computer device. The memory 802 can also be used to temporarily store data that has been output or will be output.

[0118] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0119] In the embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units through some interfaces, and may be electrical, mechanical, or other forms.

[0120] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0121] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A template generation method characterized by, The method includes: Obtain the engineering files corresponding to the product to be laser-processed, as well as the surface image of the product to be laser-processed; Query the basic graphics contained in the project file, and the vector parameters corresponding to each basic graphic; Based on the vector parameters corresponding to each basic graphic, the repeating unit in the project file is drawn in the first image, and the repeating unit contains at least one basic graphic. Based on the repeating unit in the first image, the image portion corresponding to the repeating unit in the surface image of the product is extracted, and the extracted image portion is subjected to noise reduction processing to generate the template; The step of drawing the repeating units in the engineering file into the first image according to the vector parameters corresponding to each basic graphic includes: Arrange all basic graphics in the project file in a directional order; Compare all sorted basic shapes, identify the common basic shapes, and classify the common basic shapes into a preset category; Based on the distance variation characteristics between the basic graphics in each major category, each major category is divided into multiple subcategories; Select a basic graphic from the outermost edge of each subclass in a preset direction as a basic graphic belonging to the repeating unit, and draw it in the first image.

2. The method of claim 1, wherein, The basic graphic includes a circle, line segment, arc, or point; the vector parameters include center coordinates, vector length, angle, or radian.

3. The method of claim 2, wherein, The project file includes a directional sorting of all basic graphics, including: Based on the center coordinates of all basic graphics, the basic graphics are sorted to achieve a left-to-right and top-to-bottom sorting of all basic images.

4. The method according to claim 3, characterized in that, The process of comparing all sorted basic shapes, identifying identical basic shapes, and categorizing identical basic shapes into preset major categories includes: All basic shapes are compared pairwise in the sorted order. The vector parameters other than the center coordinates are compared. If the vector parameters of the same type being compared are within the preset error range, the two basic shapes being compared are considered to be the same basic shape. The basic shapes are then added to the preset category in the sorted order.

5. The method according to claim 4, characterized in that, Based on the distance variation characteristics between the basic graphics in each major category, each major category is divided into multiple subcategories, including: Based on the sorting order of the basic shapes in each major category, the distance between the center coordinates of two adjacent basic shapes is compared. Basic shapes whose distance changes do not exceed the threshold are classified into the same sub-category, while basic shapes whose distance changes exceed the threshold are classified into different sub-categories.

6. The method according to claim 5, characterized in that, The step of extracting the image portion corresponding to the repeating unit in the surface image of the product based on the repeating unit in the first image includes: Determine the coordinate transformation matrix between the first image and the surface image; According to the coordinate transformation matrix, the first boundary coordinates of the repeating unit are replaced with the second boundary coordinates in the surface image, and the image portion within the second boundary coordinates is extracted.

7. The method according to claim 1, characterized in that, The project file is a DXF file; the surface image of the product is obtained by capturing the surface of the product using an industrial camera.

8. A template generation device, characterized in that, The device includes: The acquisition unit is used to acquire the engineering file corresponding to the product to be laser-processed, and the surface image of the product to be laser-processed; The query unit is used to query the basic graphics contained in the project file, and the vector parameters corresponding to each basic graphic. The file conversion unit is used to draw the repeating units in the project file in the first image according to the vector parameters corresponding to each basic graphic, wherein the repeating units contain at least one basic graphic. An image processing unit is configured to extract an image portion corresponding to the repeating unit in the surface image of the product based on the repeating unit in the first image, and to perform noise reduction processing on the extracted image portion to generate the template; The file conversion unit is specifically used to sort all the basic graphics in the project file in a directional manner; compare all sorted basic graphics, identify the same basic graphics, and classify the same basic graphics into a preset major category; divide each major category into multiple minor categories according to the distance variation characteristics between the basic graphics in each major category; select the basic graphic at the outermost edge of the preset direction from each minor category as a basic graphic belonging to the repeating unit, and draw it in the first image.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed, controls the device containing the computer-readable storage medium to perform the template generation method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for generating inspection template of automated optical inspection equipment

    CN105512428A

  • CCD recognition-based PCB printing machine vision detection method and system

    CN110213900A