Method, device, system, storage medium and program product for generating three-dimensional grid

By generating voxels during the scanning process and generating mesh patches based on distance field values, the balance problem of scanning speed and accuracy in multi-scale grid generation is solved, and the accuracy and visual perception of three-dimensional object feature representation is improved.

CN119919604BActive Publication Date: 2025-08-29SCANTECH (HANGZHOU) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510397538.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-01
Publication Date
2025-08-29
Estimated Expiration
2045-04-01

AI Technical Summary

Technical Problem

In the prior art, when generating multi-scale grids, it is difficult to balance scanning speed and scanning accuracy, resulting in the perception and accuracy of the grid model being affected.

Method used

During the scanning process, voxels of three-dimensional objects are generated, and mesh patches of different fineness or resolutions are generated based on the distance field value of the voxels. The position of the mesh patch in the polyhedron is determined through the pre-stored mapping relationship information, and a mesh of three-dimensional objects is generated.

Benefits of technology

It realizes the generation of grids of different fineness or resolutions during the scanning process, improves the representation accuracy and correctness of different parts of the three-dimensional object, and avoids errors during grid splicing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119919604B_ABST
    Figure CN119919604B_ABST
Patent Text Reader

Abstract

The present application provides a method, apparatus, system, storage medium, and program product for generating a three-dimensional mesh. The method includes: generating voxels of the three-dimensional object during scanning of the three-dimensional object, wherein the voxels of the three-dimensional object include a first group of voxels, wherein the first group of voxels are adjacent voxels in three-dimensional space and the first group of voxels includes multiple voxels of different sizes; generating a first mesh patch based on the distance field values ​​corresponding to the first group of voxels; and generating a mesh of the three-dimensional object based on the first mesh patch. Using this method, a mesh patch can be generated for a group of voxels formed by multiple voxels of different sizes during scanning of the three-dimensional object, thereby better generating meshes of different fineness or resolution (i.e., different scales), thereby better representing the features of different parts of the three-dimensional object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of three-dimensional reconstruction, and more specifically, to a method for generating a three-dimensional grid, an apparatus for generating a three-dimensional grid, a three-dimensional scanning system, a computer-readable storage medium, and a computer program product. Background Art

[0002] When performing 3D scanning and measurement of 3D objects, it's often necessary to balance scanning speed for large surface areas with accuracy for local details. This requires scanning large surfaces at high resolution while also capturing local details at low resolution. In this situation, the technical challenge of generating meshes of varying fineness or resolution (i.e., scale) to better represent the features of different parts of a 3D object remains. Summary of the Invention

[0003] The present application provides a method and apparatus for generating a three-dimensional grid, so as to better generate grids of different fineness or resolution (ie, different scales), thereby better representing the features of different parts of a three-dimensional object.

[0004] In a first aspect, a method for generating a three-dimensional mesh is provided, the method comprising: generating voxels of the three-dimensional object during scanning of the three-dimensional object, the voxels of the three-dimensional object comprising a first group of voxels, the first group of voxels being adjacent voxels in three-dimensional space, and the first group of voxels comprising a plurality of voxels of different sizes; generating a first mesh patch based on distance field values ​​corresponding to the first group of voxels; and generating a mesh of the three-dimensional object based on the first mesh patch.

[0005] As a possible implementation, generating the first mesh patch based on the distance field values ​​corresponding to the first group of voxels includes: generating the first mesh patch within a first polyhedron based on the distance field values ​​corresponding to the first group of voxels and pre-stored first mapping relationship information; wherein the vertices of the first polyhedron are center points of the first group of voxels, and the first mapping relationship information is used to indicate a mapping relationship between the distance field values ​​corresponding to the first group of voxels and position information of the first mesh patch in the first polyhedron.

[0006] As a possible implementation manner, before generating the first mesh patch within the first polyhedron based on the distance field values ​​corresponding to the first group of voxels and pre-stored first mapping relationship information, the method further includes: determining the first polyhedron from a plurality of polyhedrons based on a spatial positional relationship of the first group of voxels, the plurality of polyhedrons having different shapes in three-dimensional space.

[0007] As a possible implementation manner, the voxels corresponding to the three-dimensional object also include a second group of voxels, the second group of voxels are adjacent voxels in three-dimensional space, and the voxels in the second group of voxels have the same size. The method also includes: generating a second mesh patch within a second polyhedron based on the distance field values ​​corresponding to the second group of voxels, wherein the second polyhedron is a cube; and generating the mesh of the three-dimensional object based on the first mesh patch includes: generating the mesh of the three-dimensional object based on the first mesh patch and the second mesh patch.

[0008] As a possible implementation manner, generating the second mesh patch within the second polyhedron based on the distance field values ​​corresponding to the second group of voxels includes: generating the second mesh patch within the second polyhedron based on the distance field values ​​corresponding to the second group of voxels and pre-stored second mapping relationship information; wherein the second mapping relationship information is used to indicate a mapping relationship between the distance field values ​​corresponding to the second group of voxels and position information of the second mesh patch in the second polyhedron.

[0009] As a possible implementation, the first group of voxels includes a first type of voxels and a second type of voxels, and the size of the first type of voxels is 2N times the size of the second type of voxels, where N is a positive integer greater than or equal to 1.

[0010] In a second aspect, a device for generating a three-dimensional mesh is provided, the device comprising: a first generation module for generating voxels of the three-dimensional object during scanning of the three-dimensional object, the voxels of the three-dimensional object comprising a first group of voxels, the first group of voxels being adjacent voxels in three-dimensional space, and the first group of voxels comprising a plurality of voxels of different sizes; a second generation module for generating a first mesh patch based on distance field values ​​corresponding to the first group of voxels; and a third generation module for generating a mesh of the three-dimensional object based on the first mesh patch.

[0011] As a possible implementation manner, the second generation module is further configured to generate the first mesh patch within a first polyhedron based on the distance field values ​​corresponding to the first group of voxels and pre-stored first mapping relationship information; wherein the vertices of the first polyhedron are the center points of the first group of voxels, and the first mapping relationship information is used to indicate a mapping relationship between the distance field values ​​corresponding to the first group of voxels and position information of the first mesh patch within the first polyhedron.

[0012] As a possible implementation, the apparatus further includes: a fourth generating module, configured to determine the first polyhedron from a plurality of polyhedrons according to a spatial positional relationship of the first group of voxels, wherein the plurality of polyhedrons have different shapes in three-dimensional space.

[0013] As a possible implementation, the voxels corresponding to the three-dimensional object also include a second group of voxels, the second group of voxels are adjacent voxels in three-dimensional space, and the voxels in the second group of voxels have the same size. The device also includes: a fifth generation module, used to generate a second mesh patch within a second polyhedron based on the distance field values ​​corresponding to the second group of voxels, wherein the second polyhedron is a cube; the third generation module is further used to: generate a mesh of the three-dimensional object based on the first mesh patch and the second mesh patch.

[0014] As a possible implementation manner, the fifth generation module is further configured to generate the second mesh patch within the second polyhedron based on the distance field values ​​corresponding to the second group of voxels and pre-stored second mapping relationship information; wherein the second mapping relationship information is used to indicate a mapping relationship between the distance field values ​​corresponding to the second group of voxels and position information of the second mesh patch within the second polyhedron.

[0015] As a possible implementation, the first group of voxels includes a first type of voxels and a second type of voxels, and the size of the first type of voxels is 2N times the size of the second type of voxels, where N is a positive integer greater than or equal to 1.

[0016] In a third aspect, a three-dimensional scanning system is provided, comprising: a memory for storing program code; and a processor for executing the program code to execute the method as described in the first aspect or any one of the implementations of the first aspect.

[0017] In a fourth aspect, a computer-readable storage medium is provided, on which a program code for executing the method as described in the first aspect or any one of the implementations of the first aspect is stored.

[0018] In a fifth aspect, a computer program product is provided, comprising a program code for executing the method as described in the first aspect or any one of the implementations of the first aspect.

[0019] The embodiment of the present application can generate a mesh patch for a group of voxels formed by multiple voxels of different sizes during the process of scanning a three-dimensional object, thereby better generating meshes of different fineness or resolutions (i.e., different scales), and further better representing the characteristics of different parts of the three-dimensional object. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application, and other drawings obtained by ordinary technicians in this field based on these drawings fall within the scope of the present application.

[0021] Figure 1 This is an example diagram of generating a multi-scale grid in real time in related technology.

[0022] Figure 2 is an example diagram of a distance field in related art.

[0023] Figure 3 This is an example diagram of a marching cube used in a marching cube algorithm in the related art.

[0024] Figure 4 is Figure 3 Schematic diagram of generating mesh patches in the marching cubes shown.

[0025] Figure 5 This is a schematic flowchart of a method for generating a three-dimensional grid provided in an embodiment of the present application.

[0026] Figure 6A This is an example diagram of the first group of voxels and the first polyhedron provided in an embodiment of the present application.

[0027] Figure 6B This is another example diagram of the first group of voxels and the first polyhedron provided in an embodiment of the present application.

[0028] Figure 6C This is another example diagram of the first group of voxels and the first polyhedron provided in an embodiment of the present application.

[0029] Figure 7 This is an example diagram of the octree provided in an embodiment of the present application.

[0030] Figure 8 This is an example diagram of a multi-scale transition region and a single-scale region provided in an embodiment of the present application.

[0031] Figure 9 The embodiment of this application provides Figure 8 An example of a mesh generated by the multi-scale transition region is shown.

[0032] Figure 10 It is a schematic structural diagram of the device for generating a three-dimensional grid provided in an embodiment of the present application.

[0033] Figure 11 It is a schematic structural diagram of the three-dimensional scanning system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0034] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. All other embodiments obtained based on the embodiments in this application are within the scope of protection of this application.

[0035] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0036] It should be understood that the embodiments described below are only used to explain the present application and are not used to limit the present application.

[0037] The embodiments of the present application can be applied to the generation of a three-dimensional grid. To facilitate understanding, the generation of a three-dimensional grid mentioned in the embodiments of the present application is first introduced.

[0038] In 3D scanning measurement, a mesh of a 3D object can be generated from point cloud data. For example, a 3D scanner can be used to scan the surface of a 3D object, generating point cloud data of the object's surface. A mesh generation algorithm can then be used to generate the mesh of the 3D object from the point cloud data. Examples of these algorithms include the ball-pivoting algorithm (BPA) and the Delaunay triangulation algorithm. These algorithms connect points in the point cloud to form a triangular or polygonal mesh, thereby approximating the object's surface. Alternatively, mesh generation can be performed without using point cloud data. For example, the 3D space containing the 3D object can be divided into a uniform grid of cubes (voxels). Mesh patches (or isosurfaces) can then be extracted from each voxel using certain rules or algorithms. These rules or algorithms can include the marching cube algorithm. The mesh patches in each voxel are then connected to form the mesh of the 3D object.

[0039] When scanning a three-dimensional object, using a high resolution can increase scanning speed, but may result in lower accuracy for local details. Using a low resolution, while still ensuring accuracy for local details, can result in slow scanning speeds and excessive data volumes. Therefore, in practical applications, multi-scale scanning is often employed. Specifically, a high resolution is used to scan large planar surfaces of a 3D object, while a low resolution is used to scan local details. This approach achieves a balance between scanning speed and accuracy.

[0040] Multi-scale scanning may involve the generation of multi-scale meshes. The scale of the mesh can also be understood as the resolution of the mesh. Meshes of different scales, or meshes of different resolutions, can have different sizes and densities, allowing them to represent different levels of detail of a three-dimensional object. For example, a high-resolution mesh can have finer-grained mesh cells, allowing for a more detailed representation of the geometric features of a three-dimensional object. A low-resolution mesh may contain coarser-grained mesh cells, which may not accurately represent the local details of a three-dimensional object.

[0041] In some cases, multi-scale meshes can be generated from multi-scale point cloud data (i.e., point cloud data with varying densities). Because points are discrete and lack topological connectivity between them, point clouds of different scales can be easily combined. Therefore, related art has proposed methods for generating multi-scale meshes from multi-scale point cloud data. Generating multi-scale meshes from multi-scale point cloud data can be achieved in two ways: offline and real-time. In the offline mode, the scanning process and meshing process are not performed simultaneously. Specifically, the 3D object is first scanned to generate multi-scale point cloud data, and then this multi-scale point cloud data is meshed (for example, using algorithms such as BPA and Delaunay mentioned above) to generate the multi-scale mesh. In the real-time mode, the scanning process and meshing process can be performed simultaneously. Specifically, while the 3D object is being scanned, the multi-scale point cloud data is simultaneously being meshed to generate the multi-scale mesh. However, because meshing point cloud data is time-consuming, generating a multi-scale mesh from a multi-scale point cloud in real-time is inefficient.

[0042] In other cases, during the multi-scale scanning of a 3D object, multiple meshes of different scales can be generated separately. These meshes are then stitched together (or "mesh gap") after the scan is complete. In other words, during the scanning process, a low-resolution mesh can be generated for the large area of ​​the entire 3D object, while a high-resolution mesh is generated for the localized details of the object. In other words, both low-resolution and high-resolution meshes are generated for the localized details. Figure 1 An example diagram of real-time generation of multi-scale grids in related art is shown. Figure 1 In the figure, the white filled area represents the marker point on the three-dimensional object, the circled area indicated by 110 represents the common area of ​​the low-resolution grid and the high-resolution grid, and the circled area indicated by 120 represents the high-resolution grid corresponding to the local detail area. Figure 1 It can be seen that because meshes of different scales are generated separately during the scanning process, the boundaries of the meshes of different scales are clear and overlap in the common areas mentioned above. There will also be obvious traces at the splicing of meshes of different scales. In addition, when the error is large, meshes of different resolutions may not be in the same plane. In other words, meshes of different resolutions may be layered, which greatly affects the appearance and accuracy of the mesh model. After the scan is completed, the low-resolution mesh corresponding to the common area mentioned above can be deleted. In other words, the part of the low-resolution mesh corresponding to the local detail area can be deleted. Then, the high-resolution mesh corresponding to the local detail area can be spliced ​​together with the deleted low-resolution mesh. The splicing here can also be understood as repairing the deleted part. However, during the repair process, it is difficult to ensure the accuracy and correctness of the mesh.

[0043] As can be seen from the above description, the solutions proposed in the related art for generating multi-scale grids have many problems. Therefore, when using multi-scale scanning, how to better generate multi-scale grids to better represent the features of different parts of a three-dimensional object is a technical problem that needs to be solved.

[0044] In order to solve the above technical problems, an embodiment of the present application provides a method for generating a three-dimensional mesh. The method includes: generating voxels of the three-dimensional object during scanning of a three-dimensional object, wherein the voxels of the three-dimensional object include a first group of voxels, wherein the first group of voxels are adjacent voxels in three-dimensional space, and the first group of voxels includes multiple voxels of different sizes; generating a first mesh patch based on the distance field values ​​corresponding to the first group of voxels; and generating a mesh of the three-dimensional object based on the first mesh patch. Using this method, a mesh patch can be generated for a group of voxels formed by multiple voxels of different sizes during scanning of a three-dimensional object, thereby better generating meshes of different fineness or resolution (i.e., different scales), thereby better representing the features of different parts of the three-dimensional object.

[0045] In order to better understand the method for generating a three-dimensional grid proposed in the embodiment of the present application, Figures 2 to 4 , the concepts of distance field, voxel, marching cube, etc. involved in the embodiments of this application are introduced.

[0046] Figure 2 This figure shows an example of a signed distance field. In 3D scanning, a distance field can be understood as a function representing the distance from each point in space to the surface of a 3D object. Distance fields can be categorized as signed distance fields (SDFs) and truncated signed distance functions (TSDFs). TSDFs can be considered an improvement over SDFs. Figure 2 An example diagram of SDF is shown in . SDF can be understood as a scalar function that can assign a value to each point in three-dimensional space, which can represent the shortest distance from the point to the surface of a three-dimensional object. The generation of a distance field can be achieved through a variety of algorithms, such as voxelization. Voxelization can be understood as a process of converting the surface of a three-dimensional object into a voxel representation. By calculating the shortest distance from the center point of each voxel to the surface of the three-dimensional object, a complete distance field can be constructed. Voxel can be understood as the smallest unit in three-dimensional space, similar to a pixel in a two-dimensional image. Each voxel can represent a small cube in three-dimensional space. Each voxel can store a distance value related to the surface of an object. As Figure 2 As shown, Figure 2 Each square in the _{\text{A}} represents a voxel in three-dimensional space. Figure 2 The gray filled areas in represent the areas where SDF exists. Figure 2The black closed curve in the figure represents the zero-edge line of the SDF, which is the scanning point area when scanning a three-dimensional object. The positive or negative number and arrow in the voxel represent whether the center point of the voxel is inside or outside the three-dimensional object. If the center point of the voxel is inside the three-dimensional object, the number in the voxel is negative, and the arrow points from the surface of the three-dimensional object to the inside of the three-dimensional object. If the center point of the voxel is outside the three-dimensional object, the number in the voxel is positive, and the arrow points from the surface of the three-dimensional object to the outside of the three-dimensional object. If the center point of the voxel is on the surface of the three-dimensional object, the number in the voxel is zero.

[0047] After constructing the distance field and assigning distance field values ​​to each voxel, algorithms such as marching cube can be used to extract isosurfaces, and then a mesh of a three-dimensional object can be generated. The isosurface here is usually a surface with an SDF value of 0. Figure 3 and Figure 4 This paper introduces how to use the marching cube algorithm to generate meshes of three-dimensional objects.

[0048] The three-dimensional space where the three-dimensional object is located can be divided into multiple Figure 3 The hexahedron shown in Figure 3 Each vertex of the hexahedron shown represents the center point of a voxel. That is to say, every 8 adjacent voxels in space can constitute the 12 edges of the hexahedron. The 8 vertices of the hexahedron are numbered v0 to v7 respectively. The 12 edges of the hexahedron are numbered e0 to e11 respectively. The distance field value of each vertex of the hexahedron can be positive or negative. That is, the distance field value of each vertex can have two cases. The distance field value of each vertex can be encoded using an eight-bit binary index in the order from v0 to v7. If the distance field value of a vertex is positive, the distance field value of the vertex is encoded as 1. If the distance field value of a vertex is negative, the distance field value of the vertex is encoded as 0. For example, if the distance field values ​​of vertices v0, v2, and v4 are positive, and the distance field values ​​of the remaining vertices are negative, the distance field values ​​of the 8 vertices are encoded as 10101000. The binary index of the distance field value of the 8 vertices can include 2 8 = 256 cases. Theoretically, each case can correspond to a distribution of isosurfaces. However, due to the symmetry of the cube, the distribution of isosurfaces can be simplified to 15 cases, such as Figure 4 The marching cube algorithm provides the binary index of the distance field value and Figure 4 The mapping relationship (or mapping table) between the 15 isosurface distributions shown in the figure. That is to say, once the positive and negative values ​​of the 8 distance field values ​​corresponding to the 8 vertices of the cube are determined, the distance field values ​​can be obtained from the mapping table. Figure 4The isosurface distribution shown in the figure determines how the isosurfaces in the cube intersect with the edges of the cube. In other words, it is possible to determine which edges of the cube can be interpolated with isosurfaces. The positions where each isosurface intersects with each edge of the cube can be calculated by linear interpolation. Figure 3 The cube shown traverses the three-dimensional space occupied by the three-dimensional object. Each time the cube is moved, a mesh patch is generated within the cube using the method described above. After traversing the three-dimensional space occupied by the three-dimensional object, a large number of mesh patches are generated. By connecting these mesh patches together, the mesh of the three-dimensional object is formed.

[0049] Combination of the above Figures 2 to 4 The concepts of distance field, voxel, marching cube, etc. involved in the embodiments of this application are introduced below. Figures 5 to 9 The method for generating a three-dimensional grid provided in an embodiment of the present application is described in detail.

[0050] Figure 5 This is a schematic flow chart of a method for generating a three-dimensional grid provided in an embodiment of the present application. Figure 5 As shown, the method for generating a three-dimensional grid provided in an embodiment of the present application may include the following steps S510 to S530.

[0051] In step S510 , during the process of scanning the three-dimensional object, voxels of the three-dimensional object are generated.

[0052] The embodiments of the present application do not specifically limit the type of three-dimensional object. The three-dimensional objects herein may be small, medium, or large. Small objects may include precision parts, human teeth, jewelry, etc. Medium-sized objects may include printed circuit boards, archaeological artifacts, engineering equipment, castings, furniture, handicrafts, etc. Large objects may include large industrial equipment, buildings, bridges, etc. A three-dimensional scanning system may be used to scan the three-dimensional object. The three-dimensional scanning system herein may include any of the following: a portable three-dimensional scanning system, an automated three-dimensional scanning system, or a tracking three-dimensional scanning system. The three-dimensional scanning system can perform multi-scale scanning, or multi-resolution scanning, on the three-dimensional object, thereby generating voxels of different sizes during the scanning process. For example, a high-resolution scan may be performed on one or more parts of the three-dimensional object, thereby generating small-sized voxels. In another example, a low-resolution scan may be performed on another or more parts of the three-dimensional object, thereby generating large-sized voxels.

[0053] In the case of multi-scale scanning, adjacent voxels of different sizes in three-dimensional space can form a group of voxels. For ease of description, this group of adjacent voxels of different sizes will be referred to as the first group of voxels below. That is, the voxels of a three-dimensional object may include a first group of adjacent voxels in three-dimensional space. This first group of voxels may include multiple voxels of different sizes, or multiple types of voxels. The embodiments of this application do not specifically limit the number of voxels included in the first group of voxels. For example, in some cases, the first group of voxels may include four voxels. For another example, in other cases, the first group of voxels may include five voxels. The embodiments of this application do not specifically limit the types of voxels included in the first group of voxels. For example, in some cases, the first group of voxels may include two types of voxels of different sizes. For another example, in other cases, the first group of voxels may include three types of voxels of different sizes. The embodiments of this application do not specifically limit the size differences of the voxels included in the first group of voxels. For example, in some cases, the sizes of the multiple types of voxels included in the first group of voxels differ by a factor of 2. For another example, in some other cases, the sizes of the various voxels included in the first group of voxels differ by 3 times.

[0054] The center points of each voxel included in the first group of voxels can form a polyhedron. For the sake of convenience of description, the polyhedron corresponding to the first group of voxels will be referred to as the first polyhedron below. The center points of each voxel in the first group of voxels can serve as the vertices of the first polyhedron. From the above description, it can be seen that the number of voxels included in the first group of voxels, the types of voxels included in the first group of voxels, and the size differences of the voxels included in the first group of voxels will be different in different situations. Therefore, the shape of the first polyhedron is also different in different situations. For example, in some cases, the first polyhedron can be a tetrahedron. For another example, in other cases, the first polyhedron can be a pentahedron. In conjunction with Figure 6, the following example is used to illustrate that the first group of voxels includes first-class voxels and second-class voxels, and the size of the first-class voxels is twice the size of the second-class voxels.

[0055] 6 , the large cube represents the first type of voxel, the small cube represents the second type of voxel, the black dots represent the center points of the voxels, and the dotted line connecting the black dots represents the first polyhedron. Figures 6A to 6C Different situations of the first group of voxels and the first polyhedron are shown respectively. Figure 6A In , the first group of voxels includes 2 first-type voxels and 2 second-type voxels. The first polyhedron is a tetrahedron formed by the center points of the four voxels. Figure 6B In , the first group of voxels includes 1 voxel of the first type and 4 voxels of the second type. The first polyhedron is a pentahedron formed by the center points of the 5 voxels. Figure 6C In the example, the first group of voxels includes 1 voxel of the first type and 4 voxels of the second type. The first polyhedron is a pentahedron formed by the center points of the 5 voxels. Figure 6B and Figure 6C It can be seen that although Figure 6B and Figure 6C The first polyhedrons in FIG6 are all pentahedrons, but the shapes of the first polyhedrons may be different in different situations. It should be understood that the first type of voxels and the first polyhedrons shown in FIG6 are only for illustrative purposes and do not constitute a limitation on the first type of voxels and / or the first polyhedrons.

[0056] Since voxels of different sizes can be generated by scanning a three-dimensional object at different scales or different resolutions, "voxels of different sizes" may include or be replaced by: voxels of different scales. Alternatively, "voxels of different sizes" may also include or be replaced by: voxels of different resolutions. The multiple of the size difference between multiple voxels may be equal to the multiple of the scale difference between multiple voxels or the multiple of the resolution difference between multiple voxels. For example, if the sizes of two voxels differ by twice, it can be said that the scales of the two voxels differ by twice, or it can also be said that the resolutions of the two voxels differ by twice. Since the first group of voxels includes voxels of different sizes, it can be considered that the three-dimensional space corresponding to the first group of voxels is a multi-scale transition region or a multi-scale boundary region of the three-dimensional object.

[0057] Each voxel can correspond to a distance field value, which can be used to indicate the distance from the center point of the voxel to the surface of the three-dimensional object. Voxels of the same size can be considered to correspond to the same layer or level of the distance field. Because the voxels of a three-dimensional object have different sizes, the voxels of the three-dimensional object can be considered to correspond to multiple layers or levels of distance fields. In other words, a multi-level distance field is constructed for the voxels of the three-dimensional object. Voxels corresponding to the same level of distance field have the same size.

[0058] In step S520 , a first mesh patch is generated according to the distance field values ​​corresponding to the first group of voxels.

[0059] The distance field values ​​corresponding to the first group of voxels may include the distance field values ​​corresponding to each voxel in the first group of voxels. In some cases, the “distance field values ​​corresponding to the first group of voxels” may include or be replaced by: the distance field values ​​of the first polyhedron. Figure 6ATaking the first group of voxels shown as an example, the distance field values ​​corresponding to the first group of voxels may include the distance field values ​​corresponding to four voxels respectively. The distance field values ​​corresponding to the first group of voxels can also be understood as the distance field values ​​of a tetrahedron. Knowing the distance field values ​​corresponding to the first group of voxels, the distribution of the mesh patches within the first polyhedron can be determined based on the positive and negative conditions of the distance field values ​​corresponding to the first group of voxels. For ease of description, the mesh patches generated within the first polyhedron can be referred to as first mesh patches. The first mesh patch here can be understood as the isosurface mentioned above, and the isosurface can approximately represent the surface of a three-dimensional object. The first mesh patch can be a triangular patch passing through the first polyhedron, for example, Figure 4 The triangular mesh patch passing through the cube is shown. The distribution of mesh patches within the first polyhedron can be understood as which edges of the first polyhedron the first mesh patches are inserted into. According to the values ​​of the distance field values ​​corresponding to the first group of voxels, the intersection positions of the first mesh patch and the various edges of the first polyhedron can be determined. For example, linear interpolation can be used to determine the intersection positions of the first mesh patch and the various edges of the first polyhedron according to the values ​​of the distance field values ​​corresponding to the first group of voxels. Based on the distribution of the first mesh patch within the first polyhedron and the intersection positions of the first mesh patch and the various edges of the first polyhedron, the first mesh patch can be generated within the first polyhedron. The following is Figure 6A The first group of voxels shown is used as an example for explanation.

[0060] See also Figure 6A , the first polyhedron is a tetrahedron. The tetrahedron includes four edges, namely e0 to e3. The tetrahedron includes four vertices, namely v0 to v3. Whether the first mesh patch passes through e0 can be determined based on the sign of the distance field values ​​of the two vertices v0 and v1 corresponding to e0. If one of the distance field values ​​of v0 and v1 is positive and the other is negative, the first mesh patch passes through e0. Otherwise, the first mesh patch does not pass through e0. In addition, if the first mesh patch passes through e0, the position of the intersection of e0 and the first mesh patch on e0 can be determined based on the numerical values ​​of the distance field values ​​of v0 and v1, or in other words, the position of the vertex of the first mesh patch on e0 can be determined. The position of the intersection point can be determined by linear interpolation. For example, when the distance field values ​​of v0 and v1 are one positive and one negative, and their absolute values ​​are equal, the middle position of e0 can be determined as the intersection point of e0 and the first mesh patch. The above operation can be performed on the remaining edges e1 to e3 of the tetrahedron, thereby generating a first mesh patch within the tetrahedron.

[0061] In step S530 , a mesh of the three-dimensional object is generated according to the first mesh patch.

[0062] After generating a first mesh patch based on the distance field values ​​corresponding to the first group of voxels in step S520, a mesh of the three-dimensional object can be generated based on the first mesh patch in step S530. As mentioned above, the three-dimensional space corresponding to the first group of voxels can be considered to be the multi-scale transition region or multi-scale boundary region of the three-dimensional object. Therefore, the first mesh patch generated based on the distance field values ​​corresponding to the first group of voxels can be considered to be the mesh patch of the three-dimensional object in the multi-scale boundary region. The first mesh patch can be connected to the mesh patch of the non-boundary region (or single-scale region) to generate the mesh of the three-dimensional object. The non-boundary region here can be understood as an area with the same voxel size. Alternatively, the non-boundary region can also be understood as an area where the three-dimensional object is scanned with the same resolution. The mesh patch of the non-boundary region can also be generated based on the distance field.

[0063] It should be understood that the above steps S520 and S530 can be performed during the scanning of the three-dimensional object, or after the scanning of the three-dimensional object is completed. In other words, using the method for generating a three-dimensional mesh provided in the embodiments of the present application, the three-dimensional mesh can be generated in an offline manner or in a real-time manner.

[0064] As can be seen from the above description of steps S510 to S530, the embodiments of the present application can generate a mesh patch for a group of voxels formed by multiple voxels of different sizes, thereby better generating meshes of different fineness or resolution (i.e., different scales), thereby better representing the features of different parts of a three-dimensional object. In addition, the method provided in the embodiments of the present application can be used to generate multi-scale meshes in real time. Compared to the real-time multi-scale mesh generation methods proposed in the related art, the multi-scale mesh generated using the method provided by the present application does not require splicing meshes of different scales, thereby better ensuring the accuracy and correctness of the multi-scale mesh.

[0065] As mentioned above, the first group of voxels may include a variety of voxels of different sizes. Voxels of different sizes may be considered to have different size levels. The size corresponding to a voxel with a larger size may be referred to as the size of the previous level, and the size corresponding to a voxel with a smaller size may be referred to as the size of the next level. In some implementations, the size of the previous level may be 2N times the size of the next level, where N is a positive integer greater than or equal to 1. Voxels with the size of the previous level may be referred to as first-class voxels, and voxels with the size of the next level may be referred to as second-class voxels. Therefore, it can also be said that the size of the first-class voxels is 2N times the size of the second-class voxels. It can also be said that the scanning resolution corresponding to the first-class voxels is 2N times the scanning resolution corresponding to the second-class voxels. For example, the size of the first-class voxels may be twice the size of the second-class voxels. This can simplify the shape of the first polyhedron and the type of the first polyhedron, thereby reducing the amount of calculation.

[0066] As mentioned above, each voxel can correspond to a distance field value, and a multi-level distance field can be constructed for voxels of different sizes. In some implementations, the distance field values ​​of different levels can be placed in a three-dimensional index structure. The three-dimensional index structure here can include a multi-level tree structure. The multi-level tree structure can be, for example, an octree. In addition to storing the distance field value corresponding to each voxel, the three-dimensional index structure can also indicate the position of each voxel in three-dimensional space. Through the three-dimensional index structure, a multi-level distance field can be easily constructed. See below. Figure 7 , taking the case where the sizes of adjacent levels differ by 2 times as an example, this article introduces how to use octrees to construct multi-level distance fields.

[0067] like Figure 7 As shown, the octree can be understood as a tree-like data structure for describing three-dimensional space, which represents spatial position relationships by recursively dividing the space into 8 sub-regions. The basic idea of ​​the octree is to continuously subdivide a cube until each node contains 8 child nodes, thereby forming a hierarchical spatial representation structure. In the octree, each leaf node can represent a cube area, and these cube areas can be further subdivided into 8 smaller cubes until a predetermined depth is reached or other termination conditions are met. In an embodiment of the present application, the size of the voxel corresponding to the same scanning scale can be stored in the leaf node of the corresponding level of the octree. Figure 7 In the octree shown, the default scan layer corresponds to a resolution of 1. The voxel distance field values ​​obtained by scanning a 3D object at the default resolution can be stored in the leaf nodes of the default scan layer. The ×2 fine scan layer corresponds to a resolution of 0.5. The voxel distance field values ​​obtained by scanning a 3D object at a resolution of 0.5 can be stored in the leaf nodes of the ×2 fine scan layer. The location of the voxel distance field values ​​in the octree (which leaf node at which level) can also be used to determine the spatial relationship between voxels. By constructing a three-dimensional index structure, distance field values ​​corresponding to voxels of different sizes can be efficiently retrieved, allowing the generation of a 3D object mesh based on the voxel distance field values.

[0068] As mentioned in step S520, a first mesh patch can be generated within the first polyhedron based on the distance field values ​​corresponding to the first group of voxels. There are multiple ways to generate the first mesh patch within the first polyhedron based on the distance field values ​​corresponding to the first group of voxels.

[0069] In the first implementation, an algorithm for extracting isosurfaces based on distance field values ​​in related technologies can be used to extract isosurfaces from the first polyhedron based on the distance field values ​​corresponding to the first group of voxels, and the extracted isosurfaces are used as the first mesh patch generated within the first polyhedron. For a detailed description of the first implementation, please refer to step S520 in conjunction with Figure 6AIn the first implementation, the distribution of the first mesh patch within the first polyhedron and the intersection positions of the first mesh patch with each edge of the first polyhedron are calculated in real time when the first mesh patch needs to be generated.

[0070] In a second implementation, a mapping relationship (hereinafter referred to as a first mapping relationship for ease of description) can be pre-established between the distance field values ​​corresponding to the first group of voxels and the position information of the first mesh patch within the first polyhedron. The position information of the first mesh patch within the first polyhedron can be used to indicate the distribution of the first mesh patch within the first polyhedron. The distribution of the first mesh patch within the first polyhedron can be understood as the edges of the first polyhedron into which the first mesh patch is inserted. This first mapping relationship can be indicated by first mapping relationship information. This first mapping relationship information can be pre-stored. When the first mesh patch needs to be generated, the pre-stored first mapping relationship information can be directly called and, based on the first mapping relationship information, the distribution of the first mesh patch corresponding to the positive and negative values ​​of the distance field values ​​at each vertex of the first polyhedron can be determined. After determining the distribution of the first mesh patch, the intersection locations of the first mesh patch with each edge of the first polyhedron can be determined based on the distance field values ​​at each vertex of the first polyhedron, thereby generating the first mesh patch within the first polyhedron.

[0071] As can be seen from the above description, the difference between the second implementation method and the first implementation method is that the distribution of the first mesh surface in the first polyhedron in the second implementation method is pre-set or manually set. When it is necessary to generate the first mesh surface in the first polyhedron, the distribution corresponding to the distance field value of the first polyhedron can be selected from the pre-set distribution, without the need for real-time calculation. The first mapping relationship information in the second implementation method can be understood as a manually set connection strategy. The establishment of the above-mentioned first mapping relationship is similar to the establishment of the mapping relationship in the marchingcube algorithm in the related art. The first mapping relationship information can indicate the mapping relationship between the distance field value corresponding to the first group of voxels and the position information of the first mesh surface in the first polyhedron in the form of a table. Therefore, when the distance field value corresponding to the first group of voxels is known, the position information of the first mesh surface in the first polyhedron can be determined by looking up the table, so that the first mesh surface can be generated in the first polyhedron.

[0072] As mentioned above, the first group of voxels includes a variety of voxels of different sizes. As the number of voxels included in the first group of voxels and the size of the voxels vary, the shape of the polyhedron corresponding to the first group of voxels will also vary. When the second implementation method is used to generate the first mesh patch within the first polyhedron, the first mapping relationship can be established for polyhedrons of different shapes. Figures 6A to 6C Taking the three polyhedrons shown as examples, the first mapping relationships mentioned above can be established for the three polyhedrons respectively. In practical applications, the shapes of polyhedrons may be more complex, so it may be necessary to establish the first mapping relationships mentioned above for more types of polyhedrons.

[0073] In the case where first mapping relationships are established for polyhedrons of different shapes, before generating a first mesh patch within the first polyhedron based on the distance field values ​​corresponding to the first group of voxels and the first mapping relationship information, the method provided in this embodiment of the present application may further include: determining the first polyhedron from a plurality of polyhedrons based on the spatial positional relationship of the first group of voxels.

[0074] That is to say, before generating the first mesh patch, the shape of the first polyhedron corresponding to the first group of voxels can be determined first (hereinafter referred to as the first shape for ease of description). The first shape can be determined based on the spatial position relationship of the first group of voxels. The spatial position relationship of the first group of voxels can be indicated by the three-dimensional index structure mentioned above. Taking the octree as an example, the spatial position relationship of the first group of voxels can be determined based on the storage position of the distance field value of each voxel in the octree in the first group of voxels. After determining the first shape, the position information of the first mesh patch of the spatial position relationship of the first group of voxels in the first polyhedron can be determined based on the first mapping relationship corresponding to the first shape, so that the first mesh patch can be generated in the first polyhedron. In this way, the position information of the first mesh patch in the first polyhedron can be quickly determined based on the distance field corresponding to the first voxel and the first mapping relationship information, so that the mesh can be quickly generated in the first polyhedron. Still with Figures 6A to 6C Before generating the first mesh patch, the first polyhedron corresponding to the first group of voxels can be determined based on the spatial position relationship of the first group of voxels. Figures 6A to 6C For example, if it is determined that the first polyhedron corresponding to the first set of voxels is Figure 6A For a tetrahedron as shown, the distribution of the first mesh facet within the tetrahedron can be determined by directly searching the first mapping relationship information corresponding to the tetrahedron. Then, based on the distance field values ​​of the four vertices of the tetrahedron, the intersection points of the first mesh facet with each edge of the tetrahedron can be determined, thereby generating the first mesh facet within the tetrahedron.

[0075] As mentioned in step S530, the first mesh patch can be connected to the mesh patch in the non-boundary area to generate a mesh of the three-dimensional object. The above describes the method for generating the first mesh patch. The following describes the method for generating the mesh patch in the non-boundary area.

[0076] In non-boundary regions, the voxels of a three-dimensional object may have the same size. Adjacent voxels of the same size in three-dimensional space may form a group of voxels. For ease of description, this group of adjacent voxels of the same size will be referred to as a second group of voxels below. In other words, the voxels corresponding to the three-dimensional object may also include a second group of adjacent voxels in three-dimensional space, and the second group of voxels may include multiple voxels of the same size. The method provided in this embodiment of the application may also include: generating a second mesh patch within the second polyhedron based on the distance field values ​​corresponding to the second group of voxels.

[0077] The second polyhedron mentioned above can be a cube. The second mesh surface here can be, for example, a triangular mesh surface. According to the positive and negative values ​​of the distance field values ​​corresponding to the vertices of the second polyhedron, the distribution of the second mesh surface or the isosurface in the second polyhedron can be determined. The distribution of the second mesh surface in the second polyhedron can be understood as which edges of the second polyhedron can be interpolated between an isosurface. According to the values ​​of the distance field values ​​corresponding to the vertices of the second polyhedron, the intersection positions of the second mesh surface in the second polyhedron and the respective edges of the second polyhedron can be determined. According to the determined distribution of the second mesh surface and the determined intersection positions, the second mesh surface can be generated within the second polyhedron.

[0078] It should be understood that in addition to the non-boundary regions corresponding to the second group of voxels mentioned above, other non-boundary regions may also be included in the embodiments of the present application. The grid generation method for other non-boundary regions can refer to the grid generation method for the non-boundary regions corresponding to the second group of voxels, with the difference being that the size of the voxels in the other non-boundary regions may be different from the size of the voxels in the second group of voxels. Therefore, the mesh patches generated in the other non-boundary regions may have different scales or different resolutions than the mesh patches generated in the non-boundary regions corresponding to the second group of voxels.

[0079] By connecting mesh patches in the boundary region (e.g., the first mesh patch) with one or more mesh patches in the non-boundary region (e.g., the second mesh patch), a mesh of the 3D object can be obtained. Because the resulting 3D object mesh is generated from voxels of different sizes, it can be said that the 3D object mesh has multiple scales.

[0080] In some implementations, a mapping relationship (hereinafter referred to as a second mapping relationship, for ease of description) can be pre-established between the distance field values ​​corresponding to the second group of voxels and the position information of the second mesh patch within the second polyhedron. The position information of the second mesh patch within the second polyhedron can be used to indicate the distribution of the second mesh patch within the second polyhedron. The distribution of the second mesh patch within the second polyhedron can be understood as the edges of the second polyhedron into which the second mesh patch is inserted. This second mapping relationship can be indicated by second mapping relationship information. This second mapping relationship information can be pre-stored. When the second mesh patch needs to be generated, the pre-stored second mapping relationship information can be directly called and, based on the second mapping relationship information, the distribution of the second mesh patch corresponding to the positive or negative distance field values ​​of each vertex of the second polyhedron can be determined. After determining the distribution of the second mesh patch, the intersection locations of the second mesh patch with each edge of the second polyhedron can be determined based on the distance field values ​​of each vertex of the second polyhedron, thereby generating the second mesh patch within the second polyhedron. In this way, the position information of the second mesh patch in the second polyhedron can be quickly determined, so that the second mesh patch can be quickly generated in the second polyhedron.

[0081] For example, the second polyhedron may be Figure 3 The second group of voxels may include eight adjacent voxels of the same size in three-dimensional space. The center points of these eight voxels can serve as the eight vertices of the second polyhedron. In this case, the mapping relationship information provided by the marching cube algorithm in the related art can be used as the second mapping relationship information, eliminating the need to re-establish the mapping relationship between the distance field values ​​corresponding to the second group of voxels and the position information of the second mesh patch in the second polyhedron, greatly simplifying the calculation.

[0082] To better understand the method for generating a three-dimensional grid provided by this application, see Figure 8 and Figure 9 , and explain it with more specific examples. Since the three-dimensional space is too complicated, Figure 8 and Figure 9 Taking the case of a two-dimensional plane as an example, the principle of the case of three-dimensional space is similar to that of the two-dimensional plane.

[0083] exist Figure 8 and Figure 9In the figure, each large solid square represents a large-size pixel, and each small solid square represents a small-size pixel, and the size of the large-size pixel is twice the size of the small-size pixel. Each solid circle represents the center point of a large-size pixel or a small-size pixel. Each triangular area or quadrilateral area surrounded by dotted lines represents a grid generation area. Area A is a local large-scale area. Five local large-scale areas are shown in the figure. Area B is a local small-scale area, and nine local small-scale areas are shown in the figure. In addition to local large-scale areas and local small-scale areas, there are 7 transition areas adjacent to local large-scale areas and local small-scale areas. These 7 transition areas can be divided into three types, namely quadrilateral area C, quadrilateral area D, and triangular area E. As can be seen from the figure, the transition area can only be the above three cases. That is, area C, area D, and area E are all the cases of the enumerated transition areas.

[0084] like Figure 9 As shown, for local single-scale regions, i.e., regions A and B, normal connections can be made. For example, for region A, the positive and negative distance field values ​​of the four vertices a0 to a3 in region A can be used to determine which two edges in region A are connected. As a specific example, if the distance field value of a1 is positive and the distance field values ​​of the other three vertices are negative, a connection can be established between edges m0 and m1. The position of the intersection point P1 of the connecting line with m0 can be determined based on the distance field values ​​of a0 and a1. The position of the intersection point P2 of the connecting line with m1 can be determined based on the distance field values ​​of a1 and a2.

[0085] For the transition area, the connection strategy can be set manually according to different situations. Figure 9As shown, the dashed lines in regions C, D, and E represent manually set connection strategies. For different situations, a mapping relationship can be established between the positive and negative distance field values ​​corresponding to each vertex and the set connection strategy. A detailed description of the mapping relationship can be found in the previous introduction to the marching cube and will not be repeated here. This mapping relationship can be stored in a table. In the transition region, the transition region can first be determined to be the transition region. In other words, it is first determined whether the transition region is region C, region D, or region E. Then, the transition region can be connected according to the lookup table. For example, after determining that the transition region is region D, the connection strategy corresponding to the positive and negative distance field values ​​of the four vertices in region D can be selected from the lookup table corresponding to region D, specifically between which two edges in region D a connection line should be established. If the distance field value of vertex d1 in region D is positive, and the distance field values ​​of the remaining vertices are negative, the lookup table can be used to determine whether a connection line should be established between edges n0 and n1 in region D. In addition, the position of the intersection point Q1 of the connecting line and n0 can be determined based on the distance field values ​​of vertex d0 and vertex d1, and the position of the intersection point Q2 of the connecting line and n1 can be determined based on the distance field values ​​of vertex d1 and vertex d2.

[0086] Generating a multi-scale grid in three-dimensional space is similar to the connection in two-dimensional planes described above, except that there are more types or enumerations corresponding to transition regions in three-dimensional space, and the lookup table is larger.

[0087] Combined with the above Figures 5 to 9 , describes in detail an embodiment of the method for generating a three-dimensional grid provided by the present application. The following describes in detail an embodiment of the apparatus of the present application. It should be understood that the description of the apparatus embodiment corresponds to the description of the method embodiment. Therefore, for portions not described in detail, reference can be made to the description of the method embodiment above.

[0088] The embodiment of the present application further provides a device for generating a three-dimensional grid, which is used to execute the method for generating a three-dimensional grid mentioned above. Figure 10 A structural example diagram of an apparatus 100 for generating a three-dimensional grid provided in an embodiment of the present application is shown.

[0089] like Figure 10As shown, the apparatus 100 for generating a three-dimensional mesh may include: a first generation module 1010, for generating voxels of the three-dimensional object during scanning of the three-dimensional object, wherein the voxels of the three-dimensional object include a first group of voxels, wherein the first group of voxels are adjacent voxels in a three-dimensional space, and the first group of voxels includes a plurality of voxels of different sizes; a second generation module 1020, for generating a first mesh patch according to distance field values ​​corresponding to the first group of voxels; and a third generation module 1030, for generating a mesh of the three-dimensional object according to the first mesh patch.

[0090] In some implementations, the second generation module 1020 is further configured to generate the first mesh patch within a first polyhedron based on the distance field values ​​corresponding to the first group of voxels and pre-stored first mapping relationship information; wherein the vertices of the first polyhedron are the center points of the first group of voxels, and the first mapping relationship information is used to indicate a mapping relationship between the distance field values ​​corresponding to the first group of voxels and the position information of the first mesh patch within the first polyhedron.

[0091] In some implementations, the apparatus 100 further includes: a fourth generating module, configured to determine the first polyhedron from a plurality of polyhedrons according to a spatial positional relationship of the first group of voxels, wherein the plurality of polyhedrons have different shapes in three-dimensional space.

[0092] In some implementations, the voxels corresponding to the three-dimensional object also include a second group of voxels, the second group of voxels are adjacent voxels in three-dimensional space, and the voxels in the second group of voxels have the same size. The device 100 also includes: a fifth generation module, which is used to generate a second mesh patch within a second polyhedron based on the distance field values ​​corresponding to the second group of voxels, wherein the second polyhedron is a cube; the third generation module 1030 is further used to: generate a mesh of the three-dimensional object based on the first mesh patch and the second mesh patch.

[0093] In some implementations, the fifth generation module is further configured to generate the second mesh patch within the second polyhedron based on the distance field values ​​corresponding to the second group of voxels and pre-stored second mapping relationship information; wherein the second mapping relationship information is used to indicate a mapping relationship between the distance field values ​​corresponding to the second group of voxels and position information of the second mesh patch within the second polyhedron.

[0094] In some implementations, the first group of voxels includes a first type of voxels and a second type of voxels, and a size of the first type of voxels is 2N times a size of the second type of voxels, where N is a positive integer greater than or equal to 1.

[0095] The embodiment of the present application further provides a three-dimensional scanning system 110, which includes: a memory 1110 for storing program code; and a processor 1120 for executing the program code to perform the method for generating a three-dimensional grid in any of the above embodiments.

[0096] The present application also provides a computer-readable storage medium having program code stored thereon, which can be used to execute the method for generating a three-dimensional grid in any of the above embodiments.

[0097] The present application also provides a computer program product including program code for executing the method for generating a three-dimensional grid in any of the above embodiments.

[0098] It should be understood that in the embodiment of the present application, determining B based on A does not mean determining B only based on A, but B can also be determined based on A and / or other information.

[0099] It should be understood that in the embodiments of the present application, "B corresponding to A" means that B is associated with A and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B based solely on A, but B can also be determined based on A and / or other information.

[0100] It should be understood that the term "and / or" in this document simply describes a relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the related objects are in an "or" relationship.

[0101] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0102] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0103] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0104] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0105] In the above embodiments, all or part of the embodiments can be implemented using software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be read by a computer or a data storage device such as a server or data center that integrates one or more available media. Available media may be magnetic media (eg, floppy disks, hard disks, tapes), optical media (eg, digital versatile discs (DVDs)), or semiconductor media (eg, solid state disks (SSDs)).

[0106] The above are only specific embodiments of the present application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A method for generating a three-dimensional grid, characterized in that: include: During scanning of a three-dimensional object, voxels of the three-dimensional object are generated, wherein the voxels of the three-dimensional object include a first group of voxels, the first group of voxels are adjacent voxels in a three-dimensional space, and the first group of voxels includes a plurality of voxels of different sizes; generating a first mesh patch within a first polyhedron according to distance field values ​​corresponding to the first group of voxels and pre-stored first mapping relationship information, wherein the vertices of the first polyhedron are center points of the first group of voxels, and the first mapping relationship information indicates a mapping relationship between the distance field values ​​corresponding to the first group of voxels and position information of the first mesh patch within the first polyhedron; A mesh of the three-dimensional object is generated based on the first mesh patch.

2. The method according to claim 1, characterized in that Before generating the first mesh patch within the first polyhedron according to the distance field values ​​corresponding to the first group of voxels and pre-stored first mapping relationship information, the method further includes: The first polyhedron is determined from a plurality of polyhedrons according to the spatial positional relationship of the first group of voxels, and the plurality of polyhedrons have different shapes in three-dimensional space.

3. The method according to claim 1, characterized in that The voxels corresponding to the three-dimensional object further include a second group of voxels, the second group of voxels are adjacent voxels in the three-dimensional space, and the voxels in the second group of voxels have the same size. The method further includes: generating a second mesh patch within a second polyhedron according to the distance field values ​​corresponding to the second group of voxels, wherein the second polyhedron is a cube; Generating the mesh of the three-dimensional object according to the first mesh surface comprises: A mesh of the three-dimensional object is generated based on the first mesh patch and the second mesh patch.

4. The method according to claim 3, characterized in that Generating a second mesh patch within the second polyhedron according to the distance field values ​​corresponding to the second group of voxels includes: generating a second mesh patch within the second polyhedron according to the distance field values ​​corresponding to the second group of voxels and pre-stored second mapping relationship information; The second mapping relationship information is used to indicate a mapping relationship between the distance field values ​​corresponding to the second group of voxels and the position information of the second mesh patch in the second polyhedron.

5. The method according to claim 1, wherein The first group of voxels includes a first type of voxels and a second type of voxels, and a size of the first type of voxels is 2N times a size of the second type of voxels, where N is a positive integer greater than or equal to 1.

6. A device for generating a three-dimensional grid, characterized in that: include: a first generating module, configured to generate voxels of the three-dimensional object during scanning of the three-dimensional object, wherein the voxels of the three-dimensional object include a first group of voxels, the first group of voxels being adjacent voxels in a three-dimensional space, and the first group of voxels including a plurality of voxels of different sizes; a second generating module, configured to generate a first mesh patch within a first polyhedron based on the distance field values ​​corresponding to the first group of voxels and pre-stored first mapping relationship information, wherein the vertices of the first polyhedron are the center points of the first group of voxels, and the first mapping relationship information is used to indicate a mapping relationship between the distance field values ​​corresponding to the first group of voxels and the position information of the first mesh patch within the first polyhedron; A third generation module is configured to generate a mesh of the three-dimensional object based on the first mesh surface.

7. The device according to claim 6, characterized in that The device further comprises: The fourth generating module is configured to determine the first polyhedron from a plurality of polyhedrons according to the spatial position relationship of the first group of voxels, wherein the plurality of polyhedrons have different shapes in three-dimensional space.

8. The device according to claim 6, characterized in that The voxels corresponding to the three-dimensional object further include a second group of voxels, the second group of voxels are adjacent voxels in the three-dimensional space, and the voxels in the second group of voxels have the same size, and the device further includes: a fifth generating module, configured to generate a second mesh patch within a second polyhedron according to the distance field values ​​corresponding to the second group of voxels, wherein the second polyhedron is a cube; The third generation module is further configured to: A mesh of the three-dimensional object is generated based on the first mesh patch and the second mesh patch.

9. The device according to claim 8, characterized in that The fifth generation module is further configured to: generating a second mesh patch within the second polyhedron according to the distance field values ​​corresponding to the second group of voxels and pre-stored second mapping relationship information; The second mapping relationship information is used to indicate a mapping relationship between the distance field values ​​corresponding to the second group of voxels and the position information of the second mesh patch in the second polyhedron.

10. The device according to claim 6, characterized in that The first group of voxels includes a first type of voxels and a second type of voxels, and a size of the first type of voxels is 2N times a size of the second type of voxels, where N is a positive integer greater than or equal to 1.

11. A three-dimensional scanning system, characterized in that: include: a memory for storing program codes; A processor, configured to execute the program code to perform the method according to any one of claims 1 to 5.

12. A computer-readable storage medium, characterized in that A program code for executing the method according to any one of claims 1 to 5 is stored thereon.

13. A computer program product, characterized in that The method comprises a program code for executing the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Multi-resolution voxel meshing

    CN113139992A