Self-adaptive grid sampling method and device based on error driving and storage medium

Through the error-driven adaptive grid sampling method, the sampling point density is dynamically adjusted, which solves the problems of low sampling accuracy and complex calculation in traditional surface sampling methods, realizes efficient sampling in complex curvature areas, reduces the number of sampling points and improves sampling efficiency. It is particularly suitable for aerospace, automotive design, consumer electronics and industrial design.

CN120635368APending Publication Date: 2025-09-12BEIJING INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510716464.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-30
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Traditional surface sampling methods have the disadvantages of low sampling accuracy, complex calculations and inability to adaptively increase sampling density. It is difficult to effectively increase sampling points in areas with complex curvature changes, and it is impossible to take into account multiple constraints at the same time. In addition, existing adaptive methods cannot increase sampling density in key areas.

Method used

An error-driven adaptive grid sampling method is adopted. Regular grid points are generated through initial uniform sampling, the surface is reconstructed and the error distribution is obtained. The sampling point density is dynamically adjusted, and the sampling points in the high error area are increased. The position and direction of the maximum error point are determined according to the error distribution to increase the sampling points.

Benefits of technology

While ensuring sampling accuracy, the number of sampling points is reduced and sampling efficiency is improved. It is applicable to surface models in various forms of representation, and is particularly suitable for high-precision measurement of free-form surface models with complex geometric features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120635368A_ABST
    Figure CN120635368A_ABST
Patent Text Reader

Abstract

The invention provides a self-adaptive grid sampling method and device based on error driving and a storage medium, and the method comprises the steps: carrying out the sparse initial uniform sampling of a to-be-sampled original curved surface model, and generating sampling points of a regular grid; performing curved surface reconstruction according to the sampling points to obtain a reconstructed curved surface; obtaining distance error distribution and a maximum error point of the reconstructed curved surface and the original curved surface model; under the condition that the distance error parameter meets a preset condition or the current iteration frequency reaches a preset value, a sampling point set composed of sampling points and / or a reconstructed curved surface are / is output, and the error parameter comprises a maximum error and a root-mean-square error; otherwise, according to the parameter coordinates of the error points, adding the sampling points in the row direction or the column direction corresponding to the maximum error point, and returning to execute the step of reconstructing the curved surface. According to the method, the adaptive iterative sampling strategy is reconstructed according to the curved surface, so that the number of sampling points is reduced on the premise of ensuring the sampling precision; and the sampling efficiency and generalization are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer-aided geometric design and reverse engineering, and in particular to an error-driven adaptive grid sampling method, device and storage medium. Background Art

[0002] Due to their flexibility and expressive power, free-form surfaces are widely used in aerospace, automotive design, consumer electronics, and industrial design. In product design, inspection, and quality control, it is often necessary to sample complex free-form surfaces to obtain their geometric features. The distribution of sampling points directly affects the accuracy of subsequent surface reconstruction or inspection. Therefore, how to efficiently sample the point set of a free-form surface while minimizing the number of sampling points and ensuring the accuracy of subsequent analysis or reconstruction becomes a key issue.

[0003] Traditional surface sampling methods mainly include uniform sampling and curvature-based sampling. The uniform sampling method is simple to implement, but in areas with complex curvature changes, the sampling density is insufficient, resulting in the loss of important geometric features. Although the curvature-based sampling method can increase sampling points in areas with large curvature changes, it requires pre-estimation of the curvature distribution, which is computationally complex and not suitable for models with only discrete representations. Moreover, most existing methods adopt a one-time sampling strategy, which makes it difficult to dynamically adjust the distribution of sampling points based on the sampling results, and cannot effectively increase the sampling density in key areas. At the same time, existing adaptive methods can often only be performed under a single constraint, making it difficult to take into account multiple constraints at the same time. In addition, many methods focus on optimizing point cloud density rather than minimizing subsequent reconstruction or detection errors. Summary of the Invention

[0004] The technical purpose to be achieved by the embodiments of the present application is to provide an error-driven adaptive grid sampling method, device and storage medium to solve the problems of low sampling accuracy, complex calculation and inability to adaptively increase the sampling density in traditional surface sampling methods.

[0005] To solve the above technical problems, the present invention provides an error-driven adaptive grid sampling method, including:

[0006] Perform initial uniform sampling on the original surface model to be sampled to generate sampling points of a regular grid;

[0007] Reconstructing a surface based on the sampling points to obtain a reconstructed surface;

[0008] Obtaining a distance error distribution between the reconstructed surface and the original surface model;

[0009] Determining a maximum error point and error point parameter coordinates corresponding to the maximum error point according to the distance error distribution;

[0010] When the error parameters corresponding to the distance error distribution meet a preset condition or the current number of iterations reaches a preset value, outputting the sampling point set composed of the sampling points and / or the reconstructed surface, wherein the error parameters include a maximum error and a root mean square error;

[0011] If the error parameter corresponding to the distance error distribution does not meet the preset condition and the current number of iterations does not reach the preset value, sampling points are added in the row direction or column direction corresponding to the maximum error point according to the error point parameter coordinates, and the process returns to the step of performing surface reconstruction according to the sampling points to obtain a reconstructed surface.

[0012] Preferably, in the above method, the initial uniform sampling of the original surface model to be sampled to generate sampling points of a regular grid includes:

[0013] Obtaining a bounding box of the original surface model;

[0014] Extracting the boundary line of the original surface model;

[0015] Determining four characteristic corner points of the original surface model on the boundary line according to the boundary box;

[0016] Based on the four characteristic corner points, an initial uniform grid sampling point with a preset number of rows and columns is generated according to a bilinear interpolation method;

[0017] The initial uniform grid sampling points located inside the boundary line are projected onto the original surface model, and the projected points are determined as the sampling points.

[0018] Specifically, the method described above, projecting the initial uniform grid sampling points located inside the boundary line onto the original surface model, and determining the projected points as the sampling points, includes:

[0019] Constructing a first ray according to each of the initial uniform grid sampling points located inside the boundary line, wherein the starting point of the first ray is the grid point corresponding to the initial uniform grid sampling point, and the direction of the first ray is the normal vector of the original surface model;

[0020] Calculating the intersection points of each first ray with all triangles on the original surface model, and determining the intersection point closest to the starting point as the projection point corresponding to the initial uniform grid sampling point;

[0021] The projection point is determined as the sampling point.

[0022] Preferably, in the above method, reconstructing the surface according to the sampling points to obtain the reconstructed surface includes:

[0023] Parameterizing the sampling points to determine sampling parameter coordinates corresponding to each sampling point, wherein the sampling parameter coordinates are determined according to the position of the sampling point in the grid;

[0024] A surface is reconstructed according to the sampling points and the corresponding sampling parameter coordinates to obtain the reconstructed surface, wherein the reconstructed surface is expressed as a non-uniform rational B-splines (NURBS) surface parametric equation, wherein the control point coordinates and weights of the NURBS surface parametric equation are obtained by solving the least squares method according to a basis function matrix and the spatial coordinate vectors of the sampling points.

[0025] Preferably, in the above method, obtaining the distance error distribution between the reconstructed surface and the original surface model includes:

[0026] Uniformly generating a dense verification point set on the original surface model, wherein the number of verification points in the verification point set is greater than the number of sampling points;

[0027] Obtaining verification parameter coordinates of each verification point in the parameter space;

[0028] According to the verification parameter coordinates, the distance error between each of the verification points and the corresponding point on the reconstructed surface is calculated to obtain the distance error distribution.

[0029] Preferably, in the above method, the step of adding sampling points in the row direction or column direction corresponding to the maximum error point according to the error point parameter coordinates includes:

[0030] Determine the target grid unit where the maximum error point is located according to the error point parameter coordinates corresponding to the maximum error point;

[0031] According to the error distribution, obtaining the average error corresponding to the maximum error point in the row direction and the column direction in the grid;

[0032] According to the target direction and the relative position of the maximum error point in the target grid unit, a row or a column of sampling points is added, and the target direction is the direction corresponding to the larger value of the average error corresponding to the row direction and the average error corresponding to the column direction.

[0033] Another embodiment of the present application provides a control device, including:

[0034] The sampling module is used to perform initial uniform sampling on the original surface model to be sampled and generate sampling points of a regular grid;

[0035] A surface reconstruction module, configured to reconstruct a surface based on the sampling points to obtain a reconstructed surface;

[0036] an error distribution determining module, configured to obtain a distance error distribution between the reconstructed surface and the original surface model;

[0037] A maximum error point determination module is used to determine the maximum error point and the error point parameter coordinates corresponding to the maximum error point according to the distance error distribution;

[0038] a first processing module, configured to output the sampling point set formed by the sampling points and / or the reconstructed surface when an error parameter corresponding to the distance error distribution satisfies a preset condition or the current number of iterations reaches a preset value, wherein the error parameter includes a maximum error and a root mean square error;

[0039] The second processing module is used to add sampling points in the row direction or column direction corresponding to the maximum error point according to the error point parameter coordinates, when the error parameters corresponding to the distance error distribution do not meet the preset conditions and the current number of iterations does not reach the preset value, and return to the step of reconstructing the surface according to the sampling points to obtain a reconstructed surface.

[0040] Yet another embodiment of the present application provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the error-driven adaptive grid sampling method as described above.

[0041] Yet another embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the error-driven adaptive grid sampling method as described above.

[0042] Another embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps of the error-driven adaptive grid sampling method as described above.

[0043] Compared with the prior art, the error-driven adaptive grid sampling method, device, and storage medium provided in the embodiments of the present application have at least the following beneficial effects:

[0044] In this application, an adaptive iterative sampling strategy is adopted to dynamically adjust the sampling point density according to the error distribution of surface reconstruction, and the sampling points in the high error area are increased in a targeted manner, thereby reducing the number of sampling points while ensuring the sampling accuracy; the sampling point increase method based on the row and column structure maintains the regular distribution of sampling points, which is convenient for subsequent surface reconstruction and parameterization processing; by analyzing the errors in the row and column directions, the direction of increasing the sampling points is intelligently selected, further improving the sampling efficiency; at the same time, this application does not require pre-estimation of the curvature distribution, but only relies on reconstruction error analysis, and is applicable to surface models of various representation forms. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 This is a flow chart of the error-driven adaptive grid sampling method of the present application;

[0046] Figure 2 This is the second flow chart of the error-driven adaptive grid sampling method of this application;

[0047] Figure 3 This is the third flow chart of the error-driven adaptive grid sampling method of this application;

[0048] Figure 4 This is the fourth flow chart of the error-driven adaptive grid sampling method of this application;

[0049] Figure 5 This is the fifth flow chart of the error-driven adaptive grid sampling method of this application;

[0050] Figure 6 This is the sixth flow chart of the error-driven adaptive grid sampling method of this application;

[0051] Figure 7 Schematic diagram of the reconstructed surface and the original surface model of this application;

[0052] Figure 8 This is a schematic structural diagram of the control device of this application. DETAILED DESCRIPTION

[0053] In order to make the technical problems, technical solutions and advantages to be solved by the present application clearer, the following will be described in detail with reference to the accompanying drawings and specific embodiments. In the following description, specific details such as specific configurations and components are provided only to help fully understand the embodiments of the present application. Therefore, it should be clear to those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. In addition, for clarity and brevity, the description of known functions and structures has been omitted.

[0054] It should be understood that references throughout this specification to "one embodiment" or "an embodiment" mean that a particular feature, structure, or characteristic associated with the embodiment is included in at least one embodiment of the present application. Therefore, the appearances of "in one embodiment" or "in an embodiment" throughout this specification do not necessarily refer to the same embodiment. Furthermore, these particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0055] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0056] It should be understood that the term "and / or" in this document simply describes a relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the related objects are in an "or" relationship.

[0057] In the embodiments provided herein, it should be understood that "B corresponding to A" means that B is associated with A and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B based solely on A; B can also be determined based on A and / or other information.

[0058] It should be noted that the data structure of the sampling points described below in this application includes at least one of the following information:

[0059] Spatial coordinates (x, y, z): represent the position of a point in three-dimensional space;

[0060] Parameter coordinates (u, v): represent the position of the point in the parameter space;

[0061] Grid index (i, j): indicates the row and column position of the point in the grid structure;

[0062] Error value e: represents the distance error between the point and the original model.

[0063] In a specific embodiment, the data structure of the sampling points can be expressed as: P=(x, y, z), (u, v), (i, j), e.

[0064] See also Figure 1 An embodiment of the present application provides an error-driven adaptive grid sampling method, comprising:

[0065] Step S101, performing initial uniform sampling on the original surface model to be sampled to generate sampling points of a regular grid;

[0066] Step S102, reconstructing a surface based on the sampling points to obtain a reconstructed surface;

[0067] Step S103, obtaining a distance error distribution between the reconstructed surface and the original surface model;

[0068] Step S104, determining a maximum error point and error point parameter coordinates corresponding to the maximum error point according to the distance error distribution;

[0069] Step S105: When the error parameters corresponding to the distance error distribution meet a preset condition or the current number of iterations reaches a preset value, outputting the sampling point set formed by the sampling points and / or the reconstructed surface, wherein the error parameters include a maximum error and a root mean square error;

[0070] Step S106: When the error parameter corresponding to the distance error distribution does not meet the preset condition and the current number of iterations does not reach the preset value, sampling points are added in the row direction or column direction corresponding to the maximum error point according to the error point parameter coordinates, and the process returns to the step of performing surface reconstruction according to the sampling points to obtain a reconstructed surface.

[0071] When sampling a surface, the adaptive grid sampling method provided in this embodiment first performs a relatively sparse initial uniform sampling of the original surface model to be sampled using a grid uniform sampling method to generate a regular grid of sampling points. This ensures that the initial sampling points are regularly distributed. Surface reconstruction is then performed based on these initial sampling points to obtain a reconstructed surface based on the sampling points. The error distance between the reconstructed surface and the original surface model is then determined to determine the distance error distribution between the reconstructed surface and the original surface model. This distance error distribution can be used to characterize the sampling accuracy of the sampling points, the quality of the surface reconstruction, and its adaptability to the original surface model. Based on the distance error distribution, the error point corresponding to the maximum error distance is determined as the maximum error point. This maximum error point represents the weakest area in the current reconstruction, i.e., the area where sampling density needs to be prioritized. Therefore, determining the maximum error point is key to adaptive sampling, facilitating the targeted increase of sampling points in high-error areas, thereby reducing the number of sampling points while ensuring sampling accuracy.

[0072] Specifically, the maximum error point and its corresponding error point parameter coordinates can be expressed as:

[0073]

[0074]

[0075] (u max ,v max )=argminu,v |V max -S(u,v)| 2

[0076] Among them, (u max ,v max ) represents the coordinates of the error point; S(u,v) represents the expression of the reconstructed surface; V max Indicates the verification point corresponding to the maximum error distance, that is, the maximum error point; e i Represents the distance error corresponding to the i-th verification point.

[0077] Furthermore, a judgment is made based on the error parameters corresponding to the error distribution and the preset conditions. If the maximum error in the error parameters (i.e., the error distance corresponding to the maximum error point) is less than or equal to the preset error threshold, and the root mean square error based on all error distances is less than or equal to the preset root mean square error threshold, then the error parameters are determined to meet the preset conditions. In addition, to avoid iterative calculations, the current number of iterations is also judged. If the current number of iterations reaches a preset value or the error parameters meet the preset conditions, then it is determined that the currently obtained reconstructed surface or sampling points have a certain accuracy, that is, the output conditions are met, and the sampling point set composed of the sampling points and / or the reconstructed surface are output.

[0078] If the error parameters do not meet the above preset conditions and the current number of iterations does not reach the preset value, it indicates that the current accuracy and iteration requirements are not met. Therefore, it is necessary to add sampling points and return to the step of surface reconstruction based on the sampling points to iterate to ensure the final output. Specifically, when adding sampling points, based on the coordinates of the error point parameters, a sampling point is added in the row or column direction corresponding to the maximum error point, which helps improve sampling efficiency and ensure a regular distribution of sampling points.

[0079] In one embodiment, the maximum error threshold ε max =0.01mm, RMS error threshold ε rms =0.005mm, the preset value of the number of iterations MaxIter=20.

[0080] In summary, the embodiments of the present application adopt an adaptive iterative sampling strategy to dynamically adjust the sampling point density according to the error distribution of surface reconstruction, and increase the sampling points in the high error area in a targeted manner, thereby reducing the number of sampling points while ensuring sampling accuracy; the sampling point increase method based on the row and column structure maintains the regular distribution of sampling points, which is convenient for subsequent surface reconstruction and parameterization processing; through the analysis of row and column direction errors, the direction of increasing sampling points is intelligently selected, further improving the sampling efficiency; at the same time, the present application does not require pre-estimation of the curvature distribution, but only relies on reconstruction error analysis, and is applicable to surface models of various representation forms.

[0081] In addition, experimental results show that compared with the traditional uniform sampling method, the method provided by this application can reduce the number of sampling points by 5-10% under the same accuracy requirements, thereby improving the sampling efficiency, and is particularly suitable for high-precision measurement of free-form surface models with complex geometric features.

[0082] It should be noted that after adding new sampling points, the coordinate parameters of the newly added sampling points on the reconstructed surface are also obtained, and the grid structure is updated. If a row is added, the number of rows in the current grid is updated to n = n + 1; if a column is added, the number of columns in the current grid is updated to m = m + 1. Specifically, this can be achieved by recalculating the relative position of each sampling point in the updated grid:

[0083]

[0084]

[0085] where m new and n new is the number of rows and columns of the updated grid, and Indicates the parameter coordinates of the newly added sampling points.

[0086] At the same time, the sampling point set needs to be reorganized to ensure that the sampling points maintain a regular grid structure in the parameter space to facilitate subsequent surface reconstruction and parameterization processing.

[0087] See also Figure 2 Preferably, in the above method, the initial uniform sampling of the original surface model to be sampled to generate sampling points of a regular grid includes:

[0088] Step S201, obtaining the bounding box of the original surface model;

[0089] Step S202, extracting the boundary line of the original surface model;

[0090] Step S203, determining four characteristic corner points of the original surface model on the boundary line according to the boundary box;

[0091] Step S204, using the four characteristic corner points as a reference, generating an initial uniform grid of sampling points having a preset number of rows and columns according to a bilinear interpolation method;

[0092] Step S205 : Projecting the initial uniform grid sampling points located inside the boundary line onto the original surface model, and determining the projected points as the sampling points.

[0093] In this embodiment, after loading the original surface model (such as a triangular mesh model in STL format), its bounding box is calculated. The calculation formula of the bounding box is:

[0094] X min =min v∈V v x ,X max =max v∈V v x

[0095] Y min =min v∈V v y ,Y max =max v∈V v y

[0096] Z min =min v∈V v z ,Z max =max v∈V v z

[0097] Among them, V is the vertex set of the model, v x ,v y ,v z They represent the three-dimensional coordinate components of the vertex respectively.

[0098] Furthermore, the boundary lines of the original surface model are extracted. In a triangular mesh model, boundary lines refer to edges that belong to only one triangle in the triangular mesh. They can be extracted by the following steps: constructing an edge-face adjacency table E; traversing all triangle edges and determining the number of adjacent triangles for each edge; if an edge has only one adjacent triangle, then the edge is a boundary edge; connecting all boundary edges into a boundary ring to obtain the boundary line. The mathematical representation of boundary extraction can be: B = e|e∈E,|f|e∈f,f∈F| = 1; where E is the set of all edges of the model, F is the set of all faces of the model, and B is the set of boundary edges.

[0099] After obtaining the above boundary line, the four characteristic corner points of the model will be found on the boundary line according to the bounding box, namely the lower left (left_bottom), lower right (right_bottom), upper left (left_top) and upper right (right_top). These characteristic corner points are usually determined based on the extreme points of the bounding box. Specifically, it can be expressed as: the lower left characteristic corner point P lb =argmin v∈B (v x +v y ); lower right feature corner point P rb=argmin v∈B (-v x +v y ); Upper left feature corner point P lt =argmin v∈B (v x -v y ); upper right feature corner point P rt =argmin v∈B (-v x -v y ).

[0100] Furthermore, the four characteristic corner points are used as a reference to generate an initial uniform grid sampling point with a preset number of rows and columns using a bilinear interpolation method. The bilinear interpolation formula is:

[0101] P(u,v)=(1-u)(1-v)P lb +u(1-v)P rb +(1-u)vP lt +uvP rt

[0102] When generating an m×n grid, the values ​​of the parameter coordinates u and v are:

[0103] In one embodiment, the preset number of rows and the preset number of columns of the initial grid are both 5, that is, m=n=5, so the values ​​of the parameters u and v are 0, 0.25, 0.5, 0.75, and 1, respectively.

[0104] After obtaining the initial uniform grid sampling points, in order to ensure that the sampling points are located on the original surface model, the initial uniform grid sampling points located inside the boundary line will be projected onto the original surface model, and the projected points will be determined as the required sampling points.

[0105] See also Figure 3 Specifically, the method described above, projecting the initial uniform grid sampling points located inside the boundary line onto the original surface model, and determining the projected points as the sampling points, includes:

[0106] Step S301, constructing a first ray according to each of the initial uniform grid sampling points located inside the boundary line, wherein the starting point of the first ray is the grid point corresponding to the initial uniform grid sampling point, and the direction of the first ray is the normal vector of the original surface model;

[0107] Step S302, calculating the intersection points of each of the first rays and all triangles on the original surface model, and determining the intersection point closest to the starting point as the projection point corresponding to the initial uniform grid sampling point;

[0108] Step S303: Determine the projection point as the sampling point.

[0109] In this embodiment, the projection process of projecting the initial uniform grid sampling points onto the original surface model is exemplified, wherein the ray-triangle intersection test algorithm can be used for implementation, wherein the steps of the ray-triangle intersection test algorithm can be expressed as follows: construct a first ray R according to each internal initial uniform grid sampling point, the starting point of the first ray R is the grid point P, and the direction is the normal vector of the model Preferably, it is an approximate normal vector. Then, the intersection points of the first ray R and all triangles in the original surface model are calculated, and the intersection point closest to the starting point is determined as the corresponding projection point, so as to determine the projection point as the corresponding sampling point.

[0110] In one embodiment, the mathematical expression of the ray-triangle intersection test is: Where t is the ray parameter, by solving the equation: We can get V0, V1, and V2, where V0, V1, and V2 are the three vertices of the triangle, α and β are the barycentric coordinates, and α≥0, β≥0, α+β≤1.

[0111] It should be noted that the initial uniform grid sampling points located on the boundary line are located on the original surface model, so they are used as sampling points.

[0112] See also Figure 4 Preferably, in the above method, the surface reconstruction according to the sampling points to obtain the reconstructed surface includes:

[0113] Step S401, parameterizing the sampling points to determine sampling parameter coordinates corresponding to each sampling point, wherein the sampling parameter coordinates are determined according to the position of the sampling point in the grid;

[0114] Step S402: Reconstruct a surface based on the sampling points and the corresponding sampling parameter coordinates to obtain the reconstructed surface. The reconstructed surface is represented by a NURBS surface parametric equation, wherein the control point coordinates and weights of the NURBS surface parametric equation are obtained by solving the least squares method based on a basis function matrix and the spatial coordinate vectors of the sampling points.

[0115] In this embodiment, when reconstructing a surface based on sampling points, the sampling points are first parameterized to obtain the sampling parameter coordinates of each sampling point. Since the sampling points are arranged in a grid structure, their positions in the grid can be directly used to determine the parameter coordinates, i.e. Among them, col(P i ) and row(P i ) represent points P iThe column index and row index in the grid, m and n are the number of columns and rows in the grid respectively.

[0116] After obtaining the parameterized sampling points, a surface reconstruction is performed based on the sampling points and their sampling parameter coordinates to obtain a reconstructed surface. In this embodiment, the reconstructed surface is represented by a NURBS surface parametric equation, where the URBS surface parametric equation is defined as:

[0117]

[0118] Among them, N i,p (u) and N j,q (v) is the B-spline basis function, p and q are the order of the surface, P i,j is the control point, w i,j is the weight.

[0119] The recursive definition of the B-spline basis function in the column direction is:

[0120] When the order is 0,

[0121] When the order is greater than 0,

[0122] Among them, the node vector You can choose between uniform knot vectors or open uniform knot vectors, the latter giving better control at surface boundaries:

[0123] The recursive definition of the B-spline basis function in the row direction is similar to that in the column direction and will not be repeated here.

[0124] The coordinates and weights of the control points are solved by the least squares method. To simplify the calculation, it can be assumed that all weights w i,j =1, then the NURBS surface parametric equation is simplified to the B-spline surface parametric equation:

[0125] The least squares optimization problem can be expressed as: Where N is the total number of sampling points, (u k ,v k ) is the parameter coordinate of the kth sampling point, Q k is the spatial coordinate of the sampling point. This problem can be expressed as a system of linear equations: NP = Q, where N is the matrix of basis function values, P is the coordinate vector of the control points, and Q is the coordinate vector of the sampling points.

[0126] The linear equations are specifically expressed as:

[0127]

[0128] Among them, R j (u i ,v i ) represents the rational basis function, P j is the control point to be found, Q i are the coordinates of the sampling points.

[0129] The control points can be obtained by solving the equations: P = (N T N) -1 N T Q.

[0130] See also Figure 5 Preferably, in the above method, obtaining the distance error distribution between the reconstructed surface and the original surface model includes:

[0131] Step S501, uniformly generating a dense verification point set on the original surface model, wherein the number of verification points in the verification point set is greater than the number of sampling points;

[0132] Step S502, obtaining the verification parameter coordinates of each verification point in the parameter space;

[0133] Step S503 : calculating the distance error between each verification point and the corresponding point on the reconstructed surface according to the verification parameter coordinates to obtain the distance error distribution.

[0134] This embodiment illustrates the steps of obtaining the distance error distribution between the reconstructed surface and the original surface model. First, a dense verification point set is uniformly generated on the original surface model. The number of verification points is large enough to ensure that subtle changes on the surface can be captured. In this embodiment, the number of verification points is selected to be 10-20 times the number of sampling points. In a specific embodiment, the verification points can be generated in the following way: First, uniformly distributed points (u i ,v i ), then, map these parameter points to the original surface model to obtain the required verification points V i .

[0135] Specifically, the sampling of the parameter space can be done using the following formula:

[0136]

[0137] Among them, M u and M v are the number of divisions in the direction of parameters u and v, respectively. Specifically, M u and M v The values ​​belong to N is the number of sampling points.

[0138] Furthermore, for each verification point, its verification parameter coordinates in the parameter space are obtained to find the closest point from the verification point to the reconstructed surface. This problem can be expressed as:

[0139] min u,v |V i -S(u,v)| 2

[0140] This optimization problem can be solved by Newton-Newton method or Gauss-Newton method. The iterative process can be expressed as:

[0141] Where, d=|V i -S(u,v)| 2 is the distance function.

[0142] Then, the distance error between each verification point and the corresponding point on the reconstructed surface can be calculated based on the verification parameter coordinates of each verification point and the parameter coordinates of its corresponding point on the reconstructed surface. This distance error is a direct measure of the surface reconstruction quality: i =|V i -S(u i ,v i )|.

[0143] To better visualize the reconstructed model, Figure 7 As shown, red represents the reconstructed surface area, and white represents the original surface model area.

[0144] See also Figure 6 Preferably, in the above method, the step of adding sampling points in the row direction or column direction corresponding to the maximum error point according to the error point parameter coordinates includes:

[0145] Step S601, determining the target grid unit where the maximum error point is located according to the error point parameter coordinates corresponding to the maximum error point;

[0146] Step S602, obtaining the average errors corresponding to the maximum error point in the row direction and the column direction in the grid according to the error distribution;

[0147] Step S603: Add a row or a column of sampling points according to the target direction and the relative position of the maximum error point in the target grid unit, where the target direction is the direction corresponding to the larger value of the average error corresponding to the row direction and the average error corresponding to the column direction.

[0148] In this embodiment, after obtaining the distance error distribution and determining the maximum error point and its corresponding error point parameter coordinates based on the distance error distribution, if the error parameters corresponding to the distance error distribution do not meet the preset conditions and the current number of iterations does not reach the preset value, it is determined that the sampling accuracy is low at this time and the sampling points need to be increased.

[0149] At this time, firstly according to the error point parameter coordinates (u max ,v max ), determine the target grid cell where the maximum error point is located. In an m×n grid, the grid cell where the maximum error point is located can be determined by the following method:

[0150] i=[u max ·(m-1)]

[0151] j=[v max ·(n-1)]

[0152] The four vertex parameter coordinates of the unit are: (u i ,v j ),(u i+1 ,v j ),(u i ,v j+1 ),(u i+1 ,v j+1 )

[0153] where u i =i / (m-1),v j =j / (n-1),u i+1 =(i+1) / (m-1),v j+1 =(j+1) / (n-1).

[0154] Then, based on the distance errors corresponding to the verification points in the same row or column as the maximum error point in the error distribution, the average errors corresponding to the maximum error point in the row direction and column direction in the grid are obtained, which can be specifically expressed as:

[0155] The average error of the jth row is:

[0156] The average error of column i is:

[0157] Among them, Row j and Col i They represent the parameter coordinate v close to v j and parameter coordinate u is close to u i The set of all verification points.

[0158] Then, compare the average errors in the row and column directions, select the direction with the larger average error as the target direction, and increase the sampling points based on the target direction:

[0159] If a row of sampling points is added, the parameter coordinates of the new row are v j+α , where α∈(0,1);

[0160] If a column of sampling points is added, the coordinates of the newly added column parameters are u i+β , where β∈(0,1).

[0161] The values ​​of α and β are determined according to the relative position of the maximum error point in the grid cell:

[0162]

[0163] In a specific embodiment, the specific locations of the added sampling points are:

[0164] When adding a row: (u k ,v j+α ), where k = 0, 1, ..., m-1

[0165] When adding columns: (u i+β ,v k ), where k = 0, 1, ..., n-1

[0166] It should also be noted that after adding sampling points, the coordinates of the newly added sampling points on the reconstructed surface will also be calculated. This step is achieved by substituting the newly added sampling points into the expression of the reconstructed surface, that is, the NURBS surface equation: new (u new ,v new )=S(u new ,v new ).

[0167] When adding a row, m points are added, and the parameter coordinates of these points are (u k ,v j+α ), where k=0,1,...,m-1, and the spatial coordinates are S(u k ,v j+α ).

[0168] When a column is added, n points are added, and the parameter coordinates of these points are (u i+β ,v k ), where k=0,1,...,n-1, and the spatial coordinates are S(u i+β ,v k ).

[0169] See also Figure 8Another embodiment of the present application provides a control device, comprising:

[0170] Sampling module 801, used to perform initial uniform sampling on the original surface model to be sampled, and generate sampling points of a regular grid;

[0171] A surface reconstruction module 802 is configured to reconstruct a surface based on the sampling points to obtain a reconstructed surface;

[0172] An error distribution determination module 803 is used to obtain a distance error distribution between the reconstructed surface and the original surface model;

[0173] A maximum error point determination module 804 is configured to determine a maximum error point and error point parameter coordinates corresponding to the maximum error point based on the distance error distribution;

[0174] A first processing module 805 is configured to output the sampling point set formed by the sampling points and / or the reconstructed surface when an error parameter corresponding to the distance error distribution satisfies a preset condition or the current number of iterations reaches a preset value, wherein the error parameter includes a maximum error and a root mean square error;

[0175] The second processing module 806 is used to add sampling points in the row direction or column direction corresponding to the maximum error point according to the error point parameter coordinates when the error parameter corresponding to the distance error distribution does not meet the preset condition and the current number of iterations does not reach the preset value, and return to the step of reconstructing the surface according to the sampling points to obtain a reconstructed surface.

[0176] Preferably, the control device as described above, the sampling module includes:

[0177] A first processing unit is configured to obtain a bounding box of the original surface model;

[0178] A second processing unit, configured to extract a boundary line of the original surface model;

[0179] a third processing unit, configured to determine four characteristic corner points of the original surface model on the boundary line according to the bounding box;

[0180] a fourth processing unit, configured to generate, based on the four characteristic corner points and according to a bilinear interpolation method, an initial uniform grid of sampling points having a preset number of rows and a preset number of columns;

[0181] The fifth processing unit is configured to project the initial uniform grid sampling points located inside the boundary line onto the original surface model, and determine the projected points as the sampling points.

[0182] Specifically, in the control device as described above, the fifth processing unit includes:

[0183] a first sub-processing unit, configured to construct a first ray according to each of the initial uniform grid sampling points located inside the boundary line, wherein the starting point of the first ray is the grid point corresponding to the initial uniform grid sampling point, and the direction of the first ray is the normal vector of the original surface model;

[0184] a second sub-processing unit, configured to calculate the intersection points of each of the first rays with all triangles on the original surface model, and determine the intersection point closest to the starting point as the projection point corresponding to the initial uniform grid sampling point;

[0185] The third sub-processing unit is configured to determine the projection point as the sampling point.

[0186] Preferably, in the control device as described above, the surface reconstruction module includes:

[0187] a sixth processing unit, configured to parameterize the sampling points and determine sampling parameter coordinates corresponding to each sampling point, wherein the sampling parameter coordinates are determined according to a position of the sampling point in a grid;

[0188] a seventh processing unit, configured to perform surface reconstruction based on the sampling points and the corresponding sampling parameter coordinates to obtain the reconstructed surface, wherein the reconstructed surface is represented as a NURBS surface parametric equation, wherein the control point coordinates and weights of the NURBS surface parametric equation are obtained by solving the least squares method based on a basis function matrix and the spatial coordinate vectors of the sampling points.

[0189] Preferably, in the control device as described above, the error distribution determination module includes:

[0190] an eighth processing unit, configured to uniformly generate a dense verification point set on the original surface model, wherein the number of verification points in the verification point set is greater than the number of sampling points;

[0191] a ninth processing unit, configured to obtain verification parameter coordinates of each verification point in the parameter space;

[0192] A tenth processing unit is configured to calculate a distance error between each of the verification points and a corresponding point on the reconstructed surface according to the verification parameter coordinates to obtain the distance error distribution.

[0193] Preferably, in the control device as described above, the second processing module includes:

[0194] an eleventh processing unit, configured to determine a target grid cell where the maximum error point is located according to the error point parameter coordinates corresponding to the maximum error point;

[0195] a twelfth processing unit, configured to obtain, according to the error distribution, average errors corresponding to the maximum error point in the row direction and the column direction in the grid;

[0196] The thirteenth processing unit is used to add a row or a column of sampling points according to the target direction and the relative position of the maximum error point in the target grid unit, wherein the target direction is the direction corresponding to the larger value of the average error corresponding to the row direction and the average error corresponding to the column direction.

[0197] The control device embodiment of the present application is a device corresponding to the embodiment of the error-driven adaptive grid sampling method described above. All implementation means in the above method embodiment are applicable to the embodiment of this device and can achieve the same technical effects. The above control device provided in the embodiment of the present application can implement all the method steps implemented in the above method embodiment and can achieve the same technical effects. The parts and beneficial effects of this embodiment that are the same as those in the method embodiment will not be described in detail here.

[0198] Another embodiment of the present application provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the error-driven adaptive grid sampling method described above are implemented, and the same technical effects can be achieved. To avoid repetition, they will not be described here.

[0199] Another embodiment of the present application 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 error-driven adaptive grid sampling method as described above are implemented, and the same technical effects can be achieved. To avoid repetition, they will not be described here.

[0200] Another embodiment of the present application provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the error-driven adaptive grid sampling method as described above and can achieve the same technical effect. To avoid repetition, they will not be described here.

[0201] The diagnostic device embodiment of the present application is a device corresponding to the embodiment of the diagnostic method described above. All implementation means in the embodiment of the method described above are applicable to the embodiment of the device and can achieve the same technical effects. The diagnostic device provided in the embodiment of the present application can implement all the method steps implemented in the embodiment of the method described above and can achieve the same technical effects. The parts and beneficial effects of this embodiment that are the same as those in the embodiment of the method will not be described in detail here.

[0202] In addition, the present application may repeat reference numerals and / or letters in different examples. This repetition is for the purpose of simplicity and clarity and does not in itself indicate the relationship between the various embodiments and / or settings discussed.

[0203] It should also be noted that, in this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "include," "comprises," or any other variations thereof are intended to cover non-exclusive inclusion.

[0204] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. An error-driven adaptive grid sampling method, characterized in that: include: Perform initial uniform sampling on the original surface model to be sampled to generate sampling points of a regular grid; Reconstructing a surface according to the sampling points to obtain a reconstructed surface; Obtaining a distance error distribution between the reconstructed surface and the original surface model; Determining a maximum error point and error point parameter coordinates corresponding to the maximum error point according to the distance error distribution; When the error parameters corresponding to the distance error distribution meet a preset condition or the current number of iterations reaches a preset value, outputting the sampling point set composed of the sampling points and / or the reconstructed surface, wherein the error parameters include a maximum error and a root mean square error; If the error parameter corresponding to the distance error distribution does not meet the preset condition and the current number of iterations does not reach the preset value, sampling points are added in the row direction or column direction corresponding to the maximum error point according to the error point parameter coordinates, and the process returns to the step of performing surface reconstruction according to the sampling points to obtain a reconstructed surface.

2. The method according to claim 1, characterized in that The initial uniform sampling of the original surface model to be sampled to generate sampling points of a regular grid includes: Obtaining a bounding box of the original surface model; Extracting the boundary line of the original surface model; Determining four characteristic corner points of the original surface model on the boundary line according to the boundary box; Based on the four characteristic corner points, an initial uniform grid sampling point with a preset number of rows and columns is generated according to a bilinear interpolation method; The initial uniform grid sampling points located inside the boundary line are projected onto the original surface model, and the projected points are determined as the sampling points.

3. The method according to claim 2, characterized in that The projecting the initial uniform grid sampling points located inside the boundary line onto the original surface model and determining the projected points as the sampling points includes: Constructing a first ray according to each of the initial uniform grid sampling points located inside the boundary line, wherein the starting point of the first ray is the grid point corresponding to the initial uniform grid sampling point, and the direction of the first ray is the normal vector of the original surface model; Calculating the intersection points of each first ray with all triangles on the original surface model, and determining the intersection point closest to the starting point as the projection point corresponding to the initial uniform grid sampling point; The projection point is determined as the sampling point.

4. The method according to claim 1, wherein The step of reconstructing a surface according to the sampling points to obtain a reconstructed surface includes: Parameterizing the sampling points to determine sampling parameter coordinates corresponding to each sampling point, wherein the sampling parameter coordinates are determined according to the position of the sampling point in the grid; A surface is reconstructed according to the sampling points and the corresponding sampling parameter coordinates to obtain the reconstructed surface, wherein the reconstructed surface is expressed as a non-uniformly partitioned rational B-spline NURBS surface parametric equation, wherein the control point coordinates and weights of the NURBS surface parametric equation are obtained by solving the least squares method according to a basis function matrix and the spatial coordinate vectors of the sampling points.

5. The method according to claim 1, characterized in that The obtaining of a distance error distribution between the reconstructed surface and the original surface model includes: Uniformly generating a dense verification point set on the original surface model, wherein the number of verification points in the verification point set is greater than the number of sampling points; Obtaining verification parameter coordinates of each verification point in the parameter space; According to the verification parameter coordinates, the distance error between each of the verification points and the corresponding point on the reconstructed surface is calculated to obtain the distance error distribution.

6. The method according to claim 1, characterized in that The step of adding sampling points in the row direction or column direction corresponding to the maximum error point according to the error point parameter coordinates includes: Determine the target grid unit where the maximum error point is located according to the error point parameter coordinates corresponding to the maximum error point; According to the error distribution, obtaining the average error corresponding to the maximum error point in the row direction and the column direction in the grid; According to the target direction and the relative position of the maximum error point in the target grid unit, a row or a column of sampling points is added, and the target direction is the direction corresponding to the larger value of the average error corresponding to the row direction and the average error corresponding to the column direction.

7. A control device, characterized in that: include: The sampling module is used to perform initial uniform sampling on the original surface model to be sampled and generate sampling points of a regular grid; A surface reconstruction module, configured to reconstruct a surface based on the sampling points to obtain a reconstructed surface; an error distribution determining module, configured to obtain a distance error distribution between the reconstructed surface and the original surface model; A maximum error point determination module is used to determine the maximum error point and the error point parameter coordinates corresponding to the maximum error point according to the distance error distribution; a first processing module, configured to output the sampling point set formed by the sampling points and / or the reconstructed surface when an error parameter corresponding to the distance error distribution satisfies a preset condition or the current number of iterations reaches a preset value, wherein the error parameter includes a maximum error and a root mean square error; The second processing module is used to add sampling points in the row direction or column direction corresponding to the maximum error point according to the error point parameter coordinates, when the error parameters corresponding to the distance error distribution do not meet the preset conditions and the current number of iterations does not reach the preset value, and return to the step of reconstructing the surface according to the sampling points to obtain a reconstructed surface.

8. An electronic device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the method implements the steps of the error-driven adaptive grid sampling method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the error-driven adaptive grid sampling method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the error-driven adaptive grid sampling method according to any one of claims 1 to 6.