Texture processing area segmentation method and device, computer equipment and storage medium

By performing multi-level binaryization and random seed point segmentation on the texture grayscale map, the problem of obvious boundaries in adjacent areas in traditional laser texture processing is solved, and high-quality texture processing is achieved.

CN119525735APending Publication Date: 2025-02-28SHENZHEN SHUMA ELECTRONICS TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411947584.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

When traditional laser texture processing technology divides regions on three-dimensional objects, it is difficult to avoid obvious dividing lines between adjacent areas, resulting in poor texture processing quality.

Method used

By performing multi-level binaryization of the texture grayscale map, randomly selecting seed points for area segmentation, and mapping the segmented area to the surface of the three-dimensional object, determining the appropriate position to match the laser processing range.

Benefits of technology

This achieves the avoidance of obvious dividing lines between adjacent areas on three-dimensional objects, and improves the quality and efficiency of texture processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119525735A_ABST
    Figure CN119525735A_ABST
Patent Text Reader

Abstract

The invention relates to a texture processing area segmentation method and device, computer equipment and a storage medium. The method comprises the following steps: binarizing a texture grey-scale image based on a multi-level grey-scale range to obtain a multi-level binary image; randomly selecting seed points from a connected domain in the binary image; segmenting the connected domain based on the seed points to obtain segmented regions; determining a first mapping region where the segmentation region is mapped to the surface of the three-dimensional object; determining a first pose of the three-dimensional object when the center of a seed triangular patch corresponding to the seed point in the first mapping area is vertically penetrated by a central ray in the laser processing range; if the first mapping area is matched with the laser processing range when the three-dimensional object is in the first pose, determining that the first mapping area is a texture processing area, and determining that the first pose is a corresponding processing pose; otherwise, the first mapping area is segmented into a texture machining area matched with the laser machining range, and the corresponding machining pose is determined. By adopting the method, the texture processing quality can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of mechanical processing technology, and in particular to a method, device, computer equipment and storage medium for segmenting a texture processing area. Background Art

[0002] With the development of mechanical processing technology, laser texturing technology has emerged, which can process rich and diverse textures on objects through laser beams. Since factors such as the scanning angle of the galvanometer limit the processing range of the laser beam, regional segmentation is required when processing textures using laser beams.

[0003] In traditional technology, a three-dimensional object is directly divided into regions, and then a laser beam is used to perform texture processing in the divided regions. This cannot avoid the problem of obvious dividing lines between adjacent regions on the three-dimensional object, resulting in poor texture processing quality. Summary of the invention

[0004] Based on this, it is necessary to provide a method, device, computer equipment and storage medium for segmenting a texture processing area that can improve the processing quality of the texture in order to solve the above technical problems.

[0005] In a first aspect, the present application provides a method for segmenting a texture processing area, comprising: Binarize the texture grayscale image according to the multi-level grayscale range to obtain a multi-level binary image; Randomly select a seed point from a connected domain in the binary graph; Performing region segmentation on the connected domain according to the seed point to obtain a segmented region; Mapping the segmented area to the surface of the three-dimensional object to obtain a first mapping area; the first mapping area includes a seed triangle facet corresponding to the seed point; Determine the first position of the three-dimensional object when the center of the seed triangle is vertically passed by the center ray within the laser processing range; If the first mapping area matches the laser processing range when the three-dimensional object is in the first posture, determining that the first mapping area is a texture processing area at the level where the binary image is located, and determining that the first posture is a processing posture corresponding to the texture processing area; Otherwise, the first mapping area is divided into texture processing areas at the level of the binary image matching the laser processing range, and the processing posture corresponding to the texture processing area is determined.

[0006] In a second aspect, the present application further provides a texture processing area segmentation device, comprising: A layering module is used to binarize the texture grayscale image according to the multi-level grayscale range to obtain a multi-level binary image; A selection module, used for randomly selecting seed points from the connected domain in the binary graph; A first segmentation module, used for performing region segmentation on the connected domain according to the seed point to obtain a segmented region; A mapping module, configured to map the segmented area to a surface of a three-dimensional object to obtain a first mapping area; the first mapping area includes a seed triangle facet corresponding to the seed point; A determination module, used to determine the first pose of the three-dimensional object when the center of the seed triangle is vertically passed by the center ray within the laser processing range; A second segmentation module is used to determine that the first mapping area is a texture processing area at the level where the binary image is located, and determine that the first posture is a processing posture corresponding to the texture processing area if the first mapping area matches the laser processing range when the three-dimensional object is in the first posture; otherwise, the first mapping area is segmented into texture processing areas at the level where the binary image is located that match the laser processing range, and the processing posture corresponding to the texture processing area is determined.

[0007] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above method when executing the computer program.

[0008] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps in the above method when executed by a processor.

[0009] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps in the above method when executed by a processor.

[0010] The above-mentioned texture processing area segmentation method, device, computer equipment, storage medium and computer program product binarize the texture grayscale image according to the grayscale range of multiple levels to obtain a multi-level binary image, which can realize the stratification of the texture grayscale image and avoid directly segmenting the texture grayscale image, resulting in the formation of obvious dividing lines when the texture grayscale image is mapped to a three-dimensional object. Randomly select seed points from the connected domain in the binary image; perform regional segmentation on the connected domain according to the seed points to obtain segmented areas, and achieve regional segmentation of the connected domain in the binary image through random seed points, which can ensure the randomness of the segmented areas in each level of the binary image and avoid the formation of obvious dividing lines when the multi-level binary image is mapped to a three-dimensional object. Then, the segmented area is mapped to the surface of the three-dimensional object to obtain a first mapping area; the first mapping area includes seed triangles corresponding to the seed points. Since the segmented areas in the connected domain are random, the first mapping area corresponding to the segmented area may not be processed by the laser in one go. Therefore, by determining the first pose of the three-dimensional object when the center of the seed triangle is vertically passed by the central ray within the laser processing range; if the first mapping area matches the laser processing range when the three-dimensional object is in the first pose, it means that the first mapping area can be processed by the laser in one go, and the first mapping area is determined to be the texture processing area at the level where the binary image is located, and the first pose is determined to be the processing pose corresponding to the texture processing area; otherwise, the first mapping area is divided into texture processing areas at the level where the binary image is located that matches the laser processing range, and the processing pose corresponding to the texture processing area is determined, to ensure that the divided multi-level texture processing areas are random and can be processed by the laser in one go, thereby avoiding obvious dividing lines between adjacent areas on the three-dimensional object, and at the same time ensuring the laser texture processing efficiency, and effectively improving the texture processing quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 A schematic flow chart of a texture processing area segmentation method provided in an embodiment of the present application.

[0012] Figure 2 A schematic diagram of a connected domain provided in an embodiment of the present application.

[0013] Figure 3 A schematic diagram of various sub-points within a connected domain provided in an embodiment of the present application.

[0014] Figure 4 A schematic diagram of various discretized sub-points provided in an embodiment of the present application.

[0015] Figure 5 A schematic diagram of a process for randomly selecting seed points from a connected domain provided in an embodiment of the present application.

[0016] Figure 6 A schematic diagram of a circumscribed rectangle of a connected domain provided in an embodiment of the present application.

[0017] Figure 7 A schematic diagram of a Thiessen polygon constructed within a circumscribed rectangle of a connected domain provided in an embodiment of the present application.

[0018] Figure 8 A schematic diagram of each segmented area within a connected domain provided in an embodiment of the present application.

[0019] Fig. 9 A simplified flowchart of a texture processing area segmentation method provided in an embodiment of the present application.

[0020] Fig.10 A structural block diagram of a texture processing area segmentation device provided in an embodiment of the present application.

[0021] Fig.11 An internal structure diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0023] In an exemplary embodiment, Figure 1 As shown, a texture processing area segmentation method is provided, and the method is applied to a computer device as an example for explanation, and the computer device may include at least one of a terminal or a server. The method includes the following steps 102 to 114.

[0024] Step 102, binarizing the texture grayscale image according to the multi-level grayscale range to obtain a multi-level binary image.

[0025] Among them, the grayscale size in the texture grayscale image is positively correlated with the depth of the texture. It can be understood that the greater the grayscale of the pixel in the texture grayscale image, the greater the depth of the texture in the area mapped to the pixel, and the smaller the grayscale of the pixel, the smaller the depth of the texture in the area mapped to the pixel. The grayscale difference in the texture grayscale image can indicate the different depths of the texture, thereby achieving a three-dimensional effect of the texture.

[0026] Exemplarily, for each level of grayscale range, the computer device may set the grayscale values ​​within the grayscale range of the current level in the texture grayscale image to 1, and set the grayscale values ​​outside the grayscale range of the current level in the texture grayscale image to 0, to obtain a binary image of the current level.

[0027] In some embodiments, the computer device may determine a grayscale interval. The starting grayscale value in the grayscale range of each level differs from the starting grayscale value in the grayscale range of the next level of the level by a grayscale interval. The ending grayscale values ​​in the grayscale ranges of each level are the same. It is understood that the starting grayscale value in the grayscale range of the first level may not be greater than the minimum grayscale value in the texture grayscale map. The ending grayscale value in the grayscale range of each level may not be less than the maximum grayscale value of the texture grayscale map.

[0028] In some embodiments, the computer device may obtain a preset multi-level grayscale range.

[0029] In some embodiments, the computer device may divide the grayscale range into multiple levels based on the grayscale interval and the minimum grayscale value and the maximum grayscale value in the texture grayscale image.

[0030] Step 104: randomly select seed points from the connected domain in the binary graph.

[0031] It can be understood that the boundaries between connected domains are existing boundaries in the texture grayscale image. In order to ensure the quality of texture processing, the boundaries of the connected domains need to be retained. Therefore, randomly selecting seed points at the connected domain level and performing region segmentation can ensure the quality of texture processing.

[0032] Exemplarily, the computer device can perform a connected domain detection on the binary graph of each level to obtain a connected domain of each level. The computer device can map each connected domain of each level to the surface of a three-dimensional object to obtain a second mapping area. If the second mapping area matches the laser processing range, the second mapping area is determined as the texture processing area of ​​this level. If the second mapping area does not match the laser processing range, a seed point is randomly selected from the connected domain. Among them, the laser processing range is the spatial range where laser rays at different angles are located. It can be understood that in the laser texture processing technology, the angle of the laser beam is adjusted by a galvanometer, and these laser beams at different angles constitute the laser processing range.

[0033] In some embodiments, the computer device can randomly select a reference triangle from the second mapping area to determine the second pose of the three-dimensional object when the center of the reference triangle is vertically passed by the central ray. The central ray refers to the laser ray located at the center of the laser processing range. If the second mapping area matches the laser processing range when the three-dimensional object is in the second pose, the second mapping area is determined to be the texture processing area of ​​the current level, and the second pose is determined to be the processing pose corresponding to the texture processing area. If the second mapping area does not match the laser processing range when the three-dimensional object is in the second pose, a seed point is randomly selected from the connected domain.

[0034] In some embodiments, the computer device may randomly select seed points from each connected domain of each level. It is understandable that matching the second mapping area of ​​the connected domain on the three-dimensional object with the laser processing range requires a lot of computing resources. In order to reduce the consumption of this part of computing resources, the second mapping area matching the laser processing range may no longer be selected as the texture processing area, but the seed points may be directly randomly selected from each connected domain and then the segmented area matching the laser processing range may be selected as the texture processing area.

[0035] Step 106, segmenting the connected domain according to the seed points to obtain segmented regions.

[0036] Exemplarily, the computer device may construct a polygon for the circumscribed rectangle of the connected domain according to the seed point, and divide the connected domain into segmented areas based on the constructed polygon.

[0037] In some embodiments, the computer device may divide the connected domain into polygons according to the seed points to obtain segmented regions. It is understood that the divided polygons are the segmented regions.

[0038] In some embodiments, the computer device may perform region growing based on the seed points within the connected domain to obtain segmented regions that meet a preset size.

[0039] Step 108 , mapping the segmented area to the surface of the three-dimensional object to obtain a first mapping area; the first mapping area includes seed triangles corresponding to the seed points.

[0040] The seed triangle patch is the triangle patch to which the seed point in the segmentation area is mapped.

[0041] For example, the computer device may use a texture mapping program to map points in the segmented area to triangular facets on the surface of the three-dimensional object to obtain a first mapping area. It is understood that the first mapping area includes the triangular facets to which each point in the segmented area is mapped. The three-dimensional object may be a workpiece or a mold, etc.

[0042] Step 110, determining the first pose of the three-dimensional object when the center of the seed triangle is vertically penetrated by the center ray within the laser processing range.

[0043] The seed triangle patch corresponding to the seed point is the triangle patch to which the seed point is mapped.

[0044] It is understandable that in the laser texturing scenario, the adjustable laser processing range of the galvanometer is fixed. In order to perform texture processing on different surface areas of a three-dimensional object, the posture of the three-dimensional object needs to be changed. Accordingly, the subsequent matching of the laser processing range and the mapping area also needs to be combined with the corresponding posture.

[0045] Exemplarily, the computer device may determine the first pose of the three-dimensional object when the normal of the seed triangle is parallel to the central ray and the center of the seed triangle is passed through by the central ray.

[0046] It should be noted that in this embodiment, there is no specific limitation on the method of determining the first pose of a three-dimensional object, as long as the three-dimensional object is in the first pose and satisfies the two conditions that the normal of the seed triangle is parallel to the central ray and the center of the seed triangle is passed through the central ray.

[0047] In some embodiments, the center of the triangular facet may be the centroid or incenter of the triangular facet.

[0048] Step 112, if the first mapping area matches the laser processing range when the three-dimensional object is in the first pose, determine the first mapping area as a texture processing area at the level of the binary image, and determine the first pose as a processing pose corresponding to the texture processing area.

[0049] The processing posture corresponding to the texture processing area is used to characterize the posture of the three-dimensional object when texture processing is performed in the texture processing area.

[0050] Exemplarily, the computer device can determine whether the first mapping area is located in the spatial area where each laser ray in the laser processing range is located when the three-dimensional object is in the first pose. If so, determine whether the angle between the normal of each triangular facet in the first mapping area and each laser ray in the laser processing range does not exceed the preset angle range when the three-dimensional object is in the first pose. If so, determine that the first mapping area matches the laser processing range when the three-dimensional object is in the first pose. If the first mapping area matches the laser processing range when the three-dimensional object is in the first pose, it means that the first mapping area can be processed by the laser at one time, and the first mapping area is used as the texture processing area of ​​the level where the binary image is located, and the first pose is used as the processing pose corresponding to the texture processing area.

[0051] In some embodiments, if the first mapping area is not located in the spatial area where the laser rays in the laser processing range are located when the three-dimensional object is in the first pose, it is determined that the first mapping area does not match the laser processing range when the three-dimensional object is in the first pose.

[0052] In some embodiments, if the angle between the normal of each triangular facet in the first mapping area and each laser ray in the laser processing range exceeds a preset angle range when the three-dimensional object is in the first pose, it is determined that the first mapping area does not match the laser processing range when the three-dimensional object is in the first pose.

[0053] Step 114: otherwise, the first mapping area is divided into texture processing areas at the level of the binary image matching the laser processing range, and the processing posture corresponding to the texture processing area is determined.

[0054] Exemplarily, the computer device can select the current triangular facet from the remaining mapping area except the texture processing area in the first mapping area. It can be understood that when the current triangular facet is selected for the first time, there is no texture processing area in the first mapping area. At this time, the remaining mapping area is the first mapping area. Determine the current triangular facet as the current area, and determine the current posture of the three-dimensional object when the center of the current triangular facet is vertically passed by the central ray. Continuously determine the triangular facets to be merged that are adjacent to the current area and match the laser processing range when the three-dimensional object is in the current posture from the remaining mapping area, and merge the triangular facets to be merged into the current area until there are no triangular facets to be merged. The above process realizes the regional growth based on the current triangular facet in the remaining mapping area, and obtains the initial area in the remaining mapping area that can be processed by the laser at one time. Then, determine the initial area as the texture processing area at the level of the binary image, and determine the initial posture as the processing posture corresponding to the texture processing area. Return to the step of selecting the current triangular facet from the remaining mapping area except the texture processing area in the first mapping area and continue to execute until there are no remaining mapping areas. It can be understood that there is no remaining mapping area in the first mapping area, which means that the first mapping area has been completely divided into various texture processing areas.

[0055] In some embodiments, the computer device may use the seed triangle as the current triangle selected for the first time. It is understood that in step 112, the first mapping area is actually determined by matching the laser processing range with the first mapping area when the three-dimensional object is in the first pose to determine whether the first mapping area can be processed by the laser at one time. If the seed triangle is directly used as the current triangle selected for the first time, the first pose can be directly used as the current pose without performing pose calculation again, which can save computing resources.

[0056] In some embodiments, the first mapping area is divided into texture processing areas at a level of the binary image matching the laser processing range, and processing poses corresponding to the texture processing areas are determined.

[0057] In some embodiments, the current triangle patch may be randomly selected from the remaining mapped area.

[0058] In some embodiments, the computer device may traverse the triangular facets in the remaining mapping area, and determine the angles between the currently traversed triangular facet and the remaining triangular facets except the currently traversed triangular facet. From the angles, the maximum angle corresponding to the currently traversed triangular facet is determined. From the maximum angles corresponding to the triangular facets in the remaining mapping area, the minimum angle is determined. The triangular facet corresponding to the minimum angle is selected as the current triangular facet.

[0059] In some embodiments, the computer device can select the current triangular facet from the remaining mapping area. Determine the current posture of the three-dimensional object when the center of the current triangular facet is vertically passed by the central ray. Determine from the remaining mapping area the triangular facets to be merged that are located in the spatial area where the laser rays within the laser processing range are located when the three-dimensional object is in the current posture, and whose angles with the laser rays within the laser processing range do not exceed a preset angle range. Determine the texture processing area formed by the current triangular facet and the triangular facets to be merged. Return to the step of selecting the current triangular facet from the remaining mapping area and continue to execute until there is no remaining mapping area in the first mapping area.

[0060] In the above-mentioned texture processing area segmentation method, the texture grayscale image is binarized according to the grayscale range of multiple levels to obtain a multi-level binary image, which can realize the stratification of the texture grayscale image and avoid directly performing regional segmentation on the texture grayscale image, resulting in the formation of obvious dividing lines when the texture grayscale image is mapped to a three-dimensional object. Seed points are randomly selected from the connected domain in the binary image; the connected domain is segmented according to the seed points to obtain segmented areas, and the regional segmentation of the connected domain in the binary image is achieved by random seed points, which can ensure the randomness of the segmented areas in each level of the binary image and avoid the formation of obvious dividing lines when the multi-level binary image is mapped to a three-dimensional object. Then, the segmented area is mapped to the surface of the three-dimensional object to obtain a first mapping area; the first mapping area includes seed triangles corresponding to the seed points. Since the segmented areas in the connected domain are random, the first mapping area corresponding to the segmented area may not be processed by the laser in one go. Therefore, by determining the first pose of the three-dimensional object when the center of the seed triangle is vertically passed by the central ray within the laser processing range; if the first mapping area matches the laser processing range when the three-dimensional object is in the first pose, it means that the first mapping area can be processed by the laser in one go, and the first mapping area is determined to be the texture processing area at the level where the binary image is located, and the first pose is determined to be the processing pose corresponding to the texture processing area; otherwise, the first mapping area is divided into texture processing areas at the level where the binary image is located that matches the laser processing range, and the processing pose corresponding to the texture processing area is determined, to ensure that the divided multi-level texture processing areas are random and can be processed by the laser in one go, thereby avoiding obvious dividing lines between adjacent areas on the three-dimensional object, and at the same time ensuring the laser texture processing efficiency, and effectively improving the texture processing quality.

[0061] In some embodiments, the method also includes: obtaining the minimum grayscale value and the maximum grayscale value in the texture grayscale map; determining the minimum grayscale value as the starting grayscale value of the first level; starting from the level below the first level, determining the starting grayscale value of each level that increases the grayscale interval compared to the starting grayscale value of the previous level and is less than the maximum grayscale value; determining the grayscale range of multiple levels formed by the starting grayscale values ​​of multiple levels and the maximum grayscale value.

[0062] Exemplarily, the computer device may obtain the grayscale difference between the maximum grayscale value and the minimum grayscale value in the texture grayscale image. The grayscale interval is determined based on the ratio between the grayscale difference and the preset number of levels. The minimum grayscale value is used as the starting grayscale value of the first level. Starting from the next level of the first level, the starting grayscale value and the grayscale interval of each level are summed to obtain the starting grayscale value of the next level of each level. The range from the starting grayscale value of each level to the maximum grayscale value is used as the grayscale range of each level.

[0063] In some embodiments, the computer device may weight the grayscale interval using the number of interval levels between each level and the first level, and then superimpose the minimum grayscale value to obtain the grayscale range of each level.

[0064] In some embodiments, the computer device may use the ratio between the grayscale difference and the preset number of levels as the grayscale interval. min Represents the minimum grayscale value in the texture grayscale image. max represents the maximum grayscale value in the texture grayscale image. m represents the number of preset levels. Then, the grayscale interval r=(g max -g min ) / m. The starting grayscale value of the first level is g min , the starting grayscale value of the next level of the first level is g min +r, and so on. The grayscale range of the first level is from g min to g max , the grayscale range of the next level of the first level is g min +r to g max , and so on.

[0065] In this embodiment, by obtaining the minimum grayscale value and the maximum grayscale value in the texture grayscale image; determining the minimum grayscale value as the starting grayscale value of the first level; starting from the level below the first level, determining the starting grayscale value of each level that increases the grayscale interval compared to the starting grayscale value of the previous level and is less than the maximum grayscale value; determining the grayscale range of multiple levels consisting of the starting grayscale values ​​of multiple levels and the maximum grayscale value, the grayscale range of multiple levels can be adaptively determined based on the grayscale situation of the texture grayscale image itself, thereby improving adaptability.

[0066] In some embodiments, the method also includes: obtaining each connected domain in the binary map of each level; mapping the connected domain to the surface of the three-dimensional object to obtain a second mapping area; traversing the triangular facets in the second mapping area, and determining the angles between the currently traversed triangular facet and the remaining triangular facets except the currently traversed triangular facet; determining the maximum angle corresponding to the currently traversed triangular facet from each angle; determining the minimum angle from the maximum angles corresponding to the triangular facets in the second mapping area; determining the second posture of the three-dimensional object when the center of the reference triangular facet corresponding to the minimum angle in the second mapping area is vertically passed by the central ray; if the second mapping area matches the laser processing range when the three-dimensional object is in the second posture, determining the second mapping area is the texture processing area of ​​this level, and determining the second posture is the processing posture corresponding to the texture processing area; randomly selecting seed points from the connected domain in the binary map, including: if the second mapping area does not match the laser processing range when the three-dimensional object is in the second posture, randomly selecting seed points from the connected domain in the binary map.

[0067] Exemplarily, the computer device can detect each connected domain in the binary map of each level. Map the points in the connected domain to the triangular facets on the surface of the three-dimensional object to obtain a second mapping area. Traverse the triangular facets in the second mapping area, and determine the angles between the currently traversed triangular facet and the above-mentioned remaining triangular facets based on the normal of the currently traversed triangular facet and the normals of the remaining triangular facets except the currently traversed triangular facet. By comparing the angles, the maximum angle corresponding to the currently traversed triangular facet is obtained. By comparing the maximum angles corresponding to the triangular facets in the second mapping area, the reference triangular facet corresponding to the minimum angle among the maximum angles is determined.

[0068] Assuming that there are n triangles in the second mapping area, calculate the maximum angle maxAngle1 among the angles between the normal of the first triangle and the normals of the second to nth triangles except the first, calculate the maximum angle maxAngle2 among the angles between the normal of the second triangle and the normals of the first, third to nth triangles except the second, and so on, and obtain the maximum angles maxAngle1, maxAngle2...maxAnglen corresponding to the first, second...nth triangles respectively. Then, find the reference triangle corresponding to the smallest maxAngle from maxAngle1, maxAngle2...maxAnglen.

[0069] It can be understood that the angle transformation range of each laser ray within the laser processing range relative to the central ray is fixed. The larger the maxAngle corresponding to the reference triangle patch, the larger the angle transformation range of the triangle patch in the second mapping area relative to the reference triangle patch, and it may even exceed the angle transformation range of each laser ray within the laser processing range, which may cause the connected domain that can be processed by the laser in one go to be misjudged as not being able to be processed by the laser in one go. The smaller the maxAngle corresponding to the reference triangle patch, the smaller the angle transformation range of the triangle patch in the second mapping area relative to the reference triangle patch, and the more it can be covered by the angle transformation range of each laser ray within the laser processing range. Therefore, selecting the triangle patch corresponding to the smallest maxAngle as the reference triangle patch can reduce the possibility of misjudging the connected domain that can be processed by the laser in one go as not being able to be processed by the laser in one go, thereby improving accuracy.

[0070] The computer device can determine the second posture of the three-dimensional object when the normal of the reference triangle is parallel to the central ray and the reference triangle is passed through by the central ray. Determine whether the second mapping area is located in the spatial area where the laser rays in the laser processing range are located when the three-dimensional object is in the second posture. If so, determine whether the angle between the normal of each triangle in the second mapping area and each laser ray in the laser processing range does not exceed the preset angle range when the three-dimensional object is in the second posture. If so, determine that the second mapping area matches the laser processing range when the three-dimensional object is in the second posture. If the second mapping area matches the laser processing range when the three-dimensional object is in the second posture, it means that the second mapping area can be processed by the laser at one time, and the second mapping area is used as the texture processing area of ​​the level where the binary image is located, and the second posture is used as the processing posture corresponding to the texture processing area.

[0071] The computer device can determine that the first mapping area does not match the laser processing range when the three-dimensional object is in the first pose, if the first mapping area is not located in the spatial area where the laser rays in the laser processing range are located when the three-dimensional object is in the first pose, and randomly select a seed point from the connected domain.

[0072] The computer device can randomly select seed points from the connected domain if the angles between the normals of the triangular facets in the first mapping area and the laser rays in the laser processing range exceed a preset angle range when the three-dimensional object is in the first pose, indicating that the first mapping area does not match the laser processing range.

[0073] In some embodiments, in order to save computing resources, the spatial region where each laser beam within the laser processing range is located can be simplified into a three-dimensional shape such as a cube or a frustum.

[0074] In this embodiment, each connected domain in the binary graph of each level is obtained; the connected domain is mapped to the surface of the three-dimensional object to obtain the second mapping area; the triangles in the second mapping area are traversed to determine the angles between the triangle currently traversed and the remaining triangles except the triangle currently traversed; the maximum angle corresponding to the triangle currently traversed is determined from the angles. Since the smaller the maximum angle corresponding to the reference triangle, the smaller the angle change range of the triangle in the second mapping area relative to the reference triangle, the more the angle change range of each laser ray in the laser processing range can be covered as much as possible, therefore, by determining the minimum angle from the maximum angles corresponding to the triangles in the second mapping area; determining the second posture of the three-dimensional object when the center of the reference triangle corresponding to the minimum angle in the second mapping area is vertically passed by the central ray, and matching the second mapping area with the laser processing range under the second posture, it can reduce the possibility of misjudging the connected domain that can be processed by the laser at one time as being unable to be processed by the laser at one time, thereby improving the accuracy. If the second mapping area matches the laser processing range when the three-dimensional object is in the second posture, the second mapping area is determined to be the texture processing area of ​​the current level, and the second posture is determined to be the processing posture corresponding to the texture processing area. The connected domain that matches the laser processing range can be directly used as the texture processing area, and the connected domain boundary existing in the binary image is retained to ensure the texture processing effect. If the second mapping area does not match the laser processing range when the three-dimensional object is in the second posture, seed points are randomly selected from the connected domain, and the connected domain can be subsequently segmented based on the randomly selected seed points to ensure the randomness of the segmented areas in the connected domain, avoid the formation of obvious dividing lines when multi-level binary images are mapped to the three-dimensional object, and ensure the quality of texture processing.

[0075] In some embodiments, seed points are randomly selected from a connected domain, including: determining the number of seed points based on the size difference between the connected domain and the laser processing range; randomly selecting various sub-points from the connected domain based on the number of seed points; determining a pair of seed points with the closest distance from the various sub-points to obtain a nearest neighbor point pair; randomly selecting a point to be replaced from the nearest neighbor point pair; randomly selecting a new discrete point from the connected domain; if the distances between the discrete points and the seed points other than the point to be replaced are all greater than the distances between the nearest neighbor point pairs, removing the point to be replaced from the various sub-points, using the discrete points as new seed points from the various sub-points, and if the first loop stop condition is not met, returning to the step of determining a pair of seed points with the closest distance from the various sub-points to obtain a nearest neighbor point pair to continue execution; otherwise, if the second loop stop condition is not met, returning to the step of randomly selecting a new discrete point from the connected domain to continue execution.

[0076] For example, the computer device may determine the number of seed points according to the multiple of the difference between the size of the connected domain and the size of the laser processing range. Figure 2As shown in FIG. 1 , a schematic diagram of a connected domain is provided. The computer device can randomly select a number of seed points from the connected domain. Figure 3 As shown in Figure 1, a schematic diagram of various sub-points in the connected domain is provided. Figure 3 The various sub-points in are completely randomly selected and not discretized enough. In order to ensure that the size of the subsequent segmented area is as uniform as possible, the seed points need to be distributed as discretely as possible and not gathered in a certain place. Therefore, it is necessary to add a step to discretize the seed points. Find a pair of seed points with the closest distance among various sub-points to obtain the nearest neighbor point pair. Assuming that the nearest neighbor point pair is d, if the purpose of discretizing the seed point is to be achieved, it is necessary to select the point to be replaced from the nearest neighbor point pair, and find a discrete point in the connected domain whose distance from the seed point other than the point to be replaced is greater than d, remove the point to be replaced from various sub-points, and use this discrete point as a new seed point. In addition, in order to ensure the randomness of the seed point as much as possible, randomly select the point to be replaced from the nearest neighbor point pair, randomly select a new discrete point from the connected domain, and then judge whether the distance between the new discrete point and the seed point other than the point to be replaced is greater than d.

[0077] The computer device can calculate the distances between the discrete points and the seed points other than the point to be replaced, and compare the above distances with the distances of the nearest neighbor point pair. If the distances between the discrete points and the seed points other than the point to be replaced are all greater than the distances of the nearest neighbor point pair, the point to be replaced is removed from the various sub-points, and the point to be replaced is no longer used as a seed point, and the discrete point is used as a new seed point. Update the number of loop rounds, that is, the number of loop rounds + 1. When the number of loop rounds is less than the preset number of rounds, it means that the first loop stop condition is not met, the number of loops is set to 0, and the step of determining the closest pair of seed points from the various sub-points and obtaining the nearest neighbor point pair is returned to continue.

[0078] If the distances between the discrete points and the seed points other than the point to be replaced are not all greater than the distances between the nearest neighboring points, update the number of loops, i.e., the number of loops + 1. If the number of loops is less than the preset number, return to the step of randomly selecting new discrete points from the connected domain and continue to execute. If the number of loops is not less than the preset number of loops or the number of loops is not less than the preset number of loops, stop the loop and obtain various sub-points after discretization. Figure 4 As shown, a schematic diagram of various sub-points after discretization is provided. Figure 4 Compared with the various sub-points in Figure 3 The distribution of various sub-points in is more discrete.

[0079] In some embodiments, the computer device can calculate the multiple of the difference between the bottom surface size of the spatial area where each laser ray in the laser processing range is located and the size of the connected domain to obtain the number of seed points.

[0080] In some embodiments, Figure 5As shown, a flow chart of randomly selecting seed points from a connected domain is provided. The computer device can randomly select n non-repeating seed points from the connected domain. n represents the number of seed points. Find a pair of seed points with the closest distance from the n non-repeating seed points to obtain a nearest neighbor pair, and the distance between the nearest neighbor pair is d. Randomly select a new discrete point in the connected domain, and randomly select a point to be replaced from the nearest neighbor pair. Determine whether the distance between the discrete point and the seed point other than the point to be replaced is greater than d. If the distance between the discrete point and the seed point other than the point to be replaced is greater than d, remove the point to be replaced from the n seed points, use the discrete point as a new seed point, reset the number of loops, and update the number of loops. Resetting the number of loops can be to set the number of loops to zero. Updating the number of loops can be to add 1 to the number of loops. Determine whether the number of loops is less than the preset number of loops. If not, end the loop. If so, return to the step of finding a pair of seed points with the closest distance to obtain the nearest neighbor pair. If the distance between the discrete point and the seed point other than the point to be replaced is not greater than d, update the number of loops. Updating the number of loops may be to increase the number of loops by 1. Determine whether the number of loops is less than a preset number, if not, end the loop, if so, return to the step of randomly selecting a new discrete point in the connected domain.

[0081] In this embodiment, the number of seed points is determined according to the size difference between the connected domain and the laser processing range; various sub-points are randomly selected from the connected domain according to the number of seed points. Since the various sub-points are completely randomly selected, in order to ensure that the size of the subsequent segmented area is as uniform as possible, it is necessary to introduce a seed point discretization step. From the various sub-points, the closest pair of seed points is determined to obtain the nearest neighbor point pair; the point to be replaced is randomly selected from the nearest neighbor point pair; and new discrete points are randomly selected from the connected domain to ensure randomness. If the distances between the discrete points and the seed points other than the point to be replaced are all greater than the distance between the nearest neighbor pair, the point to be replaced is removed from various sub-points, and the discrete point is used as a new seed point among the various sub-points. If the first loop stop condition is not met, return to the step of determining a pair of seed points with the closest distance from the various sub-points to obtain the nearest neighbor pair and continue to execute; otherwise, if the second loop stop condition is not met, return to the step of randomly selecting a new discrete point from the connected domain and continue to execute. This can ensure the randomness of various sub-points while discretizing the various sub-points, so that the segmented areas based on the various sub-points are as random and uniform as possible, and the mapping of the segmented areas to the first mapping area is also random and uniform. If the first mapping area needs to be segmented into texture processing areas later, compared with the uneven mapping areas, the number of segmented texture processing areas can be reduced, the complexity of texture processing can be reduced, and the efficiency of texture processing can be improved.

[0082] In some embodiments, segmenting a connected domain according to seed points to obtain segmented regions includes: constructing Thiessen polygons for a circumscribed rectangle of the connected domain according to the seed points; and segmenting the connected domain into segmented regions based on the constructed Thiessen polygons.

[0083] For example, Figure 6 As shown in FIG. 1 , a schematic diagram of the circumscribed rectangle of the connected domain is provided. The computer device can construct Thiessen polygons for the circumscribed rectangle of the connected domain according to the seed points using the perpendicular bisector method or the triangular mesh method. Figure 7 As shown in FIG. 1 , a schematic diagram of Thiessen polygons constructed within a circumscribed rectangle of a connected domain is provided. The computer device can use the constructed Thiessen polygons as a mask, and by covering the mask on the connected domain, the region within the same Thiessen polygon in the connected domain can be segmented into a segmented region. Figure 8 As shown, a schematic diagram of each segmented area in the connected domain is provided.

[0084] Among them, the perpendicular bisector method first draws the connecting line between the seed point p1 and the remaining seed points, and then draws the perpendicular bisectors of all the connecting lines. The smallest perpendicular bisector segment that can surround the p1 seed point is connected to construct the Thiessen polygon grown from the p1 seed point. The Thiessen polygon can be constructed by growing in this way to form the circumscribed rectangle of the entire connected domain.

[0085] The triangulated mesh method first triangulates all seed points to construct a Delaunay triangulation network, and then finds all adjacent triangles of the p1 seed point, sorts these triangles clockwise or counterclockwise, traverses each triangle, draws the circumscribed circle of the triangle, and then connects the centers of the circumscribed circles of these triangles in order to construct the Thiessen polygon grown from the p1 seed point. In this way, the circumscribed rectangle of the entire connected domain can be grown in sequence to complete the construction of the Thiessen polygon.

[0086] In this embodiment, Thiessen polygons are constructed for the circumscribed rectangle of the connected domain according to the seed points; Thiessen polygons are not limited to any specific shape or direction, and can freely form polygonal areas of various shapes according to the distribution of the seed points. Then, the connected domain is divided into segmented areas based on the constructed Thiessen polygons, which can ensure the randomness of the segmented areas. Moreover, the boundaries of the segmented areas of Thiessen polygons are mostly straight lines, which can avoid generating too tortuous dividing lines, shorten the length of the dividing lines, reduce the complexity of texture processing, and improve the efficiency of texture processing.

[0087] In some embodiments, the first mapping area is divided into texture processing areas at the level of the binary image matching the laser processing range, and the processing posture corresponding to the texture processing area is determined, including: for the first time, a seed triangle is selected as the current triangle, and from the next time after the first time, a new current triangle is randomly selected from the remaining mapping areas except the texture processing area in the first mapping area each time until there are no remaining mapping areas; for each current triangle selected, the current triangle is determined to be the current area; the current posture of the three-dimensional object when the center of the current triangle is vertically passed by the central ray is determined; in the process of regional growth based on the current area, the triangles to be merged that are adjacent to the current area and match the laser processing range when the three-dimensional object is in the current posture are continuously determined from the remaining mapping areas, and the triangles to be merged are merged into the current area until there are no triangles to be merged, and the current area after growth is obtained; the current area after growth is determined to be the texture processing area at the level of the binary image, and the current posture is determined to be the processing posture corresponding to the texture processing area.

[0088] It can be understood that when the current triangle patch is selected for the first time, there is no texture processing area in the first mapping area. Therefore, for the current triangle patch selected for the first time, the remaining mapping area is the first mapping area.

[0089] Exemplarily, the computer device can determine that the seed triangle is the current area, and determine the first pose as the current pose; continuously determine the triangles to be merged that are adjacent to the current area and match the laser processing range when the three-dimensional object is in the current pose from the first mapping area, merge the triangles to be merged into the current area until there are no triangles to be merged, and obtain the current area after growth; determine that the current area after growth is the texture processing area of ​​the level where the binary image is located, and determine the current pose as the processing pose corresponding to the texture processing area; if there are remaining mapping areas except each texture processing area in the first mapping area, A current triangle is randomly selected from the remaining mapping area; the current triangle is determined to be a new current area, and the current posture of the three-dimensional object is determined when the center of the current triangle is vertically passed by the central ray; triangles to be merged that are adjacent to the current area and match the laser processing range when the three-dimensional object is in the current posture are continuously determined from the remaining mapping area, and the triangles to be merged are merged into the current area until there are no triangles to be merged, thereby obtaining the grown current area; the step of returning to determine that the current area is a texture processing area at the level of the binary image, and determining that the current posture is a processing posture corresponding to the texture processing area continues to be executed.

[0090] In some embodiments, the computer device may determine the current pose of the three-dimensional object when the normal of the current triangle is parallel to the central ray and the center of the current triangle is passed through by the central ray.

[0091] In some embodiments, in the process of performing region growing based on the current region, triangular facets to be merged that are adjacent to the current region and are located in the spatial region where the laser rays within the laser processing range are located when the three-dimensional object is in the current posture, and whose angles with the laser rays within the laser processing range do not exceed a preset angle range are continuously determined from the remaining mapping regions. The triangular facets to be merged are merged into the current region until there are no triangular facets to be merged, and the current region is used as the texture processing region at the level of the binary image, and the current posture is used as the processing posture corresponding to the texture processing region.

[0092] In this embodiment, a seed triangle is selected as the current triangle for the first time, and from the next time after the first time, a new current triangle is randomly selected from the remaining mapping area in the first mapping area except the texture processing area each time until there is no remaining mapping area; for each selected current triangle, the current triangle is determined to be the current area; the current posture of the three-dimensional object when the center of the current triangle is vertically passed by the central ray is determined; since the current triangle selected for the first time is a seed triangle, the first posture can be directly used as the current posture, and there is no need to perform a posture calculation again, which can save computing resources. In the process of regional growth based on the current area, the triangles to be merged that are adjacent to the current area and match the laser processing range when the three-dimensional object is in the current posture are continuously determined from the remaining mapping area, and the triangles to be merged are merged into the current area until there is no triangle to be merged, and the current area after growth is obtained. Since the current triangle selected from the next time after the first time is random, it can be guaranteed that the current area after subsequent growth is also random. Furthermore, the current area after growth is determined to be the texture processing area of ​​the level where the binary image is located, and the current posture is determined to be the processing posture corresponding to the texture processing area. This can ensure the randomness of the texture processing area at each level and avoid the formation of obvious dividing lines when multi-level binary images are mapped onto three-dimensional objects.

[0093] In some embodiments, the method also includes: determining each texture processing area in the multi-level texture processing area as an area to be grouped; selecting a reference processing area from each area to be grouped; determining a target area in each area to be grouped that matches the laser processing range when the three-dimensional object is in a processing posture corresponding to the reference processing area; grouping the reference processing area and the target area into a processing area set, and determining the processing posture corresponding to the reference processing area as the processing posture corresponding to the processing area set; determining the area to be grouped except each processing area set, and returning to execute the step of selecting the reference processing area from each area to be grouped until the grouping stop condition is met.

[0094] For example, the computer device may determine each texture processing region in the multi-level texture processing regions as a region to be grouped when grouping for the first time.

[0095] In each grouping, if there are at least two areas to be grouped, a reference processing area is randomly selected from each area to be grouped or the reference processing area with the largest size is selected. When the three-dimensional object is in the processing posture corresponding to the reference processing area, each area to be grouped that is located in the spatial area where each laser ray in the laser processing range is located and the angle between the normal of each triangular facet of the object and each laser ray in the laser processing range does not exceed the preset angle range is determined as the target area. The reference processing area and the target area are grouped into a processing area set, and the processing posture corresponding to the reference processing area is the processing posture corresponding to the processing area set. Determine the areas to be grouped except for each processing area set. If there are no areas to be grouped, determine that this is the last time, stop grouping, and obtain the sets of processing areas that have been grouped. If there are areas to be grouped, perform the next grouping.

[0096] In each grouping, if there is only one area to be grouped, the area to be grouped is taken as a processing area set, and this is determined to be the last time, and the grouping is stopped to obtain the processing area sets that have been grouped. It can be understood that all texture processing areas in the processing area set can be processed by the laser at one time in one processing posture.

[0097] In some embodiments, the marshaling stop condition refers to a condition for determining whether to stop marshaling. The marshaling stop condition may be, but is not limited to, that the number of areas to be marshaled is less than a preset number. The computer device may determine the areas to be marshaled other than each processing area set. If the number of areas to be marshaled is not less than the preset number, the computer device may return to the step of selecting a reference processing area from each area to be marshaled and continue to execute. If the number of areas to be marshaled is less than the preset number, each area to be marshaled is directly used as a processing area set, and then the marshaling is stopped to obtain each processing area set that has been marshaled.

[0098] In some embodiments, the preset number is not less than 2. The grouping stop condition may be, but is not limited to, the absence of at least two areas to be grouped, that is, the number of areas to be grouped is less than 2. Specifically, the computer device may determine the areas to be grouped other than each processing area set. If there are at least two areas to be grouped, the step of selecting a reference processing area from each area to be grouped is returned to continue execution. If there is only one area to be grouped, the area to be grouped is taken as a processing area set, and grouping is stopped to obtain each processing area set that has been grouped. If there is no area to be grouped, grouping is stopped to obtain each processing area set that has been grouped.

[0099] In this embodiment, each texture processing area in the multi-level texture processing area is determined as an area to be grouped; a reference processing area is selected from each area to be grouped; when the three-dimensional object is in the processing posture corresponding to the reference processing area, the target area in each area to be grouped that matches the laser processing range is determined; the reference processing area and the target area are grouped into a processing area set, and the processing posture corresponding to the reference processing area is determined as the processing posture corresponding to the processing area set; the area to be grouped except each processing area set is determined, and the step of selecting the reference processing area from each area to be grouped is returned to continue to execute until the grouping stop condition is met. The texture processing area that can be laser processed at the same time under the processing posture corresponding to the reference processing area is used as the same processing area set together with the reference processing area, and then the texture processing of a processing area set can be realized under one processing posture. Compared with the method of processing only one texture processing area under one processing posture, the number of posture adjustments is reduced, and the efficiency of texture processing is greatly improved. In addition, the texture processing areas in the same processing area set are processed under the same processing posture, which can avoid the problem of misalignment of textures of different layers caused by posture adjustment errors, and ensure the quality of texture processing.

[0100] In some embodiments, Fig. 9 As shown in FIG. 1 , a simple flow chart of a method for segmenting a texture processing area is provided. The texture grayscale is divided into Figure 2 The binary image of each level includes at least one connected domain. The at least one connected domain includes at least one of a connected domain that matches the laser processing range and a connected domain that does not match the laser processing range.

[0101] For each connected domain in the binary graph of each level, each point in the connected domain is mapped to each triangular facet on the surface of the three-dimensional object to obtain a second mapping area. The triangular facets in the second mapping area are traversed, and the angles between the normal of the currently traversed triangular facet and the normal of the remaining triangular facets except the currently traversed triangular facet are calculated. The maximum angle corresponding to the currently traversed triangular facet is determined from each angle. The maximum angles corresponding to the triangular facets in the second mapping area are compared, and the triangular facet with the smallest corresponding maximum angle is used as the reference triangular facet. The second posture of the three-dimensional object is determined when the normal of the reference triangular facet is parallel to the central ray and the reference triangular facet is passed through by the central ray. It can be understood that the posture of the three-dimensional object is controlled by the machine tool platform where the three-dimensional object is located, and the posture of the three-dimensional object is adjusted by adjusting the posture of the machine tool platform. Therefore, in the actual texture processing scene, the posture of the machine tool platform can be used to characterize the posture of the three-dimensional object. If when the three-dimensional object is in the second posture, the second mapping area is located in the spatial area where the laser rays are located within the laser processing range, and the angle between the normal of each triangle in the second mapping area and each laser ray does not exceed the preset angle range, it means that the second mapping area matches the laser processing range, and the second mapping area is directly determined as the texture processing area of ​​this level, and the second posture is determined as the corresponding processing posture.

[0102] If, when the three-dimensional object is in the second posture, the second mapping area is not located in the spatial area where the laser rays are located, or the angle between the normal of each triangle facet in the second mapping area and each laser ray does not exceed the preset angle range, it means that the second mapping area does not match the laser processing range. For the connected domain that does not match the laser processing range, various sub-points are randomly selected from the connected domain.

[0103] Since the various sub-points are completely randomly selected, the degree of discreteness may not be high, so it is necessary to introduce the step of discretizing the various sub-points. Determine a pair of seed points with the closest distance from the various sub-points to obtain the nearest neighbor pair. Randomly select the point to be replaced from the nearest neighbor pair. Randomly select a new discrete point from the connected domain. If the distance between the discrete point and the seed point other than the point to be replaced is greater than the distance of the nearest neighbor pair, remove the point to be replaced from the various sub-points, use the discrete point as the new seed point, update the number of loops, and reset the number of loops. If the number of loops is less than the preset number of loops, return to the step of determining the pair of seed points with the closest distance from the various sub-points to obtain the nearest neighbor pair and continue to execute. If the number of loops is not less than the preset number of loops, stop the loop and obtain the various sub-points after discretization. If the distance between the discrete point and the seed point other than the point to be replaced is not greater than the distance of the nearest neighbor pair, update the number of loops. If the number of loops is less than the preset number of times, return to the step of randomly selecting a new discrete point from the connected domain and continue to execute. If the number of loops is not less than the preset number of times, stop the loop and obtain the various sub-points after discretization.

[0104] According to various sub-points, Thiessen polygons are constructed for the circumscribed rectangle of the connected domain, and the constructed Thiessen polygons are used as masks. By covering the connected domain with the mask, the area in the same Thiessen polygon in the connected domain is segmented into a segmented area. The segmented areas segmented in the connected domain are random. Therefore, the first mapping areas mapped to the segmented areas in the connected domain may not all match the laser processing range. It is necessary to further determine whether the first mapping area matches the laser processing range. For the first mapping area that does not match the laser processing range, it is necessary to further segment. For the first mapping area that matches the laser processing range, it can be directly used as a texture processing area without further segmentation.

[0105] Map each point in the segmented area to each triangular facet on the surface of the three-dimensional object to obtain the first mapping area. Determine the first pose of the three-dimensional object when the normal of the seed triangular facet corresponding to the seed point in the first mapping area is parallel to the central ray and the center of the seed triangular facet is passed by the central ray. If the first mapping area is located in the spatial area where the laser rays are located within the laser processing range when the three-dimensional object is in the first pose, and the angle between the normal of each triangular facet in the first mapping area and each laser ray does not exceed the preset angle range, it means that the first mapping area matches the laser processing range, the first mapping area is determined to be the texture processing area, and the first pose is determined to be the corresponding processing pose.

[0106] If, when the three-dimensional object is in the first pose, the first mapping area is not located in the spatial area where the laser rays are located within the laser processing range, or the angle between the normal of each triangle in the first mapping area and each laser ray does not exceed the preset angle range, it means that the first mapping area does not match the laser processing range, and the seed triangle is selected as the current triangle for the first time, and from the next time after the first time, a new current triangle is randomly selected from the remaining mapping area except the texture processing area in the first mapping area each time until there is no remaining mapping area. For each selected current triangle, the current triangle is determined to be the current area. Determine the current pose of the three-dimensional object when the normal of the current triangle is parallel to the central ray and the center of the current triangle is passed by the central ray. In the process of regional growth based on the current area, the triangles to be merged that are adjacent to the current area and are located in the spatial area where the laser rays are located within the laser processing range when the three-dimensional object is in the current pose, and the angle between its normal and each laser ray does not exceed the preset angle range are continuously determined from the remaining mapping area, and the triangles to be merged are merged into the current area until there is no triangle to be merged, and the current area after growth is obtained. The current region after growth is determined to be a texture processing region at the level of the binary image, and the current posture is determined to be a processing posture corresponding to the texture processing region.

[0107] After obtaining the multi-level texture processing area, in order to improve the texture processing efficiency, the texture processing area is grouped to obtain a processing area set that can be processed by laser at one time in the same posture. Each texture processing area in the multi-level texture processing area is determined as a to-be-grouped area. A reference processing area is selected from each to-be-grouped area. When the three-dimensional object is in the processing posture corresponding to the reference processing area, the to-be-grouped area located in the spatial area where each laser ray in the laser processing range is located, and the angle between the normal of each triangular facet of the object and each laser ray in the laser processing range does not exceed the preset angle range is determined as the target area. The reference processing area and the target area are grouped into a processing area set, and the processing posture corresponding to the reference processing area is determined as the processing posture corresponding to the processing area set. The to-be-grouped area other than each processing area set is determined. If there are at least two to-be-grouped areas, the step of selecting the reference processing area from each to-be-grouped area is returned to continue. If there is only one to-be-grouped area, the to-be-grouped area is taken as a processing area set, and the grouping is stopped to obtain each processing area set that has been grouped. If there is no area to be grouped, stop grouping and obtain a set of processing areas that have been grouped.

[0108] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0109] Based on the same inventive concept, the embodiment of the present application also provides a texture processing area segmentation device for implementing the texture processing area segmentation method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in the embodiments of one or more texture processing area segmentation devices provided below can refer to the limitations of the texture processing area segmentation method above, and will not be repeated here.

[0110] In an exemplary embodiment, Fig.10As shown, a texture processing region segmentation device 1000 is provided, comprising: a layering module 1002, a selection module 1004, a first segmentation module 1006, a mapping module 1008, a determination module 1010 and a second segmentation module 1012, wherein: The layering module 1002 is used to binarize the texture grayscale image according to the multi-level grayscale range to obtain a multi-level binary image.

[0111] The selection module 1004 is used to randomly select seed points from the connected domain in the binary graph.

[0112] The first segmentation module 1006 is used to segment the connected domain according to the seed points to obtain segmented regions.

[0113] The mapping module 1008 is used to map the segmented area to the surface of the three-dimensional object to obtain a first mapping area; the first mapping area includes seed triangles corresponding to the seed points.

[0114] The determination module 1010 is used to determine the first pose of the three-dimensional object when the center of the seed triangle is vertically penetrated by the center ray within the laser processing range.

[0115] The second segmentation module 1012 is used to determine that the first mapping area is a texture processing area at the level of the binary image when the three-dimensional object is in the first pose and that the first mapping area matches the laser processing range, and to determine that the first pose is a processing pose corresponding to the texture processing area; otherwise, the first mapping area is segmented into texture processing areas at the level of the binary image that matches the laser processing range and the processing pose corresponding to the texture processing area is determined.

[0116] In some embodiments, the layering module 1002 is used to obtain the minimum grayscale value and the maximum grayscale value in the texture grayscale image; determine the minimum grayscale value as the starting grayscale value of the first level; starting from the level below the first level, determine the starting grayscale value of each level that increases the grayscale interval compared to the starting grayscale value of the previous level and is less than the maximum grayscale value; determine the grayscale range of multiple levels composed of the starting grayscale values ​​of multiple levels and the maximum grayscale value.

[0117] In some embodiments, the selection module 1004 is used to obtain each connected domain in the binary map of each level; the mapping module 1008 is used to map the connected domain to the surface of the three-dimensional object to obtain a second mapping area; the selection module 1004 is also used to traverse the triangular facets in the second mapping area, determine the angles between the currently traversed triangular facets and the remaining triangular facets except the currently traversed triangular facets; determine the maximum angle corresponding to the currently traversed triangular facet from the angles; determine the minimum angle from the maximum angles corresponding to the triangular facets in the second mapping area Angle; a determination module 1010, used to determine the second posture of the three-dimensional object when the center of the reference triangle corresponding to the minimum angle in the second mapping area is vertically passed by the central ray; a selection module 1004, further used to determine that the second mapping area is a texture processing area of ​​this level, and determine that the second posture is a processing posture corresponding to the texture processing area if the second mapping area matches the laser processing range when the three-dimensional object is in the second posture; if the second mapping area does not match the laser processing range when the three-dimensional object is in the second posture, randomly select a seed point from the connected domain in the binary image.

[0118] In some embodiments, the selection module 1004 is used to determine the number of seed points according to the size difference between the connected domain and the laser processing range; randomly select various sub-points from the connected domain according to the number of seed points; determine a pair of seed points with the closest distance from the various sub-points to obtain a nearest neighbor point pair; randomly select a point to be replaced from the nearest neighbor point pair; randomly select a new discrete point from the connected domain; if the distances between the discrete points and the seed points other than the point to be replaced are greater than the distances of the nearest neighbor point pair, replace the point to be replaced among the various sub-points with discrete points, and if the first loop stop condition is not met, return to the step of determining a pair of seed points with the closest distance from the various sub-points to obtain the nearest neighbor point pair to continue execution; otherwise, if the second loop stop condition is not met, return to the step of randomly selecting a new discrete point from the connected domain to continue execution.

[0119] In some embodiments, the first segmentation module 1006 is used to construct Thiessen polygons for the circumscribed rectangle of the connected domain according to the seed point; the connected domain is divided into segmented areas based on the constructed Thiessen polygons. In some embodiments, the second segmentation module 1012 is used to select the seed triangle as the current triangle for the first time, and from the next time after the first time, randomly select a new current triangle from the remaining mapping area except the texture processing area in the first mapping area each time until there is no remaining mapping area; for each selected current triangle, determine the current triangle as the current area; determine the current posture of the three-dimensional object when the center of the current triangle is vertically passed by the central ray; in the process of regional growth based on the current area, continuously determine the triangles to be merged that are adjacent to the current area and match the laser processing range when the three-dimensional object is in the current posture from the remaining mapping area, merge the triangles to be merged into the current area until there is no triangle to be merged, and obtain the current area after growth; determine the current area after growth as the texture processing area at the level of the binary image, and determine the current posture as the processing posture corresponding to the texture processing area.

[0120] In some embodiments, the second segmentation module 1012 is used to determine each texture processing area in the multi-level texture processing area as an area to be grouped; select a reference processing area from each area to be grouped; determine a target area in each area to be grouped that matches the laser processing range when the three-dimensional object is in a processing posture corresponding to the reference processing area; group the reference processing area and the target area into a processing area set, and determine that the processing posture corresponding to the reference processing area is the processing posture corresponding to the processing area set; determine the areas to be grouped except each processing area set, and return to the step of selecting the reference processing area from each area to be grouped to continue executing until the grouping stop condition is met.

[0121] Each module in the above-mentioned texture processing area segmentation device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.

[0122] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.11As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for segmenting a texture processing area is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0123] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0124] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0125] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0126] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0127] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0128] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0129] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for segmenting a texture processing area, characterized in that: The method comprises: Binarize the texture grayscale image according to the multi-level grayscale range to obtain a multi-level binary image; Randomly select a seed point from a connected domain in the binary graph; Performing region segmentation on the connected domain according to the seed point to obtain a segmented region; Mapping the segmented area to the surface of the three-dimensional object to obtain a first mapping area; the first mapping area includes a seed triangle facet corresponding to the seed point; Determine the first position of the three-dimensional object when the center of the seed triangle is vertically passed by the center ray within the laser processing range; If the first mapping area matches the laser processing range when the three-dimensional object is in the first posture, determining that the first mapping area is a texture processing area at the level where the binary image is located, and determining that the first posture is a processing posture corresponding to the texture processing area; Otherwise, the first mapping area is divided into texture processing areas at the level of the binary image matching the laser processing range, and the processing posture corresponding to the texture processing area is determined.

2. The method according to claim 1, characterized in that: The method further comprises: Get the minimum grayscale value and the maximum grayscale value in the texture grayscale image; Determine the minimum grayscale value as the starting grayscale value of the first level; Starting from the next level of the first level, determining a starting grayscale value of each level that increases the grayscale interval compared to the starting grayscale value of the previous level and is less than the maximum grayscale value; Determine the grayscale range of the multiple levels formed by the starting grayscale values ​​of the multiple levels and the maximum grayscale value.

3. The method according to claim 1, characterized in that The method further comprises: Get each connected domain in the binary graph of each level; Mapping the connected domain to the surface of the three-dimensional object to obtain a second mapping area; Traversing the triangular facets in the second mapping area, and determining each angle between the triangular facet currently traversed and the remaining triangular facets except the triangular facet currently traversed; Determine the maximum angle corresponding to the currently traversed triangle from the angles; Determine a minimum angle from the maximum angles respectively corresponding to the triangular facets in the second mapping area; Determine a second pose of the three-dimensional object when the center of the reference triangle corresponding to the minimum angle in the second mapping area is vertically passed by the central ray; If the second mapping area matches the laser processing range when the three-dimensional object is in the second posture, determining the second mapping area as a texture processing area of ​​the current level, and determining the second posture as a processing posture corresponding to the texture processing area; The randomly selecting a seed point from a connected domain in the binary graph comprises: If the second mapping area does not match the laser processing range when the three-dimensional object is in the second posture, a seed point is randomly selected from a connected domain in the binary image.

4. The method according to claim 3, characterized in that: The randomly selecting a seed point from the connected domain comprises: Determine the number of seed points according to the size difference between the connected domain and the laser processing range; Randomly selecting various sub-points from the connected domain according to the number of seed points; Determine a pair of seed points with the closest distance from the various seed points to obtain a nearest neighbor point pair; Randomly select a point to be replaced from the nearest neighbor point pair; Randomly select new discrete points from the connected domain; If the distances between the discrete point and the seed points other than the point to be replaced are all greater than the distance of the nearest neighbor point pair, the point to be replaced is removed from the various sub-points, the discrete point is used as a new seed point among the various sub-points, and if the first loop stop condition is not met, the step of determining a pair of seed points with the closest distance from the various sub-points to obtain the nearest neighbor point pair is continued; Otherwise, when the second loop stop condition is not met, the process returns to the step of randomly selecting a new discrete point from the connected domain and continues to execute.

5. The method according to claim 1, characterized in that: The step of segmenting the connected domain according to the seed point to obtain segmented regions includes: Constructing Thiessen polygons for the circumscribed rectangle of the connected domain according to the seed points; The connected domain is divided into segmented areas based on the constructed Thiessen polygons.

6. The method according to claim 1, characterized in that The step of dividing the first mapping area into texture processing areas at the level of the binary image matching the laser processing range, and determining processing postures corresponding to the texture processing areas, includes: The seed triangle is selected as the current triangle for the first time, and from the next time after the first time, a new current triangle is randomly selected from the remaining mapping area except the texture processing area in the first mapping area each time until there is no remaining mapping area; For each selected current triangle patch, determining the current triangle patch as the current region; Determine a current position of the three-dimensional object when the center of the current triangle is vertically passed through by the central ray; In the process of performing region growing based on the current region, triangular facets to be merged that are adjacent to the current region and match the laser processing range when the three-dimensional object is in the current posture are continuously determined from the remaining mapping region, and the triangular facets to be merged are merged into the current region until the triangular facets to be merged do not exist, thereby obtaining the current region after growth; The grown current region is determined to be a texture processing region at the level where the binary image is located, and the current posture is determined to be a processing posture corresponding to the texture processing region.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Determine each texture processing area in the multi-level texture processing area as an area to be grouped; Selecting a reference processing area from each of the to-be-grouped areas; Determine a target area in each of the to-be-grouped areas that matches the laser processing range when the three-dimensional object is in a processing posture corresponding to the reference processing area; Grouping the reference processing area and the target area into a processing area set, and determining the processing posture corresponding to the reference processing area as the processing posture corresponding to the processing area set; Determine the areas to be grouped except each of the processing area sets, and return to execute the step of selecting a reference processing area from each of the areas to be grouped until the grouping stop condition is met.

8. A texture processing area segmentation device, characterized in that: The device comprises: A layering module is used to binarize the texture grayscale image according to the multi-level grayscale range to obtain a multi-level binary image; A selection module, used for randomly selecting seed points from the connected domain in the binary graph; A first segmentation module, used for performing region segmentation on the connected domain according to the seed point to obtain a segmented region; A mapping module, used for mapping the segmented area to the surface of the three-dimensional object to obtain a first mapping area; the first mapping area includes a seed triangle facet corresponding to the seed point; A determination module, used to determine the first pose of the three-dimensional object when the center of the seed triangle is vertically passed by the center ray within the laser processing range; A second segmentation module is used to determine that the first mapping area is a texture processing area at the level where the binary image is located, and determine that the first posture is a processing posture corresponding to the texture processing area if the first mapping area matches the laser processing range when the three-dimensional object is in the first posture; otherwise, the first mapping area is segmented into texture processing areas at the level where the binary image is located that match the laser processing range, and the processing posture corresponding to the texture processing area is determined.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.