Hole repairing method, electronic device and storage medium

文档序号:192794 发布日期:2021-11-02 浏览:14次 中文

阅读说明:本技术 孔洞修补方法、电子装置和存储介质 (Hole repairing method, electronic device and storage medium ) 是由 郑俊 周国勇 于 2021-07-12 设计创作,主要内容包括:本申请涉及一种孔洞修补方法、电子装置和存储介质,其中,该孔洞修补方法包括:获取标记点在三维网格模型中的中心坐标和标记点的半径;根据标记点的中心坐标和标记点的半径,确定几何体,其中,几何体的中心坐标与标记点的中心坐标相同;在几何体范围内,获取面片各顶点的坐标;根据面片各顶点的坐标,确定待修补孔洞的边界顶点集合;在三维网格模型中,根据边界顶点集合,确定待修补孔洞的边界,并对待修补孔洞的边界进行孔洞修补,其中,待修补的孔洞是标记点在三维网格模型中所在区域,通过本申请,解决了修复的孔洞区域数据错误率高的问题,实现了对孔洞区域的精准修补。(The application relates to a hole repairing method, an electronic device and a storage medium, wherein the hole repairing method comprises the following steps: acquiring the center coordinates of the mark points in the three-dimensional grid model and the radiuses of the mark points; determining a geometric body according to the central coordinate of the mark point and the radius of the mark point, wherein the central coordinate of the geometric body is the same as that of the mark point; in the range of the geometric body, obtaining the coordinates of each vertex of the patch; determining a boundary vertex set of the hole to be repaired according to the coordinates of each vertex of the patch; in the three-dimensional grid model, the boundary of the hole to be repaired is determined according to the boundary vertex set, and the hole repairing is carried out on the boundary of the hole to be repaired, wherein the hole to be repaired is the area where the mark point is located in the three-dimensional grid model.)

1. A hole repairing method is characterized by comprising the following steps:

acquiring the center coordinates of the mark points in the three-dimensional grid model and the radius of the mark points;

determining a geometric body according to the central coordinate of the mark point and the radius of the mark point, wherein the central coordinate of the geometric body is the same as that of the mark point;

in the geometric body range, obtaining the coordinates of each vertex of the patch;

determining a boundary vertex set of the hole to be repaired according to the coordinates of each vertex of the patch;

in the three-dimensional mesh model, determining the boundary of the hole to be repaired according to the boundary vertex set, and performing hole repairing on the boundary of the hole to be repaired, wherein the hole to be repaired is the area of the mark point in the three-dimensional mesh model.

2. The hole repairing method of claim 1, wherein determining the set of boundary vertices of the hole to be repaired according to the coordinates of the vertices of the patch comprises:

determining adjacent vertexes of the mark points according to the coordinates of the vertexes of the patch, wherein the number of the adjacent vertexes is more than one;

determining a first triangle set according to the adjacent vertexes, wherein at least one vertex in the first triangle is the adjacent vertex;

if one or two adjacent vertexes in the first triangle meet a first preset condition, retaining the non-adjacent vertexes in the first triangle to obtain the boundary vertex set.

3. The hole repairing method of claim 2, wherein determining the adjacent vertices of the mark points according to the coordinates of the vertices of the patch comprises:

and determining a spatial data structure according to the coordinates of each vertex of the patch, and determining the adjacent vertex of the mark point in the spatial data structure.

4. The method for repairing a hole according to claim 2, wherein the first predetermined condition comprises:

and the included angle between the normal line of the adjacent vertex and the normal line of the mark point is less than 90 degrees.

5. The hole repairing method according to claim 1, wherein determining the geometry based on the center coordinates of the marking points and the radii of the marking points comprises:

adding the radius of the mark point and a first preset value to obtain a preset size value of the mark point;

and determining the geometric body according to the preset size value and the radius of the mark point.

6. The hole repairing method of claim 1, wherein determining the boundary of the hole to be repaired according to the set of boundary vertices in the three-dimensional mesh model comprises:

determining a non-manifold vertex in the boundary vertex set, and recording the non-manifold vertex;

traversing each boundary vertex by taking the non-manifold vertex as a starting point, and determining the boundary of the first hole according to the number of adjacent triangles corresponding to each boundary vertex;

deleting the top points on the first hole boundary from the boundary top point set to obtain a boundary top point set of a second hole;

determining a boundary of a second hole according to a set of boundary vertices of the second hole.

7. The hole repairing method of claim 5, wherein determining the boundary of the first hole according to the number of the adjacent triangles corresponding to each of the boundary vertices comprises:

if the adjacent side corresponding to the boundary vertex has only one adjacent triangle, recording the adjacent side corresponding to the boundary vertex, and taking the adjacent side corresponding to the boundary vertex as a first hole boundary.

8. The hole repairing method according to claim 6, wherein determining the non-manifold vertices of the set of boundary vertices comprises:

in the three-dimensional mesh model, according to the boundary vertices, determining adjacent edges and adjacent triangles corresponding to the boundary vertices, and determining adjacent boundary edges from the adjacent edges according to a second preset condition, where the adjacent edges are edges with at least one boundary vertex as an end point, the adjacent triangles are triangles with at least one adjacent edge as an edge, and the second preset condition is that the number of the adjacent triangles corresponding to the adjacent edges is 1;

and acquiring the quantity of adjacent boundary edges and the quantity of adjacent triangles corresponding to each boundary vertex, and if the difference between the quantity of adjacent boundary edges corresponding to a certain boundary vertex in each boundary vertex and the quantity of adjacent triangles is greater than 1, determining the boundary vertex as a non-manifold vertex.

9. The hole repairing method of claim 1, wherein determining the boundary of the hole to be repaired according to the set of boundary vertices in the three-dimensional mesh model further comprises:

determining two end points of the area to be repaired according to the mark points, wherein the two end points of the area to be repaired are respectively a first end point and a second end point, the first sides of the first end point and the second end point are both the mark points, and the side opposite to the first side is not provided with the mark points;

in the three-dimensional mesh model, traversing adjacent edges corresponding to the boundary vertexes from the first end point, and if one adjacent edge has only one adjacent surface, taking the adjacent edge as the boundary of the hole to be repaired until the traversed boundary vertex is the second end point.

10. The hole repairing method according to claim 1, wherein repairing a hole according to the boundary of the hole to be repaired comprises:

determining a first included angle, a second included angle and a third included angle corresponding to each boundary vertex; the first included angle is an included angle between two adjacent sides corresponding to the same boundary vertex, the two adjacent sides of each boundary vertex respectively correspond to two adjacent triangles, the second included angle and the third included angle are included angles between the normal lines of the two adjacent triangles and the normal line of a second triangle, and the second triangle is a triangle formed by the two adjacent sides;

calculating a first angle sum corresponding to each boundary vertex, wherein the first angle sum is the sum of the first included angle, the second included angle and the third included angle;

determining a first vertex from the boundary vertex set according to the first angle sum, wherein the first vertex is the boundary vertex with the smallest sum of the first angle sum in the boundary vertex set;

the first vertex and two boundary edges corresponding to the first vertex determine a third triangle;

deleting the first vertex from the boundary vertex set, and executing the step of determining the first vertex from the boundary vertex set again according to the first angle until the number of the boundary vertices in the boundary vertex set is 0, wherein each third triangle is a hole area to be repaired.

11. The hole repairing method according to claim 10, wherein the step of repairing the hole according to the boundary of the hole to be repaired comprises:

and if the distances between the centroid of the third triangle and the three vertexes of the third triangle are all larger than a first threshold value, segmenting the third triangle according to the centroid of the third triangle, wherein the first threshold value is a constant multiple of the side length of the average adjacent side corresponding to each vertex of the third triangle.

12. The hole repairing method of claim 11, wherein the step of segmenting the third triangle according to the centroid of the third triangle comprises:

if the two third triangles have two overlapped vertexes, determining a circumscribed circle according to one of the two third triangles, if the non-overlapped vertex of the other one of the two third triangles is outside the circumscribed circle, connecting the non-overlapped vertexes of the two third triangles, and deleting overlapped edges of the two third triangles.

13. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the hole repairing method according to any one of claims 1 to 12.

14. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the hole repairing method according to any one of claims 1 to 12.

Technical Field

The present disclosure relates to the field of three-dimensional scanning, and more particularly, to a hole repairing method, device, electronic device, and storage medium.

Background

In the process of rapidly scanning and measuring the surface of the physical model through the 3D scanner, mark points are often required to be pasted on a scanned object, and position information is provided for a three-dimensional reconstruction algorithm; because the mark points have a certain thickness and high light reflectivity, holes are formed in the area where the mark points are located in the scanning data, resulting in the loss of the obtained three-dimensional grid model data, and therefore, the data in the hole area needs to be repaired.

The existing method for repairing the data of the hole area mainly comprises a repairing method based on a triangular mesh model and a repairing method based on a point cloud model, but the existing method for repairing the data of the hole area is easy to add the data of a non-hole area into a three-dimensional mesh model, so that the problem of high error rate of the repaired hole area is caused.

Disclosure of Invention

The present embodiment provides a hole repairing method, an electronic device, and a storage medium, so as to solve the problem of high data error rate of a repaired hole area in the related art.

In a first aspect, in this embodiment, a hole repairing method is provided, including:

acquiring the center coordinates of the mark points in the three-dimensional grid model and the radius of the mark points;

determining a geometric body according to the central coordinate of the mark point and the radius of the mark point, wherein the central coordinate of the geometric body is the same as that of the mark point;

in the geometric body range, obtaining the coordinates of each vertex of the patch;

determining a boundary vertex set of the hole to be repaired according to the coordinates of each vertex of the patch;

in the three-dimensional mesh model, determining the boundary of the hole to be repaired according to the boundary vertex set, and performing hole repairing on the boundary of the hole to be repaired, wherein the hole to be repaired is the area of the mark point in the three-dimensional mesh model.

In some embodiments, determining the set of boundary vertices of the hole to be repaired according to the coordinates of the vertices of the patch comprises:

determining adjacent vertexes of the mark points according to the coordinates of the vertexes of the patch, wherein the number of the adjacent vertexes is more than one;

determining a first triangle set according to the adjacent vertexes, wherein at least one vertex in the first triangle is the adjacent vertex;

if one or two adjacent vertexes in the first triangle meet a first preset condition, retaining the non-adjacent vertexes in the first triangle to obtain the boundary vertex set.

In some of these embodiments, determining the adjacent vertices of the marked points according to the coordinates of the vertices of the patch comprises:

and determining a spatial data structure according to the coordinates of each vertex of the patch, and determining the adjacent vertex of the mark point in the spatial data structure.

In some of these embodiments, the first preset condition comprises:

and the included angle between the normal line of the adjacent vertex and the normal line of the mark point is less than 90 degrees.

In some of these embodiments, determining the geometry based on the center coordinates of the marker point and the radius of the marker point comprises:

adding the radius of the mark point and a first preset value to obtain a preset size value of the mark point;

and determining the geometric body according to the preset size value and the radius of the mark point.

In some of these embodiments, in the three-dimensional mesh model, determining the boundary of the hole to be repaired from the set of boundary vertices includes:

determining a non-manifold vertex in the boundary vertex set, and recording the non-manifold vertex;

traversing each boundary vertex by taking the non-manifold vertex as a starting point, and determining the boundary of the first hole according to the number of adjacent triangles corresponding to each boundary vertex;

deleting the top points on the first hole boundary from the boundary top point set to obtain a boundary top point set of a second hole;

determining a boundary of a second hole according to a set of boundary vertices of the second hole.

In some embodiments, determining the boundary of the first hole according to the number of adjacent triangles corresponding to each of the boundary vertices comprises:

if the adjacent side corresponding to the boundary vertex has only one adjacent triangle, recording the adjacent side corresponding to the boundary vertex, and taking the adjacent side corresponding to the boundary vertex as a first hole boundary.

In some embodiments, determining the non-manifold vertices in the set of boundary vertices specifically includes:

in the three-dimensional mesh model, according to the boundary vertices, determining adjacent edges and adjacent triangles corresponding to the boundary vertices, and determining adjacent boundary edges from the adjacent edges according to a second preset condition, where the adjacent edges are edges with at least one boundary vertex as an end point, the adjacent triangles are triangles with at least one adjacent edge as an edge, and the second preset condition is that the number of the adjacent triangles corresponding to the adjacent edges is 1;

and acquiring the quantity of adjacent boundary edges and the quantity of adjacent triangles corresponding to each boundary vertex, and if the difference between the quantity of adjacent boundary edges corresponding to a certain boundary vertex in each boundary vertex and the quantity of adjacent triangles is greater than 1, determining the boundary vertex as a non-manifold vertex.

In some embodiments, in the three-dimensional mesh model, determining the boundary of the hole to be repaired according to the set of boundary vertices further includes:

determining two end points of the area to be repaired according to the mark points, wherein the two end points of the area to be repaired are respectively a first end point and a second end point, the first sides of the first end point and the second end point are both the mark points, and the side opposite to the first side is not provided with the mark points;

in the three-dimensional mesh model, traversing adjacent edges corresponding to the boundary vertexes from the first end point, and if one adjacent edge has only one adjacent surface, taking the adjacent edge as the boundary of the hole to be repaired until the traversed boundary vertex is the second end point.

In some of these embodiments, repairing the hole according to the boundary of the hole to be repaired includes:

determining a first included angle, a second included angle and a third included angle corresponding to each boundary vertex; the first included angle is an included angle between two adjacent sides corresponding to the same boundary vertex, the two adjacent sides of each boundary vertex respectively correspond to two adjacent triangles, the second included angle and the third included angle are included angles between the normal lines of the two adjacent triangles and the normal line of a second triangle, and the second triangle is a triangle formed by the two adjacent sides;

calculating a first angle sum corresponding to each boundary vertex, wherein the first angle sum is the sum of the first included angle, the second included angle and the third included angle;

determining a first vertex from the boundary vertex set according to the first angle sum, wherein the first vertex is the boundary vertex with the smallest sum of the first angle sum in the boundary vertex set;

the first vertex and two boundary edges corresponding to the first vertex determine a third triangle;

deleting the first vertex from the boundary vertex set, and executing the step of determining the first vertex from the boundary vertex set again according to the first angle until the number of the boundary vertices in the boundary vertex set is 0, wherein each third triangle is a hole area to be repaired.

In some embodiments, repairing the hole according to the boundary of the hole to be repaired comprises:

and if the distances between the centroid of the third triangle and the three vertexes of the third triangle are all larger than a first threshold value, segmenting the third triangle according to the centroid of the third triangle, wherein the first threshold value is a constant multiple of the side length of the average adjacent side corresponding to each vertex of the third triangle.

In some of these embodiments, segmenting the third triangle according to its centroid comprises:

if the two third triangles have two overlapped vertexes, determining a circumscribed circle according to one of the two third triangles, if the non-overlapped vertex of the other one of the two third triangles is outside the circumscribed circle, connecting the non-overlapped vertexes of the two third triangles, and deleting overlapped edges of the two third triangles.

In a second aspect, an electronic device is provided in this embodiment, and includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the hole repairing method according to the first aspect is implemented.

In a third aspect, a storage medium is provided in the present embodiment, on which a computer program is stored, which when executed by a processor, implements the hole repairing method according to the first aspect.

Compared with the related art, in the hole repairing method, the electronic device and the storage medium provided in the embodiment, the geometric body is determined according to the center coordinates of the mark points and the radiuses of the mark points, and the coordinates of the vertexes of the surface patch are obtained within the range of the geometric body, so that the vertexes in the non-hole area can be removed, further, the boundary of the hole to be repaired is determined based on the coordinates of the vertexes of the surface patch, the hole to be repaired is repaired according to the boundary of the hole to be repaired, the problem of high data error rate of the repaired hole area is solved, and accurate repairing of the hole area is achieved.

The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.

Drawings

The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:

fig. 1 is a block diagram of a hardware structure of an application terminal of a hole repairing method according to an embodiment of the present application;

FIG. 2 is a flow chart of a hole repairing method according to an embodiment of the present application;

FIG. 3 is a schematic view of a non-thin wall part according to an embodiment of the present application;

FIG. 4 is a schematic view of a thin-walled part according to an embodiment of the present application;

FIG. 5 is a schematic view of a non-manifold vertex in accordance with an embodiment of the present application;

FIG. 6 is a schematic view of a non-occluded cavity according to an embodiment of the present application;

FIG. 7 is a schematic diagram of a three-dimensional mesh prior to overlap edge exchange according to an embodiment of the present application;

FIG. 8 is a schematic diagram of a three-dimensional mesh after overlap edge swapping in accordance with an embodiment of the present application;

FIG. 9 is a schematic diagram of a three-dimensional mesh self-intersection according to an embodiment of the present application;

FIG. 10 is a schematic diagram illustrating the first vertex moving tangentially to the average coordinate value of a corresponding ring of area points according to an embodiment of the present application;

FIG. 11 is a flow chart of yet another hole repair method according to an embodiment of the present application;

FIG. 12 is a flow chart of another hole repairing method according to an embodiment of the present application;

FIG. 13 is a schematic view of a hole before repair according to an embodiment of the present application;

fig. 14 is a schematic view of a repaired hole according to an embodiment of the present application.

Detailed Description

For a clearer understanding of the objects, aspects and advantages of the present application, reference is made to the following description and accompanying drawings.

Unless defined otherwise, technical or scientific terms used herein shall have the same general meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The use of the terms "a" and "an" and "the" and similar referents in the context of this application do not denote a limitation of quantity, either in the singular or the plural. The terms "comprises," "comprising," "has," "having," and any variations thereof, as referred to in this application, are intended to cover non-exclusive inclusions; for example, a process, method, and system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or modules, but may include other steps or modules (elements) not listed or inherent to such process, method, article, or apparatus. Reference throughout this application to "connected," "coupled," and the like is not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. Reference to "a plurality" in this application means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. In general, the character "/" indicates a relationship in which the objects associated before and after are an "or". The terms "first," "second," "third," and the like in this application are used for distinguishing between similar items and not necessarily for describing a particular sequential or chronological order.

The method embodiments provided in the present embodiment may be executed in a terminal, a computer, or a similar computing device. For example, the method is executed on a terminal, and fig. 1 is a block diagram of a hardware structure of an application terminal of the hole repairing method according to the embodiment of the present application. As shown in fig. 1, the terminal may include one or more processors 102 (only one shown in fig. 1) and a memory 104 for storing data, wherein the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA. The terminal may also include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those of ordinary skill in the art that the structure shown in fig. 1 is merely an illustration and is not intended to limit the structure of the terminal described above. For example, the terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.

The memory 104 may be used to store a computer program, for example, a software program and a module of an application software, such as a computer program corresponding to the hole repairing method in the present embodiment, and the processor 102 executes the computer program stored in the memory 104 to execute various functional applications and data processing, thereby implementing the method described above. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.

The transmission device 106 is used to receive or transmit data via a network. The network described above includes a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.

In this embodiment, a hole repairing method is provided, and fig. 2 is a flowchart of a hole repairing method according to an embodiment of the present application, as shown in fig. 2, the flowchart includes the following steps:

step S201, obtaining the center coordinates of the mark points in the three-dimensional grid model and the radiuses of the mark points.

Step S202, determining a geometric body according to the central coordinate of the mark point and the radius of the mark point, wherein the central coordinate of the geometric body is the same as the central coordinate of the mark point.

In the present embodiment, the center of the mark point, which is inside the geometry, is taken as the body center of the geometry.

Step S203, in the geometric body range, the coordinates of each vertex of the patch are obtained.

And step S204, determining a boundary vertex set of the hole to be repaired according to the coordinates of each vertex of the patch.

Step S205, in the three-dimensional mesh model, according to the boundary vertex set, determining the boundary of the hole to be repaired, and performing hole repairing on the boundary of the hole to be repaired, wherein the hole to be repaired is the region where the mark point is located in the three-dimensional mesh model.

Through the steps, the geometric body is determined according to the center coordinates of the mark points and the radiuses of the mark points, and the coordinates of each vertex of the surface patch are obtained within the range of the geometric body, so that the vertex in the non-hole area can be removed, further, the boundary of the hole to be repaired is determined based on the coordinates of each vertex of the surface patch, the hole to be repaired is repaired according to the boundary of the hole to be repaired, the problem of high data error rate of the repaired hole area is solved, and accurate repairing of the hole area is achieved.

In some embodiments, determining the set of boundary vertices of the hole to be repaired according to the coordinates of the vertices of the patch includes:

determining adjacent vertexes of the mark points according to the coordinates of the vertexes of the patch, wherein the number of the adjacent vertexes is more than one;

determining a first triangle set according to adjacent vertexes, wherein at least one vertex in the first triangle is an adjacent vertex;

if one or two adjacent vertexes in the first triangle meet a first preset condition, retaining non-adjacent vertexes in the first triangle to obtain a boundary vertex set.

It can be understood that the first triangle set is determined according to the adjacent vertices of the patches, so that the vertices of all the patches are prevented from being used for determining the boundary vertex set, and the efficiency of determining the hole boundary vertices to be repaired is improved.

In some of these embodiments, determining adjacent vertices of the marked points based on the coordinates of the vertices of the patch comprises:

and determining a spatial data structure according to the coordinates of each vertex of the patch, and determining the adjacent vertex of the mark point in the spatial data structure.

In this embodiment, the spatial data structure includes an octree and a K-D tree, but is not limited to the two spatial data structures, and the specific spatial data structure is not limited herein.

The spatial Data Structure (SpatiaI Data Structure) is a logical Structure in which spatial Data is suitable for storage, management, and processing in a computer, and is an organization and encoding format of spatial Data in a computer.

It can be understood that, in this embodiment, the adjacent vertex of the mark point can be quickly determined according to the spatial data structure, and the efficiency of determining the adjacent vertex of the mark point is improved.

In some of these embodiments, the first preset condition comprises:

the normal line of the adjacent vertex is at an angle of less than 90 degrees to the normal line of the marking point.

In this embodiment, a geometric body is determined according to a central coordinate of a mark point and a radius of the mark point, where the geometric body may be a sphere or a rectangular parallelepiped, and in this embodiment, the shape of the geometric body is not limited, and here, the geometric body is described as an example of a sphere, please refer to fig. 3 and 4, fig. 3 is a schematic diagram of a non-thin wall part according to an embodiment of the present application, fig. 4 is a schematic diagram of a thin wall part according to an embodiment of the present application, in fig. 3 and 4, a hollow circular point in the middle is a mark point, a dashed circle is a sphere with a mark point as a sphere center, a non-mark point in the dashed circle is an adjacent vertex to be deleted, an arrow direction indicates each adjacent vertex and a normal vector of the mark point, as shown in fig. 3, in a sphere range, the non-thin wall part has only one surface, as shown in fig. 4, in a sphere range, the thin wall part has two surfaces, if an included angle between the adjacent vertex and a normal of the mark point is not considered, the surfaces on both sides of the thin-walled part are deleted to cause the data deletion of the thin-walled part, and as can be seen from fig. 4, the included angle between the normal line of the adjacent vertex on the surface on the side without the mark point and the normal line of the mark point is greater than 90 degrees, so that the included angle between the normal line of the adjacent vertex and the normal line of the mark point is considered in the embodiment, and the adjacent vertex with the included angle smaller than 90 degrees is deleted, so that the data deletion of the surface on the side without the mark point in the non-thin-walled part can be avoided.

In some of these embodiments, determining the geometry based on the center coordinates of the marker point and the radius of the marker point comprises:

adding the radius of the mark point and the first preset value to obtain a preset size value of the mark point;

and determining the geometric body according to the preset size value and the radius of the mark point.

It can be understood that, because the data reconstructed near the mark point is poor, in this embodiment, the radius of the mark point is added to the first preset value to obtain the preset size value of the mark point, the geometric solid is determined according to the preset size value and the radius of the mark point, and further, the adjacent vertex inside the geometric solid is deleted, that is, the poor data near the mark point can be deleted, so that the hole area data can be more accurately repaired.

Fig. 5 is a schematic diagram of a non-manifold vertex according to an embodiment of the present application, and as shown in fig. 5, two holes are located near the non-manifold vertex P, and when determining the hole boundaries according to the number of adjacent triangles corresponding to each boundary vertex, only the boundary of one hole can be found by using the conventional hole repairing method, because the boundary of another hole cannot be determined after determining one hole according to the boundary vertices in the prior art, the present application determines the boundaries of two holes in the following manner.

In some of these embodiments, in the three-dimensional mesh model, determining the boundary of the hole to be repaired from the set of boundary vertices comprises:

determining a non-manifold vertex in the boundary vertex set, and recording the non-manifold vertex;

traversing each boundary vertex by taking the non-manifold vertex as a starting point, and determining the boundary of the first hole according to the number of adjacent triangles corresponding to each boundary vertex;

deleting the top points on the boundary of the first hole from the boundary top point set to obtain a boundary top point set of a second hole;

and determining the boundary of the second hole according to the boundary vertex set of the second hole.

In this embodiment, the non-manifold vertex is taken as a starting point, the boundary vertex of the second hole is traversed, and if there is only one adjacent triangle corresponding to the boundary vertex, the adjacent edge is taken as the boundary of the second hole.

By the mode, the determined non-manifold vertexes are used as the starting points to traverse the boundary vertexes, the boundary of the first hole is determined according to the number of the adjacent triangles of the boundary vertexes, and then the vertexes on the boundary of the first hole are deleted from the boundary vertex set, so that the boundary vertex of the second hole can be determined, the boundary of the second hole can be further determined according to the non-manifold vertexes and the boundary vertex of the second hole, the boundary determination of the two holes with the non-manifold vertexes is realized, the problem that all holes to be repaired cannot be repaired is solved, and the repairing of the holes to be repaired can be more accurately completed.

In some of these embodiments, determining the boundary of the first hole based on the number of adjoining triangles corresponding to each boundary vertex comprises:

if the adjacent side corresponding to the boundary vertex has only one adjacent triangle, recording the adjacent side corresponding to the boundary vertex, and taking the adjacent side corresponding to the boundary vertex as the first hole boundary.

It can be understood that, in this embodiment, if there is only one adjacent triangle corresponding to the vertex of the boundary, it is indicated that the adjacent edge is a boundary edge, and all the boundary edges form the boundary of the first hole, so as to implement the determination of the boundary of the first hole.

In some embodiments, determining the non-manifold vertices in the set of boundary vertices specifically includes:

in the three-dimensional mesh model, determining each adjacent side and each adjacent triangle corresponding to each boundary vertex according to the boundary vertices, and determining adjacent boundary sides from the adjacent sides according to a second preset condition, wherein the adjacent sides are sides with at least one boundary vertex as an end point, the adjacent triangles are triangles with at least one adjacent side as a side, and the second preset condition is that the number of the adjacent triangles corresponding to the adjacent sides is 1;

and acquiring the number of adjacent boundary edges and the number of adjacent triangles corresponding to each boundary vertex, and determining the boundary vertex as a non-manifold vertex if the difference between the number of adjacent boundary edges corresponding to a certain boundary vertex in each boundary vertex and the number of adjacent triangles is greater than 1.

In this embodiment, please refer to fig. 5, the number of the adjacent boundary edges corresponding to the non-manifold vertex is 4, the number of the adjacent triangles corresponding to the non-manifold vertex is 2, if the boundary vertex is a non-manifold vertex, the number of the adjacent boundary edges corresponding to the boundary vertex is 2, and the number of the adjacent triangles corresponding to the boundary vertex is 2, so that the non-manifold vertex can be determined according to the difference between the number of the adjacent boundary edges corresponding to the boundary vertex and the number of the adjacent triangles.

By the mode, the determination of the non-manifold vertex is realized, and further, the repair of two holes adjacent to the non-manifold vertex can be realized according to the non-manifold vertex, so that the repair of the hole to be repaired can be completed more accurately.

When the mark points are attached to the edge of the three-dimensional grid model, because the mark point area and data in a certain range of the mark points are not ideal, the mark points need to be deleted, and a newly appeared boundary after the data is deleted can be communicated with an inherent boundary outside the three-dimensional grid model to form a large boundary which may contain the edge of the whole three-dimensional grid model. Since the newly introduced boundary is not closed, referring to fig. 6, the boundary finding algorithm fails to return to the starting point from the starting point, and continues to iterate along the outer boundary, resulting in incorrect boundary data. The repair of the non-closed type hole is accurately completed in the following manner in the present application.

In some embodiments, in the three-dimensional mesh model, determining the boundary of the hole to be repaired according to the set of boundary vertices further comprises:

determining two end points of the area to be repaired according to the mark points, wherein the two end points of the area to be repaired are a first end point and a second end point respectively, the first sides of the first end point and the second end point are both mark points, and the side opposite to the first side is not provided with the mark points;

in the three-dimensional mesh model, traversing adjacent edges corresponding to all boundary vertexes from a first endpoint, and if the adjacent edges have one or more adjacent surfaces, taking the adjacent edges as the boundaries of the holes to be repaired until the traversed boundary vertexes are second endpoints.

In this embodiment, the hole to be repaired is an area where the mark point is located, and data in the mark point area and the mark point expanded within a certain range is not ideal, and therefore needs to be deleted, assuming that a boundary vertex set newly introduced by deleting data is a, and a boundary vertex set inherent to the three-dimensional mesh model is B, a vertex set C is obtained when the mark point area is deleted, and vertices in the set C necessarily belong to the set a, in this embodiment, the first end point is determined as a start point P1, and the second end point is determined as an end point P2.

Traversing and searching all edges connected with the vertexes in the vertex set C, for example, directly obtaining all edges connected with the vertexes in the vertex set C through a mesh topology connection relation or according to adjacent edges of the vertexes, if one vertex of the edge belongs to A and the other vertex belongs to B, then the vertex belonging to A is a potential first endpoint or a second endpoint, finding out all vertexes meeting the above conditions in C, obtaining a set D, taking one vertex in D as a starting point P1, then searching boundary vertexes in the set A in a counterclockwise direction until a third preset condition is met, stopping, for example, the third preset condition is that n continuous newly found vertexes all belong to the set B, obtaining a series of boundary data E after stopping, the boundary data E being a vertex or an edge, searching the vertex belonging to the first set D forward from the end of E as a termination point P2, and calculating the number k of the vertexes between the P1 and the P2, finding a correct hole boundary if the occupation ratio of the k in the set C is greater than a second threshold, for example, the second threshold is 0.8, otherwise, continuously taking a vertex from the D and continuing the iteration until the occupation ratio of the number of the vertexes between the P1 and the P2 in the set C is greater than the second threshold.

Through the above, the repairing of the non-closed hole is realized according to the first end point and the second end point of the non-closed hole, that is, the hole repairing method according to the embodiment can be applied to the scene of the non-closed hole, and the scene applicability of the three-dimensional scanning is improved.

When repairing according to the hole boundary to be repaired, if the included angle between two adjacent edges corresponding to the boundary vertex is greater than 180 °, the repaired triangular network overlaps with the original network.

In some of these embodiments, repairing the hole according to the boundary of the hole to be repaired comprises:

determining a first included angle, a second included angle and a third included angle corresponding to each boundary vertex; the first included angle is an included angle between two adjacent sides corresponding to the same boundary vertex, the two adjacent sides of each boundary vertex respectively correspond to two adjacent triangles, the second included angle and the third included angle are included angles between the normal lines of the two adjacent triangles and the normal line of the second triangle respectively, and the second triangle is a triangle formed by the two adjacent sides;

calculating a first angle sum corresponding to each boundary vertex, wherein the first angle sum is the sum of a first included angle, a second included angle and a third included angle;

determining a first vertex from the boundary vertex set according to the first angle sum, wherein the first vertex is the boundary vertex with the smallest sum of the first angle sum in the boundary vertex set;

the first vertex and two boundary edges corresponding to the first vertex determine a third triangle;

and deleting the first vertex from the boundary vertex set, and executing the step of determining the first vertex from the boundary vertex set according to the first angle again until the number of the boundary vertices in the boundary vertex set is 0, wherein each third triangle is a hole area to be repaired.

It can be understood that, in the present embodiment, when repairing a hole to be repaired, an included angle between two adjacent edges corresponding to a boundary vertex is considered, so as to solve the technical problem that a repaired triangular network overlaps with an original network, in addition, in the hole repairing process, an included angle between a normal line of two adjacent triangles and a normal line of a second triangle is considered, and the hole is repaired from a sum minimum of the second included angle and a third included angle, it should be noted that a sum minimum of the second included angle and the third included angle represents that the three-dimensional mesh is flattest, that is, in the present embodiment, repairing is started from a flattest position of the three-dimensional mesh, so that the repaired three-dimensional mesh is closer to the original three-dimensional mesh, that is, repairing of the hole to be repaired can be completed more accurately.

After the hole to be repaired is repaired, the problem that the repaired three-dimensional grid is uneven is solved in the following mode.

In some of these embodiments, repairing the hole according to the boundary of the hole to be repaired comprises:

and if the distances between the centroid of the third triangle and the three vertexes of the third triangle are all larger than a first threshold, segmenting the third triangle according to the centroid of the third triangle, wherein the first threshold is a constant multiple of the side length of the average adjacent side corresponding to each vertex of the third triangle.

It can be understood that the first threshold in this embodiment may be set according to an actual three-dimensional mesh resolution, where the size of the first threshold is not specifically limited, and the size of the first threshold may be adjusted according to an actual situation, and if distances between a centroid of the third triangle and three vertices of the third triangle are greater than the first threshold, it is described that an area of the third triangle is too large, at this time, the third triangle needs to be segmented, and the size of the area of each segmented third triangle is more appropriate, so that the segmented three-dimensional mesh is more uniform.

In some of these embodiments, segmenting the third triangle according to its centroid comprises:

and if the non-overlapping vertex of the other one of the two third triangles is outside the circumscribed circle, connecting the non-overlapping vertices of the two third triangles, and deleting the overlapping edges of the two third triangles.

In this embodiment, fig. 7 is a schematic diagram before the overlapping edges in the three-dimensional mesh are swapped, fig. 8 is a schematic diagram after the overlapping edges in the three-dimensional mesh are swapped, as shown in fig. 7, a non-overlapping vertex of another one of the two third triangles is outside the circumscribed circle, at this time, the non-overlapping vertices of the two third triangles are connected, and the overlapping edges in the two third triangles are deleted, as can be seen from comparing fig. 7 and fig. 8, the sizes of the two third triangles in fig. 8 are more uniform than the sizes of the two third triangles in fig. 7.

By the method, after the third triangle is segmented, the repaired three-dimensional mesh is further more uniform.

After the hole repairing is completed, some grids may have self-intersections, and fig. 9 is a schematic diagram of a three-dimensional grid self-intersection according to an embodiment of the present application, which solves the technical problem of the repaired three-dimensional grid self-intersection in the following manner.

In some embodiments, repairing the hole according to the boundary of the hole to be repaired further comprises:

traversing each first vertex in the hole to be repaired, and determining a ring domain point corresponding to each first vertex according to the connection relation of each first vertex, wherein the first vertex is connected with the ring domain point to obtain the side of a triangle in the hole to be repaired;

and calculating the average coordinate value of a ring field point corresponding to each first vertex, and moving each first vertex to the average coordinate value of a corresponding ring field point along the tangential direction.

In the present embodiment, a ring region point is C, D, E, F in fig. 9, and fig. 10 is a schematic diagram illustrating that the first vertex moves to the average coordinate value of the corresponding ring region point along the tangential direction according to the embodiment of the present application.

By the mode, the technical problem of self-intersection of the repaired three-dimensional grids is solved, and the repaired holes are closer to real scanned objects.

Fig. 11 is a flowchart of a further hole repairing method according to an embodiment of the present application, and as shown in fig. 11, the flowchart includes the following steps:

step S1101, obtaining a center coordinate of the mark point in the three-dimensional mesh model and a radius of the mark point.

Step S1102, adding the radius of the mark point to the first preset value to obtain a preset size value of the mark point.

And S1103, determining a geometric body according to the preset size value and the radius of the mark point.

In step S1104, coordinates of vertices of the patch are obtained within the geometric range.

Step S1105, establishing a spatial data structure according to the coordinates of each vertex of the patch, and determining the adjacent vertices of the mark points in the spatial data structure, wherein the number of the adjacent vertices is more than one.

In step S1106, a first triangle set is determined according to neighboring vertices, wherein at least one vertex in the first triangle is a neighboring vertex.

In step S1107, if one or two adjacent vertices in the first triangle satisfy the first preset condition, the non-adjacent vertices in the first triangle are retained to obtain the boundary vertex set.

In this embodiment, the first preset condition is: the normal line of the adjacent vertex is at an angle of less than 90 degrees to the normal line of the marking point.

Step S1108, in the three-dimensional mesh model, determining a boundary of the hole to be repaired according to the boundary vertex set, and performing hole repairing on the boundary of the hole to be repaired, where the hole to be repaired is an area where the mark point is located in the three-dimensional mesh model.

In step S1109, if the distances between the centroid of the third triangle and the three vertices of the third triangle are all greater than a first threshold, the third triangle is segmented according to the centroid of the third triangle, where the first threshold is a constant multiple of the length of the average adjacent side corresponding to each vertex of the third triangle.

In step S1110, if two third triangles have two overlapping vertices, a circumscribed circle is determined according to one of the two third triangles, and if a non-overlapping vertex of another one of the two third triangles is outside the circumscribed circle, the non-overlapping vertices of the two third triangles are connected, and overlapping edges of the two third triangles are deleted.

Through the steps, the geometric body is determined according to the central coordinates of the mark points and the radiuses of the mark points, the coordinates of all vertexes of the surface patch are obtained within the range of the geometric body, a space data structure is established according to the coordinates of all vertexes of the surface patch, and the adjacent vertexes of the mark points are determined in the space data structure, so that the vertexes in the non-hole area can be removed, further, the boundaries of the holes to be repaired are determined based on the coordinates of all vertexes of the surface patch, the holes to be repaired are repaired according to the boundaries of the holes to be repaired, the problem of high data error rate of the repaired hole area is solved, and accurate repairing of the hole area is achieved.

Fig. 12 is a flowchart of a hole repairing method according to an embodiment of the present application, and as shown in fig. 12, the flowchart includes the following steps:

step S1201, determine a set of boundary vertices of the hole to be repaired.

In the embodiment, because the data reconstructed near the mark point is poor, the data generally needs to be expanded by 3-5 mm on the basis of the radius of the mark point, and the expanded radius is assumed to be r;

extracting the vertex coordinates of a surface patch in the triangular mesh model, determining the vertex of the surface patch in a square box with the length of 2r by taking the mark point as the central side by comparing the vertex coordinates of the surface patch with the mark point coordinates, then establishing a local kd tree by using the vertex of the surface patch in the square box, and searching the adjacent vertex of the mark point in the local kd tree, so that the whole vertex data can be prevented from being established, and the algorithm efficiency is improved;

determining an included angle between the normal of each adjacent vertex and the normal of the mark point, marking the adjacent vertex with the angle smaller than 90 degrees as deleted, otherwise marking as reserved, and deleting the grid data associated with the adjacent vertex marked as deleted, thereby avoiding mistakenly deleting the data of the thin-walled workpiece;

in the three-dimensional mesh model, if only one or two vertexes of a certain triangle are marked and deleted, the triangle should be located at the edge position of the marked point area, after the grid data associated with the adjacent vertexes marked and deleted are deleted, the vertexes not marked and deleted become boundary vertexes of holes to be repaired, and the boundary vertexes of the holes to be repaired are recorded and used as a basis for searching the boundary of the holes to be repaired.

Step S1202, determine the boundary of the hole to be repaired according to the boundary vertex set.

In the triangular mesh model, if the adjacent edge corresponding to the boundary vertex has one and only one adjacent triangle, the adjacent edge of the boundary vertex is the boundary edge,

the number of the adjacent triangles corresponding to all the boundary vertexes is judged, so that the boundary of the hole to be repaired contained in the whole triangular mesh model can be extracted, and the non-manifold vertexes exist in the real-time mesh, for example, the non-manifold vertexes are possibly introduced after the mesh data associated with the adjacent vertexes marked as deletion are deleted, so that the accurate extraction of the boundary of the hole to be repaired has certain difficulty. Fig. 5 is a schematic diagram of non-manifold vertices according to an embodiment of the present disclosure, as shown in fig. 5, after grid data associated with neighboring vertices marked as deletions are deleted, a small hole is introduced, which may interfere with extraction of a hole boundary to be repaired, in this embodiment, determination of boundaries of two holes to be repaired is completed by determining, in a three-dimensional grid model, each adjacent edge and each adjacent triangle corresponding to each boundary vertex according to the boundary vertices, and determining an adjacent boundary edge from the adjacent edges according to a second preset condition, where the adjacent edge is an edge with at least one boundary vertex as an end point, the adjacent triangle is a triangle with at least one adjacent edge as an edge, and the second preset condition is that the number of adjacent triangles corresponding to the adjacent edges is 1;

acquiring the number of adjacent boundary edges and the number of adjacent triangles corresponding to each boundary vertex, and if the difference between the number of adjacent boundary edges corresponding to a certain boundary vertex in each boundary vertex and the number of adjacent triangles is greater than 1, determining the boundary vertex as a non-manifold vertex;

traversing each boundary vertex by taking the non-manifold vertex as a starting point, recording adjacent edges corresponding to the boundary vertices if the adjacent edges corresponding to the boundary vertices have only one adjacent triangle, and taking the adjacent edges corresponding to the boundary vertices as first hole boundaries;

deleting the top points on the boundary of the first hole from the boundary top point set to obtain a boundary top point set of a second hole;

and determining the boundary of the second hole according to the boundary vertex set of the second hole.

In addition, if the mark point is attached to the edge of the object, the mesh data associated with the adjacent vertex marked as deleted is deleted, and then a non-closed hole to be repaired is formed, as shown in fig. 6, the hole is repaired by finding the hole end points p1 and p2, and then traversing from the point p1 to find the boundary edge until the point p2 is traversed, and then a complete hole is considered to be formed.

In step S1203, the hole to be repaired is repaired according to the boundary of the hole to be repaired.

In the embodiment, a first included angle, a second included angle and a third included angle corresponding to each boundary vertex are determined; the first included angle is an included angle between two adjacent sides corresponding to the same boundary vertex, the two adjacent sides of each boundary vertex respectively correspond to two adjacent triangles, the second included angle and the third included angle are included angles between the normal lines of the two adjacent triangles and the normal line of the second triangle respectively, and the second triangle is a triangle formed by the two adjacent sides; calculating a first angle sum corresponding to each boundary vertex, wherein the first angle sum is the sum of a first included angle, a second included angle and a third included angle; determining a first vertex from the boundary vertex set according to the first angle sum, wherein the first vertex is the boundary vertex with the smallest sum of the first angle sum in the boundary vertex set; the first vertex and two boundary edges corresponding to the first vertex determine a third triangle; deleting the first vertex from the boundary vertex set, and performing the step of determining the first vertex from the boundary vertex set according to the first angle again until the number of the boundary vertices in the boundary vertex set is 0, where each third triangle is a hole region to be repaired, as shown in fig. 13 and 14, fig. 13 is a schematic diagram before hole repairing according to an embodiment of the present application, and fig. 14 is a schematic diagram after hole repairing according to an embodiment of the present application.

In step S1204, post-processing is performed on the repaired hole.

In this embodiment, if distances between a centroid of the third triangle and three vertices of the third triangle are greater than a first threshold, the third triangle is segmented according to the centroid of the third triangle, where the first threshold is a constant multiple of the side length of an average adjacent side corresponding to each vertex of the third triangle;

if the two third triangles have two overlapped vertexes, determining a circumscribed circle according to one of the two third triangles, if the non-overlapped vertex of the other one of the two third triangles is outside the circumscribed circle, connecting the non-overlapped vertexes of the two third triangles, and deleting overlapped edges of the two third triangles;

traversing each first vertex in the hole to be repaired, and determining a ring domain point corresponding to each first vertex according to the connection relation of each first vertex, wherein the first vertex is connected with the ring domain point to obtain the side of a triangle in the hole to be repaired;

and calculating the average coordinate value of a ring field point corresponding to each first vertex, and moving each first vertex to the average coordinate value of a corresponding ring field point along the tangential direction.

Through the steps, the geometric body is determined according to the central coordinates of the mark points and the radiuses of the mark points, the coordinates of all vertexes of the surface patch are obtained within the range of the geometric body, a space data structure is established according to the coordinates of all vertexes of the surface patch, and the adjacent vertexes of the mark points are determined in the space data structure, so that the vertexes in the non-hole area can be removed, further, the boundaries of the holes to be repaired are determined based on the coordinates of all vertexes of the surface patch, the holes to be repaired are repaired according to the boundaries of the holes to be repaired, the problem of high data error rate of the repaired hole area is solved, and accurate repairing of the hole area is achieved.

There is also provided in this embodiment an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.

Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.

Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:

and acquiring the center coordinates of the mark points in the three-dimensional grid model and the radius of the mark points.

And determining the geometric body according to the central coordinate of the mark point and the radius of the mark point, wherein the central coordinate of the geometric body is the same as that of the mark point.

And acquiring the coordinates of each vertex of the patch in the range of the geometric body.

And determining a boundary vertex set of the hole to be repaired according to the coordinates of each vertex of the patch.

In the three-dimensional mesh model, determining the boundary of the hole to be repaired according to the boundary vertex set, and performing hole repairing on the boundary of the hole to be repaired, wherein the hole to be repaired is the area where the mark point is located in the three-dimensional mesh model.

It should be noted that, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments and optional implementations, and details are not described again in this embodiment.

In addition, in combination with the hole repairing method provided in the above embodiment, a storage medium may also be provided in this embodiment. The storage medium having stored thereon a computer program; the computer program, when executed by a processor, implements any of the hole repairing methods in the above embodiments.

It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to be limiting. All other embodiments, which can be derived by a person skilled in the art from the examples provided herein without any inventive step, shall fall within the scope of protection of the present application.

It is obvious that the drawings are only examples or embodiments of the present application, and it is obvious to those skilled in the art that the present application can be applied to other similar cases according to the drawings without creative efforts. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.

The term "embodiment" is used herein to mean that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is to be expressly or implicitly understood by one of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

The above examples only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the patent protection. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

27页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:三维模型的生成装置、生成方法和存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!