Point cloud hole repairing method and device, electronic equipment and storage medium
By selecting the CGAL library or least squares method according to the hole diameter in the point cloud hole repair method for repair, and adjusting the maximum hole edge number, the problem of poor repair effect of irregular large point cloud models in the existing technology is solved, and a more efficient and accurate hole repair effect is achieved.
Patent Information
- Application Number
- CN202510177032.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-05-16
AI Technical Summary
The existing triangular mesh-based point cloud hole repair method is poor when dealing with irregular large point cloud models or mesh models with large hole areas, especially when the hole diameter is greater than 3 cm, it is difficult to achieve the ideal effect. The setting of hole filling threshold is likely to lead to changes in the model structure, and the processing of large-scale point cloud data is long.
By determining the point cloud of the workpiece to be detected, a workpiece point cloud grid is generated, the hole is identified, and the appropriate repair method is selected based on the diameter of the hole and the preset parameters. For holes with diameters larger than the preset maximum hole diameter, use the hole repair method of the CGAL library to repair; for holes with diameters smaller than or equal to the preset maximum hole diameter, use the least squares method to repair, and optimize the repair process by adjusting the maximum number of hole edges.
It improves the repair efficiency and effect of point cloud holes, can more effectively process large irregular point cloud models and large-scale point cloud data, reduces model structure changes during the repair process, and improves processing speed.
Smart Images

Figure CN120014203A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of point cloud processing, and in particular to a point cloud hole repair method, device, electronic device and storage medium. Background Art
[0002] With the development of computer graphics and 3D modeling technology, mesh hole filling has become an important technology. In the existing technology, mesh hole filling is usually performed directly on the mesh surface by solving implicit functions or using radial basis functions to create a smooth and continuous surface to fill the missing area. Such methods are widely used, such as in reverse engineering, medical imaging, and virtual reality. For example, the open source CGAL (Computational Geometry Algorithms Library) library uses these methods to implement point cloud hole filling, and its specific steps include hole identification, hole triangulation, mesh patch generation, and mesh refinement and shaping.
[0003] Hole identification is automatically identified by finding boundary vertices, a process that is critical for subsequent hole filling operations. Subsequently, once the location of the hole is determined, the next step is to triangulate it, that is, to find the triangulation of the 3D polygon defined by the boundary, which is usually done without introducing any new vertices. Next, the process of generating a mesh patch is to select the optimal mesh patch by minimizing the quality function Q evaluated by all possible triangle patches. This quality function first focuses on minimizing the worst dihedral angle between patch triangles, and then looks at minimizing the total surface area of the patch as the final strategy. In addition, the CGAL library significantly improves the performance of the algorithm by narrowing the search space to the faces of the 3D Delaunay triangulation of the hole boundary vertices, and finding the best patch from all possible patches.
[0004] Nevertheless, the existing triangular mesh-based repair methods show good repair effects when facing general regular objects (such as mechanical parts and animal point cloud models); but for irregular large point cloud models or mesh models with large hole areas, the repair effect is not satisfactory. Especially when dealing with holes with a diameter greater than 3 cm, a one-time mesh hole filling method is difficult to achieve the ideal effect, and multiple hole filling filters may be required to achieve a complete repair. At the same time, the setting of the hole filling threshold is also a key factor. Too high a threshold may lead to changes in the model structure. For example, when there is a hole with a diameter greater than 5 cm above and below the weld, if the threshold is set too high, the two holes may be connected. In addition, for situations with large amounts of point cloud data, existing hole filling algorithms may become very time-consuming. Summary of the invention
[0005] The purpose of the present invention is to provide a point cloud hole repair method, device, electronic device and storage medium, which can improve the effect and efficiency of point cloud hole repair.
[0006] In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0007] In a first aspect, an embodiment of the present application provides a point cloud hole repair method, the method comprising:
[0008] Determine the point cloud of the workpiece to be inspected;
[0009] Based on the point cloud of the workpiece to be inspected, generating a workpiece point cloud grid;
[0010] Determining holes in the workpiece point cloud grid;
[0011] Determine a first preset maximum number of hole edges;
[0012] For each hole, comparing the diameter of the hole with a preset maximum hole diameter;
[0013] When the diameter of the hole is greater than the preset maximum hole diameter, the hole is repaired based on the first preset maximum number of hole edges, the preset maximum hole diameter and the CGAL library hole repair method;
[0014] When the diameter of the hole is less than or equal to the preset maximum hole diameter, the hole is repaired based on a first preset maximum number of hole edges, a preset maximum hole diameter and a least square method.
[0015] In an optional embodiment, the method further comprises:
[0016] Determine the holes that have been repaired based on the CGAL library hole-filling method;
[0017] For each repaired hole, determining the hole area of each repaired hole;
[0018] When the hole areas are all smaller than or equal to the preset hole areas, the hole repair of the workpiece point cloud grid is completed.
[0019] In an optional embodiment, the method further comprises:
[0020] Determine the holes that have been repaired based on the CGAL library hole-filling method;
[0021] For each repaired hole, determining the hole area of each repaired hole;
[0022] When the hole area is larger than the preset hole area, adjusting the first preset maximum number of hole sides;
[0023] Using the adjusted first preset maximum number of hole sides as a new first preset maximum number of hole sides;
[0024] Return to execute the step of repairing the hole based on the first preset maximum number of hole edges, the preset maximum hole diameter and the CGAL library hole filling method.
[0025] In an optional implementation, when the hole area is greater than a preset hole area, the step of adjusting the maximum number of hole sides includes:
[0026] Obtain a maximum hole edge number list, wherein the hole edge number list includes preset maximum hole edge numbers sorted from small to large;
[0027] When the hole area is larger than the preset hole area, a second preset maximum hole side number sorted after the first preset maximum hole side number is obtained from the maximum hole side number list as the adjusted maximum hole side number.
[0028] In an optional embodiment, the method further comprises:
[0029] Determine the target point cloud mesh after hole repair;
[0030] The target point cloud mesh is restored based on point cloud sampling to obtain a target point cloud after hole repair.
[0031] In an optional embodiment, the method further comprises:
[0032] Determining the density of the workpiece point cloud grid;
[0033] A predetermined hole area is determined based on the density.
[0034] In an optional embodiment, the step of determining holes in the workpiece point cloud grid includes:
[0035] Determine all half edges in the workpiece point cloud mesh;
[0036] Determine the boundary half-edges from all half-edges;
[0037] Based on each boundary half-edge, holes in the workpiece point cloud mesh are determined.
[0038] In a second aspect, an embodiment of the present application provides a point cloud hole repairing device, the device comprising:
[0039] A determination module, used to determine the point cloud of the workpiece to be detected;
[0040] A point cloud mesh generation module, used for generating a workpiece point cloud mesh based on the point cloud of the workpiece to be detected;
[0041] The determination module is also used to: determine holes in the workpiece point cloud grid; determine a first preset maximum number of hole edges;
[0042] A comparison module, for comparing the diameter of each hole with a preset maximum hole diameter;
[0043] A patching module is used to patch the hole based on the first preset maximum number of hole edges, the preset maximum hole diameter and the CGAL library patching method when the hole diameter is larger than the preset maximum hole diameter; and to patch the hole based on the first preset maximum number of hole edges, the preset maximum hole diameter and the least squares method when the hole diameter is less than or equal to the preset maximum hole diameter.
[0044] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the point cloud hole repairing method when executing the computer program.
[0045] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the point cloud hole repairing method when executed by a processor.
[0046] This application has the following beneficial effects:
[0047] The present application determines a point cloud of a workpiece to be inspected, generates a workpiece point cloud grid based on the point cloud of the workpiece to be inspected, determines holes in the workpiece point cloud grid, determines a first preset maximum number of hole edges, and for each hole, compares the hole diameter with a preset maximum hole diameter; when the hole diameter is greater than the preset maximum hole diameter, the hole is repaired based on the first preset maximum number of hole edges, the preset maximum hole diameter, and the CGAL library hole repair method; when the hole diameter is less than or equal to the preset maximum hole diameter, the hole is repaired based on the first preset maximum number of hole edges, the preset maximum hole diameter, and the least squares method, thereby improving the efficiency and effect of repairing point cloud holes. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0049] Figure 1 A block diagram of an electronic device provided by an embodiment of the present invention;
[0050] Figure 2 One of the flow diagrams of a point cloud hole repair method provided by an embodiment of the present invention;
[0051] Figure 3 A second flow chart of a point cloud hole repair method provided by an embodiment of the present invention;
[0052] Figure 4 A third flow chart of a point cloud hole repair method provided by an embodiment of the present invention;
[0053] Figure 5 A fourth flow chart of a point cloud hole repair method provided by an embodiment of the present invention;
[0054] Figure 6 A fifth flow chart of a point cloud hole repair method provided by an embodiment of the present invention;
[0055] Figure 7 A sixth flow chart of a point cloud hole repair method provided by an embodiment of the present invention;
[0056] Figure 8 A structural block diagram of a point cloud hole repairing device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0058] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0059] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0060] In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. appear to indicate an orientation or position relationship, they are based on the orientation or position relationship shown in the accompanying drawings, or are the orientation or position relationship in which the product of the invention is usually placed when used. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0061] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.
[0062] In the description of this application, it should also be noted that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0063] After a lot of research, it is found that with the development of computer graphics and 3D modeling technology, mesh hole filling has become a crucial technology. This technology is mainly used to fill holes in 3D models to ensure the integrity and continuity of the model surface. Mesh hole filling has a wide range of applications, including reverse engineering, medical imaging, and virtual reality. In this process, open source libraries such as CGAL play an important role, providing a set of efficient tools to deal with these problems.
[0064] The main steps of mesh hole filling:
[0065] 1. Hole Identification
[0066] Hole identification is the first step in mesh hole filling, which is mainly done by finding boundary vertices to automatically identify holes. This process is crucial for subsequent operations, because only by accurately identifying the location of the holes can the hole filling operation be performed effectively.
[0067] 2. Hole triangulation
[0068] Once the hole is located, the next step is to triangulate it. Triangulation refers to finding the triangulation of the 3D polygon defined by the boundary. Typically, triangulation is done without introducing any new vertices, preserving the structure of the original model.
[0069] 3. Generate mesh patches
[0070] The process of generating a mesh patch involves selecting the best mesh patch. This is usually done by minimizing a quality function evaluated over all possible triangle patches. Specifically, the quality function first focuses on minimizing the worst dihedral angles between patch triangles and then looks at minimizing the total surface area of the patch. The CGAL library improves the performance of the algorithm by narrowing the search space to the faces of the 3D Delaunay triangulation of the hole boundary vertices.
[0071] Limitations of existing technologies
[0072] Although existing triangular mesh-based repair methods perform well when processing general regular objects (such as mechanical parts and animal point cloud models), the repair effect is often unsatisfactory when facing irregular large point cloud models or mesh models with large hole areas. Especially when the hole diameter is greater than 3 cm, it is difficult for a one-time mesh hole filling method to achieve the desired effect, and multiple hole filling filters may be required to achieve a complete repair. In addition, the setting of the hole filling threshold is also a key factor. Too high a threshold may lead to changes in the model structure. For example, when processing a hole with a diameter greater than 5 cm above and below the weld, if the threshold is set too high, the two holes may be connected. In addition, for cases with large amounts of point cloud data, existing hole filling algorithms may become very time-consuming.
[0073] In summary, although the existing mesh hole filling technology is quite mature, it still has certain limitations when processing complex irregular models and large point cloud data. Future research directions may focus on how to improve algorithm efficiency, optimize hole filling threshold settings, and develop more effective hole filling algorithms.
[0074] In view of the discovery of the above problems, the present embodiment provides a point cloud hole repairing method, device, electronic device and storage medium, which can determine the point cloud of the workpiece to be detected, generate a workpiece point cloud grid based on the point cloud of the workpiece to be detected, determine the holes in the workpiece point cloud grid, and compare the diameter of the hole with the preset maximum hole diameter for each hole. When the diameter of the hole is greater than the preset maximum hole diameter, determine the first preset maximum number of hole edges, and repair the hole based on the CGAL library hole filling method. When the diameter of the hole is less than or equal to the preset maximum hole diameter, the hole is repaired based on the first preset maximum number of hole edges and the least squares method, which can improve the efficiency and effect of point cloud hole repairing. The solution provided in this embodiment is elaborated in detail below.
[0075] This embodiment provides an electronic device that can repair point cloud holes. In a possible implementation, the electronic device can be a user terminal, for example, the electronic device can be, but is not limited to, a server, a smart phone, a personal computer (PC), a tablet computer, a personal digital assistant (PDA), a mobile Internet device (MID), etc.
[0076] Please refer to Figure 1 , Figure 1 1 is a schematic diagram of the structure of the electronic device 100 provided in the embodiment of the present application. The electronic device 100 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0077] The electronic device 100 includes a point cloud hole repairing device 110 , a memory 120 , and a processor 130 .
[0078] The components of the memory 120 and the processor 130 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The point cloud hole repairing device 110 includes at least one software function module that can be stored in the memory 120 in the form of software or firmware or solidified in the operating system (OS) of the electronic device 100. The processor 130 is used to execute the executable modules stored in the memory 120, such as the software function modules and computer programs included in the point cloud hole repairing device 110.
[0079] The memory 120 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The memory 120 is used to store a program, and the processor 130 executes the program after receiving an execution instruction.
[0080] Please refer to Figure 2 , Figure 2 For application Figure 1 A flow chart of a point cloud hole repair method for an electronic device 100 is provided, and the method including each step is described in detail below.
[0081] S201: Determine the point cloud of the workpiece to be inspected.
[0082] S202: Generate a workpiece point cloud grid based on the point cloud of the workpiece to be inspected.
[0083] S203: Determine holes in the workpiece point cloud grid and determine a first preset maximum number of hole edges.
[0084] S204: For each hole, compare the diameter of the hole with a preset maximum hole diameter.
[0085] S205: When the diameter of the hole is greater than the preset maximum hole diameter, the hole is repaired based on the first preset maximum number of hole edges, the preset maximum hole diameter and the CGAL library hole repair method.
[0086] S206: When the diameter of the hole is less than or equal to the preset maximum hole diameter, the hole is repaired based on the first preset maximum number of hole edges, the preset maximum hole diameter and the least square method.
[0087] The method of determining the point cloud of the workpiece to be inspected can be obtained based on laser scanning, stereo vision, structured light scanning, multi-view image reconstruction and other methods, and the embodiments of the present application do not impose specific restrictions on this.
[0088] Based on the point cloud of the workpiece to be inspected, the workpiece point cloud mesh can be generated in the following ways:
[0089] The workpiece point cloud mesh is generated based on the Poisson surface reconstruction method, and the surface is reconstructed by minimizing the Poisson equation. This method uses the normal information of the point cloud to solve a scalar function through the Poisson equation, and its gradient field is consistent with the normal field of the point cloud. Then the mesh is generated by isosurface extraction (such as the Marching Cubes algorithm).
[0090] Generate workpiece point cloud mesh based on marching cubes, and generate mesh based on voxelized point cloud data through isosurface extraction algorithm. This method divides the space into voxel grids, and then determines whether there is an isosurface in each voxel according to the point cloud data, and generates corresponding triangles.
[0091] The workpiece point cloud mesh is generated based on the ball rotation algorithm. By rolling a virtual sphere in the point cloud, a triangle consisting of three points is found and gradually expanded to generate a mesh. The radius of the sphere can be adjusted according to the density of the point cloud.
[0092] Generate the workpiece point cloud mesh through the α shape, and define a parameter α to control the "compactness" of the shape to generate the geometric shape of the point cloud. The smaller the α value, the tighter the generated shape; the larger the α value, the looser the shape.
[0093] This application does not impose any specific restrictions on the specific method of generating the workpiece point cloud grid based on the point cloud of the workpiece to be inspected.
[0094] There are many ways to determine the holes in the workpiece point cloud mesh. For example, the point cloud is converted into a mesh by Delaunay triangulation. The circumscribed circle of each triangle is checked. If there are no other points in the circumscribed circle, the triangle is valid. If there are other points in the circumscribed circle, the triangle is invalid and may belong to the hole area.
[0095] The mesh can be generated by Poisson surface reconstruction. Check the topology of the mesh and identify areas that are not closed, which may be holes.
[0096] You can traverse all the edges of the mesh and identify the edges that have no opposite edges. These are the boundary edges. Holes are usually surrounded by these boundary edges. Start from a boundary edge and trace along the boundary edge until you return to the starting point, forming a closed loop. Each closed loop represents a hole.
[0097] Deep learning methods, such as convolutional neural networks (CNNs), can be used to learn the characteristics of holes from point clouds or meshes and predict the locations of holes.
[0098] For the holes in the identified workpiece point cloud grid, the diameter of each hole is compared with the preset maximum hole based on each hole. When the diameter of the hole is larger than the preset maximum hole diameter, the hole is repaired based on the CGAL library hole filling method. When the diameter of the hole is less than or equal to the preset maximum hole diameter, the hole is repaired based on the least squares method.
[0099] It should be noted that the first preset maximum number of hole sides and the preset maximum hole diameter are both preset in advance. The first preset maximum number of hole sides and the preset maximum hole diameter are both set to smaller values.
[0100] The maximum number of hole edges is used to define the maximum boundary complexity of the hole, and the maximum hole diameter is used to define the maximum size of the hole.
[0101] When repairing each hole, the repair can be performed based on multi-threaded parallel processing. For example, when the number of holes is 10, 5 threads are set, and each thread repairs 2 holes, thereby improving the efficiency of hole repair and completing the processing of large-scale data in a reasonable time.
[0102] Methods for determining whether point cloud mesh hole filling is complete, such as Figure 3 As shown, the following steps are included:
[0103] S301: Determine each hole after being repaired using the hole-filling method of the CGAL library.
[0104] S302: For each repaired hole, determine the hole area of each repaired hole.
[0105] S303: When the hole areas are all smaller than or equal to the preset hole areas, the hole repair of the workpiece point cloud grid is completed.
[0106] Exemplarily, each hole repaired by the hole-filling method based on the CGAL library includes a first repair hole, a second repair hole, and a third repair hole. The hole areas of the first repair hole, the second repair hole, and the third repair hole are determined in sequence, that is, the first hole area of the first repair hole, the second hole area of the second repair hole, and the third hole area of the third repair hole, and the first hole area is compared with the preset hole area. When the first hole area is less than or equal to the preset hole area, the second hole area is compared with the preset hole area. When the second hole area is less than or equal to the preset hole area, the third hole area is compared with the preset hole area. When the third hole area is less than or equal to the preset hole area, it is determined that the hole repair of the workpiece point cloud mesh is completed.
[0107] In another example, when the hole area of each hole repaired based on the least square method is less than or equal to the preset hole area, the hole repair of the workpiece point cloud grid is completed.
[0108] The setting method of the preset hole area can determine the density of the workpiece point cloud grid, and the preset hole area is determined based on the density.
[0109] It should be noted that the hole filling method based on the CGAL library can be set to correspond to the first preset hole area, the least square method can be set to correspond to the second preset hole area, and the second preset hole area can be set to be smaller than the first preset hole area.
[0110] That is, each hole repaired based on the CGAL library hole filling method is determined, and for each repaired hole, the hole area of each repaired hole is determined. When the hole area is less than or equal to the first preset hole area, the hole repair of the workpiece point cloud mesh is completed. Each hole repaired based on the least squares method is determined, and for each repaired hole, the hole area of each repaired hole is determined. When the hole area is less than or equal to the second preset hole area, the hole repair of the workpiece point cloud mesh is completed.
[0111] When the hole area after repair is larger than the preset hole area, Figure 4 As shown, the following steps are included:
[0112] S401: Determine each hole after being repaired using the hole-filling method of the CGAL library.
[0113] S402: For each repaired hole, determine the hole area of each repaired hole.
[0114] S403: When the hole area is greater than the preset hole area, adjusting the first preset maximum number of hole sides.
[0115] S404: Using the adjusted first preset maximum number of hole sides as a new first preset maximum number of hole sides.
[0116] S405: Return to the step of performing hole repair based on the first preset maximum hole edge number, the preset maximum hole diameter, and the CGAL library hole repair method.
[0117] In one example, when the hole area of the repaired hole is larger than the preset hole area, the first preset maximum hole side number needs to be adjusted, and the hole is repaired based on the adjusted first preset maximum hole side number, the preset maximum hole diameter, and the CGAL library hole repair method.
[0118] In another example, when the hole area of the repaired hole is larger than the preset hole area, the first preset maximum hole side number needs to be adjusted, and the hole is repaired based on the adjusted first preset maximum hole side number, the preset maximum hole diameter and the least square method.
[0119] When the hole area is larger than the preset hole area, there are multiple ways to adjust the maximum number of hole sides. In one implementation, Figure 5 As shown, the following steps are included:
[0120] S501: Obtain a list of maximum hole edge numbers.
[0121] The hole edge number list includes preset maximum hole edge numbers sorted from small to large.
[0122] S502: When the hole area is greater than the preset hole area, a second preset maximum hole side number that is sorted after the first preset maximum hole side number is obtained from the maximum hole side number list as the adjusted maximum hole side number.
[0123] Exemplarily, the maximum hole edge number list is: 20, 30, 40, 50 maximum hole edge numbers. When the first preset maximum hole edge number is 20, when the hole area of the repaired hole is larger than the preset hole area, the first preset maximum hole edge number 20 is adjusted to 30, and 30 is used as the new first preset maximum hole edge number. The hole is repaired again based on the new first preset maximum hole edge number, the preset maximum hole diameter and the hole repair algorithm. After the second repair, if the hole area of the repaired hole is still larger than the preset hole area, the new first preset maximum hole edge number is adjusted again based on the maximum hole edge number list until the hole area of the repaired hole is less than or equal to the preset hole area.
[0124] There are many ways to determine the holes in the workpiece point cloud mesh. In one implementation, Figure 6 As shown, the following steps are included:
[0125] S601: Determine all half edges in the workpiece point cloud mesh.
[0126] S602: Determine a boundary half-edge from all half-edges.
[0127] S603: Determine holes in the workpiece point cloud mesh based on each boundary half edge.
[0128] In point cloud mesh processing, traversing all half-edges and determining the boundary half-edges is an important step in detecting holes. The half-edge data structure is a powerful representation method for efficiently processing the topological information of the mesh. By traversing the half-edges, the boundary edges can be easily identified, and then the location and shape of the hole can be determined.
[0129] A boundary half-edge is a half-edge without an opposite edge, usually appearing at the boundary or holes of a mesh.
[0130] Traverse all half edges, mark whether each half edge is a boundary half edge, and determine the boundary half edge among all half edges. The boundary half edge can be determined by checking whether each half edge has an opposite edge. If there is no opposite edge, the half edge is a boundary half edge.
[0131] Start from one half edge of the boundary and traverse along the boundary until you return to the starting point, forming a closed loop. Each closed loop represents a hole.
[0132] There are many ways to restore the workpiece point cloud mesh after hole repair. In one implementation, Figure 7 As shown, the following steps are included:
[0133] S701: Determine the target point cloud mesh after the hole is repaired.
[0134] S702: Restoring the target point cloud mesh based on point cloud sampling to obtain a target point cloud after hole repair.
[0135] The grid filtering methods currently used in the commonly used open source libraries include: possion-disk Sampling and Montecalo Sampling. Both of these filtering methods change the original point cloud structure and lose the original structural information of the point cloud.
[0136] In order to avoid the loss of the original structural information of the point cloud and optimize the accuracy of point cloud recovery, point cloud sampling is used to restore the target grid to obtain the target point cloud after hole repair.
[0137] Point cloud sampling can preserve mesh vertex information, thereby improving the quality of point cloud recovery. Point cloud sampling can restore the target point cloud mesh to the target point cloud by vertex sampling or uniform sampling.
[0138] Please refer to Figure 8 The present application embodiment also provides a method for applying Figure 1 The point cloud hole repairing device 110 of the electronic device 100 includes:
[0139] A determination module 111 is used to determine a point cloud of a workpiece to be detected;
[0140] A point cloud mesh generation module 112 is used to generate a workpiece point cloud mesh based on the point cloud of the workpiece to be detected;
[0141] The determination module 111 is also used to: determine holes in the workpiece point cloud grid; determine a first preset maximum number of hole edges;
[0142] A comparison module 113, for comparing the diameter of each hole with a preset maximum hole diameter;
[0143] The repair module 114 is used to repair the hole based on the first preset maximum number of hole edges, the preset maximum hole diameter and the CGAL library repair method when the diameter of the hole is greater than the preset maximum hole diameter; and to repair the hole based on the first preset maximum number of hole edges, the preset maximum hole diameter and the least squares method when the diameter of the hole is less than or equal to the preset maximum hole diameter.
[0144] The present application also provides an electronic device 100, which includes a processor 130 and a memory 120. The memory 120 stores computer executable instructions, and when the computer executable instructions are executed by the processor 130, the point cloud hole repair method is implemented.
[0145] The embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by the processor 130, the point cloud hole repair method is implemented.
[0146] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0147] In addition, each functional module in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part. If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk.
[0148] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0149] The above are only various implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A point cloud hole repair method, characterized in that: The method comprises: Determine the point cloud of the workpiece to be inspected; Based on the point cloud of the workpiece to be inspected, generating a workpiece point cloud grid; Determining holes in the workpiece point cloud grid; Determine a first preset maximum number of hole edges; For each hole, comparing the diameter of the hole with a preset maximum hole diameter; When the diameter of the hole is greater than the preset maximum hole diameter, the hole is repaired based on the first preset maximum number of hole edges, the preset maximum hole diameter and the CGAL library hole repair method; When the diameter of the hole is less than or equal to the preset maximum hole diameter, the hole is repaired based on a first preset maximum number of hole edges, a preset maximum hole diameter and a least square method.
2. The method according to claim 1, characterized in that: The method further comprises: Determine the holes that have been repaired based on the CGAL library hole-filling method; For each repaired hole, determining the hole area of each repaired hole; When the hole areas are all smaller than or equal to the preset hole areas, the hole repair of the workpiece point cloud grid is completed.
3. The method according to claim 1, characterized in that The method further comprises: Determine the holes that have been repaired based on the CGAL library hole-filling method; For each repaired hole, determining the hole area of each repaired hole; When the hole area is larger than the preset hole area, adjusting the first preset maximum number of hole sides; Using the adjusted first preset maximum number of hole sides as a new first preset maximum number of hole sides; Return to execute the step of repairing the hole based on the first preset maximum number of hole edges, the preset maximum hole diameter and the CGAL library hole filling method.
4. The method according to claim 3, characterized in that When the hole area is greater than a preset hole area, the step of adjusting the maximum number of hole sides includes: Obtain a maximum hole edge number list, wherein the hole edge number list includes preset maximum hole edge numbers sorted from small to large; When the hole area is larger than the preset hole area, a second preset maximum hole side number sorted after the first preset maximum hole side number is obtained from the maximum hole side number list as the adjusted maximum hole side number.
5. The method according to claim 2, characterized in that: The method further comprises: Determine the target point cloud mesh after hole repair; The target point cloud mesh is restored based on point cloud sampling to obtain a target point cloud after hole repair.
6. The method according to claim 2, characterized in that The method further comprises: Determining the density of the workpiece point cloud grid; A predetermined hole area is determined based on the density.
7. The method according to claim 1, characterized in that The step of determining holes in the workpiece point cloud grid comprises: Determine all half edges in the workpiece point cloud mesh; Determine the boundary half-edges from all half-edges; Based on each boundary half-edge, holes in the workpiece point cloud mesh are determined.
8. A point cloud hole repairing device, characterized in that: The device comprises: A determination module, used to determine the point cloud of the workpiece to be detected; A point cloud mesh generation module, used for generating a workpiece point cloud mesh based on the point cloud of the workpiece to be detected; The determination module is also used to: determine holes in the workpiece point cloud grid; determine a first preset maximum number of hole edges; A comparison module, for comparing the diameter of each hole with a preset maximum hole diameter; A patching module is used to patch the hole based on the first preset maximum number of hole edges, the preset maximum hole diameter and the CGAL library patching method when the hole diameter is larger than the preset maximum hole diameter; and to patch the hole based on the first preset maximum number of hole edges, the preset maximum hole diameter and the least squares method when the hole diameter is less than or equal to the preset maximum hole diameter.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method according to any one of claims 1 to 7 when executing the computer program.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.