Method and device for filling extra-large voids in a three-dimensional triangular mesh model
By detecting the sequence of void boundary vertices and evaluating priority, and calculating the coordinates of the newly added vertices based on local and global boundary information, the problem of filling super-large voids in the three-dimensional triangle network model is solved, and an effective void fill effect is achieved.
Patent Information
- Application Number
- CN202111447276.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-26
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-11-26
AI Technical Summary
The prior art is difficult to effectively fill the super-large and complex voids in the three-dimensional triangle network model, and it is easy to have problems of self-intersecting triangles or divergence.
By detecting the sequence of vertices in the boundary of the hole, evaluating the priority of each vertex, obtaining the new vertices associated with the vertex with the largest priority, and computing their coordinates based on local and global boundary information, adding the new vertices and corresponding triangles to the model until the hole is completely filled.
The divergence problem during the hollow filling process was successfully solved, and a good filling effect was achieved, ensuring that the filled triangular net was smoothly transitioned near the boundary position and the middle position was flat.
Smart Images

Figure CN114202642B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of three-dimensional modeling or three-dimensional graphic data editing, and more particularly, to a method and device for filling ultra-large holes in a three-dimensional triangular mesh model. Background Art
[0002] The technology for automatically reconstructing three-dimensional models based on images or laser point clouds is becoming increasingly mature and its applications are also becoming increasingly widespread. However, due to various reasons such as shooting angles and lack of textures, a large number of holes inevitably exist in the initially generated three-dimensional models. In order to meet the data production specifications, the holes in the models must be eliminated.
[0003] Currently, a large number of studies have been conducted on this problem. A relatively representative method is to first directly connect non-adjacent vertices on the hole boundary to obtain a topologically complete triangular mesh, then continuously insert vertices, and finally, obtain a smooth and uniform triangular mesh through means such as interpolation fitting. Another relatively practical method is to continuously insert new vertices and add triangles near the boundary inside the hole based on the boundary of the hole, so that the hole gradually shrinks and finally closes. For holes with simple shapes, the existing hole filling methods can achieve the goal. However, for ultra-large and complex holes, the above two methods have poor effects. The first method is prone to a large number of self-intersecting triangles, and the second method may diverge and lead to filling failure. Summary of the Invention
[0004] To solve the above problems, embodiments of the present invention provide a method and device for filling ultra-large holes in a three-dimensional triangular mesh model that overcome the above problems or at least partially solve the above problems.
[0005] According to a first aspect of an embodiment of the present invention, there is provided a method for filling an ultra-large hole in a three-dimensional triangular mesh model, the method comprising: S1, detecting a vertex sequence of a hole boundary and evaluating the priority of each vertex; S2, obtaining a new vertex associated with the vertex having the highest priority, and adding the new vertex and the corresponding triangle to the triangular mesh model; S3, re-entering S1 until the hole is filled.
[0006] According to a second aspect of an embodiment of the present invention, there is provided an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the method for filling an ultra-large hole in a three-dimensional triangular mesh model provided by any one of the various possible implementation manners of the first aspect.
[0007] The method for filling extra-large holes in a three-dimensional triangular mesh model provided by an embodiment of the present invention detects the vertex sequence of the hole boundary and evaluates the priority of each vertex; obtains the new vertices associated with the vertex with the highest priority, and adds the new vertices and the corresponding triangles to the triangular mesh model. By combining local and global boundary information to calculate the coordinates of the inserted vertices inside the hole, the divergence problem during the hole filling process is successfully solved. A large number of experimental results have proved that this method can obtain a good filling effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0009] Figure 1 It is a schematic flowchart of the method for filling extra-large holes in a three-dimensional triangular mesh model provided by an embodiment of the present invention;
[0010] Figure 2 It is a schematic diagram of the model provided by an embodiment of the present invention;
[0011] Figure 3 It is a schematic diagram of the hole filling result provided by an embodiment of the present invention;
[0012] Figure 4 It is a schematic diagram of the physical structure of the electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0013] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0014] In view of the above problems existing in the prior art, an embodiment of the present invention provides a method for filling extra-large holes in a three-dimensional triangular mesh model. This method calculates the coordinates of the inserted vertices inside the hole by combining local and global boundary information, successfully solves the divergence problem during the hole filling process, and a large number of experimental results have proved that this method can obtain a good filling effect. Refer to the attached Figure 1 , this method includes but is not limited to the following steps:
[0015] S1. Detect the sequence of boundary vertices of the cavity and evaluate the priority of each vertex.
[0016] Specifically, detect the cavity in the 3D model, which can be achieved by using the open-source library OpenMesh. As an alternative embodiment, detecting the sequence of boundary vertices of the cavity in S1 includes:
[0017] Arrange the vertices on the cavity boundary in order in an array;
[0018] Among them, for a cavity containing multiple loops, convert the cavity into a single-loop cavity by bridging.
[0019] Specifically, obtain the vertices on the cavity boundary in order into an array. The cavity may consist of a single loop or multiple loops. For the convenience of processing, for a cavity with multiple loops, it can be converted into a single-loop cavity by means such as bridging.
[0020] As an alternative embodiment, evaluating the priority of each vertex in S1 includes:
[0021] Obtain the priority of the vertex according to the opening angle of the boundary line at the vertex, where the smaller the opening angle, the higher the priority.
[0022] As an alternative embodiment, obtaining the priority of the vertex according to the opening angle of the boundary line at the vertex further includes:
[0023] Take the average value of the angles between the vertex and multiple connecting lines on its two sides as the opening angle.
[0024] As an alternative embodiment, evaluating the priority of each vertex in S1 includes:
[0025] For the area where the boundary is concave inward, reduce the priority of the vertices in this area according to a preset amplitude.
[0026] Specifically, insert vertices near the cavity boundary to shrink the cavity. The boundary vertices must be processed in a certain order, otherwise self-intersection is likely to occur. The priority of the vertex is mainly measured by the opening angle of the boundary line at this vertex (such as ∠alpha in Figure 2 ), and it is better to use the average value of the angles between the boundary vertex and multiple boundary vertices on its two sides to represent the opening angle than a single angle. The smaller the opening angle, the higher the priority. In addition, some special cases need to be considered. For example, for the area where the boundary is concave inward (such as vertices A, B, and C in Figure 2 ), their priority should be greatly reduced to avoid filling the cavity in the opposite direction.
[0027] S2. Obtain the newly added vertices associated with the vertex with the highest priority, and add the newly added vertices and the corresponding triangles to the triangular mesh model.
[0028] First, when the included angle between the two sides of a boundary vertex is relatively large, a vertex needs to be inserted into the hole. The newly added vertex should be located on the angular bisecting plane of the boundary vertex (e.g., Figure 2 , the angular bisecting plane of boundary vertex E passes through vertex E and has equal angles with side DE and side EF).
[0029] As an alternative embodiment, obtaining the newly added vertices associated with the vertex with the highest priority in S2 includes:
[0030] Calculate the direction and distance of the newly added vertex; wherein, the direction of the newly added vertex is based on the following factors: minimizing the maximum value of the three dihedral angles affected by the direction of the newly added vertex, and making the direction of the newly added vertex point as much as possible to the opposite side of the hole boundary;
[0031] Determine the coordinates of the newly added vertex according to the direction and the distance.
[0032] Among them, for the calculation of the direction, calculating the direction of the newly added vertex includes:
[0033] Calculate all the intersection points of the angular bisecting plane of the vertex and the hole boundary line, and fit a three-dimensional straight line equation using the intersection points;
[0034] Sort according to the projection positions of the intersection points on the straight line, and after odd-even pairing, obtain the intersection points on the opposite side of the boundary, and use the intersection points on the opposite side as the opposite-side direction.
[0035] Specifically, determining the direction of the newly added vertex needs to consider two factors: one is to minimize the maximum value of the three dihedral angles (such as Figure 2 the three dihedral angles among the four triangles 1, 2, 3, and 4) affected by the direction of the newly added vertex, and the other is to make the direction of the newly added vertex point as much as possible to the opposite side of the hole boundary. Since the newly added vertex is restricted to the angular bisecting plane of the boundary vertex, calculating the vertex direction that minimizes the dihedral angle becomes a single-variable optimization problem, and the requirement for calculation accuracy here is not high, so a relatively optimal solution can be calculated using the variable-step direct search method. The method for calculating the opposite-side direction of the hole boundary is to first calculate all the intersection points of the angular bisecting plane of the boundary vertex and the hole boundary line, fit a three-dimensional straight line equation using these intersection points, then sort according to the projection positions of the intersection points on the straight line, and after odd-even pairing, the intersection points on the opposite side of the boundary can be obtained (such as Figure 2 the opposite-side vertex S corresponding to boundary vertex E in). Finally, calculate the weighted average of these two directions as the final vertex direction.
[0036] Among them, for the calculation of the distance, calculating the distance of the newly added vertex includes:
[0037] Determining the distance of the newly added vertex according to the average side length of the hole boundary;
[0038] Among them, a distance threshold is used to constrain the distance of the newly added vertex, and the distance threshold is obtained in the following way: calculating the intersection point of the angular bisecting plane of the adjacent two boundary vertices along the direction of the newly added vertex by the boundary vertex, and taking the distances between the vertex and these two intersection points as the distance threshold.
[0039] Specifically, the distance of the newly added vertex is determined by the average side length of the hole boundary, but a maximum threshold needs to be used for constraint to avoid the appearance of long and narrow or intersecting triangles. The method is to calculate the intersection point of the angular bisecting plane of the adjacent two boundary vertices along the above direction by the boundary vertex, and the distances between the boundary vertex and these two intersection points are used as the maximum distance threshold of the newly added vertex (such as Figure 2 using the angular bisecting plane of vertex D and vertex F to limit the distance of the newly added vertex of vertex E).
[0040] It should be noted that if the direction of the newly added vertex in the embodiment of the present invention is not ideal, divergence is likely to occur, that is, the program falls into an infinite loop and the hole cannot be closed all the time. By combining local and global boundary information, not only should the dihedral angle of adjacent triangles be as large as possible, but also the vertex direction should be as much as possible towards the other side of the boundary line, so that the filled triangular mesh is smooth at the position close to the hole boundary and relatively flat at the middle position of the hole.
[0041] As an alternative embodiment, adding the newly added vertex and the corresponding triangle to the triangular mesh model in S2 further includes:
[0042] If the included angle between the two sides located on the hole boundary associated with the boundary vertex is less than a preset angle, add a triangle without adding a vertex to the mesh model, and delete the boundary vertex from the hole boundary vertex sequence; otherwise, add a vertex and two triangles to the mesh model, and use the newly added vertex to replace the original boundary vertex in the hole boundary vertex sequence.
[0043] Specifically, when the included angle between the two sides located on the hole boundary associated with the boundary vertex is small (a suitable threshold is 60 degrees), the steps of obtaining the newly added vertex in S1 and S2 should be skipped, directly add a triangle without adding a vertex to the mesh model, and then delete the boundary vertex from the hole boundary vertex sequence; otherwise, a vertex and two triangles need to be added to the mesh model, and the original boundary vertex in the hole boundary vertex sequence is replaced by the newly added vertex (such as Figure 2 for vertex E in, vertex G and triangles 2 and 3 need to be added, and vertex G is used to replace vertex E in the hole boundary).
[0044] S3. Re-enter S1 until the filling of the hole is completed.
[0045] Specifically, it is necessary to recalculate the priorities of the affected boundary vertices ( Figure 2 vertices D, G, F in), enter the next loop, and when there are only three vertices left on the hole boundary, directly add a triangle and end the process. Figure 2 The gray triangle in is the result of hole filling.
[0046] The method for filling an extra-large hole in a three-dimensional triangular mesh model provided by the embodiments of the present invention detects the hole boundary vertex sequence and evaluates the priority of each vertex; obtains the new vertices associated with the vertex with the highest priority, and adds the new vertices and the corresponding triangles to the triangular mesh model. By combining local and global boundary information to calculate the coordinates of the inserted vertices inside the hole, the divergence problem in the hole filling process is successfully solved. A large number of experimental results have proved that this method can obtain a better filling effect.
[0047] The embodiments of the present invention provide an electronic device, as Figure 4 shown, the device includes: a processor 501, a communication interface 502, a memory 503, and a communication bus 504. Among them, the processor 501, the communication interface 502, and the memory 503 complete mutual communication through the communication bus 504. The processor 501 can call the computer program stored on the memory 503 and executable on the processor 501 to execute the method for filling an extra-large hole in a three-dimensional triangular mesh model provided by the above embodiments, for example, including: S1. Detect the hole boundary vertex sequence and evaluate the priority of each vertex; S2. Obtain the new vertices associated with the vertex with the highest priority, and add the new vertices and the corresponding triangles to the triangular mesh model; S3. Re-enter S1 until the filling of the hole is completed.
[0048] The embodiments of the present invention also provide a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is implemented to execute the method for filling an extra-large hole in a three-dimensional triangular mesh model provided by the above embodiments, for example, including: S1. Detect the hole boundary vertex sequence and evaluate the priority of each vertex; S2. Obtain the new vertices associated with the vertex with the highest priority, and add the new vertices and the corresponding triangles to the triangular mesh model; S3. Re-enter S1 until the filling of the hole is completed.
[0049] It should be noted that in the above embodiments, the descriptions of the various embodiments have their own emphases. For parts not described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0050] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, apparatuses, or computer program products. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0051] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (apparatuses), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 or multiple blocks.
[0052] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 or multiple blocks.
[0053] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 or multiple blocks.
[0054] Although the preferred embodiments of the present invention have been described, additional changes and modifications can be made to these embodiments by those skilled in the art once they learn the basic inventive concept. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications falling within the scope of the present invention.
[0055] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these modifications and variations.
Claims
1. A method for filling ultra-large voids in a three-dimensional triangular mesh model, characterized in that, Including: S1. Detect the vertex sequence of the cavity boundary and evaluate the priority of each vertex; S2. Obtain the newly added vertices associated with the vertex with the highest priority, and add the newly added vertices and the corresponding triangles to the triangular mesh model; S3. Re-enter S1 until the cavity is filled; Obtaining the newly added vertices associated with the vertex with the highest priority in S2 includes: calculating the direction and distance of the newly added vertices; wherein, the direction of the newly added vertices is based on the following factors: minimizing the maximum value of the three dihedral angles affected by the direction of the newly added vertices, and making the direction of the newly added vertices point as much as possible to the opposite side of the cavity boundary; determining the coordinates of the newly added vertices according to the direction and the distance.
2. The method according to claim 1, wherein Detecting the vertex sequence of the cavity boundary in S1 includes: arranging the vertices on the cavity boundary in order in an array; wherein, for a cavity containing multiple loops, the cavity is converted into a single-loop cavity by building a bridge.
3. The method according to claim 1, wherein Evaluating the priority of each vertex in S1 includes: obtaining the priority of the vertex according to the included angle of the boundary line at the vertex, wherein the smaller the included angle, the higher the priority.
4. The method according to claim 3, wherein Obtaining the priority of the vertex according to the included angle of the boundary line at the vertex further includes: taking the average value of the included angles between the vertex and multiple connecting lines on its two sides as the included angle.
5. The method according to claim 1 or 3, characterized in that, Evaluating the priority of each vertex in S1 includes: for the area where the boundary is concave inward, reducing the priority of the vertices in this area according to a preset amplitude.
6. The method according to claim 1, wherein Calculating the direction of the newly added vertices includes: calculating all the intersection points of the angular bisecting plane of the vertex and the cavity boundary line, and fitting a three-dimensional straight line equation by using the intersection points; sorting according to the projection positions of the intersection points on the straight line, and obtaining the intersection points on the opposite side of the boundary after odd-even pairing, and taking the intersection points on the opposite side as the direction on the opposite side.
7. The method according to claim 1, wherein Calculating the distance of the newly added vertices includes: determining the distance of the newly added vertices according to the average side length of the cavity boundary; wherein, a distance threshold is used to constrain the distance of the newly added vertices, and the distance threshold is obtained by the following method: calculating the intersection points of the boundary vertices along the direction of the newly added vertices with the angular bisecting plane of two adjacent boundary vertices, and taking the distances between the vertex and these two intersection points as the distance threshold.
8. The method according to claim 1, characterized in that, Adding the newly added vertices and the corresponding triangles to the triangular mesh model in S2 further includes: if the included angle between the two sides located on the cavity boundary associated with the boundary vertex is less than a preset angle, adding a triangle without adding a vertex to the mesh model, and deleting the boundary vertex from the vertex sequence of the cavity boundary; otherwise, adding a vertex and two triangles to the mesh model, and using the newly added vertex to replace the original boundary vertex in the vertex sequence of the cavity boundary.
9. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method for filling an extra-large cavity in the three-dimensional triangular mesh model according to any one of claims 1 to 8.