Hole detection and repair method and device based on boundary extraction and medium

By using a boundary extraction algorithm to filter and classify holes, combined with a 3D visualization feedback mechanism, the problems of low efficiency and poor controllability in hole repair in existing technologies have been solved, achieving efficient and controllable hole repair results.

CN121120989APending Publication Date: 2025-12-12SHENZHEN BERXEL PHOTONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511239760.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-01
Publication Date
2025-12-12

AI Technical Summary

Technical Problem

Existing hole repair technologies are inefficient, poorly controllable, and have a high rate of false identification in large-scale meshes. They cannot effectively identify and flexibly control the repair location and method, leading to incorrect filling.

Method used

A set of hole boundaries is constructed using a boundary extraction algorithm. Holes are then filtered and classified using a set maximum perimeter threshold. Holes smaller than the threshold are automatically filled, and holes larger than the threshold are repaired through user interaction. Target holes are identified using a 3D visualization feedback mechanism.

Benefits of technology

It achieves efficient and controllable hole repair, improves processing efficiency and user interactivity, reduces false recognition rate, and is suitable for 3D models of different sizes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121120989A_ABST
    Figure CN121120989A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a hole detection and repair method and device based on boundary extraction and a medium. The method comprises the steps of determining triangular mesh data needing to be detected and repaired; according to the triangular mesh data, obtaining a boundary set of all edges contained by only one surface patch; in the boundary set, any one edge is taken as a starting edge of hole tracking, and adjacent vertexes are gradually connected to form a closed path; after determining that the closed path is a closed hole path, determining a three-dimensional space perimeter corresponding to each closed hole path; if the perimeter of the three-dimensional space is smaller than or equal to a set threshold value, determining that the closed hole path corresponds to a small hole, and adding the small hole into a first hole set; otherwise, determining that the closed hole path corresponds to a large hole, and adding the large hole into a second hole set; and repairing each hole in the first hole set and the second hole set to obtain repaired grid data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of three-dimensional reconstruction technology, and in particular to a method, apparatus and medium for detecting and repairing holes based on boundary extraction. Background Technology

[0002] With the widespread application of 3D reconstruction and point cloud modeling technologies, triangular mesh models generated based on RGB-D cameras, LiDAR, or multi-view image fusion often have problems such as holes, discontinuous patches, or topological damage. These holes may be caused by missing data, occlusion, blind spots, or algorithm reconstruction errors. If they are not repaired, they will seriously affect the subsequent application effects such as texture mapping, structural analysis, simulation calculation, and 3D printing.

[0003] Existing hole repair techniques mainly include regular mesh interpolation, global reconstruction, or machine learning methods. Although they can fill missing areas under certain conditions, they often have some problems, such as: low efficiency, especially in large-scale meshes, where identifying and manually selecting each hole is time-consuming and laborious; poor controllability, as most automated methods do not support users' flexible control over the repair location and method, which may lead to incorrect filling; and high misidentification rate, lacking an effective boundary recognition mechanism, which easily misidentifies model edges or feature lines as holes. Summary of the Invention

[0004] Therefore, it is necessary to propose a method, device, and medium for detecting and repairing holes based on boundary extraction to address the above problems.

[0005] A method for detecting and repairing holes based on boundary extraction, the method comprising:

[0006] The triangular mesh data that needs to be detected and repaired is determined. The triangular mesh data includes several polygonal patches and three-dimensional point cloud data containing only position information corresponding to the vertices. Each polygonal patch consists of multiple edges, and each edge includes two vertices.

[0007] Based on the triangular mesh data, obtain the boundary set of all edges that are contained in only one facet;

[0008] In the set of boundaries, any edge is selected as the starting edge for hole tracing, and adjacent vertices are gradually connected to form a closed path;

[0009] After determining that the closed path is a closed hole path, the corresponding three-dimensional spatial perimeter is determined for each closed hole path;

[0010] If the perimeter of the three-dimensional space is less than or equal to the set threshold max_perimeter, the closed hole path is determined to be a small hole and added to the first hole set hole_edges_min; otherwise, the closed hole path is determined to be a large hole and added to the second hole set hole_edges_max.

[0011] Repair each hole in the first hole set hole_edges_min and the second hole set hole_edges_max to obtain repaired mesh data.

[0012] Preferably, obtaining the boundary set of all edges contained in only one facet based on the triangular mesh data specifically includes: traversing the polygonal faces in the triangular mesh data, extracting all constituent edges of each polygonal facet, and combining the three-dimensional point cloud data containing only position information to extract vertex index pairs of each constituent edge;

[0013] Add each edge to the edge set and remove duplicate edges from the edge set to obtain the boundary set of all edges that are contained in only one face.

[0014] Preferably, after obtaining the boundary set of all edges contained by only one patch, the method further includes: traversing each boundary edge in the boundary set, and using the 3D point cloud data containing only position information to establish a list of edges connected to each vertex in the vertex index pair of each boundary edge, thereby obtaining a mapping table from vertex to edge.

[0015] Preferably, determining that the closed path is a closed hole path specifically includes: if the number of vertices in the closed path is greater than or equal to 3, and the starting point and the ending point are the same, then confirming that the closed path is a closed hole path.

[0016] Preferably, determining the corresponding three-dimensional spatial perimeter for each of the closed hole paths specifically includes: the three-dimensional spatial perimeter is obtained by successively accumulating the Euclidean distances between adjacent vertices in the closed hole path.

[0017] Preferably, the repair of each hole in the first hole set `hole_edges_min` and the second hole set `hole_edges_max` specifically includes:

[0018] The position information of the boundary vertices of each hole in the 3D point cloud data is extracted sequentially, and the corresponding boundary point cloud is constructed accordingly.

[0019] Based on the vertex-to-edge mapping table, construct a new face of type pcl::Vertices and insert it into the polygons container of the triangular mesh data that needs to be detected and repaired to complete the filling of the hole;

[0020] Remove the hole from either the first hole set hole_edges_min or the second hole set hole_edges_max.

[0021] Preferably, the method further includes: highlighting the large holes in the second hole set hole_edges_max;

[0022] Specifically, this includes: sequentially extracting the position information of the boundary vertices of each large hole in the 3D point cloud data, and using this information to construct the corresponding boundary point cloud;

[0023] Each boundary point cloud is rendered using a highlight color;

[0024] For each rendered boundary point cloud, connect adjacent point pairs in sequence, and connect the first and last nodes to form a closed boundary curve.

[0025] Preferably, the method further includes:

[0026] Register mouse click events to obtain the location information of the clicked location when a specified location is clicked by the mouse in the 3D visualization interface;

[0027] The clicked location is marked and feedback is provided;

[0028] The geometric center point of each hole is determined in the first hole set hole_edges_min and the second hole set hole_edges_max, respectively.

[0029] Determine the Euclidean distance between the click location and the geometric center of all holes, and select the hole with the closest distance as the target hole;

[0030] The target holes are repaired. After the repair is completed, the mesh model is updated in real time and the current state is redisplayed, including the highlighted areas of the remaining holes.

[0031] A device for detecting and repairing holes based on boundary extraction, the device comprising:

[0032] Mesh construction unit is used to determine the triangular mesh data that needs to be detected and repaired. The triangular mesh data includes several polygonal patches and three-dimensional point cloud data containing only position information corresponding to the vertices. Each polygonal patch consists of multiple edges, and each edge includes two vertices.

[0033] A boundary set construction unit is used to obtain a boundary set of all edges contained in only one facet based on the triangular mesh data.

[0034] The path construction unit, in the boundary set, arbitrarily selects one edge as the starting edge for hole tracing, and gradually connects adjacent vertices to form a closed path; it is also used to determine that the closed path is a closed hole path.

[0035] The hole determination unit is used to determine the corresponding three-dimensional spatial perimeter for each closed hole path; if the three-dimensional spatial perimeter is less than or equal to a set threshold max_perimeter, the closed hole path is determined to be a small hole and added to the first hole set hole_edges_min; otherwise, the closed hole path is determined to be a large hole and added to the second hole set hole_edges_max.

[0036] The repair unit is used to repair each hole in the first hole set hole_edges_min and the second hole set hole_edges_max to obtain repaired mesh data.

[0037] A computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the following steps:

[0038] Step 101: Determine the triangular mesh data that needs to be detected and repaired. The triangular mesh data includes several polygonal patches and three-dimensional point cloud data containing only position information corresponding to the vertices. Each polygonal patch consists of multiple edges, and each edge includes two vertices.

[0039] Step 102: Obtain the boundary set of all edges contained by only one facet based on the triangular mesh data;

[0040] Step 103: In the set of boundaries, take any edge as the starting edge for hole tracing, and gradually connect adjacent vertices to form a closed path;

[0041] Step 104: After determining that the closed path is a closed hole path, determine the corresponding three-dimensional spatial perimeter for each closed hole path;

[0042] Step 105: If the perimeter of the three-dimensional space is less than or equal to the set threshold max_perimeter, determine that the closed hole path corresponds to a small hole and add it to the first hole set hole_edges_min; otherwise, determine that the closed hole path corresponds to a large hole and add it to the second hole set hole_edges_max.

[0043] Step 106: Repair each hole in the first hole set hole_edges_min and the second hole set hole_edges_max to obtain the repaired mesh data.

[0044] The embodiments of the present invention have the following beneficial effects:

[0045] This invention extracts unclosed boundaries using an edge counting algorithm, constructs a set of hole boundaries, and automatically filters and classifies holes based on a set maximum perimeter threshold: holes smaller than the threshold are automatically filled, and holes larger than the threshold allow users to select and repair them through a three-dimensional visual interactive method. Attached Figure Description

[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0047] in:

[0048] Figure 1 The flowchart illustrates a method for detecting and repairing holes based on boundary extraction, as provided in this embodiment of the invention.

[0049] Figure 2 These are before-and-after images showing the effect of hole repair. Detailed Implementation

[0050] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0051] This invention provides a method for detecting and repairing holes based on boundary extraction, such as... Figure 1 As shown, the method includes:

[0052] Step 101: Determine the triangular mesh data that needs to be detected and repaired. The triangular mesh data includes several polygonal patches and three-dimensional point cloud data containing only position information corresponding to the vertices. Each polygonal patch consists of multiple edges, and each edge includes two vertices.

[0053] Specifically, the triangular mesh data is represented by a pcl::PolygonMesh structure, and the point cloud data within it is stored in the sensor_msgs::PointCloud2 format, which is then converted to pcl::PointCloud. <pcl::pointxyz>Type of three-dimensional point cloud data.

[0054] Step 102: obtaining a boundary set of edges contained by only one face sheet from the triangular mesh data;

[0055] Specifically, all constituent edges of each polygonal face sheet in the triangular mesh data are extracted, and the vertex index pair of each constituent edge is extracted in combination with the three-dimensional point cloud data containing only position information.

[0056] To eliminate the interference of repeated edges, the vertex index pair of each edge is arranged in ascending order, thereby maintaining a unified direction

[0057] Each edge is added to the edge set, and the repeated edges in the edge set are removed, thereby obtaining a boundary set of edges contained by only one face sheet.

[0058] Exemplarily, for each polygonal sheet in the mesh, all constituent edges thereof are extracted and converted into the form of vertex index pairs.

[0059] All edges are initially added to an edge set edge_set.

[0060] If an edge already exists in the set, it is considered as a "closed edge" and removed from the set; otherwise, the edge is retained and considered as a "boundary edge".

[0061] The finally retained edge set is a boundary set of edges contained by only one face sheet, which constitutes a boundary set of the mesh model, and can also be referred to as a boundary edge set edge_set containing boundary edges.

[0062] Step 103: taking an edge in the boundary set as a starting edge for hole tracking, and gradually connecting adjacent vertices to form a closed path.

[0063] Specifically, an edge in the boundary edge set edge_set is taken as a starting edge for hole tracking, and the two vertices of the starting edge are sequentially added to the current hole path, and the second vertex is taken as a current tracking point.

[0064] Exemplarily, in the boundary edge set edge_set, any edge is taken as the starting edge of the hole tracking (for example, edge (v1, v2)); the two vertices of the starting edge are sequentially added to the current hole path (v1 is first added as the starting point of the path, and then v2 is added), and the second vertex (v2) is taken as the current tracking point. This selection is because v2 represents the current end of the path, facilitating the search for the next edge connected to v2 (such as (v2, v3)) from the remaining edge set, so as to gradually expand the path and finally form a closed loop. The whole process does not depend on the sorting direction of the vertex index, but is based on the dynamic needs of path construction, ensuring that the hole boundary can be accurately tracked.

[0065] After the starting edge (v1, v2) is added to the path, v2 is the end point of the path. From this point, the next adjacent edge (such as (v2, v3)) can be naturally connected, realizing the continuous expansion of the path. This avoids path breakage and efficiently forms a closed hole loop (the number of vertex points ≥ 3).

[0066] Subsequently, the next edge connected to the current tracking point is searched from the remaining edge set. If found, the new vertex is added to the current hole path and the tracking is continued until the second vertex is tracked, forming a hole path of a vertex sequence connected at the head and tail, that is, a closed path, which represents a potential hole.

[0067] If not found, it is considered that the tracking is ended, and the hole path is ignored.

[0068] Exemplarily, subsequently, the next edge connected to the current tracking point (such as v2) is searched from the remaining edge set. If found (for example, edge (v2, v3)), the new vertex v3 is added to the current hole path, and the current tracking point is updated to v3, and the path is continued to be expanded.

[0069] This process is repeatedly executed until the path finally tracks back to the second vertex of the starting edge (that is, v2), forming a vertex sequence connected at the head and tail (such as v1→v2→v3→…→vn→v1), that is, a closed path.

[0070] Step 104: after determining that the closed path is a closed hole path, determining the corresponding three-dimensional space perimeter of each closed hole path;

[0071] Specifically, if the number of vertices in the closed path is greater than or equal to 3, and the starting point and the end point are the same, it is confirmed that the closed path is a closed hole path.

[0072] In the hole repair process, removing the end vertex in the closed hole path is a key preprocessing operation to ensure the topological regularity and repair efficiency;

[0073] Since the sequence of vertices of a closed hole path contains repeated points by default (e.g. path [v1, v2, v3,..., v n 1]). If directly used to construct a new face, it will cause the first and last vertices to be repeated.

[0074] Therefore, the boundary vertices need to be constructed into a new face of pcl::Vertices type when repairing. The face definition of a triangular mesh requires that the vertex indices be strictly connected in sequence and do not need to be closed at the beginning and end (i.e. the sequence of face vertices should be [v1, v2,..., v n 1]). Retaining the last vertex will generate an illegal face.

[0075] If the number of vertices in the closed path is less than 3, it is determined that the closed path is not closed, and the closed path is ignored.

[0076] The perimeter of the three-dimensional space is obtained by sequentially accumulating the Euclidean distances between adjacent vertices in the closed hole path.

[0077] Step 105: If the three-dimensional space perimeter is less than or equal to a set threshold max_perimeter, it is determined that the closed hole path corresponds to a small hole, and is added to the first hole set hole_edges_min; otherwise, it is determined that the closed hole path corresponds to a large hole, and is added to the second hole set hole_edges_max.

[0078] Specifically, the set threshold max_perimeter is dynamically adjusted according to the actual physical size of the modeling target.

[0079] Illustratively, small objects (such as mechanical parts, electronic components): max_perimeter = 5-10 mm; medium-sized objects (such as furniture, human models): max_perimeter = 10-30 mm; large objects (such as buildings, terrain): max_perimeter = 50-200 mm.

[0080] Step 106: Repair each hole in the first hole set hole_edges_min and the second hole set hole_edges_max to obtain repaired mesh data.

[0081] Specifically, the position information of the boundary vertices of each hole in the three-dimensional point cloud data is extracted in sequence, and the corresponding boundary point cloud is constructed therefrom;

[0082] According to the vertex-to-edge mapping table, a new face of pcl::Vertices type is constructed, and is inserted into the polygons container of the triangular mesh data that needs to be detected and repaired, to complete the filling of the hole;

[0083] The hole is removed from the first hole set hole_edges_min or the second hole set hole_edges_max.

[0084] In the hole repairing stage, the specific process of constructing a new patch of pcl::Vertices type according to the vertex-to-edge mapping table and inserting it into the mesh container is as follows:

[0085] Step 1: Prepare the hole boundary vertex index sequence, i.e. the detected hole vertices.

[0086] Extract the boundary vertex sequence from the identified hole (small hole set hole_edges_min or large hole set hole_edges_max). For example, the boundary path of a hole is [v1, v2, v3] (with the last repeated vertex removed).

[0087] The vertex-to-edge mapping table (vertex_edge_map) is used to quickly retrieve the vertex connection relationship, ensuring the consistency of the index sequence (such as from v1 to v2 and then to v3).

[0088] The ordered vertex index list (such as std::vector <int>indices = {0, 1, 2}), which represents the position of the hole boundary in the point cloud.

[0089] Step 2: Using pcl::Vertices type, the vertex sequence of the hole boundary is taken as the vertex set of the new face.

[0090] The vertex index sequence is encapsulated into a pcl::Vertices object;

[0091] The pcl::Vertices structure defines a polygonal face, and the vertex sequence does not need to be explicitly closed at the beginning and end (the PCL library automatically handles the connection). For example, input 3 vertices to generate a triangular face, and input 4 vertices to generate a quadrilateral face.

[0092] Step 3: Insert the new face into the mesh. Add the face to the face container of the original mesh. This operation is equivalent to adding a polygonal face covering the hole to the original mesh.

[0093] Further, the method further comprises: traversing each boundary edge in the boundary set, and combining the three-dimensional point cloud data containing only position information to establish a list of edges connected to each vertex in each vertex index pair of the boundary edge, thereby obtaining a vertex-to-edge mapping table.

[0094] Specifically, the above edge_set is traversed, and a list of edges connected to each vertex is established, thereby forming a vertex-to-edge mapping table vertex_edge_map

[0095] Further, the method further comprises: highlighting the large holes in the second hole set hole_edges_max.

[0096] Specifically, it comprises: sequentially extracting the position information of the boundary vertices of each large hole in the three-dimensional point cloud data, and constructing the corresponding boundary point cloud therefrom.

[0097] Each boundary point cloud is rendered by highlighting the color;

[0098] After rendering, each boundary point cloud is connected to adjacent point pairs in order, and the first and last nodes are connected to form a closed boundary curve.

[0099] Specifically, a point cloud of red highlight color is constructed, and each boundary point cloud is rendered by the point cloud, thereby constructing a complete hole outline framework visually.

[0100] Further, a unique naming label is assigned to each large hole and its corresponding boundary point cloud, such as "hole_i" and "line_i_j", where i represents the hole number, and j represents the line segment number.

[0101] Further, the method further comprises:

[0102] A mouse click event is registered, and when a position is specified by mouse clicking in the three-dimensional visualization interface, the position information of the clicked position is obtained; if an effective three-dimensional point cloud data region is not clicked, it is directly returned.

[0103] The clicked position is marked and fed back; if there is a mark before, it is removed first to avoid interference.

[0104] The geometric center point of each hole is determined in the first hole set hole_edges_min and the second hole set hole_edges_max.

[0105] The Euclidean distance between the clicked position and the geometric center point of all holes is determined, and the hole with the closest distance is selected as the target hole.

[0106] If a reasonable target is not detected, a prompt message is output.

[0107] For example, the mouse clicks outside the UI interface, or in a blank place, etc., which cannot be recognized, it is considered that a reasonable target is not detected.

[0108] Step 106 is performed to repair the target hole, and after the repair is completed, the grid model is updated in real time, and the current state is re-displayed, including the remaining hole highlight area.

[0109] As Figure 2 shown, for small holes in the face of the model, automatic repair can be achieved. For some larger holes, such as in the red box, repair is performed after mouse selection. For very large holes such as the head, which are the holes of the object itself, i.e., in the blue box, no repair is performed.

[0110] The present application extracts unclosed boundaries by edge counting algorithm, constructs a hole boundary set, and automatically selects and classifies holes according to a set maximum perimeter threshold: for holes smaller than the threshold, automatic filling is performed, and for holes larger than the threshold, the user can select and repair through three-dimensional visualization interaction.

[0111] The application introduces a visual feedback mechanism, automatically identifies the target hole selected by the user and performs closed repair by calculating the distance between the click point and the hole centroid.

[0112] The application also provides a hole detection and repair device based on boundary extraction, which comprises:

[0113] A mesh construction unit is configured to determine triangular mesh data that needs to be detected and repaired, wherein the triangular mesh data comprises a plurality of polygonal patches and three-dimensional point cloud data corresponding to vertices and only containing position information, each polygonal patch is composed of a plurality of edges, and each edge comprises two vertices.

[0114] A boundary set construction unit is configured to obtain a boundary set of edges that are only contained by one patch according to the triangular mesh data.

[0115] A path construction unit is configured to take an edge in the boundary set as a starting edge for hole tracking, and gradually connect adjacent vertices to form a closed path, and determine the closed path as a closed hole path.

[0116] A hole determination unit is configured to determine the three-dimensional space perimeter corresponding to each closed hole path, and if the three-dimensional space perimeter is less than or equal to a set threshold max_perimeter, determine that the closed hole path corresponds to a small hole and is added to a first hole set hole_edges_min, otherwise, determine that the closed hole path corresponds to a large hole and is added to a second hole set hole_edges_max.

[0117] A repair unit is configured to repair each hole in the first hole set hole_edges_min and the second hole set hole_edges_max to obtain repaired mesh data.

[0118] The application also provides a computer device, which comprises a memory and a processor, wherein the memory stores a computer program, and the computer program is executed by the processor to make the processor perform the following steps:

[0119] Step 101: determining triangular mesh data that needs to be detected and repaired, wherein the triangular mesh data comprises a plurality of polygonal patches and three-dimensional point cloud data corresponding to vertices and only containing position information, each polygonal patch is composed of a plurality of edges, and each edge comprises two vertices.

[0120] Step 102: obtaining a boundary set of edges that are only contained by one patch according to the triangular mesh data.

[0121] Step 103: in the boundary set, take an edge as the starting edge of hole tracking, and gradually connect adjacent vertices to form a closed path;

[0122] Step 104: after determining that the closed path is a closed hole path, determine the corresponding three-dimensional space perimeter of each closed hole path;

[0123] Step 105: if the three-dimensional space perimeter is less than or equal to a set threshold max_perimeter, determine that the closed hole path corresponds to a small hole, and add it to the first hole set hole_edges_min; otherwise, determine that the closed hole path corresponds to a large hole, and add it to the second hole set hole_edges_max;

[0124] Step 106: repair each hole in the first hole set hole_edges_min and the second hole set hole_edges_max to obtain repaired mesh data.

[0125] The embodiment of the application also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to make the processor execute the following steps:

[0126] Step 101: determine the triangular mesh data to be detected and repaired, the triangular mesh data includes a plurality of polygon patches and three-dimensional point cloud data corresponding to vertices, the three-dimensional point cloud data only contains position information, each polygon patch is composed of a plurality of edges, and each edge includes two vertices;

[0127] Step 102: obtain a boundary set of edges contained only by one patch according to the triangular mesh data;

[0128] Step 103: in the boundary set, take an edge as the starting edge of hole tracking, and gradually connect adjacent vertices to form a closed path;

[0129] Step 104: after determining that the closed path is a closed hole path, determine the corresponding three-dimensional space perimeter of each closed hole path;

[0130] Step 105: if the three-dimensional space perimeter is less than or equal to a set threshold max_perimeter, determine that the closed hole path corresponds to a small hole, and add it to the first hole set hole_edges_min; otherwise, determine that the closed hole path corresponds to a large hole, and add it to the second hole set hole_edges_max;

[0131] Step 106: repairing each hole in the first hole set hole_edges_min and the second hole set hole_edges_max to obtain the repaired grid data.

[0132] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by a computer program instructing related hardware, and the program can be stored in a non-volatile computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiment methods. Any reference to memory, storage, database or other medium used in the embodiments provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchl ink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0133] The technical features of the above embodiments can be combined in any way. To make the description concise, not all possible combinations of the technical features in the above embodiments are described, but as long as the combinations of the technical features do not contradict, they should be considered within the scope of the present disclosure.

[0134] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are all within the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.< / int> < / pcl::pointxyz>

Claims

1. A method for detecting and repairing holes based on boundary extraction, characterized in that, The method includes: The triangular mesh data that needs to be detected and repaired is determined. The triangular mesh data includes several polygonal patches and three-dimensional point cloud data containing only position information corresponding to the vertices. Each polygonal patch consists of multiple edges, and each edge includes two vertices. Based on the triangular mesh data, obtain the boundary set of all edges that are contained in only one facet; In the set of boundaries, any edge is selected as the starting edge for hole tracing, and adjacent vertices are gradually connected to form a closed path; After determining that the closed path is a closed hole path, the corresponding three-dimensional spatial perimeter is determined for each closed hole path; If the perimeter of the three-dimensional space is less than or equal to the set threshold max_perimeter, the closed hole path is determined to be a small hole and added to the first hole set hole_edges_min; otherwise, the closed hole path is determined to be a large hole and added to the second hole set hole_edges_max. Repair each hole in the first hole set hole_edges_min and the second hole set hole_edges_max to obtain repaired mesh data.

2. The method for detecting and repairing holes based on boundary extraction according to claim 1, characterized in that, The step of obtaining the boundary set of all edges contained by only one facet based on the triangular mesh data specifically includes: traversing the polygonal faces in the triangular mesh data, extracting all constituent edges of each polygonal facet, and combining the three-dimensional point cloud data containing only position information to extract the vertex index pairs of each constituent edge; Add each edge to the edge set and remove duplicate edges from the edge set to obtain the boundary set of all edges that are contained in only one face.

3. The method for detecting and repairing holes based on boundary extraction according to claim 1 or 2, characterized in that, After obtaining the boundary set of all edges contained by only one patch, the method further includes: traversing each boundary edge in the boundary set, and using the 3D point cloud data containing only position information to establish a list of edges connected to each vertex in the vertex index pair of each boundary edge, thereby obtaining a mapping table from vertex to edge.

4. The method for detecting and repairing holes based on boundary extraction according to claim 3, characterized in that, The determination that the closed path is a closed hole path specifically includes: if the number of vertices in the closed path is greater than or equal to 3, and the starting point and the ending point are the same, then the closed path is confirmed as a closed hole path.

5. The method for detecting and repairing holes based on boundary extraction according to claim 4, characterized in that, The determination of the corresponding three-dimensional spatial perimeter for each of the closed hole paths specifically includes: the three-dimensional spatial perimeter is obtained by successively accumulating the Euclidean distances between adjacent vertices in the closed hole path.

6. The method for detecting and repairing holes based on boundary extraction according to claim 5, characterized in that, The repair of each hole in the first hole set `hole_edges_min` and the second hole set `hole_edges_max` specifically includes: The position information of the boundary vertices of each hole in the 3D point cloud data is extracted sequentially, and the corresponding boundary point cloud is constructed accordingly. Based on the vertex-to-edge mapping table, construct a new face of type pcl::Vertices and insert it into the polygons container of the triangular mesh data that needs to be detected and repaired to complete the filling of the hole; Remove the hole from either the first hole set hole_edges_min or the second hole set hole_edges_max.

7. The method for detecting and repairing holes based on boundary extraction according to claim 6, characterized in that, The method also includes: highlighting the large holes in the second hole set hole_edges_max; Specifically, this includes: sequentially extracting the position information of the boundary vertices of each large hole in the 3D point cloud data, and using this information to construct the corresponding boundary point cloud; Each boundary point cloud is rendered using a highlight color; For each rendered boundary point cloud, connect adjacent point pairs in sequence, and connect the first and last nodes to form a closed boundary curve.

8. The method for detecting and repairing holes based on boundary extraction according to claim 7, characterized in that, The method also includes: Register mouse click events to obtain the location information of the clicked location when a specified location is clicked by the mouse in the 3D visualization interface; The clicked location is marked and feedback is provided; The geometric center point of each hole is determined in the first hole set hole_edges_min and the second hole set hole_edges_max, respectively. Determine the Euclidean distance between the click location and the geometric center of all holes, and select the hole with the closest distance as the target hole; The target holes are repaired. After the repair is completed, the mesh model is updated in real time and the current state is redisplayed, including the highlighted areas of the remaining holes.

9. A device for detecting and repairing holes based on boundary extraction, characterized in that, The device includes: Mesh construction unit is used to determine the triangular mesh data that needs to be detected and repaired. The triangular mesh data includes several polygonal patches and three-dimensional point cloud data containing only position information corresponding to the vertices. Each polygonal patch consists of multiple edges, and each edge includes two vertices. A boundary set construction unit is used to obtain a boundary set of all edges contained in only one facet based on the triangular mesh data. The path construction unit, in the boundary set, arbitrarily selects one edge as the starting edge for hole tracing, and gradually connects adjacent vertices to form a closed path; it is also used to determine that the closed path is a closed hole path. The hole determination unit is used to determine the corresponding three-dimensional spatial perimeter for each closed hole path; if the three-dimensional spatial perimeter is less than or equal to a set threshold max_perimeter, the closed hole path is determined to be a small hole and added to the first hole set hole_edges_min; otherwise, the closed hole path is determined to be a large hole and added to the second hole set hole_edges_max. The repair unit is used to repair each hole in the first hole set hole_edges_min and the second hole set hole_edges_max to obtain repaired mesh data.

10. A computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform the steps of the method as claimed in any one of claims 1 to 8.