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

By generating voxels and generating mesh patches in polyhedrals based on distance field values, the problem of difficult to generate grids in different fineness or resolutions in three-dimensional scanning is solved, and clearer three-dimensional object feature representations and higher mesh accuracy are achieved.

CN119919604AActive Publication Date: 2025-05-02SCANTECH (HANGZHOU) CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

During the three-dimensional scanning process, it is difficult to effectively generate grids of different fineness or resolutions, resulting in the lack of clear characteristics of different parts of the three-dimensional object.

Method used

Mesh generation at different scales is achieved by generating voxels and generating mesh patches in polyhedrals according to the distance field value of voxels. The specific steps include generating voxels during the scanning process, generating mesh sheets based on the distance field value of the voxels and the pre-stored mapping relationship information, and finally forming a grid of three-dimensional objects.

Benefits of technology

It realizes better generating grids of different fineness or resolution when scanning three-dimensional objects, thereby more clearly representing the characteristics of different parts of three-dimensional objects, improving the accuracy and correctness of multi-scale grids.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119919604A_ABST
    Figure CN119919604A_ABST
Patent Text Reader

Abstract

The invention provides a method, device and system for generating a three-dimensional grid, a storage medium and a program product. The method comprises: in a process of scanning a three-dimensional object, voxels of the three-dimensional object are generated, the voxels of the three-dimensional object comprise a first group of voxels, the first group of voxels are adjacent voxels in a three-dimensional space, and the first group of voxels comprise a plurality of voxels with different sizes; generating a first grid patch according to the distance field values corresponding to the first group of voxels; and generating a grid of the three-dimensional object according to the first grid patch. By using the method, the grid surface patch can be generated for a group of voxels formed by various voxels with different sizes in the process of scanning the three-dimensional object, so that grids with different finesses or resolutions (namely, different scales) can be better generated, and the characteristics of different parts of the three-dimensional object can be better represented.
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] In the process of 3D scanning and measuring 3D objects, in order to balance the scanning speed of large plane areas and the scanning accuracy of local details, it is often necessary to scan large plane areas with high resolution and scan local details with low resolution. In this case, how to better generate grids of different fineness or resolution (i.e., different scales) to better represent the characteristics of different parts of the 3D object is a technical problem that needs to be solved. Summary of the invention

[0003] The present application provides a method for generating a three-dimensional grid and an apparatus for generating a three-dimensional grid, so as to better generate grids of different fineness or resolution (ie, different scales), so as to better represent 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 according to distance field values ​​corresponding to the first group of voxels; and generating a mesh of the three-dimensional object according to the first mesh patch.

[0005] As a possible implementation manner, generating the first mesh patch according to the distance field values ​​corresponding to the first group of voxels includes: generating the first mesh patch within a first polyhedron according to 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 according to the distance field values ​​corresponding to the first group of voxels and the pre-stored first mapping relationship information, the method further includes: determining the first polyhedron from a plurality of polyhedrons according to the spatial position 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 the three-dimensional space, and the voxels in the second group of voxels have the same size, and the method also 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 patch includes: generating the mesh of the three-dimensional object according to the first mesh patch and the second mesh patch.

[0008] As a possible implementation manner, generating the second mesh patch within the second polyhedron according to the distance field values ​​corresponding to the second group of voxels includes: generating the 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; 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 manner, 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.

[0010] In a second aspect, a device for generating a three-dimensional grid is provided, the device comprising: a first generation module, used to generate 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, used to generate a first grid patch according to distance field values ​​corresponding to the first group of voxels; and a third generation module, used to generate a grid of the three-dimensional object according to the first grid patch.

[0011] As a possible implementation manner, the second generating module is further used to: generate the first mesh surface 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; 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 surface patch in the first polyhedron.

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

[0013] 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 the three-dimensional space, and the voxels in the second group of voxels have the same size, and the device also includes: a fifth generation module, used to generate a second mesh patch in 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 also used to: generate a mesh of the three-dimensional object according to the first mesh patch and the second mesh patch.

[0014] As a possible implementation manner, the fifth generating module is further used to: generate the second mesh surface 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; 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 surface patch in the second polyhedron.

[0015] As a possible implementation manner, 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.

[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] According to a fourth aspect, a computer-readable storage medium is provided, on which a program code for executing the method according to the first aspect or any one of the implementations of the first aspect is stored.

[0018] According to a fifth aspect, a computer program product is provided, wherein the computer program product comprises 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, so as to better generate meshes of different fineness or resolutions (i.e., different scales), and further better represent the features 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 the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. 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 the related art.

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

[0023] Figure 3 This is an example diagram of a marching cube used by 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 It is a schematic flowchart of a method for generating a three-dimensional grid provided in an embodiment of the present application.

[0026] Fig. 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] Fig. 9 The embodiment of the present application provides Figure 8 An example of a mesh generated by the multi-scale transition region is shown.

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

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

[0034] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained based on the embodiments in the present application belong to the scope of protection of the present application.

[0035] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[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 embodiment of the present application can be applied to the generation of a three-dimensional grid. For ease of understanding, the generation of a three-dimensional grid mentioned in the embodiment of the present application is first introduced.

[0038] In 3D scanning measurement, the 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 to obtain point cloud data of the object surface. A mesh generation algorithm can be used to generate a mesh of a 3D object based on point cloud data. The mesh generation algorithms here can include the ball-pivoting algorithm (BPA), the Delaunay triangulation (Delaunay) algorithm, etc. These mesh generation algorithms can form a triangular or polygonal mesh by connecting the points in the point cloud, thereby approximating the surface of the object. In addition, the mesh can also be generated without point cloud data. For example, the 3D space where the 3D object is located can be divided into a uniform cubic mesh (voxel), and then a mesh patch (or isosurface) can be extracted from each voxel using certain rules or algorithms. The rules or algorithms here can include the marching cube algorithm. The mesh patches in each voxel are connected together to form a mesh of the 3D object.

[0039] In the process of scanning a three-dimensional object, if a high resolution is used to scan the three-dimensional object, although the scanning speed can be improved, the scanning accuracy of the local details of the three-dimensional object may be low. If a low resolution is used to scan the three-dimensional object, although the scanning accuracy of the local details can be guaranteed, it will result in too slow scanning speed and too much data. Therefore, in practical applications, multi-scale scanning is often used. That is, a large plane area of ​​a three-dimensional object is scanned with a high resolution, and a local detail of the three-dimensional object is scanned with a low resolution. In this way, a balance can be achieved between scanning speed and scanning accuracy.

[0040] Multi-scale scanning may involve the generation of multi-scale grids. The scale of the grid can also be understood as the resolution of the grid. Grids of different scales or grids of different resolutions can have different sizes and densities, so that different levels of detail of three-dimensional objects can be represented. For example, a high-resolution grid can have finer-grained grid cells, so that the geometric features of three-dimensional objects can be more finely represented. A low-resolution grid may contain coarser-grained grid cells, which may not accurately represent the local details of a three-dimensional object.

[0041] In some cases, multi-scale grids can be generated by multi-scale point cloud data, that is, point cloud data of different densities. Since the points are discrete and there is no topological connection information between the points, point clouds of different scales can be easily put together. Therefore, a solution for generating multi-scale grids based on multi-scale point cloud data is proposed in the related art. Generating multi-scale grids based on multi-scale point cloud data can be achieved in two ways, namely, offline and real-time. In the offline mode, the scanning process and the grid generation process are not performed at the same time. That is, the three-dimensional object is first scanned to obtain multi-scale point cloud data, and then the multi-scale point cloud data is gridded (for example, using the BPA, Delaunay and other algorithms mentioned above) to generate a multi-scale grid. In the real-time mode, the scanning process and the grid generation process can be performed simultaneously. That is, in the process of scanning the three-dimensional object, the three-dimensional object is scanned to obtain multi-scale point cloud data while the multi-scale point cloud data is gridded to generate a multi-scale grid. However, since the gridding of point cloud data is time-consuming, the efficiency of generating multi-scale grids based on multi-scale point clouds in real-time is low.

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

[0043] From the above description, it can be seen that there are many problems with the solutions for generating multi-scale grids proposed in the related art. Therefore, when multi-scale scanning is used, 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 grid. The method includes: in the process of scanning a three-dimensional object, generating voxels of the three-dimensional object, the voxels of the three-dimensional object include a first group of voxels, the first group of voxels are adjacent voxels in three-dimensional space, and the first group of voxels include multiple voxels of different sizes; generating a first grid patch according to the distance field values ​​corresponding to the first group of voxels; generating the grid of the three-dimensional object according to the first grid patch. Using this method, in the process of scanning a three-dimensional object, a grid patch can be generated for a group of voxels formed by multiple voxels of different sizes, so that grids of different fineness or resolution (i.e., different scales) can be better generated, and the features of different parts of the three-dimensional object can be better represented.

[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 the present application are introduced.

[0046] Figure 2 An example diagram of a signed distance field is shown. In 3D scanning, the distance field can be understood as a function that represents the distance from each point in space to the surface of a 3D object. The distance field can be divided into a signed distance field (SDF) and a truncated signed distance function (TSDF). TSDF can be seen as an improvement of SDF. Figure 2 An example graph 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 represents a voxel in three-dimensional space. Figure 2 The grey filled areas in indicate the regions 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, you can use algorithms such as marching cube to extract isosurfaces, and then generate a mesh of a 3D object. The isosurfaces here are usually surfaces with SDF values ​​of 0. Figure 3 and Figure 4 Describes 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 1 is a hexahedron. 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 values ​​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 conditions of the 8 distance field values ​​corresponding to the 8 vertices of the cube are determined, the mapping table can be used to obtain Figure 4The distribution of isosurfaces shown in the figure can be used to determine how isosurfaces in the cube intersect with the edges of the cube. In other words, it can be determined on which edges of the cube the isosurfaces can be interpolated. The positions where each isosurface intersects with each edge of the cube can be calculated by linear interpolation. Figure 3 The cube shown in FIG. traverses the three-dimensional space occupied by the three-dimensional object. Each time the cube is moved, a mesh patch can be generated in the cube in the above manner. After traversing the three-dimensional space occupied by the three-dimensional object, a large number of mesh patches can be obtained. By connecting these mesh patches together, the mesh of the three-dimensional object can be obtained.

[0049] Combination of the above Figures 2 to 4 The concepts of distance field, voxel, marching cube, etc. involved in the embodiments of the present 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 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 embodiment of the present application does not specifically limit the type of three-dimensional object. The three-dimensional object here can be a small object, a medium-sized object, or a large object. Small objects can include precision parts, human teeth, jewelry, etc. Medium-sized objects can include printed circuit boards, archaeological relics, engineering equipment, castings, furniture, handicrafts, etc. Large objects can include large industrial equipment, buildings, bridges, etc. A three-dimensional scanning system can be used to scan the three-dimensional object. The three-dimensional scanning system here can include any of the following: a portable three-dimensional scanning system, an automated three-dimensional scanning system, and 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, so that voxels of different sizes can be generated during the scanning process. For example, a high-resolution scan can be performed on one or some parts of a three-dimensional object, so that small-sized voxels can be generated. For another example, a low-resolution scan can be performed on another or some other parts of the three-dimensional object, so that large-sized voxels can be generated.

[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, the group of adjacent voxels of different sizes is referred to as the first group of voxels below. That is, the voxels of the three-dimensional object may include a first group of voxels adjacent in the three-dimensional space, and the first group of voxels may include multiple voxels or multiple types of voxels of different sizes. The embodiment of the present application does 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 4 voxels. For another example, in other cases, the first group of voxels may include 5 voxels. The embodiment of the present application does 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, and the sizes of the two types of voxels are different. For another example, in other cases, the first group of voxels may include three types of voxels, and the sizes of the three types of voxels are different. The implementation of the present application does not specifically limit the size difference of the voxels included in the first group of voxels. For example, in some cases, the sizes of the multiple voxels included in the first group of voxels differ by 2 times. 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 convenience of description, the polyhedron corresponding to the first group of voxels is referred to as the first polyhedron below. The center points of each voxel in the first group of voxels can be used 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 is an example in which the first group of voxels includes a first type of voxel and a second type of voxel, and the size of the first type of voxel is twice the size of the second type of voxel.

[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 lines connecting the black dots represent the first polyhedron. FIG. 6A to FIG. 6C Different situations of the first group of voxels and the first polyhedron are shown respectively. Fig. 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 first-type voxel and 4 second-type voxels. 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 FIG. 6 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 FIG. 6 are only for schematic illustration 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 the multiple voxels or the multiple of the resolution difference between the 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 may correspond to a distance field value, which may 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 may be considered to correspond to the same level or the same level of distance field. Since the voxels of a three-dimensional object have different sizes, it may be considered that the voxels of the three-dimensional object correspond to multi-level or multi-level 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. Fig. 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 patches here can be understood as the isosurfaces mentioned above, and the isosurfaces 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 the edges of the first polyhedron into which the first mesh patches are inserted. 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 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 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 edges of the first polyhedron, the first mesh patch can be generated within the first polyhedron. The following is a diagram showing the distribution of the first mesh patch within the first polyhedron and the intersection positions of the first mesh patch with the edges of the first polyhedron. Fig. 6A The first group of voxels is shown as an example for explanation.

[0060] See also Fig. 6A , the first polyhedron is a tetrahedron. The tetrahedron includes 4 edges, namely e0 to e3. The tetrahedron includes 4 vertices, namely v0 to v3. Whether the first mesh surface passes through e0 can be determined based on the positive and negative 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 surface passes through e0. Otherwise, the first mesh surface does not pass through e0. In addition, if the first mesh surface passes through e0, the position of the intersection of e0 and the first mesh surface at e0 can be determined based on the values ​​of the distance field values ​​of v0 and v1, or the position of the vertex of the first mesh surface on e0 can be determined. The position of the intersection can be determined by linear interpolation. For example, when the distance field values ​​of v0 and v1 are one positive and one negative and the absolute values ​​are equal, the middle position of e0 can be determined as the intersection of e0 and the first mesh surface. The above operation can be performed on the remaining edges e1 to e3 of the tetrahedron, so that the first mesh patch can be generated inside the tetrahedron.

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

[0062] After generating the first mesh patch according to the distance field values ​​corresponding to the first group of voxels in step S520, in step S530, the mesh of the three-dimensional object can be generated according to the first mesh patch. As mentioned above, the three-dimensional space corresponding to the first group of voxels can be considered as the multi-scale transition area or multi-scale boundary area of ​​the three-dimensional object. Therefore, the first mesh patch generated according to the distance field values ​​corresponding to the first group of voxels can be considered as the mesh patch of the three-dimensional object in the multi-scale boundary area. The first mesh patch can be connected to the mesh patch of the non-boundary area (or single-scale area) to generate the mesh of the three-dimensional object. The non-boundary area here can be understood as an area with the same voxel size. Alternatively, the non-boundary area 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 area can also be generated according to 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. In other words, using the method for generating a three-dimensional mesh provided in the embodiment of the present application, the three-dimensional mesh can be generated in an offline manner or in a real-time manner.

[0064] Through the above description of step S510 to step S530, it can be known that the embodiment of the present application can generate a mesh patch for a group of voxels formed by multiple voxels of different sizes, so as to better generate meshes of different fineness or resolution (i.e., different scales), and thus better represent the features of different parts of a three-dimensional object. In addition, the method provided in the embodiment of the present application can be used to generate multi-scale meshes in real time. Compared with the method of generating multi-scale meshes in real time proposed in the related art, the multi-scale mesh generated by the method provided by the present application does not need to splice meshes of different scales, so as to better ensure 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. It can be considered that voxels of different sizes have different size levels. The size corresponding to the voxel with a larger size can be called the size of the previous level, and the size corresponding to the voxel with a smaller size can be called the size of the next level. In some implementations, the size of the previous level can 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 can be called first-class voxels, and voxels with the size of the next level can be called second-class voxels. Therefore, it can also be said that the size of the first-class voxel is 2N times the size of the second-class voxel. It can also be said that the scanning resolution corresponding to the first-class voxel is 2N times the scanning resolution corresponding to the second-class voxel. For example, the size of the first-class voxel can be twice the size of the second-class voxel. 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 put into 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 the 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 size of adjacent levels differs by 2 times as an example, this paper 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 the spatial position relationship 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 sub-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 voxels corresponding to the same scanning scale can be stored in the leaf nodes of the corresponding level of the octree. Figure 7 In the octree shown, the resolution corresponding to the default scanning layer is 1, and the distance field value of the voxel obtained by scanning the three-dimensional object with the default resolution can be stored in the leaf node of the default scanning layer. The resolution corresponding to the ×2 fine scanning layer is 0.5, and the distance field value of the voxel obtained by scanning the three-dimensional object with a resolution of 0.5 can be stored in the leaf node of the ×2 fine scanning layer. The spatial position relationship between voxels can also be determined by the location where the distance field value of the voxel is stored in the octree (which leaf node at which level it is stored). By constructing a three-dimensional index structure, the distance field values ​​corresponding to voxels of different sizes can be efficiently retrieved, so as to generate a mesh of a three-dimensional object based on the distance field value of the voxel.

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

[0069] In the first implementation, an algorithm for extracting isosurfaces according to 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, see step S520 in conjunction with Fig. 6AIn the first implementation, the distribution of the first mesh patch in the first polyhedron and the intersection positions of the first mesh patch and 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 between the distance field value corresponding to the first group of voxels and the position information of the first mesh patch in the first polyhedron can be pre-established (hereinafter referred to as the first mapping relationship for ease of description). The position information of the first mesh patch in the first polyhedron can be used to indicate the distribution of the first mesh patch in the first polyhedron. The distribution of the first mesh patch in the first polyhedron can be understood as which edges of the first polyhedron the first mesh patch is inserted into. The above-mentioned first mapping relationship can be indicated by the first mapping relationship information. The above-mentioned first mapping relationship information can be pre-stored. When it is necessary to generate the first mesh patch, the pre-stored first mapping relationship information can be directly called, and the distribution of the first mesh patch corresponding to the positive and negative conditions of the distance field values ​​of each vertex of the first polyhedron can be determined according to the first mapping relationship information. After determining the distribution of the first mesh patch, the intersection position of the first mesh patch and each edge of the first polyhedron can be determined according to the value of the distance field value of each vertex of the first polyhedron, so that the first mesh patch can be generated in the first polyhedron.

[0071] From the above description, it can be seen that 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 artificially 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 an artificially 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. FIG. 6A to FIG. 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] When first mapping relationships are established for polyhedrons of different shapes respectively, 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 the embodiment of the present application may further include: determining the first polyhedron from a plurality of polyhedrons based on the spatial position 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 (for the sake of ease of description, referred to as the first shape hereinafter). 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 values ​​of each voxel in the first group of voxels in the octree. 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 FIG. 6A to FIG. 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. FIG. 6A to FIG. 6C For example, if it is determined that the first polyhedron corresponding to the first set of voxels is Fig. 6A For the tetrahedron shown in FIG. 1 , the distribution of the first mesh face in the tetrahedron can be determined by directly searching the first mapping relationship information corresponding to the tetrahedron. Then, according to the values ​​of the distance field values ​​of the four vertices in the tetrahedron, the intersection positions of the first mesh face and each edge of the tetrahedron can be determined, so that the first mesh face can be generated in the tetrahedron.

[0075] In step S530, it is mentioned that the first mesh patch can be connected to the mesh patch of the non-boundary area to generate the mesh of the three-dimensional object. The above describes the method of generating the first mesh patch, and the following describes the method of generating the mesh patch of the non-boundary area.

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

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

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

[0079] The mesh of the three-dimensional object can be obtained by connecting the mesh surface of the boundary region (such as the first mesh surface) with one or more mesh surface of the non-boundary region (such as the second mesh surface). Since the mesh of the three-dimensional object is generated based on voxels of different sizes, it can be said that the mesh of the three-dimensional object has multiple scales.

[0080] In some implementations, a mapping relationship between the distance field value corresponding to the second group of voxels and the position information of the second mesh patch in the second polyhedron can be pre-established (hereinafter referred to as the second mapping relationship for ease of description). The position information of the second mesh patch in the second polyhedron can be used to indicate the distribution of the second mesh patch in the second polyhedron. The distribution of the second mesh patch in the second polyhedron can be understood as which edges of the second polyhedron the second mesh patch is inserted into. The above second mapping relationship can be indicated by the second mapping relationship information. The above second mapping relationship information can be pre-stored. When it is necessary to generate the second mesh patch, the pre-stored second mapping relationship information can be directly called, and the distribution of the second mesh patch corresponding to the positive and negative conditions of the distance field value of each vertex of the second polyhedron can be determined according to the second mapping relationship information. After determining the distribution of the second mesh patch, the intersection position of the second mesh patch and each edge of the second polyhedron can be determined according to the value of the distance field value of each vertex of the second polyhedron, so that the second mesh patch can be generated in the second polyhedron. In this way, the position information of the second mesh surface patch in the second polyhedron can be quickly determined, so that the second mesh surface 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 the three-dimensional space. The center points of these eight voxels may be used 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 may be used as the second mapping relationship information, so that there is no 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 face in the second polyhedron, which can greatly simplify the operation.

[0082] To better understand the method for generating a three-dimensional grid provided by the present application, see Figure 8 and Fig. 9 , and explain it with more specific examples. Because the situation in three-dimensional space is too complicated, Figure 8 and Fig. 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 Fig. 9In the figure, each large solid square box represents a large-size pixel, each small solid square box represents a small-size pixel, and the size of the large-size pixel is twice the size of the small-size pixel. Each solid dot 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 the local large-scale areas and local small-scale areas, there are 7 transition areas adjacent to the local large-scale areas and the 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 Fig. 9 As shown, for local single-scale regions, that is, regions A and B, normal connections can be made. For example, for region A, the two edges of region A between which the connection is made can be determined based on the positive and negative distance field values ​​of the four vertices a0 to a3 of region A. 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 edge m0 and edge m1. The position of the intersection point P1 of the connecting line and m0 can be determined based on the distance field value of a0 and the distance field value of a1. The position of the intersection point P2 of the connecting line and m1 can be determined based on the distance field value of a1 and the distance field value of a2.

[0085] For the transition area, the connection strategy can be set manually according to different situations. Fig. 9As shown, the dotted lines in area C, area D, and area E represent artificially set connection strategies. For different situations, a mapping relationship can be established between the positive and negative conditions of the distance field values ​​corresponding to each vertex and the set connection strategy. For a detailed description of the mapping relationship, please refer to the relevant introduction to marching cube in the previous text, which will not be repeated here. The mapping relationship can be stored in the form of a table. In the transition area, it can be first determined which situation the transition area is. In other words, it is first determined whether the transition area is area C, area D, or area E. Then the transition area can be connected according to the lookup table. For example, after determining that the transition area is area D, the connection strategy corresponding to the positive and negative conditions of the distance field values ​​of the four vertices of area D can be selected from the lookup table corresponding to area D, that is, between which two edges of area D the connection line is established. If the distance field value of vertex d1 of area D is positive and the distance field values ​​of the remaining vertices are negative, the connection line can be determined by the lookup table to establish the connection line between edge n0 and edge n1 of area D. In addition, the position of the intersection point Q1 of the connecting line and n0 can be determined according to 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 according to the distance field values ​​of vertex d1 and vertex d2.

[0086] The generation of multi-scale grids in three-dimensional space is similar to the connection in two-dimensional plane 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] Combination of 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 device of the present application. It should be understood that the description of the device embodiment corresponds to the description of the method embodiment. Therefore, for the part not described in detail, reference can be made to the description of the previous method embodiment.

[0088] The embodiment of the present application also provides a device for generating a three-dimensional grid, which is used to execute the method for generating a three-dimensional grid mentioned above. Fig.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 Fig.10As shown, the device 100 for generating a three-dimensional grid may include: a first generating module 1010, used to generate voxels of the three-dimensional object during scanning of the three-dimensional object, the voxels of the three-dimensional object including a first group of voxels, the first group of voxels are adjacent voxels in the three-dimensional space, and the first group of voxels includes a plurality of voxels of different sizes; a second generating module 1020, used to generate a first grid patch according to the distance field values ​​corresponding to the first group of voxels; and a third generating module 1030, used to generate a grid of the three-dimensional object according to the first grid patch.

[0090] In some implementations, the second generating module 1020 is further used to: generate the first mesh patch within a first polyhedron according to 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.

[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 position 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 the three-dimensional space, and the voxels in the second group of voxels have the same size, and the device 100 also includes: a fifth generation module, used to generate a second mesh patch in 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 1030 is also used to generate a mesh of the three-dimensional object according to the first mesh patch and the second mesh patch.

[0093] In some implementations, the fifth generation module is further used to: generate the second mesh surface within the second polyhedron according to 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 surface in 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, and the three-dimensional scanning system 110 includes: a memory 1110 for storing program code; a processor 1120 for executing the program code to execute the method for generating a three-dimensional grid in any of the above embodiments.

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

[0097] The embodiment of the present application further provides a computer program product, which includes 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 embodiment of the present application, "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.

[0100] It should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after 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 the present 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 only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, 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] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[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, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. 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 computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. 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 contains one or more available media integrated. The available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, digital video disc (DVD)), or semiconductor media (eg, solid state disk (SSD)), etc.

[0106] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for generating a three-dimensional grid, characterized in that: include: In a process of scanning 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 according to the distance field values ​​corresponding to the first group of voxels; 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 Generating a first mesh patch according to the distance field values ​​corresponding to the first group of voxels includes: Generate the first mesh patch within the first polyhedron according to the distance field values ​​corresponding to the first group of voxels and the pre-stored first mapping relationship information; 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 distance field values ​​corresponding to the first group of voxels and position information of the first mesh patch in the first polyhedron.

3. The method according to claim 2, 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 the pre-stored first mapping relationship information, the method further includes: The first polyhedron is determined from a plurality of polyhedrons according to the spatial position relationship of the first group of voxels, and the plurality of polyhedrons have different shapes in three-dimensional space.

4. The method according to any one of claims 1 to 3, 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 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 patch includes: A mesh of the three-dimensional object is generated according to the first mesh patch and the second mesh patch.

5. The method according to claim 4, 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 comprises: generating the second mesh patch within the second polyhedron according to the distance field values ​​corresponding to the second group of voxels and the 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 surface in the second polyhedron.

6. The method according to claim 1 or 2, 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.

7. A device for generating a three-dimensional grid, characterized in that: include: A first generating module is used 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, wherein the first group of voxels are adjacent voxels in the three-dimensional space, and the first group of voxels includes a plurality of voxels of different sizes; A second generating module, configured to generate a first mesh patch according to the distance field values ​​corresponding to the first group of voxels; The third generation module is used to generate the mesh of the three-dimensional object according to the first mesh surface.

8. The device according to claim 7, characterized in that The second generating module is further used for: Generate the first mesh patch within the first polyhedron according to the distance field values ​​corresponding to the first group of voxels and the pre-stored first mapping relationship information; 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 distance field values ​​corresponding to the first group of voxels and position information of the first mesh patch in the first polyhedron.

9. The device according to claim 8, characterized in that The device also includes: The fourth generating module is used to determine the first polyhedron from a plurality of polyhedrons according to the spatial position relationship of the first group of voxels, and the plurality of polyhedrons have different shapes in three-dimensional space.

10. The device according to any one of claims 7 to 9, 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 in 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 also used for: A mesh of the three-dimensional object is generated according to the first mesh patch and the second mesh patch.

11. The device according to claim 10, characterized in that The fifth generation module is also used for: generating the second mesh patch within the second polyhedron according to the distance field values ​​corresponding to the second group of voxels and the 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 surface in the second polyhedron.

12. The device according to claim 7 or 8, 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.

13. 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 6.

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

15. A computer program product, characterized in that The method comprises a program code for executing the method as claimed in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Quick and robust RGB-D indoor three-dimensional scene reconstruction method

    CN108564616A

  • Multi-resolution voxel meshing

    CN113139992A

  • Three-dimensional grid reconstruction method and device, electronic device and storage medium

    CN113470180A

  • Three-dimensional model voxelization method and device, electronic equipment and storage medium

    CN113850917A

  • Reconstruction method, device and equipment of three-dimensional entity model, medium and program product

    CN117409144A

Cited By

  • Three-dimensional grid construction method, electronic equipment, scanning equipment and storage medium

    CN121053309A