Embodiment
Please referring to Fig. 1, a kind of model searching device 100 of better embodiment comprises: initialization module 110, pretreatment module 120, image processing module 130, matching module 140, data provide module 150 and display unit 160 as a result.
Initialization module 110 is used to obtain model parameter.Described model comprises one-dimensional model, two dimensional model or the above model of two dimension.The embodiment of the invention is that example describes with the three-dimensional model.Described model parameter comprises: data such as summit quantity, apex coordinate, normal line vector and triangular plate vertex index.
Pretreatment module 120 is used for the model of input is carried out pre-service, carries out the required consistance of feature extraction according to the model parameter that initialization module 110 obtains.
Image processing module 130 is used for according to described model parameter described model being carried out being described behind the model image local structure, obtains the description result of described model.Image processing module 130 is connected with pretreatment module 120 in the embodiment of the invention, and according to described coordinate system described model is described.Image processing module 130 can with change module 110 at the beginning and be connected and directly obtain model parameter, also can be connected with pretreatment module 120, repeat no more.
Data provide module 150 to be used to store and provide the model file information that needs retrieval.Described model file information comprises: data such as summit quantity, apex coordinate, normal line vector and triangular plate vertex index.
Matching module 140 is used for according to the description result after image processing module 130 processing as a result, and the model file information matches with data provide module 150 to provide obtains result for retrieval.
Display unit 160 is connected with matching unit 140 as a result, is used for the display model result for retrieval.
Please, further model searching device 100 is introduced in conjunction with referring to Fig. 2.Wherein, initialization module 110 also comprises model receiving element 112 and model information reading unit 114.
Model receiving element 112 is used to receive the model file that the user selects, and it is the example explanation that the embodiment of the invention receives a three-dimensional model with model receiving element 112.Model receiving element 112 is independent of the file layout of model, can receive the file of various form three-dimensional models, as file of .3ds form etc.
Model information reading unit 114 is used to read described model file information, comprises the structure variable of model parameter, and described model file information comprises data such as number of vertex amount, apex coordinate, normal line vector and triangular plate vertex index.The file layout of described model file information can be the file layout that can store text, as .txt file layout etc.Wherein, the details that reads described model file information can comprise the steps: in the present embodiment
1) opens described model file.
2) preceding 9 bit that read file are the sign that begins of apex portion, skip.Read 4 Byte and be stored as an int (integer) type variable, as number of vertices.According to described number of vertices circulation execution in step 3) and step 4).
3) read the x on summit, y, z coordinate.
4) read the x of normal line vector, y, z coordinate.
5) continue to read 11 bit, partly begin sign, skip as triangular plate.Reading 4 Byte and storing becomes an int type variable, as the triangular plate number.According to described triangular plate number, circulation execution in step 6) and step 7).
6) read the index value on three summits of current triangular plate, determine the coordinate figure on described three summits according to index value.
7), calculate and preserve the area and the total area (m_myTotalArea) of each triangular plate, the minor increment (m_fMinR) of calculating and preserving all summit middle distance initial points simultaneously according to the coordinate figure on described three summits.
Above-mentioned reading in the process if model is a two dimensional model only read the x of model, and the y coordinate gets final product, and multidimensional model repeats no more.
Pretreatment module 120 comprises that also summit sampling unit 122 and coordinate system unify unit 124.
Summit sampling unit 122 is used for according to model parameter described model being carried out the summit sampling.Please referring to Fig. 3, spherical diagram is irrelevant as the θ and the α of Fourier descriptors (SFD, Sphere Fourier Descriptor) and spheric coordinate system.Wherein θ be apex coordinate at x, the angle of y plane projection and x axle, α are the angle of apex coordinate and z axle.Three-dimensional model is during around the rotation of x or y axle, and it is a nonlinearities change that θ changes, thus SFD just with the irrelevant to rotation of z axle.Because the three-dimensional model coordinate system of input may be inconsistent, and the distribution on three-dimensional model summit possibility is inhomogeneous or summit density is too little, therefore, need sample to described three-dimensional model summit, the coordinate of unified described three-dimensional model.
Please in conjunction with Fig. 3 and Fig. 4, (P1, P2 P3) describe for example with a triangular plate in the present embodiment.Wherein, P1, P2, P3 are respectively three summits of described triangular plate.(P1, P2 P3) segment, and determine that at first (P2, P3), wherein P4 is (P2, mid point P3) to longest edge to triangular plate.Connect P1 and P4, so just triangular plate (P3) segmentation becomes two triangular plates for P1, P2, be respectively triangular plate (P1, P2, P4) and triangular plate (P1, P4, P3).By the area of Heron's formula calculating triangular plate, the triangular plate area is calculated as prior art, repeats no more.If triangular plate (P1, P2, P4) or triangular plate (P1, P4, area P3) be greater than a default threshold values F, and area need adopt said method to continue segmentation greater than the triangular plate of described threshold values F so.The rest may be inferred, and each the triangular plate area after segmentation is all less than threshold values F.Each triangular plate heart after the segmentation is as a new sampled point of three-dimensional model.Be respectively the new sampled point of the three-dimensional model after cutting apart as the A1 among Fig. 4, A2, A3 and A4.Wherein above-mentioned threshold values F is preset as m_myTotalArea/100000 in the present embodiment.
If above-mentioned triangular plate is cut apart for two dimensional model, only needs cut apart by line segment the bent limit of two dimensional model to get final product, and principle is identical with above-mentioned three-dimensional model, and multidimensional model is cut apart principle also with above-mentioned to cut apart principle identical, repeats no more.
Coordinate system is unified unit 124 and is used for model is carried out normalized.Described normalization is not only to refer to that ratio is 1, can also be to comprise other real numbers of 1.Present embodiment is only clear for explanation, and the unit ball radius of 3-D view is set to 1.Described coordinate system unifies to carry out the ratio amplification after the 124 pairs of described model directions in unit are located or ratio is dwindled.In the present embodiment, because SFD and spheric coordinate system θ are irrelevant, therefore, SFD only need unify three-dimensional model z direction of principal axis.Select the z coordinate axis of the irrelevant axis of and coordinate system as the three-dimensional model coordinate system.At first, determine the three-dimensional model center point coordinate, the three-dimensional model central point determines that formula is as follows:
Wherein
Be the central point of three-dimensional model, n is the number of vertices of sampling in the three-dimensional model, P
iIt is the sampling apex coordinate.
Calculate in the three-dimensional model summit with
Ultimate range r
MaxWith minor increment r
MinR
MaxNormalization obtains the scaling coefficient S of three-dimensional model, unified three-dimensional model size, and three-dimensional model after reunification can be with a unit ball encirclement.By calculating
Determine vector
And vector
As the z direction of principal axis.Wherein
Computing formula is as follows:
Wherein, k
1And k
2Be the span coefficient, in the present embodiment, avoid
With
Overlap k
1And k
2Value be respectively 1 and 0.8.M represents to meet the summit quantity of k1 and k2 scope.
Vector
Direction and coordinate axis irrelevant, if
With
Overlap, then get with
Maximum some conducts of some distance
According to experimental data, for most cases
With
Phenomenon can not appear overlapping.Like this, its place coordinate system and the placing direction of unified all models will also be determined after the above-mentioned model normalization.
Image processing module 130 further comprises projecting cell 132, concentric structure unit 134, intersects unit 136 and description unit 138.Described concentric structure unit 134 is used for the described model of concentric structure and obtains refined model; Described projecting cell 132 is used for carrying out projection according to described refined model and obtains model projection information; Described crossing unit 136 is used for intersecting the crossing information of model that obtains according to described refined model; Described description unit 138 is used for obtaining describing the result according to described model projection information and/or the crossing described model of information description of model.
Projecting cell 132 and concentric structure unit 134 make up the model projection structure tree according to described model parameter.In the present embodiment, be that example describes with the spherical projection binary tree that makes up three-dimensional model.At first, carry out spherical projection, obtain spherical projection information by 132 pairs of models of projecting cell.Then, undertaken carrying out projection by projecting cell 132 again after the concentric structure by the 134 pairs of models in concentric structure unit, the rest may be inferred.Present embodiment is configured to example with the spherical radius difference centres of three-dimensional model and makes up the spherical projection binary tree.As mentioned above, can be surrounded by a unit ball after the above-mentioned three-dimensional model normalization, be called unit and surround ball.The centre of sphere is designated as P
cIf P is (r
1, r
2) be the set on three-dimensional model summit, P (r then
1, r
2) can be expressed as:
P(r
1,r
2)={P|r
1<L(P,P
c)≤r
2,r
1<r
2}
Wherein, r
1And r
2Represent respectively apart from centre of sphere P
cRecently and distance value farthest, L (P, P
c) be model vertices P and centre of sphere P
cDistance.The note radius is r
2Sphere is S
R2, Spherical Surface S
R2Evenly divide S by warp and weft
R2The longitude and latitude weights of grid are 0.The set P (r on three-dimensional model summit
1, r
2) the summit be mapped to S
R2On.
Please, establish summit P referring to Fig. 5
iBe three-dimensional model vertex set P (r
1, r
2) a summit, mapping method is as follows: connect centre of sphere P
cWith summit p
i, and prolong the centre of sphere and summit line P
cP
iAnd Spherical Surface S
R2Intersect.If intersection point is in Spherical Surface S
R2Grid (P
1, P
2, P
3, P
4) in, grid (P so
1, P
2, P
3, P
4) weights add 1.Wherein, grid (P
1, P
2, P
3, P
4) be the above-mentioned ruling P that presses after longitude and latitude is evenly divided
1, P
2, P
3, P
4Difference is 4 intersection points of ruling for this reason.Three-dimensional model vertex set P (r
1, r
2) summit is mapped to Spherical Surface S
R2After, can obtain three-dimensional model vertex set P (r
1, r
2) the projection of sphere weights, be designated as PRO (r
1, r
2).If the sphere weights of certain node Node of spherical projection binary tree are projected as PRO (r
1, r
2), establish r=(r
1+ r
2)/2 are sphere weights projection P RO (r
1, r) with sphere weights projection P RO (r, r
2) as the weights spherical projection of this node Node left and right sides child node.If spherical projection PRO is (r
1, 1) and be the sphere weights projection of spherical projection binary tree root node, by the radius segmentation, can obtain a spherical projection image binary tree.
In the present embodiment, get r
1=m_fMinR-0.0001, r
2=1.0001, can avoid summit P like this
iWith these two spheres intersect.The number of plies of spherical projection binary tree is generally got more than 2 layers or 2 layers preferable, is example with 3 layers in the present embodiment for ease of explanation.
For two dimensional model, above-mentioned spherical projection can similarly project on the unit circle, and principle is identical with three-dimensional model.The projection theory of multidimensional model is also identical with it, repeats no more.
Intersect unit 136 and concentric structure unit 134 and make up model intersection tree according to described model parameter.In the present embodiment, be that example describes with the spheres intersect binary tree that makes up three-dimensional model.At first, the mould that calculates the spheres intersect model vertices is long, carries out sphere concentric structure by the 134 pairs of models in concentric structure unit again, and then, the mould that calculates the spheres intersect model vertices again is long.The rest may be inferred, makes up the spheres intersect binary tree.As previously mentioned, the three-dimensional model summit is to the distance of coordinate origin and the three-dimensional model vertex set that intersects of relatively asking three-dimensional model and sphere of the radius of a ball.If spherical radius is R, intersect the model vertices set and be P (R), then P (R) can be expressed as:
P(R)={P|R-σ<L(P)≤R+σ,σ>0}
Wherein, σ is for intersecting range of definition value, promptly promptly thinks crossing in error in ± σ scope.σ gets 0.01 in the present embodiment.Wherein, L (P) is long for the model vertices mould.
Please referring to Fig. 6, summit P
jFor intersecting the summit of model vertices set P (R).If P
jAt sphere longitude and latitude network (P
5, P
6, P
7, P
8) in, grid (P then
5, P
6, P
7, P
8) weights be 1, wherein, the sphere fictitious graticule is divided equally as hereinbefore.Like this, obtain the set of three-dimensional model and spheres intersect point, be designated as PI (R).Obviously, model vertices density is big more, and σ is more little, and the precision of calculating spheres intersect is high more.If the root node of spheres intersect binary tree is PI (R), R=r
Min+ (r
Max-r
Min)/2
I+1, wherein, i represents the number of plies of spheres intersect binary tree, is 0 here.PI (R
1), PI (R
2) respectively as radius according to the node spheres intersect, wherein, R
1=R+ (r
Max-r
Min)/2
I+1, R
2=R-(r
Max-r
Min)/2
I+1, the number of plies i of the left and right sides child node of root node is 1.The rest may be inferred, obtains a spheres intersect binary tree.In the present embodiment, get r
Min=m_fMinR, r
Max=1.0.
For two dimensional model, above-mentioned spheres intersect can similarly be suitable for the method that circle intersects, and principle is identical with it.The crossing principle of multidimensional model is also identical with it, repeats no more.
Description unit 138 intersects information according to described model projection information and described model, model is described the descriptor that obtains model.In the present embodiment, also projection information and the crossing information with three-dimensional model is that example describes.To those skilled in the art, above two kinds of binary trees in a kind of, three-dimensional model can be described.For accurately describing described three-dimensional model, present embodiment adopts the comprehensive above-mentioned two kinds of model binary trees of weighting scheme that three-dimensional model is described.In the present embodiment, adopt SFD that the style characteristic of above-mentioned two spherical diagram pictures is described, this description builds on the spheric coordinate system, three-dimensional model describe PF (k, t) computing formula is as follows:
Wherein, M and N represent the grid number that the sphere longitude and latitude is divided respectively; M and n are used to circulate the grid number that the sphere longitude and latitude that adds up divides, 0<=m<=M-1,0<=n<=N-1; α and θ are meant two angles under the spherical coordinate system, as previously mentioned; α
mAnd θ
nBe meant that the capable n of m is listed as those two angles under spheric coordinate system of those two warp and weft intersection points; PF (k, t) k in and t be meant (k, t) piece fictitious graticule zone, just k bar, k+1 bar warp, the zone that t bar, t+1 bar parallel surround; 0<=k<=M-1 wherein, 0<=t<=N-1; F (α
m, θ
n) function representation (α
m, θ
n) the longitude and latitude weights of net region of some representative.Because aforementioned calculation is in spheric coordinate system, the spherical radius mould is long to be definite value, so, f (α
m, θ
n) function comprises 2 parameters.Then the computing formula of SFD is as follows:
After SFD acts on above-mentioned spherical projection binary tree and spheres intersect binary tree, promptly get corresponding three-dimensional model feature binary tree.Please referring to Fig. 7, the root node is the 0th layer of three-dimensional model feature binary tree, is used to characterize the global feature of three-dimensional model, and the number of plies of three-dimensional model feature binary tree is high more, represents local detail feature description careful more of three-dimensional model.Like this, can from integral body to the part, mate three-dimensional model by this three-dimensional model feature binary tree.
For two dimensional model or other multidimensional models, it is identical with it that SFD describes principle, repeats no more.
Data provide module 150 further to comprise data storage cell 154 and data-reading unit 152.Data storage cell 154 is used to store model file information to be found or to be matched and model parameter information.Described model parameter information comprises: data such as the quantity of model information, model file, filename, SFD coefficient, isotropy transformation matrix coefficient.In the present embodiment, described model parameter can be preserved becomes pretreated text message file, as the .txt file.Described model information is exported with list structure.
Data-reading unit 152 is used for reading of data storage unit 154 model file information and model parameter information.Data-reading unit 152 can provide model file and model parameter in the module 154 selectively to read to data according to the descriptor of 138 pairs of models of description unit, and this selection can be selected according to default reading order.In the present embodiment, data-reading unit 152 to read details as follows:
1) opens the model information file.
2) read the model file number, read preceding 4 Byte, and be stored as an int type variable.According to the model file number, following steps are carried out in circulation.
3) initialization chained list node DataLink, the DataLink structure comprises following data: a CString type variable is preserved the model file name, one 7 * 375 two-dimentional float type array is preserved the Fourier descriptors coefficient, size is that 9 float type array is preserved isotropy transformation matrix coefficient, three float type variablees are preserved three eigenwerts of isotropy transformation matrix, and a DataLink* type pointer is used in reference to follow-up node.
4) read model file length, according to preceding 4 Byte of this model file message block, preserving becomes an int type variable.Byte number according to this Length Indication reads file name.
5) read the Fourier descriptors coefficient.This is one 7 * 375 a two-dimentional float type array.
6) read 9 (3 * 3) isotropy transformation matrix coefficients, and calculate the eigenwert of 3 isotropy matrixes.
Matching module 140 further comprises side-play amount computing unit 142, similarity calculated 144, analog result sequencing unit 146 and judging unit 148 as a result.
Side-play amount computing unit 142 is used for the model file information that reads according to data-reading unit 152, calculates the deviate with the input model characteristics tree.In the present embodiment, be that example describes with input three-dimensional model feature binary tree.Three-dimensional model feature binary tree has been represented the similarity matching degree of two three-dimensional models from integral body to the part respectively from the root node to the leafy node.The SFD offset distance computing formula of three-dimensional model feature binary tree is as follows respectively:
Wherein, dist1 represents the SFD offset distance of spherical projection image, and dist2 represents the SFD offset distance of spheres intersect image.SFD1 and SFD2 represent the SFD of model in the model selected and the data storage cell 154 respectively, and the offset distance that calculates the two just can draw the two similarity degree.I and j are loop variables, and span is respectively 0..M-1 and 0..N-1.M and N represent the fictitious graticule number that sphere is divided respectively.
Similarity calculated 144 is used for the similarity of computation model structure tree.In the present embodiment, be that example describes with the similarity of calculating three-dimensional model feature binary tree.The similarity degree of three-dimensional model feature binary tree has embodied the similarity degree of two three-dimensional models, and the three-dimensional model binary tree calculating formula of similarity of two kinds of Flame Image Process modes is as follows:
Wherein, comp
1The three-dimensional model similarity of expression sphere weights projection, comp
2The three-dimensional model similarity of expression spheres intersect.Dist
I, jIt is the deviation of three-dimensional model feature binary tree i layer j corresponding node.Similarity is more little, and the similarity of three-dimensional model is poor more, otherwise similarity is big more, and the similarity of three-dimensional model is good more.
The three-dimensional model similarity comp of the sphere weights projection that above-mentioned two kinds of Flame Image Process modes calculate
1And the three-dimensional model similarity comp of spheres intersect
2Different weights can be set as required.Generally be provided with according to the test experience.
If in paying attention to the similar indexing unit of model outward appearance, comp
1And comp
2Weights can be set to 3/4 and 1/4 respectively.Then calculating formula of similarity is as follows:
Wherein, comp represents the similarity of two kinds of three-dimensional models after the weighting.
If at topological structure, during the retrieval of especially empty model, as the retrieval of mechanical model, according to test experience comp
1And comp
2Weights can be set to 1/4 and 3/4 respectively.Then the calculating formula of similarity after the weighting is as follows:
Wherein, comp represents the similarity of two kinds of three-dimensional models after the weighting.
If the model structure more complicated of retrieval, type is many, according to test experience, comp
1And comp
2Weights can be set to 1/2.Then the calculating formula of similarity after the weighting is as follows:
Wherein, comp represents the similarity of two kinds of three-dimensional models after the weighting.
Analog result sequencing unit 146 is used for each model similarity of aforementioned calculation is sorted, and described ordering is greatly to the little ordering of similarity from similarity.Described ordering can be sorted according to methods such as Hash ordering, quicksort, merge sort, heapsort and bubble sorts.
Judging unit 148 is used to judge whether result for retrieval is correct.If the model of user's appointment is one of them that comprises in the model data store unit 154 in the model, first result who then returns should be this model self, because this model and himself similarity maximum (being 1).If satisfy this condition, and the model quantity of returning is greater than the model quantity of user's appointment, and then result for retrieval is correct.If the model of user's appointment not in model data store unit 154, then only needs to judge whether return the model number meets the requirements.
Display unit 160 is used to show result for retrieval.In the present embodiment, result for retrieval is set once shows 20 models that retrieve, and arrange demonstration according to similarity order from big to small.Simultaneously, the model file name that retrieves can be kept in the text.
If retrieval two dimensional model or three-dimensional above model, searching principle is identical with the embodiment of the invention, changes parameter and gets final product, and repeats no more.
Above-mentioned model searching device 100 is described described model by the parameter of image processing module 130 according to described model, and carries out concentric structure by the 134 pairs of models in concentric structure unit.The profile that not only can describe image also can be described the hollow sectors of figure, can retrieve the image of special result, and more careful to iamge description, the embodiment of the invention scope of application is extensive than prior art.Simultaneously, owing to can receive the model information of particular image and the image that retrieval comprises the cavity, the robustness of the embodiment of the invention is preferable.In addition, be described by concentric structure unit 134 and 136 pairs of refined models of projecting cell 132 and/or crossing unit, the embodiment of the invention is more careful to the description of model, the interior void of image can be described, the topography that general image that not only can retrieval model also can retrieval model.Carry out pre-service by 120 pairs of described models of pretreatment module, carry out the triangular plate sampling by 122 pairs of described models of summit sampling unit, the coordinate system of unifying the 124 pairs of described models in unit by described coordinate system is unified.Consistance that can descriptive model makes model that identical disposing way be arranged, and makes the disposing way of model not influence result for retrieval.By the extent of deviation of two kinds of models of side-play amount computing unit 142 calculating, calculate by the similarity of 144 pairs of above-mentioned two kinds of models of similarity calculated, avoided retrieving unnecessary model, saved the resource of system.Sort by 146 pairs of described similarities of analog result sequencing unit, make similarity be aligned to visibility point, save the time and the manpower of retrieval than higher model.Whether correctly judge by 148 pairs of described result for retrieval of judging unit, make retrieval person can know that whether this result for retrieval is correct, reduced the probability of makeing mistakes.Show described result for retrieval by display unit 160, make retrieval person can browse its result for retrieval.Be weighted by similarity, improved the degree of accuracy and the robustness of retrieval, and can carry out the part retrieval of model, expanded range of application model projection and the crossing dual mode calculating of model.
Please in conjunction with referring to Fig. 8, based on the model retrieval method of above-mentioned model searching device, this method comprises the steps:
Step 202 receives the model file that the user selects, and it is the example explanation that the embodiment of the invention receives a three-dimensional model with model receiving element 112.Model receiving element 112 is independent of the file layout of model, can receive the file of various form three-dimensional models, as file of .3ds form etc.
Step 204 reads described model file information, comprises the structure variable of model parameter, and described model file information comprises data such as number of vertex amount, apex coordinate, normal line vector and triangular plate vertex index.The file layout of described model file information can be the file layout that can store text, as .txt file layout etc.Wherein, the details that reads described model file information specifically can comprise the steps: in the present embodiment
1) opens described model file.
2) preceding 9 bit that read file are the sign that begins of apex portion, skip.Read 4 Byte and be stored as an int (integer) type variable, as number of vertices.According to described number of vertices circulation execution in step 3) and step 4).
3) read the x on summit, y, z coordinate.
4) read the x of normal line vector, y, z coordinate.
5) continue to read 11 bit, partly begin sign, skip as triangular plate.Reading 4 Byte and storing becomes an int type variable, as the triangular plate number.According to described triangular plate number, circulation execution in step 6) and step 7).
6) read the index value on three summits of current triangular plate, determine the coordinate figure on described three summits according to index value.
7), calculate and preserve the area and the total area (m_myTotalArea) of each triangular plate, the minor increment (m_fMinR) of calculating and preserving all summit middle distance initial points simultaneously according to the coordinate figure on described three summits.
Above-mentioned reading in the process if model is a two dimensional model only read the x of model, and the y coordinate gets final product, and multidimensional model repeats no more.
Step 206 is carried out the summit sampling according to model parameter to described model.Spherical diagram is irrelevant as the θ and the α of Fourier descriptors (SFD, Sphere Fourier Descriptor) and spheric coordinate system.Wherein θ be apex coordinate at x, the angle of y plane projection and x axle, α are the angle of apex coordinate and z axle.Three-dimensional model is during around the rotation of x or y axle, and it is a nonlinearities change that θ changes, thus SFD just with the irrelevant to rotation of z axle.Because the three-dimensional model coordinate system of input may be inconsistent, and the distribution on three-dimensional model summit possibility is inhomogeneous or summit density is too little, therefore, need sample to described three-dimensional model summit, the coordinate of unified described three-dimensional model.
(P1, P2 P3) describe for example with a triangular plate in the present embodiment.Wherein, P1, P2, P3 are respectively three summits of described triangular plate.(P1, P2 P3) segment, and determine that at first (P2, P3), wherein P4 is (P2, mid point P3) to longest edge to triangular plate.Connect P1 and P4, so just triangular plate (P3) segmentation becomes two triangular plates for P1, P2, be respectively triangular plate (P1, P2, P4) and triangular plate (P1, P4, P3).By the area of Heron's formula calculating triangular plate, the triangular plate area is calculated as prior art, repeats no more.If triangular plate (P1, P2, P4) or triangular plate (P1, P4, area P3) be greater than a default threshold values F, and area need adopt said method to continue segmentation greater than the triangular plate of described threshold values F so.The rest may be inferred, and each the triangular plate area after segmentation is all less than threshold values F.Each triangular plate heart after the segmentation is as a new sampled point of three-dimensional model.Be respectively the new sampled point of the three-dimensional model after cutting apart as the A1 among Fig. 4, A2, A3 and A4.Wherein above-mentioned threshold values F is preset as m_myTotalArea/100000 in the present embodiment.
If above-mentioned triangular plate is cut apart for two dimensional model, only needs cut apart by line segment the bent limit of two dimensional model to get final product, and principle is identical with above-mentioned three-dimensional model, and multidimensional model is cut apart principle also with above-mentioned to cut apart principle identical, repeats no more.
Step 208 is carried out normalized to model.Described normalization is not only to refer to that ratio is 1, can also be to comprise other real numbers of 1.Present embodiment is only clear for explanation, and the unit ball radius of 3-D view is set to 1.Ratio is amplified or ratio is dwindled to carrying out behind the described model direction location.In the present embodiment, because SFD and spheric coordinate system θ are irrelevant, therefore, SFD only need unify three-dimensional model z direction of principal axis.Select the z coordinate axis of the irrelevant axis of and coordinate system as the three-dimensional model coordinate system.At first, determine the three-dimensional model center point coordinate, the three-dimensional model central point determines that formula is as follows:
Wherein
Be the central point of three-dimensional model, n is the number of vertices of sampling in the three-dimensional model, P
iIt is the sampling apex coordinate.
Calculate in the three-dimensional model summit with
Ultimate range r
MaxWith minor increment r
MinR
MaxNormalization obtains the scaling coefficient S of three-dimensional model, unified three-dimensional model size, and three-dimensional model after reunification can be with a unit ball encirclement.By calculating
Determine vector
And vector
As the z direction of principal axis.Wherein
Computing formula is as follows:
Wherein, k
1And k
2Be the span coefficient, in the present embodiment, avoid
With
Overlap k
1And k
2Value be respectively 1 and 0.8.M represents to meet the summit quantity of k1 and k2 scope.
Vector
Direction and coordinate axis irrelevant, if
With
Overlap, then get with
Maximum some conducts of some distance
According to experimental data, for most cases
With
Phenomenon can not appear overlapping.Like this, its place coordinate system and the placing direction of unified all models will also be determined after the above-mentioned model normalization.
Step 210 makes up the model projection structure tree according to described model parameter.In the present embodiment, be that example describes with the spherical projection binary tree that makes up three-dimensional model.At first, model is carried out spherical projection, obtain spherical projection information.Then, model is carried out carrying out projection again after the concentric structure, the rest may be inferred.Present embodiment is configured to example with the spherical radius difference centres of three-dimensional model and makes up the spherical projection binary tree.As mentioned above, can be surrounded by a unit ball after the above-mentioned three-dimensional model normalization, be called unit and surround ball.The centre of sphere is designated as P
cIf P is (r
1, r
2) be the set on three-dimensional model summit, P (r then
1, r
2) can be expressed as:
P(r
1,r
2)={P|r
1<L(P,P
c)≤r
2,r
1<r
2}
Wherein, r
1And r
2Represent respectively apart from centre of sphere P
cRecently and distance value farthest, L (P, P
c) be model vertices P and centre of sphere P
cDistance.The note radius is r
2Sphere is S
R2, Spherical Surface S
R2Evenly divide S by warp and weft
R2The longitude and latitude weights of grid are 0.The set P (r on three-dimensional model summit
1, r
2) the summit be mapped to S
R2On.
Please, establish summit P referring to Fig. 5
iBe three-dimensional model vertex set P (r
1, r
2) a summit, mapping method is as follows: connect centre of sphere P
cWith summit P
i, and prolong the centre of sphere and summit line P
cP
iAnd Spherical Surface S
R2Intersect.If intersection point is in Spherical Surface S
R2Grid (P
1, P
2, P
3, P
4) in, grid (P so
1, P
2, P
3, P
4) weights add 1.Wherein, grid (P
1, P
2, P
3, P
4) be the above-mentioned ruling P that presses after longitude and latitude is evenly divided
1, P
2, P
3, P
4Difference is 4 intersection points of ruling for this reason.Three-dimensional model vertex set P (r
1, r
2) summit is mapped to Spherical Surface S
R2After, can obtain three-dimensional model vertex set P (r
1, r
2) the projection of sphere weights, be designated as PRO (r
1, r
2).If the sphere weights of certain node Node of spherical projection binary tree are projected as PRO (r
1, r
2), establish r=(r
1+ r
2)/2 are sphere weights projection P RO (r
1, r) with sphere weights projection P RO (r, r
2) as the weights spherical projection of this node Node left and right sides child node.If spherical projection PRO is (r
1, 1) and be the sphere weights projection of spherical projection binary tree root node, by the radius segmentation, can obtain a spherical projection image binary tree.
In the present embodiment, get r
1=m_fMinR-0.0001, r
2=1.0001, can avoid summit P like this
iWith these two spheres intersect.The number of plies of spherical projection binary tree is generally got more than 2 layers or 2 layers preferable, is example with 3 layers in the present embodiment for ease of explanation.
For two dimensional model, above-mentioned spherical projection can similarly project on the unit circle, and principle is identical with three-dimensional model.The projection theory of multidimensional model is also identical with it, repeats no more.
Step 212 makes up model intersection tree according to described model parameter.In the present embodiment, be that example describes with the spheres intersect binary tree that makes up three-dimensional model.At first, the mould that calculates the spheres intersect model vertices is long, again model is carried out sphere concentric structure, and then, the mould that calculates the spheres intersect model vertices again is long.The rest may be inferred, makes up the spheres intersect binary tree.As previously mentioned, the three-dimensional model summit is to the distance of coordinate origin and the three-dimensional model vertex set that intersects of relatively asking three-dimensional model and sphere of the radius of a ball.If spherical radius is R, intersect the model vertices set and be P (R), then P (R) can be expressed as:
P(R)={P|R-σ<L(P)≤R+σ,σ>0}
Wherein, σ is for intersecting range of definition value, promptly promptly thinks crossing in error in ± σ scope.σ gets 0.01 in the present embodiment.Wherein, L (P) is long for the model vertices mould.
Please referring to Fig. 6, summit P
jFor intersecting the summit of model vertices set P (R).If P
jAt sphere longitude and latitude network (P
5, P
6, P
7, P
8) in, grid (P then
5, P
6, P
7, P
8) weights be 1, wherein, the sphere fictitious graticule is divided equally as hereinbefore.Like this, obtain the set of three-dimensional model and spheres intersect point, be designated as PI (R).Obviously, model vertices density is big more, and σ is more little, and the precision of calculating spheres intersect is high more.If the root node of spheres intersect binary tree is PI (R), R=r
Min+ (r
Max-r
Min)/2
I+1, wherein, i represents the number of plies of spheres intersect binary tree, is 0 here.PI (R
1), PI (R
2) respectively as radius according to the node spheres intersect, wherein, R
1=R+ (r
Max-r
Min)/2
I+1, R
2=R-(r
Max-r
Min)/2
I+1, the number of plies i of the left and right sides child node of root node is 1.The rest may be inferred, obtains a spheres intersect binary tree.In the present embodiment, get r
Min=m_fMinR, r
Max=1.0.
For two dimensional model, above-mentioned spheres intersect can similarly be suitable for the method that circle intersects, and principle is identical with it.The crossing principle of multidimensional model is also identical with it, repeats no more.
Step 214 intersects information according to described model projection information and described model, model is described the descriptor that obtains model.In the present embodiment, also projection information and the crossing information with three-dimensional model is that example describes.To those skilled in the art, above two kinds of binary trees in a kind of, three-dimensional model can be described.For accurately describing described three-dimensional model, present embodiment adopts the comprehensive above-mentioned two kinds of model binary trees of weighting scheme that three-dimensional model is described.In the present embodiment, adopt SFD that the style characteristic of above-mentioned two spherical diagram pictures is described, this description builds on the spheric coordinate system, three-dimensional model describe PF (k, t) computing formula is as follows:
Wherein, M and N represent the grid number that the sphere longitude and latitude is divided respectively; M and n are used to circulate the grid number that the sphere longitude and latitude that adds up divides, 0<=m<=M-1,0<=n<=N-1; α and θ are meant two angles under the spherical coordinate system, as previously mentioned; α
mAnd θ
nBe meant that the capable n of m is listed as those two angles under spheric coordinate system of those two warp and weft intersection points; PF (k, t) k in and t be meant (k, t) piece fictitious graticule zone, just k bar, k+1 bar warp, the zone that t bar, t+1 bar parallel surround; 0<=k<=M-1 wherein, 0<=t<=N-1; F (α
m, θ
n) function expression (α just
m, θ
n) the longitude and latitude weights of net region (represent a zone with the coordinate of a bit, this is like representing this rectangle with the upper left corner of a rectangle) of some representative.Because aforementioned calculation is in spheric coordinate system, the spherical radius mould is long to be definite value, so, f (α
m, θ
n) function comprises 2 parameters.Then the computing formula of SFD is as follows:
After SFD acts on above-mentioned spherical projection binary tree and spheres intersect binary tree, promptly get corresponding three-dimensional model feature binary tree.Please referring to Fig. 7, the root node is the 0th layer of three-dimensional model feature binary tree, is used to characterize the global feature of three-dimensional model, and the number of plies of three-dimensional model feature binary tree is high more, represents local detail feature description careful more of three-dimensional model.Like this, can from integral body to the part, mate three-dimensional model by this three-dimensional model feature binary tree.
For two dimensional model or other multidimensional models, it is identical with it that SFD describes principle, repeats no more.
Step 216, model file information and model parameter information in the reading of data storage unit 154.Can provide model file and model parameter in the module 154 selectively to read to data according to the descriptor of 138 pairs of models of description unit, this selection can be selected according to default reading order.In the present embodiment, it is as follows to read details:
1) opens the model information file.
2) read the model file number, read preceding 4 Byte, and be stored as an int type variable.According to the model file number, following steps are carried out in circulation.
3) initialization chained list node DataLink, the DataLink structure comprises following data: a CString type variable is preserved the model file name, one 7 * 375 two-dimentional float type array is preserved the Fourier descriptors coefficient, size is that 9 float type array is preserved isotropy transformation matrix coefficient, three float type variablees are preserved three eigenwerts of isotropy transformation matrix, and a DataLink* type pointer is used in reference to follow-up node.
4) read model file length, according to preceding 4 Byte of this model file message block, preserving becomes an int type variable.Byte number according to this Length Indication reads file name.
5) read the Fourier descriptors coefficient.This is one 7 * 375 a two-dimentional float type array.
6) read 9 (3 * 3) isotropy transformation matrix coefficients, and calculate the eigenwert of 3 isotropy matrixes.
Step 218 according to the model file information that reads, is calculated the deviate with the input model characteristics tree.In the present embodiment, be that example describes with input three-dimensional model feature binary tree.Three-dimensional model feature binary tree has been represented the similarity matching degree of two three-dimensional models from integral body to the part respectively from the root node to the leafy node.The SFD offset distance computing formula of three-dimensional model feature binary tree is as follows respectively:
Wherein, dist1 represents the SFD offset distance of spherical projection image, and dist2 represents the SFD offset distance of spheres intersect image.SFD1 and SFD2 represent the SFD of model in the model selected and the data storage cell 154 respectively, and the offset distance that calculates the two just can draw the two similarity degree.I and j are loop variables, and span is respectively 0..M-1 and 0..N-1.M and N represent the fictitious graticule number that sphere is divided respectively.
Step 220, the similarity of computation model structure tree.In the present embodiment, be that example describes with the similarity of calculating three-dimensional model feature binary tree.The similarity degree of three-dimensional model feature binary tree has embodied the similarity degree of two three-dimensional models, and the three-dimensional model binary tree calculating formula of similarity of two kinds of Flame Image Process modes is as follows:
Wherein, comp
1The three-dimensional model similarity of expression sphere weights projection, comp
2The three-dimensional model similarity of expression spheres intersect.Dist
I, jIt is the deviation of three-dimensional model feature binary tree i layer j corresponding node.Similarity is more little, and the similarity of three-dimensional model is poor more, otherwise similarity is big more, and the similarity of three-dimensional model is good more.
The three-dimensional model similarity comp of the sphere weights projection that above-mentioned two kinds of Flame Image Process modes calculate
1And the three-dimensional model similarity comp of spheres intersect
2Different weights can be set as required.Generally be provided with according to the test experience.
If in paying attention to the similar indexing unit of model outward appearance, comp
1And comp
2Weights can be set to 3/4 and 1/4 respectively.Then calculating formula of similarity is as follows:
Wherein, comp represents the similarity of two kinds of three-dimensional models after the weighting.
If at topological structure, during the retrieval of especially empty model, as the retrieval of mechanical model, according to test experience comp
1And comp
2Weights can be set to 1/4 and 3/4 respectively.Then the calculating formula of similarity after the weighting is as follows:
Wherein, comp represents the similarity of two kinds of three-dimensional models after the weighting.
If the model structure more complicated of retrieval, type is many, according to test experience, comp
1And comp
2Weights can be set to 1/2.Then the calculating formula of similarity after the weighting is as follows:
Wherein, comp represents the similarity of two kinds of three-dimensional models after the weighting.
Step 222 sorts to each model similarity of aforementioned calculation, and described ordering is greatly to the little ordering of similarity from similarity.Described ordering can be sorted according to methods such as Hash ordering, quicksort, merge sort, heapsort and bubble sorts.
Step 224 judges whether result for retrieval is correct.If the model of user's appointment is one of them that comprises in the model data store unit 154 in the model, first result who then returns should be this model self, because this model and himself similarity maximum (being 1).If satisfy this condition, and the model quantity of returning is greater than the model quantity of user's appointment, and then result for retrieval is correct.If the model of user's appointment not in model data store unit 154, only needs then to judge whether return the model number meets the requirements and judge.
Step 226 shows result for retrieval.In the present embodiment, result for retrieval is set once shows 20 models that retrieve, and arrange demonstration according to similarity order from big to small.Simultaneously, the model file name that retrieves can be kept in the text.
If retrieval two dimensional model or three-dimensional above model, searching principle is identical with the embodiment of the invention, changes parameter and gets final product, and repeats no more.
Above-mentioned model retrieval method is described described model according to the parameter of described model, and by model is carried out concentric structure.The profile that not only can describe image also can be described the hollow sectors of figure, can retrieve the image of special result, and more careful to iamge description, the embodiment of the invention scope of application is extensive than prior art.Simultaneously, owing to can receive the model information of particular image and the image that retrieval comprises the cavity, the robustness of the embodiment of the invention is preferable.In addition, by refined model is described, the embodiment of the invention is more careful to the description of model, can describe the interior void of image, the topography that general image that not only can retrieval model also can retrieval model.By described model is carried out pre-service,, unified by coordinate system to described model by described model being carried out the triangular plate sampling.Consistance that can descriptive model makes model that identical disposing way be arranged, and makes the disposing way of model not influence result for retrieval.By calculating the extent of deviation of two kinds of models, by the similarity of above-mentioned two kinds of models is calculated, avoided retrieving unnecessary model, saved the resource of system.By described similarity is sorted, make similarity be aligned to visibility point than higher model, save the time and the manpower of retrieval.By whether described result for retrieval is correctly judged, make retrieval person can know that whether this result for retrieval is correct, reduced the probability of makeing mistakes.By showing described result for retrieval, make retrieval person can browse its result for retrieval.Be weighted by similarity, improved the degree of accuracy and the robustness of retrieval, and can carry out the part retrieval of model, expanded range of application model projection and the crossing dual mode calculating of model.
In sum, more than be preferred embodiment of the present invention only, be not to be used to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.