Three-dimensional model edge recovery method, device, equipment and storage medium
By extracting and processing edge points of the three-dimensional model, combining the first-order smoothing model and position constraint regular terms, the edge oversmoothing problem is solved, and the sharpness recovery and accuracy improvement of the edges of the three-dimensional model are achieved.
Patent Information
- Application Number
- CN202111417625.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-26
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2041-11-26
AI Technical Summary
The existing three-dimensional model denoising algorithms can easily lead to excessive smooth edges during edge processing, making it difficult to retain weak and thin edges in the three-dimensional model, which in turn causes the problem of edge sharpness that cannot be restored.
By extracting the edge points of the initial three-dimensional model, erosion and gradual smoothing of boundary points are performed, the boundary points in the boundary point set are removed, and the skeleton point set is obtained, and the first-order smoothing processing model and position constraint regular term pair are processed according to the first-order smoothing of the skeleton point set and the position constraint regular term pair are used according to the first-order smoothing of the skeleton point set. The skeleton points are smoothed to ensure that the difference between the position and the initial position after processing is less than the preset threshold, and finally the target three-dimensional model is obtained.
The sharpness recovery of the edges of the target three-dimensional model is achieved, and the accuracy of edge points is improved, making the processed edge more regular.
Smart Images

Figure CN113962903B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer graphics processing technology, and in particular to a three-dimensional model edge recovery method, device, equipment and storage medium. Background Art
[0002] With the continuous development of digital twin technology, the demand for 3D models and their application scenarios are becoming increasingly rich. However, the 3D models collected from real scenes will have different degrees of noise, which makes the denoising process of the 3D models an indispensable step. From the distribution characteristics, the details and noise in the 3D model belong to high-frequency information in the frequency domain, but they are mixed together in the spatial domain and difficult to distinguish effectively. Therefore, the research focus and difficulty of 3D model denoising is: how to eliminate the noise on the model and retain and restore the original details of the model as much as possible without introducing additional noise or distortion.
[0003] At present, the 3D model denoising algorithm mainly adjusts the position of the points in the model based on the point surface position, normal and other information in the 3D model to achieve the purpose of removing noise. The existing denoising methods are generally divided into local methods and global methods. Among them, the local method uses the convolution function to perform a weighted average of the normals of the neighborhood points to adjust the position of the points so that the normals of the adjusted points are close to the weighted average.
[0004] However, the local method is essentially a filter, which suffers from edge over-smoothing caused by normal weighting, making it difficult to retain weak and fine edges in the three-dimensional model, which in turn causes the problem of being unable to restore edge sharpness. Summary of the invention
[0005] The purpose of the present invention is to provide a 3D model edge recovery method, device, equipment and storage medium to address the deficiencies in the above-mentioned prior art, so as to restore the sharpness of the edge of the target 3D model, thereby effectively improving the accuracy of the edge points of the target 3D model.
[0006] 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 method for restoring an edge of a three-dimensional model, comprising:
[0008] Extracting at least one edge point of the initial three-dimensional model, and obtaining an edge point set of the initial three-dimensional model based on the at least one edge point, wherein the edge point includes: a boundary point and a skeleton point;
[0009] For each edge point in the edge point set, a boundary point set of the initial three-dimensional model is calculated, wherein the boundary point set includes: at least one boundary point; and each boundary point in the boundary point set is smoothed to obtain a processed position of each boundary point;
[0010] Removing boundary points in the boundary point set from the edge point set to obtain a skeleton point set, wherein the skeleton point set includes: at least one skeleton point;
[0011] According to the first-order smoothing processing model of each skeleton point in the skeleton point set and the position constraint regularization term, the position of each skeleton point in the skeleton point set is smoothed to obtain a processed position of each skeleton point, wherein the position constraint regularization term is used to constrain the first-order smoothing processing model so that the difference between the processed position and the initial position of the skeleton point is less than a preset threshold;
[0012] A target three-dimensional model corresponding to the initial three-dimensional model is obtained according to the processed position of each skeleton point in the skeleton point set and the processed position of each boundary point in the boundary point set.
[0013] Optionally, the smoothing the position of each skeleton point in the skeleton point set according to the first-order smoothing model of each skeleton point in the skeleton point set and the position constraint regularization term to obtain the processed position of each skeleton point includes:
[0014] Inputting the reference points on each fixed surface and the normal direction on each fixed surface in the neighborhood of the first skeleton point into the first-order smoothing model;
[0015] Inputting the initial position of the first skeleton point and the preset weight coefficient into the position constraint regularization term, wherein the parameters in the position constraint regularization term include: the initial position, the preset weight coefficient and the processed position of the first skeleton point, and the preset weight coefficient is used to control the weight of first-order smoothing and three-dimensional model fidelity;
[0016] Based on the preset residual constraint information, the first-order smoothing model and the position constraint regularization term, the processed position of each skeleton point is obtained.
[0017] Optionally, obtaining the processed position of each skeleton point based on preset residual constraint information, the first-order smoothing model and the position constraint regularization term includes:
[0018] The calculation result of the first-order smoothing model is added to the calculation result of the position constraint regularization term, and the preset residual constraint information is used as a constraint condition. The processed position when the addition result satisfies the constraint condition is used as the processed position of the first skeleton point.
[0019] Optionally, the reference point on each fixed surface in the neighborhood of the first skeleton point is any point on each fixed surface in the neighborhood of the first skeleton point.
[0020] Optionally, extracting at least one edge point of the initial three-dimensional model includes:
[0021] Using a neighboring face discriminator, obtaining a neighboring triangular face of each vertex in the initial three-dimensional model;
[0022] Determining the sharpness of each vertex according to the normal of the neighboring triangular surface of each vertex;
[0023] If the sharpness of the first vertex is less than a preset threshold, the first vertex is determined to be an edge point; the first vertex is any vertex in the target three-dimensional model.
[0024] Optionally, the calculating the boundary point set of the initial three-dimensional model for each edge point in the edge point set includes:
[0025] Each edge point in the edge point set is judged to obtain a boundary point set of the initial three-dimensional model.
[0026] Optionally, the method further comprises:
[0027] According to the first-order smoothing processing model of each boundary point in the boundary point set and the position constraint regularization term, the position of each boundary point in the boundary point set is smoothed to obtain the processed position of each boundary point.
[0028] In a second aspect, an embodiment of the present application further provides a three-dimensional model edge restoration device, the device comprising:
[0029] An extraction module, configured to extract at least one edge point of the initial three-dimensional model, and obtain an edge point set of the initial three-dimensional model based on the at least one edge point, wherein the edge point includes: a boundary point and a skeleton point;
[0030] A calculation module, configured to calculate a boundary point set of the initial three-dimensional model for each edge point in the edge point set, wherein the boundary point set includes at least one boundary point; and perform smoothing processing on each boundary point in the boundary point set to obtain a processed position of each boundary point;
[0031] A removal module, configured to remove boundary points in the boundary point set from the edge point set to obtain a skeleton point set, wherein the skeleton point set includes: at least one skeleton point;
[0032] a smoothing module, configured to perform smoothing processing on the position of each skeleton point in the skeleton point set according to a first-order smoothing processing model of each skeleton point in the skeleton point set and a position constraint regularization term, so as to obtain a processed position of each skeleton point, wherein the position constraint regularization term is used to constrain the first-order smoothing processing model so that the difference between the processed position and the initial position of the skeleton point is less than a preset threshold;
[0033] A processing module is used to obtain a target three-dimensional model corresponding to the initial three-dimensional model according to the processed position of each skeleton point in the skeleton point set and the processed position of each boundary point in the boundary point set.
[0034] Optionally, the smoothing module is further used for:
[0035] Inputting the reference points on each fixed surface and the normal direction on each fixed surface in the neighborhood of the first skeleton point into the first-order smoothing model;
[0036] Inputting the initial position of the first skeleton point and the preset weight coefficient into the position constraint regularization term, wherein the parameters in the position constraint regularization term include: the initial position, the preset weight coefficient and the processed position of the first skeleton point, and the preset weight coefficient is used to control the weight of first-order smoothing and three-dimensional model fidelity;
[0037] Based on the preset residual constraint information, the first-order smoothing model and the position constraint regularization term, the processed position of each skeleton point is obtained.
[0038] Optionally, the smoothing module is further used for:
[0039] The calculation result of the first-order smoothing model is added to the calculation result of the position constraint regularization term, and the preset residual constraint information is used as a constraint condition. The processed position when the addition result satisfies the constraint condition is used as the processed position of the first skeleton point.
[0040] Optionally, the reference point on each fixed surface in the neighborhood of the first skeleton point is any point on each fixed surface in the neighborhood of the first skeleton point.
[0041] Optionally, the extraction module is further used to:
[0042] Using a neighboring face discriminator, obtaining a neighboring triangular face of each vertex in the initial three-dimensional model;
[0043] Determining the sharpness of each vertex according to the normal of the neighboring triangular surface of each vertex;
[0044] If the sharpness of the first vertex is less than a preset threshold, the first vertex is determined to be an edge point; the first vertex is any vertex in the target three-dimensional model.
[0045] Optionally, the computing module is further used for:
[0046] Each edge point in the edge point set is judged to obtain a boundary point set of the initial three-dimensional model.
[0047] Optionally, the smoothing module is further used for:
[0048] According to the first-order smoothing processing model of each boundary point in the boundary point set and the position constraint regularization term, the position of each boundary point in the boundary point set is smoothed to obtain the processed position of each boundary point.
[0049] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the method provided in the first aspect.
[0050] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method provided in the first aspect are executed.
[0051] The beneficial effects of this application are:
[0052] The embodiment of the present application provides a 3D model edge recovery method, apparatus, device and storage medium, including: extracting at least one edge point of an initial 3D model, and obtaining an edge point set of the initial 3D model based on the at least one edge point, wherein the edge point includes: a boundary point and a skeleton point; for each edge point in the edge point set, calculating the boundary point set of the initial 3D model, wherein the boundary point set includes: at least one boundary point; and smoothing each boundary point in the boundary point set to obtain a processed position of each boundary point; removing the boundary points in the boundary point set from the edge point set to obtain a skeleton point set, wherein the skeleton point set includes: at least one skeleton point; smoothing the position of each skeleton point in the skeleton point set according to a first-order smoothing processing model of each skeleton point in the skeleton point set and a position constraint regularization term to obtain a processed position of each skeleton point, wherein the position constraint regularization term is used to constrain the first-order smoothing processing model so that the difference between the processed position and the initial position of the skeleton point is less than a preset threshold; and obtaining a target 3D model corresponding to the initial 3D model according to the processed position of each skeleton point in the skeleton point set and the processed position of each boundary point in the boundary point set. In this scheme, the edge points of the extracted initial 3D model are first judged to be removable, and the removable edge points are used as boundary points, and smoothing operations are performed on each boundary point. Then, the boundary points in the boundary point set are removed from the edge point set to obtain a skeleton point set, and each skeleton point is smoothed according to the first-order smoothing processing model of each skeleton point in the skeleton point set and the position constraint regularization term; then, the target 3D model corresponding to the initial 3D model is obtained according to the processed position of each skeleton point and the processed position of each boundary point. In this way, the edge area of the initial 3D model is gradually smoothed, so that the edge of the target 3D model obtained after processing is more regular, and the edge sharpness of the target 3D model is restored, thereby effectively improving the accuracy of the edge points of the target 3D model. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] 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.
[0054] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0055] Figure 2 A schematic diagram of a process of a three-dimensional model edge recovery method provided in an embodiment of the present application;
[0056] Figure 3A schematic diagram of a process flow of another three-dimensional model edge recovery method provided in an embodiment of the present application;
[0057] Figure 4 A schematic flow chart of another three-dimensional model edge recovery method provided in an embodiment of the present application;
[0058] Figure 5 A schematic diagram of the structure of a three-dimensional model edge recovery device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0060] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0061] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0062] First of all, before explaining the technical solution provided by the present application in detail, a brief explanation of the relevant background involved in the present application is given.
[0063] At present, the 3D model denoising algorithm mainly adjusts the position of the points in the model based on the point position, normal direction and other information in the 3D model to achieve the purpose of removing noise. The existing denoising methods are generally divided into local methods and global methods.
[0064] Among them, the local method adjusts each point in the model, and only the neighborhood information of each point is used during the adjustment process. The principle of the local method is to use the convolution function to perform weighted averaging of the normals of the neighborhood points to adjust the position of the points so that the normals of the adjusted points are close to the weighted average. In fact, the local method is essentially a filter. Different algorithms optimize the local method mainly by adjusting the filter so that the details of the model can be retained after filtering. For example, the bilateral filtering method in image processing is applied to the model, and the weights are determined by the point distance and the normal difference. The smaller the distance and the smaller the normal difference, the larger the weight; or the point neighborhood is segmented according to the consistency of the normal, and the best neighborhood is selected for calculation during filtering. Selecting a neighborhood with consistent features for filtering can avoid the phenomenon of blurring of edge points after filtering.
[0065] However, the various optimized local methods mentioned above all suffer from the over-smoothing of edges caused by normal weighting, which makes it difficult to retain weak and thin edges in the three-dimensional model, and thus causes the problem of being unable to restore edge sharpness.
[0066] In order to solve the technical problems existing in the above-mentioned prior art, a method for restoring the edge of a three-dimensional model is proposed, which specifically comprises the following steps: extracting edge points of the initial three-dimensional model, judging whether the extracted edge points can be removed, taking the removable edge points as boundary points, and performing corrosion and progressive smoothing operations on each boundary point, taking the remaining and non-removable edge points as skeleton points, and performing smoothing operations on each skeleton point according to the first-order smoothing processing model of each skeleton point in the skeleton point set and the position constraint regularization term; then, obtaining the target three-dimensional model corresponding to the initial three-dimensional model according to the processed positions of each skeleton point and the processed positions of each boundary point. In this way, the edge area of the initial three-dimensional model is subjected to progressive smoothing processing, so that the edge of the target three-dimensional model obtained after processing is more regular, and the edge sharpness of the target three-dimensional model is restored, thereby effectively improving the accuracy of the edge points of the target three-dimensional model.
[0067] Figure 1 The schematic diagram of the structure of an electronic device provided in an embodiment of the present application; the electronic device may be a processing device such as a computer or a server, which is used to implement the three-dimensional model edge recovery method provided in the present application. Figure 1 As shown, the electronic device includes: a processor 101 and a memory 102.
[0068] The processor 101 and the memory 102 are directly or indirectly electrically connected to each other to achieve data transmission or interaction. For example, the electrical connection can be achieved through one or more communication buses or signal lines.
[0069] The processor 101 may be an integrated circuit chip having the ability to process signals. The processor 101 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc. The methods, steps, and logic block diagrams disclosed in the embodiments of the present invention may be implemented or executed. The general-purpose processor may be a microprocessor or any conventional processor.
[0070] The memory 102 can 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.
[0071] Understandably, Figure 1 The structure described above is for illustration only. 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.
[0072] The memory 102 is used to store programs, and the processor 101 calls the programs stored in the memory 102 to execute the three-dimensional model edge recovery method provided in the following embodiment.
[0073] The three-dimensional model edge recovery method provided by the present application and the corresponding beneficial effects will be described below through multiple embodiments.
[0074] Figure 2 The flowchart of a 3D model edge restoration method provided in the embodiment of the present application is shown in FIG. 1 . Optionally, the execution subject of the method can be a server, computer or other electronic device with data processing function. It should be understood that in other embodiments, the order of some steps in the 3D model edge restoration method can be interchanged according to actual needs, or some steps can be omitted or deleted. Figure 2 As shown, the method includes:
[0075] S201. Extract at least one edge point of an initial three-dimensional model, and obtain an edge point set of the initial three-dimensional model based on the at least one edge point.
[0076] Among them, edge points include: boundary points and skeleton points. Boundary points refer to points that can be removed during the erosion of the edge point set in the initial three-dimensional model from the outermost layer to the innermost layer, and skeleton points refer to points that cannot be removed during the erosion of the edge point set in the initial three-dimensional model from the outermost layer to the innermost layer. It should be understood that, according to the positions of the skeleton points finally obtained, the adjacent skeleton points can be connected one by one to obtain at least one more regular edge corresponding to the initial three-dimensional model.
[0077] Optionally, in this embodiment, the initial three-dimensional model is first preprocessed, and a corner point detection algorithm can be used to extract edge points of each triangular face in the preprocessed initial three-dimensional model, and an edge point set is obtained based on the extracted edge points. The specific algorithm used to extract the edge points of the initial three-dimensional model is not specifically limited herein.
[0078] S202, for each edge point in the edge point set, calculate a boundary point set of the initial three-dimensional model, the boundary point set including: at least one boundary point; and perform smoothing processing on each boundary point in the boundary point set to obtain a processed position of each boundary point.
[0079] In this embodiment, the boundary point set of the initial three-dimensional model is calculated for each edge point in the edge point set to obtain the boundary points included in the boundary point set, and each boundary point in the boundary point set is smoothed to obtain the processed position of each boundary point. In this way, the noise of the initial three-dimensional model can be removed so that each external boundary point in the target three-dimensional model obtained in the end can be restored to be sharp.
[0080] S203 , removing boundary points in the boundary point set from the edge point set to obtain a skeleton point set.
[0081] The skeleton point set includes: at least one skeleton point.
[0082] Optionally, in this embodiment, the skeleton points need to be retained during the smoothing process of each boundary point in the boundary point set, and the boundary points in the boundary point set are removed from the edge point set to obtain the skeleton point set, so that the final processing of the skeleton points can effectively achieve denoising and sharpening of the edge skeleton points.
[0083] S204 , performing smoothing processing on the position of each skeleton point in the skeleton point set according to the first-order smoothing processing model of each skeleton point in the skeleton point set and the position constraint regularization term to obtain a processed position of each skeleton point.
[0084] The position constraint regularization term is used to constrain the first-order smoothing processing model so that the difference between the processed position and the initial position of the skeleton point is less than a preset threshold.
[0085] It should be understood that the first-order smoothing model is used to smooth each skeleton point. The effect of the first-order smoothing model is to reduce the gradient of each skeleton point so that the position of each skeleton point is on the fixed surface of its surrounding neighborhood. However, the fixed surface of the neighborhood of a skeleton point is likely to belong to the same plane or contain noise, making it easy for the target 3D model obtained by the final processing to have an ill-conditioned solution or an erroneous solution.
[0086] Therefore, in this embodiment, in order to prevent the edge over-smoothing phenomenon caused by normal weighting and restore the sharpness of the edge points, it is proposed that a position constraint regularization term can be added on the basis of first-order smoothing to smooth the position of each skeleton point in the skeleton point set, so that the difference between the processed position of each skeleton point and the initial position of the skeleton point is less than a preset threshold. In this way, the first-order smoothing and position constraint regularization terms are comprehensively utilized to smooth the position of each skeleton point in the skeleton point set, so that the overall model can smooth each skeleton point while generating as little displacement as possible, thereby realizing the restoration of the edge sharpness of the target three-dimensional model, thereby effectively improving the accuracy of the edge points of the target three-dimensional model.
[0087] S205 , obtaining a target three-dimensional model corresponding to the initial three-dimensional model according to the processed position of each skeleton point in the skeleton point set and the processed position of each boundary point in the boundary point set.
[0088] On the basis of the above embodiment, the target three-dimensional model corresponding to the initial three-dimensional model can be obtained based on the "processed position of each skeleton point in the skeleton point set" and the "processed position of each boundary point in the boundary point set" obtained above.
[0089] In summary, an embodiment of the present application provides a three-dimensional model edge recovery method, including: extracting at least one edge point of an initial three-dimensional model, and obtaining an edge point set of the initial three-dimensional model based on the at least one edge point, the edge point including: a boundary point and a skeleton point; for each edge point in the edge point set, calculating the boundary point set of the initial three-dimensional model, the boundary point set including: at least one boundary point; and smoothing each boundary point in the boundary point set to obtain a processed position of each boundary point; removing the boundary points in the boundary point set from the edge point set to obtain a skeleton point set, the skeleton point set including: at least one skeleton point; smoothing the position of each skeleton point in the skeleton point set according to a first-order smoothing processing model of each skeleton point in the skeleton point set and a position constraint regularization term to obtain a processed position of each skeleton point, wherein the position constraint regularization term is used to constrain the first-order smoothing processing model so that the difference between the processed position and the initial position of the skeleton point is less than a preset threshold; according to the processed position of each skeleton point in the skeleton point set and the processed position of each boundary point in the boundary point set, a target three-dimensional model corresponding to the initial three-dimensional model is obtained. In this scheme, the edge points of the extracted initial 3D model are first judged to be removable, and the removable edge points are used as boundary points, and smoothing operations are performed on each boundary point. Then, the boundary points in the boundary point set are removed from the edge point set to obtain a skeleton point set, and each skeleton point is smoothed according to the first-order smoothing processing model of each skeleton point in the skeleton point set and the position constraint regularization term; then, the target 3D model corresponding to the initial 3D model is obtained according to the processed position of each skeleton point and the processed position of each boundary point. In this way, the edge area of the initial 3D model is gradually smoothed, so that the edge of the target 3D model obtained after processing is more regular, and the edge sharpness of the target 3D model is restored, thereby effectively improving the accuracy of the edge points of the target 3D model.
[0090] The following embodiments will explain in detail how to smooth the position of each skeleton point in the skeleton point set based on the first-order smoothing model of each skeleton point in the skeleton point set and the position constraint regularization term to obtain the processed position of each skeleton point.
[0091] Alternatively, if Figure 3 As shown, the above step S204: according to the first-order smoothing processing model of each skeleton point in the skeleton point set and the position constraint regularization term, the position of each skeleton point in the skeleton point set is smoothed to obtain the processed position of each skeleton point, including:
[0092] S301, inputting reference points on each fixed surface within the neighborhood of the first skeleton point and normal directions on each fixed surface into a first-order smoothing model.
[0093] Optionally, the reference point on each fixed surface in the neighborhood of the first skeleton point is any point on each fixed surface in the neighborhood of the first skeleton point.
[0094] It should be understood that in this method, after all skeleton points are smoothed, the position of each skeleton point will be adjusted. Therefore, the position of the triangle containing each skeleton point will change. The triangle containing the skeleton point is defined as a "dynamic triangle". The position of all triangles that do not contain skeleton points will not change in subsequent processing and are defined as "fixed triangles".
[0095] When smoothing each skeleton point, you can select a fixed triangle around each skeleton point and use a first-order smoothing model to smooth each skeleton point. The purpose of using a first-order smoothing model is to reduce the gradient of the skeleton point so that the position of the skeleton point is on the surrounding triangle surface.
[0096] In this embodiment, the first-order smoothing model can be expressed as the following formula (1):
[0097]
[0098] Among them, R1 is the first residual, v is the coordinate of the first skeleton point in the skeleton point set, and p i is a reference point on the i-th fixed face in the neighborhood of the first skeleton point, and the reference point p i can be any point on the i-th fixed surface, n i is the normal direction of the i-th fixed surface.
[0099] S302: Inputting the initial position of the first skeleton point and the preset weight coefficient into the position constraint regularization term.
[0100] The parameters in the position constraint regularization term include: the initial position, the preset weight coefficient, and the processed position of the first skeleton point, and the preset weight coefficient is used to control the weight of the first-order smoothing and the fidelity of the three-dimensional model. It should be understood that the relationship between the first-order smoothing and the model fidelity can be adjusted by adjusting λ1.
[0101] In this embodiment, the position constraint regularization term can be expressed as the following formula (2):
[0102] R2=λ1‖v-v0‖ (3)
[0103] Among them, R2 is the second residual, λ1 is the preset weight coefficient, v is the position of the skeleton point after smoothing, v0 is the initial position of the skeleton point, and the role of the position constraint regularization term is to constrain the position of the skeleton point after smoothing to not undergo a large displacement compared to the initial position.
[0104] S303: Based on the preset residual constraint information, the first-order smoothing model and the position constraint regularization term, the processed position of each skeleton point is obtained.
[0105] Optionally, based on preset residual constraint information, a first-order smoothing model, and a position constraint regularization term, the processed position of each skeleton point is obtained, including:
[0106] The calculation result of the first-order smoothing model is added to the calculation result of the position constraint regularization term, and the preset residual constraint information is used as the constraint condition. The processed position when the addition result satisfies the constraint condition is used as the processed position of the first skeleton point.
[0107] In this embodiment, the calculation results of formula (1) and formula (2) can be added to obtain the following formula (3):
[0108]
[0109] The residual value R3 is used as a constraint condition. After comparing multiple calculation results, the v corresponding to the minimum residual value R3 is used as the smoothed position of the first skeleton point.
[0110] In this way, the position of each skeleton point is smoothed by formula (3) so that the distance from each skeleton point to its adjacent fixed surface is minimized. In theory, the clear model edge point is located at the intersection of two or more surfaces, that is, the edge skeleton point should be on its adjacent surface. Therefore, adding a position constraint regularization term on the basis of the first-order smoothing model can prevent the problem of noise or insufficient number of adjacent surfaces, so that the overall model can smooth each skeleton point while generating as little displacement as possible, and then the edge of the target 3D model corresponding to the initial 3D model can be obtained according to the smoothed position of each skeleton point. More regular, thereby realizing the restoration of the sharpness of the edge of the target 3D model and effectively improving the accuracy of the edge points of the target 3D model.
[0111] The following example will explain in detail how to extract at least one edge point of the initial three-dimensional model.
[0112] Alternatively, if Figure 4 As shown, the above step S201: extracting at least one edge point of the initial three-dimensional model includes:
[0113] S401, using a neighboring face discriminator to obtain a neighborhood triangular face of each vertex in the initial three-dimensional model.
[0114] In this embodiment, a “neighboring face discriminator” can be used to perform neighboring discriminant on the neighboring faces of the n-ring of each vertex in the initial three-dimensional model. In actual operation, the neighboring face discrimination threshold λ2 is is the average side length of the triangular face in the initial 3D model, n is 5, and the neighbor face discriminator is as shown in the following formula (4):
[0115]
[0116] Among them, v is the coordinate of a vertex, f is a triangle in the neighborhood of the n-ring, and λ2 is the proximity judgment threshold. According to experience, the value of λ2 can be set to
[0117] For example, if the distance d between a vertex P1 in the initial 3D model and "a triangle f1 in the 5-ring neighborhood of vertex P1" is less than the neighboring face discrimination threshold Then f1 is regarded as a neighborhood triangle of "vertex P1".
[0118] S402: Determine the sharpness of each vertex according to the normal of the neighboring triangle surface of each vertex.
[0119] Usually, the normal of the neighboring triangle of each vertex is not saved in a general three-dimensional model. Therefore, it is necessary to calculate the normal of the neighboring triangle of each vertex. The normal calculation method that can be used is as shown in the following formula (5):
[0120]
[0121] in, is the normal of a triangle at a certain vertex, and p1, p2, and p3 are the three vertices of the triangle distributed counterclockwise.
[0122] S403: If the sharpness of the first vertex is less than a preset threshold, determine the first vertex as an edge point.
[0123] The first vertex is any vertex in the target three-dimensional model.
[0124] In this embodiment, the sharpness of the first vertex can be calculated according to the following formula (6). If the sharpness of the first vertex is less than the preset threshold value T τ , then the first vertex is determined to be an edge point. In addition, the threshold can be set to 0.25.
[0125]
[0126] Among them, τ is the sharpness of the first vertex, n i 、n j is the normal of the neighborhood triangle of the first vertex. The dot product closest to the 90-degree normal can be calculated using formula (6).
[0127] The following embodiments will explain in detail how to calculate the boundary point set of the initial three-dimensional model for each edge point in the edge point set.
[0128] It should be understood that the initial 3D model actually extracted usually has many edge points, and each edge point is not sharp enough. Therefore, it is necessary to remove each edge point in the edge point set, and use the removable edge points as boundary points, and obtain the boundary point set of the initial 3D model based on at least one boundary point.
[0129] Then, after removing the boundary points in the boundary point set from the edge point set, a plurality of remaining edge points are obtained as skeleton points, and a skeleton point set of the initial three-dimensional model is obtained based on at least one skeleton point.
[0130] It is worth noting that in this embodiment, considering that the skeleton points of the initial 3D model have a great influence on the smoothing effect of the final model, it is necessary to perform smoothing on each skeleton point in the skeleton point set after denoising each boundary point in the boundary point set, and the skeleton points need to be retained in the process of gradually smoothing each boundary point in the boundary point set.
[0131] Optionally, for each edge point in the edge point set, calculating the boundary point set of the initial three-dimensional model includes: judging each edge point in the edge point set to obtain the boundary point set of the initial three-dimensional model.
[0132] It should be noted that, in this embodiment, each edge point in the edge point set needs to be judged twice, namely, edge point boundary judgment and removability judgment.
[0133] (1) Edge point boundary judgment, as follows:
[0134] In this embodiment, the edge points in the edge point set are iteratively judged from the outermost layer to the innermost layer. Specifically, the outermost edge points in the edge point set can be marked using an erosion operation. If there are non-edge points in the neighborhood of an edge point P2 in the outermost layer, the edge point P2 is updated to a non-edge point. After one round of judgment, the erosion operation will continue to judge the edge points in the edge point set that are one round inward.
[0135] It is worth noting that the removable judgment is to prevent the corrosion operation from destroying the connectivity of the edge, so as to ensure the connectivity of each skeleton point obtained after removing the boundary points in the boundary point set from the edge point set.
[0136] (2) The judgment can be removed, as follows:
[0137] In this embodiment, the edge points in the neighborhood of the point to be removed can be marked based on the seed growth algorithm. If all points are marked, it means that the connection can still be established after the current point is removed, and the point to be removed can be determined to be a removable point. The details are as follows:
[0138] The first step is to define an edge point set Ω, the point v to be removed. In the edge point set Ω, find all vertices that have adjacent edges to the point v to be removed, obtain the vertex set that has adjacent edges to the point v to be removed, and define this vertex set as Ω d .
[0139] The second step is to establish a region growth stack S and transform the vertex set Ω d Put a vertex P3 into the stack S and mark the vertex P3.
[0140] Step 3: Pop a vertex from the region growth stack S Find and Vertices with adjacent edges, mark those that belong to Ω d The point will belong to Ω d Add to stack S.
[0141] Step 4: Determine whether the region growth stack S is empty. If it is empty, execute step 5, otherwise return to step 3.
[0142] Step 5: If the vertex set Ω d If all vertices in the set are marked, then the point v to be removed is determined to be a point that can be removed; if the vertex set Ω d If there is an unmarked vertex, the point v to be removed is determined to be an irremovable point.
[0143] In this embodiment, after judging each edge point in the edge point set to obtain the boundary point set of the initial three-dimensional model, it is also necessary to perform smoothing processing on the position of each boundary point in the boundary point set.
[0144] Optionally, the method further comprises: performing smoothing processing on the position of each boundary point in the boundary point set according to a first-order smoothing processing model of each boundary point in the boundary point set and a position constraint regularization term to obtain a processed position of each skeleton point.
[0145] In this embodiment, when a boundary point in the boundary point set is removed, its position needs to be smoothed according to the surrounding triangles, and all edge points will be adjusted in this method. Therefore, the above-mentioned smoothing method for skeleton points can be used to smooth each boundary point in the boundary point set. Specifically, the position of each boundary point in the boundary point set can be smoothed according to the first-order smoothing model of each boundary point in the boundary point set and the position constraint regularization term to obtain the processed position of each skeleton point.
[0146] In addition, mainly when edge point boundary judgment is performed, smoothing processing is performed on each boundary point that shrinks inward by one circle, so as to realize a gradual smoothing processing operation on each boundary point in the boundary point set.
[0147] In this way, it is possible to perform progressive smoothing on the edge area of the initial three-dimensional model, so that the edge of the target three-dimensional model obtained after processing is more regular, and the sharpness of the edge of the target three-dimensional model is restored, thereby effectively improving the accuracy of the edge points of the target three-dimensional model.
[0148] The following describes the device and storage medium corresponding to the three-dimensional model edge recovery method provided in this application. The specific implementation process and technical effects are described above and will not be repeated below.
[0149] Figure 5 A schematic diagram of the structure of a three-dimensional model edge recovery device provided in an embodiment of the present application; Figure 5 As shown, the device comprises:
[0150] An extraction module 501 is used to extract at least one edge point of the initial three-dimensional model, and obtain an edge point set of the initial three-dimensional model based on the at least one edge point, where the edge point includes: a boundary point and a skeleton point;
[0151] The calculation module 502 is used to calculate the boundary point set of the initial three-dimensional model for each edge point in the edge point set, wherein the boundary point set includes at least one boundary point; and perform smoothing processing on each boundary point in the boundary point set to obtain a processed position of each boundary point;
[0152] The removal module 503 is used to remove the boundary points in the boundary point set from the edge point set to obtain a skeleton point set, wherein the skeleton point set includes: at least one skeleton point;
[0153] A smoothing module 504 is used to perform smoothing processing on the position of each skeleton point in the skeleton point set according to the first-order smoothing processing model of each skeleton point in the skeleton point set and the position constraint regularization term to obtain a processed position of each skeleton point, wherein the position constraint regularization term is used to constrain the first-order smoothing processing model so that the difference between the processed position and the initial position of the skeleton point is less than a preset threshold;
[0154] The processing module 505 is used to obtain a target three-dimensional model corresponding to the initial three-dimensional model according to the processed position of each skeleton point in the skeleton point set and the processed position of each boundary point in the boundary point set.
[0155] Optionally, the smoothing module 504 is further configured to:
[0156] Inputting the reference points on each fixed surface in the neighborhood of the first skeleton point and the normal direction on each fixed surface into the first-order smoothing model;
[0157] Inputting the initial position of the first skeleton point and the preset weight coefficient into the position constraint regularization term, wherein the parameters in the position constraint regularization term include: the initial position, the preset weight coefficient and the processed position of the first skeleton point, and the preset weight coefficient is used to control the weight of the first-order smoothing and the fidelity of the three-dimensional model;
[0158] Based on the preset residual constraint information, the first-order smoothing model and the position constraint regularization term, the processed position of each skeleton point is obtained.
[0159] Optionally, the smoothing module 504 is further configured to:
[0160] The calculation result of the first-order smoothing model is added to the calculation result of the position constraint regularization term, and the preset residual constraint information is used as the constraint condition. The processed position when the addition result satisfies the constraint condition is used as the processed position of the first skeleton point.
[0161] Optionally, the reference point on each fixed surface in the neighborhood of the first skeleton point is any point on each fixed surface in the neighborhood of the first skeleton point.
[0162] Optionally, the extraction module 501 is further used for:
[0163] Use the neighboring face discriminator to obtain the neighboring triangular faces of each vertex in the initial three-dimensional model;
[0164] Determine the sharpness of each vertex based on the normal of the neighboring triangles of each vertex;
[0165] If the sharpness of the first vertex is less than a preset threshold, the first vertex is determined to be an edge point; the first vertex is any vertex in the target three-dimensional model.
[0166] Optionally, the calculation module 502 is further configured to:
[0167] Each edge point in the edge point set is judged to obtain the boundary point set of the initial three-dimensional model.
[0168] Optionally, the smoothing module 504 is further configured to:
[0169] According to the first-order smoothing processing model of each boundary point in the boundary point set and the position constraint regularization term, the position of each boundary point in the boundary point set is smoothed to obtain the processed position of each boundary point.
[0170] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0171] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0172] Optionally, the present invention also provides a program product, such as a computer-readable storage medium, comprising a program, which is used to execute the above method embodiment when executed by a processor.
[0173] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0174] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0175] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0176] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.
Claims
1. A three-dimensional model edge recovery method, characterized in that: include: Extracting at least one edge point of the initial three-dimensional model, and obtaining an edge point set of the initial three-dimensional model based on the at least one edge point, wherein the edge point includes: a boundary point and a skeleton point; For each edge point in the edge point set, a boundary point set of the initial three-dimensional model is calculated, wherein the boundary point set includes: at least one boundary point; and each boundary point in the boundary point set is smoothed to obtain a processed position of each boundary point; Removing boundary points in the boundary point set from the edge point set to obtain a skeleton point set, wherein the skeleton point set includes: at least one skeleton point; According to the first-order smoothing processing model of each skeleton point in the skeleton point set and the position constraint regularization term, the position of each skeleton point in the skeleton point set is smoothed to obtain a processed position of each skeleton point, wherein the position constraint regularization term is used to constrain the first-order smoothing processing model so that the difference between the processed position and the initial position of the skeleton point is less than a preset threshold; A target three-dimensional model corresponding to the initial three-dimensional model is obtained according to the processed position of each skeleton point in the skeleton point set and the processed position of each boundary point in the boundary point set.
2. The method according to claim 1, characterized in that The step of smoothing the position of each skeleton point in the skeleton point set according to the first-order smoothing model of each skeleton point in the skeleton point set and the position constraint regularization term to obtain the processed position of each skeleton point includes: Inputting the reference points on each fixed surface and the normal direction on each fixed surface in the neighborhood of the first skeleton point into the first-order smoothing model; Inputting the initial position of the first skeleton point and the preset weight coefficient into the position constraint regularization term, wherein the parameters in the position constraint regularization term include: the initial position, the preset weight coefficient and the processed position of the first skeleton point, and the preset weight coefficient is used to control the weight of first-order smoothing and three-dimensional model fidelity; Based on the preset residual constraint information, the first-order smoothing model and the position constraint regularization term, the processed position of each skeleton point is obtained.
3. The method according to claim 2, characterized in that The step of obtaining the processed position of each skeleton point based on the preset residual constraint information, the first-order smoothing model and the position constraint regularization term includes: The calculation result of the first-order smoothing model is added to the calculation result of the position constraint regularization term, and the preset residual constraint information is used as a constraint condition. The processed position when the addition result satisfies the constraint condition is used as the processed position of the first skeleton point.
4. The method according to claim 2, characterized in that: The reference point on each fixed surface in the neighborhood of the first skeleton point is any point on each fixed surface in the neighborhood of the first skeleton point.
5. The method according to any one of claims 1 to 4, characterized in that: The step of extracting at least one edge point of the initial three-dimensional model comprises: Using a neighboring face discriminator, obtaining a neighboring triangular face of each vertex in the initial three-dimensional model; Determining the sharpness of each vertex according to the normal of the neighboring triangular surface of each vertex; If the sharpness of the first vertex is less than a preset threshold, the first vertex is determined to be an edge point; the first vertex is any vertex in the target three-dimensional model.
6. The method according to claim 1, characterized in that The step of calculating the boundary point set of the initial three-dimensional model for each edge point in the edge point set includes: Each edge point in the edge point set is judged to obtain a boundary point set of the initial three-dimensional model.
7. The method according to claim 6, characterized in that Also includes: According to the first-order smoothing processing model of each boundary point in the boundary point set and the position constraint regularization term, the position of each boundary point in the boundary point set is smoothed to obtain the processed position of each boundary point.
8. A three-dimensional model edge restoration device, characterized in that: The device comprises: An extraction module, configured to extract at least one edge point of the initial three-dimensional model, and obtain an edge point set of the initial three-dimensional model based on the at least one edge point, wherein the edge point includes: a boundary point and a skeleton point; A calculation module, configured to calculate a boundary point set of the initial three-dimensional model for each edge point in the edge point set, wherein the boundary point set includes at least one boundary point; and perform smoothing processing on each boundary point in the boundary point set to obtain a processed position of each boundary point; A removal module, configured to remove boundary points in the boundary point set from the edge point set to obtain a skeleton point set, wherein the skeleton point set includes: at least one skeleton point; a smoothing module, configured to perform smoothing processing on the position of each skeleton point in the skeleton point set according to a first-order smoothing processing model of each skeleton point in the skeleton point set and a position constraint regularization term, so as to obtain a processed position of each skeleton point, wherein the position constraint regularization term is used to constrain the first-order smoothing processing model so that a difference between the processed position and the initial position of the skeleton point is less than a preset threshold; A processing module is used to obtain a target three-dimensional model corresponding to the initial three-dimensional model according to the processed position of each skeleton point in the skeleton point set and the processed position of each boundary point in the boundary point set.
9. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of any method as described in claims 1-7.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are executed.
