Summary of the invention
For the mode only for global registration that overcomes prior art, can't extract the deficiencies such as local marking area and shape normalization impact stability, the invention provides a kind of local matching method of three-dimensional model, can mate the part of three-dimensional model, can realize that the part of three-dimensional model is to retrieval and the local retrieval to the overall situation of part; Can extract local marking area feature, increase the matching precision of method; Characteristic extraction procedure no longer needs shape normalization, has guaranteed the stability of feature extraction.
The technical solution adopted for the present invention to solve the technical problems may further comprise the steps:
(1) the crooked significance on any summit of Calculation of Three Dimensional model.The present invention can represent the notable feature on summit according to having put into practice a kind of crooked significance measure self-defined.The crooked significance on any summit calculates by the Gaussian curvature of adjacent vertex and area weighted and definite in abutting connection with gore.
(2) generate sorted lists and carry out region growing according to crooked significance.Crooked significance by each summit carries out the summit ordering, generate the summit sorted lists, choose successively from high to low the summit according to crooked significance, carry out region growing according to the mode of breadth-first the neighbour, all summits, this zone form a Local Vertex set.
(3) Quadratic Surface Fitting is carried out in the zone of the set of the Local Vertex in the step (2) formation.Carry out Quadratic Surface Fitting according to the Local Vertex set that region growing forms, set the end condition of error of fitting by the limit mean value of three-dimensional grid model, fitted area is designated the local sub-block of three-dimensional model.A whole three-dimensional model can fit to several local sub-blocks according to crooked significance sorted lists.
(4) feature extraction of the local sub-block of three-dimensional model.Each local sub-block of three-dimensional model is extracted the feature of its invariable rotary, no longer carry out the normalized pre-service of shape, by calculating following three distributions as the feature of local sub-block: discrete Gaussian curvature histogram distribution, discrete Gaussian curvature histogram of gradients distributes the dihedral angle histogram distribution.
(5) feature comparison and the local matching of the local sub-block of three-dimensional model.The relatively feature by more local sub-block between the local sub-block realizes, comparative approach adopts in the step (4) the minimum Manhattan distance of three distributions to weigh any two local sub-blocks of three-dimensional.Relatively realize local matching by the feature between the local sub-block.
(6) comparison of three-dimensional model global characteristics and global registration.The overall situation between two three-dimensional models relatively can relatively realize between all the local sub-blocks by two models in twos.The local sub-block of each of a model is sought the minimum sub-block of distance in all sub-blocks of another model, calculate the distance between these two sub-blocks.By to all sub-blocks apart from summation, calculate overall distance, finish global registration.
The invention has the beneficial effects as follows: the present invention has realized a kind of local matching mode of three-dimensional grid model, and as shown in Figure 1, two similar three-dimensional grid models carry out whole matching by the part coupling, for example are complementary by tire between motorcycle and the motorcycle; Perhaps by a little three-dimensional grid model coupling with search the integral grid model that contains this similar part, for example tire and motorcycle are complementary; Also can mate two three-dimensional grid models that only have part similar, for example automobile only has tire similar with motorcycle.The present invention has considered to meet the local feature of geometry and visual aspects, has abandoned traditional global characteristics extracting mode, has guaranteed the matching precision of local detail.In addition, because the feature extraction major part of three-dimensional grid model depends on the pre-service of three-dimensional grid model, but pre-service is the subsequent characteristics extraction has brought labile factor, it is unstable that the difference of pretreated result in convergent-divergent and rotation causes subsequent characteristics to be extracted, in the present invention mainly with self-defining crooked significance as primary attribute, obtain the Local Vertex set in the breadth-first search mode and carry out Quadratic Surface Fitting, region growing method by one by one summit merging is obtained regional area, and the key feature of extraction regional area, the size dimension of whole process and three-dimensional grid model, the mapping transformations such as gyrobearing are irrelevant, therefore do not need to carry out the normalized pre-service of shape, thereby increased the robustness of method.Relatively adopt comparing one by one of local sub-block at characteristic distance, and calculate minimum Manhattan distance between the local sub-block, be used for weighing local sub-block matching degree.Distance between two three-dimensional models is determined by the distance between all local sub-blocks, can utilize like this local matching ability to promote the whole matching precision.
The present invention is further described below in conjunction with accompanying drawing and embodiment.
Embodiment
Indicated as shown in Figure 2 the method for three-dimensional model local matching.This technology of the present invention can realize three-dimensional model local matching function.Given two three-dimensional grid model A and B, each grid model is made of several parts, and wherein, three-dimensional grid model A is by A
1, A
2, A
3, A
4Four parts form, and three-dimensional grid model B is by B
1, B
2, B
3Three parts form, each part is the sub-block of a three-dimensional grid model, the vertex set of each sub-block is the subset of three-dimensional grid model vertex set, and the dough sheet set also is the subset of three-dimensional grid model dough sheet set, and the limit set is the subset of three-dimensional grid model limit set equally.If to two model A and B mate and similarity relatively, the present invention is by A relatively
1, A
2, A
3, A
4Four parts and B
1, B
2, B
3The mode of three parts realizes, with A
1Be example, A
1Respectively and B
1, B
2, B
3Three parts compare, then A
2Three parts with B compare again, are A afterwards
3And A
4Matching result is determined by the sub-block comparative result.For example by the three-dimensional grid model of a tire, mate the Autobike Mode with tire sub-block; Also can carry out whole coupling to integral body, mate according to the sub-block at the positions such as separately tire, vehicle body, handlebar such as two Autobike Modes, finish the whole matching process; Also can carry out part to the coupling of part, for example be the three-dimensional grid model of two tires equally, also can mate.When carrying out feature extraction, first three-dimensional grid model is carried out partial analysis, delimit several local sub-blocks, afterwards each sub-block is carried out feature extraction, feature extracting method adopts the histogram method of invariable rotary to carry out.When this matching way is applied in three-dimensional model search, the feature that needs all sub-blocks of storage three-dimensional model, feature more also is that sub-block is carried out feature relatively, the overall situation relatively is to utilize the result of local block feature comparison to determine, according to the result of the overall situation comparison three-dimensional model tabulation of sorting, thus the client of offering.
Be illustrated in figure 3 as the characteristic extraction procedure of local matching method of three-dimensional model of the present invention.At first calculate its crooked significance for all summits of three-dimensional model, and the descending sort that generates crooked significance is tabulated, and begin to travel through neighboring region from the highest point of significance and carry out region growing, the traversal mode adopts the width searches pattern, then Quadratic Surface Fitting is carried out in the zone that traveled through, when error of fitting then stops traversal and region growing greater than setting value.This zone then is a local sub-block of three-dimension integrally model, carries out several times region growing and local fit, generates several local sub-blocks.Carry out feature extraction for each local sub-block again, then carry out the local feature of sub-block and sub-block relatively, carry out at last global characteristics relatively.
By reference to the accompanying drawings, elaborate below the implementation step.
At first the given three-dimensional grid model of this method supposition is triangle grid model, and three-dimensional grid model should be stream shape model, allows three-dimensional grid model with the border.In addition, the summit density of three-dimensional grid model is enough large, can reach the preset range of the number of vertices of setting, if summit density does not reach preset range, need to carry out the 3D grid segmentation.The segmentation mode can adopt the methods such as Loop, namely ask for leg-of-mutton each the limit mid point of grid fundamental element, by connecting each limit mid point, a triangle is subdivided into four triangles, the triangle number of three-dimensional grid model becomes 4 times by grid subdivision, and number of vertices is corresponding increase also.If once segmentation does not reach desired number of vertices preset range, must repeatedly segment, until in the number preset range that culminates.The summit density that can guarantee like this three-dimensional grid model reaches calculation requirement.
It below is circular.
One, the crooked significance B of any vertex v of Calculation of Three Dimensional model
v
Crooked significance is defined as the crooked significance degree of any summit adjacent surface, and this degree determines jointly by the Gaussian curvature of adjacent vertex with in abutting connection with triangle area, such as Fig. 4.
The discrete Gaussian curvature on any summit of Calculation of Three Dimensional model at first, establishing this apex coordinate is v, this summit any is T in abutting connection with triangle
j, j refers to j in abutting connection with triangle, all of its neighbor triangle T
jThe set that forms is T
vThe vertex v correspondence is in abutting connection with triangle T
jInterior angle be α
j, when all of its neighbor triangle of vertex v is positioned at a plane, all interior angle
jBe 2 π.Because the change of shape of three-dimensional model comprises indent or evagination, so that the leg-of-mutton interior angle of all of its neighbor changes, all interior angles and less than 2 π.The degree of indent and evagination has represented Gauss's degree of crook, therefore adopts the discrete form of following formula to calculate Gaussian curvature.
T
j∈T
v
A kind of special circumstances are here arranged, when three-dimensional model has the border and when vertex v is positioned at the border, adopts following formula to calculate discrete Gaussian curvature:
Crooked significance function is defined by following formula:
Here, k
jThe discrete Gaussian curvature of any one adjacent vertex of expression vertex v, f
jExpression and adjacent vertex k
jAccordingly in abutting connection with triangle area.This camber significance function B
vExpressed the crooked significance degree of adjacent surface, the result has directly been affected the Quadratic Surface Fitting of the adjacent vertex set of step (3).
Two, according to crooked significance B
vGenerate sorted lists and carry out region growing
By calculating the crooked significance on all summits, carry out descending sort according to crooked significance, and carry out each summit of each three-dimensional model of descending sort according to crooked significance, generate vertex list L
vSort method adopts quicksort, and the number of supposing the three-dimensional model summit is N, and then the time complexity of ordering is NlogN.
From L
vIn the tabulation according to clooating sequence, take out successively vertex v, and carry out region growing from vertex v, increase strategy and take the mode of breadth-first search (Breadth-First Search), search for successively the adjacent vertex that is connected by the limit, go forward one by one and search all nodes, generate the Local Vertex set, the Quadratic Surface Fitting that carries out the Local Vertex set.Set in advance a minimum approximate error by the limit mean value that calculates triangle grid model, if error of fitting surmounts minimum specification error then stops width searches, stop Proximal surface, the summit that all traveled through forms a Local Vertex set, and Local Vertex set and corresponding triangle form a sub-block.Reject the summit that traveled through in the vertex list, because these summits have formed sub-block, will no longer participate in the composition of other sub-blocks.From vertex list, proceed the quadric surface approximation, until the whole traversals of vertex list are complete.
Three, the Quadratic Surface Fitting of Local Vertex set
The region growing of the breadth-first search of being undertaken by step 2 generates a Local Vertex set, and the number of vertices in the S set is N, and establishing any one apex coordinate is v
i, be expressed as (x
i, y
i, z
i).
The quadric surface form for the treatment of match is:
ax
2+by
2+cz
2+2exy+2fyz+2gzx+2lx+2my+2nz+d=0
This form is comprised of 10 coefficients, can be represented by following homogeneous coordinates,
If be expressed as Vector-Matrix Form, for
x
TUx=0
U is a real symmetric matrix.
Get 1 v in the Local Vertex set, appointing
i,
v
i∈S
With the quadric Vector-Matrix Form of this substitution,
x
i TUx
i=e
i
This point and quadric algebraic distance are e
i, then Local Vertex S set and quadric total distance are:
Because all apex coordinates in the Local Vertex S set are known, ask for quadric 10 coefficients by minimizing above-mentioned total distance, specifically can be expressed as:
This problem can be decomposed into the eigenvalue problem of 10 * 10 real symmetric matrix A.Wherein A is expressed as:
A=D
TD
D is the matrix of N * 10, and N is the element number of Local Vertex S set.
The minimal eigenvalue of matrix A is representing fitting degree, the minimum value of the total distance of match namely, and minimal eigenvalue characteristic of correspondence vector is respectively the vector that quadric coefficient forms:
[a?b?c?e?f?g?l?m?n?d]
In actual motion, set match always apart from the threshold value E of minimum value according to the limit mean value of three-dimensional grid model
Max, surpass threshold value E
MaxTo automatically stop width searches, finish match.Large local sub-block of final formation, this sub-block is comprised of vertex set S and face set, limit set.
Four, the feature extraction of the local sub-block of three-dimensional model.
In the present invention, such as Fig. 5, the feature of local sub-block comprises three features: discrete Gaussian curvature histogram distribution, discrete Gaussian curvature histogram of gradients distribute, the dihedral angle histogram distribution.Therefore three distribution characteristicss have rotational invariance, do not need to adopt the method such as principal component analysis (PCA) to carry out pre-service.
(1) the discrete Gaussian curvature histogram distribution CH (Curvature Histogram) of the local sub-block of statistics
Gaussian curvature has showed the distribution of degree of crook that should the part sub-block, has represented the feature of local sub-block, and the distribution situation of the Gaussian curvature by calculating local sub-block is obtained feature of local sub-block.The Gaussian curvature calculated amount is quite large accurately owing to calculate, and this method still adopts the approximate Gaussian curvature of step 1 to calculate, and namely discrete Gaussian curvature computing method improve computing velocity.Computation distribution adopts the fastest histogram distribution of computing velocity simultaneously, and complexity computing time of histogram distribution is O (n).
By calculating the discrete Gaussian curvature on all summits of local sub-block, statistic histogram distribution CH (Curvature Histogram).Because the distribution of Gaussian curvature has certain noise, only depends on the distribution of Gaussian curvature as the feature less stable of local sub-block.Therefore will unite the distribution of Gaussian curvature gradient as bending features.
(2) the discrete Gaussian curvature histogram of gradients distribution CDH (Curvature Gradient Histogram) of the local sub-block of statistics
The curvature gradient has showed the variation tendency of shape bending, is an important shape facility.Distributing for Gaussian curvature simultaneously has in the situation of certain noise, and associating Gaussian curvature gradient distributes and can improve stability and feature resolution as the feature that shows the shape bending.
If the Gauss curvature function of any vertex v of three-dimensional model is C (x, y, z), then the Gaussian curvature gradient function at this v is expressed as:
The mould of the curvature gradient on summit can be expressed as arbitrarily:
The mould of the curvature gradient on all summits of so local sub-block consists of curvature histogram of gradients distribution CDH (Curvature Gradient Histogram), has consisted of the discrete Gaussian curvature histogram of gradients distribution characteristics of local sub-block.
(3) statistics local sub-block dihedral angle histogram distribution DAH (Dihedral Angle Histogram)
The dihedral angle of local sub-block can reflect shape doubling degree, shows the convex-concave characteristic of 3D shape.
If any one triangle T
i, its any one be T in abutting connection with triangle
j, two leg-of-mutton angles become dihedral angle.As shown in Figure 6.
By calculating triangle T
iNormal vector N
i, and in abutting connection with triangle T
jNormal vector N
j, the angle between two triangles is converted into the angle α that asks for to form between the normal vector
IjAsk for this angle by the dot product of vector.
N
i·N
j=||N
i||||N
j||cosα
ij
Add up the dihedral angle between all adjacent triangles, consist of the dihedral angle histogram distribution DAH (Dihedral Angle Histogram) of local sub-block.
Five, feature comparison and the local matching of the local sub-block of three-dimensional model.
After having asked for three features of local sub-block, this method adopts the minimum Manhattan distance of three features to weigh any two local sub-blocks of three-dimensional.This measurement mode is conducive to further to keep feature stability relatively, and the labile factor filtering of the three-dimensional local sub-block that will cause owing to reasons such as noise, letter minute, degenerations only compares the most stable feature outside.
The characteristic distance of local sub-block i and local sub-block j is calculated as:
D
ij=min{‖CH
i-CH
j‖,‖CDH
i-CDH
j‖,‖DAH
i-DAH
j‖}
This distance method can be calculated the characteristic distance of any two local sub-blocks of three-dimensional.The local sub-block of three-dimensional model is carried out feature relatively by this distance, finishes the local matching process between the local sub-block.
Six, the comparison of three-dimensional model global characteristics and global registration.
Global characteristics distance between two three-dimensional models is carried out overall situation comparison after can being undertaken one by one relatively by all local sub-blocks of each model again.
If two three-dimensional model A and B, any one local sub-block is by A in the local sub-block of all of A
iExpression, total N sub-block.Any one local sub-block is by B in the local sub-block of all of B
jExpression, total M sub-block.At first appoint the local sub-block A that gets A
i, with B
0, B
1..., B
MCompare, choose the sub-block B of a minimum Manhattan distance
j, its distance is:
D
ij=min{A
i-B
j}
All minimum Manhattan apart from addition, can be obtained the global characteristics distance B of two three-dimensional model A and B, be expressed as:
By the overall situation distance that above-mentioned global characteristics relatively forms, carry out the global registration of two three-dimensional models.
The present invention for overcome prior art only for the global registration mode, can't extract several deficiencies of local marking area and shape normalization impact stability etc., the invention provides a kind of local matching method of three-dimensional model, the method can realize the part of three-dimensional model is mated, and can realize that the part of three-dimensional model is to retrieval and the local retrieval to the overall situation of part; Can extract local marking area feature, increase the matching precision of method; Characteristic extraction procedure no longer needs shape normalization, has guaranteed the stability of feature extraction.Above integral body is described to be preferred implementation of the present invention, and those skilled in the art can make some improvement under the prerequisite that does not break away from the principle of the invention, and scope of the present invention is by appended claims and be equal to and limit.