Three-dimensional model texture mapping conversion method, device, equipment and medium
By calculating the key point set and Laplace coordinates in the 3D model, the texture map is inserted into the target plane, which solves the problem of inaccurate texture maps and improves the accuracy and detail retention of the 3D model texture map.
Patent Information
- Application Number
- CN202111017923.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-31
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2041-08-31
AI Technical Summary
In three-dimensional modeling software, due to the redundant information and the different expansion methods of different modelers during the expansion process of texture maps, the texture map is inaccurate and details are lost, which affects the texture map quality of the three-dimensional model.
By determining the initial key point coordinates in the three-dimensional model, obtaining the key point set, calculating Laplace coordinates, and using a preset algorithm to insert the patch texture map into the target plane, generating a two-dimensional texture map, retaining detailed information, and improving accuracy .
It realizes the conversion of a three-dimensional model into a two-dimensional texture map. The generated texture map retains detailed information and improves the accuracy of the expanded three-dimensional model texture map.
Smart Images

Figure CN113781622B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and computer-readable storage medium for converting a three-dimensional model texture map. Background Art
[0002] When using 3D modeling software, it is necessary to expand the texture of the 3D model to obtain a texture map containing all the texture information of the model, and at the same time obtain the mapping relationship between the 3D model and the texture map. Different mapping relationships correspond to different texture maps.
[0003] In the actual texture image acquisition and processing process, the obtained texture map is usually a summary of a series of texture photos taken, which contains a lot of redundant information and cannot be directly applied. Moreover, for the same model, since different modelers unfold the model texture in different ways, the texture map details are easily lost, resulting in inaccurate texture mapping of the unfolded three-dimensional model. Summary of the invention
[0004] The main purpose of the present invention is to provide a method, device, equipment and computer-readable storage medium for converting texture mapping of a three-dimensional model, aiming to solve the problem of how to improve the accuracy of texture mapping of the unfolded three-dimensional model.
[0005] To achieve the above object, the present invention provides a method for converting a 3D model texture map, the method comprising the following steps:
[0006] Determining a target plane according to coordinates of a plurality of initial key points in a three-dimensional model, wherein the three-dimensional model is divided into a plurality of facets, and the initial key points are boundary vertices of the facets;
[0007] Acquire a key point set corresponding to each of the initial key points, wherein the key point set corresponding to each of the initial key points includes the coordinates of the initial key point and the initial key points in the neighborhood of the initial key point;
[0008] Determine the Laplace coordinates of each of the initial key points on the target plane according to each of the key point sets;
[0009] The texture map corresponding to each of the face patches is inserted into the target plane according to a preset algorithm and the Laplace coordinates of each of the initial key points to obtain a two-dimensional texture map.
[0010] In one embodiment, the step of determining the Laplace coordinates of each of the initial key points on the target plane according to each of the key point sets comprises:
[0011] Determine a projection plane of the key point set corresponding to each of the initial key points, wherein the projection plane is determined by the sum of the distances from each of the initial key points in the key point set to the projection plane;
[0012] Determine the projection coordinates of each of the initial key point coordinates in each of the key point sets on the projection plane;
[0013] The Laplace coordinates of each initial key point on the target plane are determined according to the projection coordinates corresponding to each key point set.
[0014] In one embodiment, the step of determining the Laplace coordinates of each initial key point on the target plane according to the projection coordinates corresponding to each key point set includes:
[0015] Obtaining a global normal vector of the target plane;
[0016] Determining a local normal vector of the projection plane;
[0017] Determine a rotation matrix according to a preset unit vector, the global normal vector and the local normal vector;
[0018] Determine, according to the rotation matrix, the rotation coordinates on the target plane corresponding to the projection coordinates on the projection plane;
[0019] The Laplace coordinates are determined based on the rotated coordinates on the target plane.
[0020] In one embodiment, the step of determining the Laplace coordinates according to the rotation coordinates on the target plane comprises:
[0021] Determine the Laplace equation according to each of the rotation coordinates on the target plane;
[0022] The Laplace coordinates of each of the initial key points are determined according to the preset anchor point and the Laplace equation corresponding to each of the key point sets.
[0023] In one embodiment, the step of determining a rotation matrix according to a preset unit vector, the global normal vector and the local normal vector comprises:
[0024] Determine a rotation angle according to the global normal vector and the local normal vector;
[0025] The rotation matrix is determined according to a preset unit vector and the rotation angle.
[0026] In one embodiment, the step of determining the target plane according to the coordinates of a plurality of initial key points in the three-dimensional model comprises:
[0027] Determine a global normal vector according to the coordinates of the multiple initial key points;
[0028] Determine two global basis vectors corresponding to the global normal vector according to a preset rule, wherein the global normal vector is perpendicular to the two global basis vectors;
[0029] The target plane is determined according to the two global basis vectors.
[0030] In one embodiment, the step of determining a global normal vector according to the coordinates of the plurality of initial key points comprises:
[0031] Determine a coordinate matrix according to the coordinates of the plurality of initial key points;
[0032] Determining the average of the values in each row of the coordinate matrix;
[0033] Subtract the average value of the row from the value in the coordinate matrix to obtain a target matrix;
[0034] A singular vector corresponding to the minimum singular value of the target matrix is determined as the global normal vector.
[0035] To achieve the above object, the present invention further provides a three-dimensional model texture map conversion device, the three-dimensional model texture map conversion device comprising:
[0036] A determination module, used to determine a target plane according to coordinates of a plurality of initial key points in a three-dimensional model, wherein the three-dimensional model is divided into a plurality of facets, and the initial key points are boundary vertices of the facets;
[0037] An acquisition module, used to acquire a key point set corresponding to each of the initial key points, wherein the key point set corresponding to each of the initial key points includes the coordinates of the initial key point and the initial key points in the neighborhood of the initial key point;
[0038] A calculation module, used for determining the Laplace coordinates of each of the initial key points on the target plane according to each of the key point sets;
[0039] A conversion module is used to insert the texture map corresponding to each of the face patches into the target plane according to a preset algorithm and the Laplace coordinates of each of the initial key points to obtain a two-dimensional texture map.
[0040] To achieve the above-mentioned purpose, the present invention also provides a three-dimensional model texture map conversion device, which includes a memory, a processor, and a three-dimensional model texture map conversion program stored in the memory and executable on the processor. When the three-dimensional model texture map conversion program is executed by the processor, the various steps of the three-dimensional model texture map conversion method as described above are implemented.
[0041] To achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, which stores a conversion program for a three-dimensional model texture map. When the conversion program for a three-dimensional model texture map is executed by a processor, the various steps of the three-dimensional model texture map conversion method as described above are implemented.
[0042] The present invention provides a method, device, equipment and computer-readable storage medium for converting a texture map of a three-dimensional model. The method determines a target plane according to the coordinates of multiple initial key points in the three-dimensional model, obtains a key point set corresponding to each initial key point, determines the Laplace coordinates of each initial key point on the target plane according to each key point set, and inserts the texture map corresponding to each face into the target plane according to a preset algorithm and the Laplace coordinates of each initial key point to obtain a two-dimensional texture map. The present invention realizes the conversion of a three-dimensional model into a two-dimensional texture map, and the generated two-dimensional texture map retains the detail information of the texture map, thereby improving the accuracy of the texture map of the unfolded three-dimensional model. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A schematic diagram of the hardware structure of a three-dimensional model texture mapping conversion device involved in an embodiment of the present invention;
[0044] Figure 2 A schematic flow chart of a first embodiment of a method for converting a texture map of a three-dimensional model according to the present invention;
[0045] Figure 3 A schematic diagram of a three-dimensional model in the method for converting a three-dimensional model texture map of the present invention;
[0046] Figure 4 A schematic diagram of the conversion result of the texture map of a three-dimensional model of the present invention;
[0047] Figure 5 It is a detailed flow chart of step S30 of the second embodiment of the method for converting a 3D model texture map of the present invention;
[0048] Figure 6 A schematic diagram of a projection plane in a method for converting a three-dimensional model texture map according to the present invention;
[0049] Figure 7 Schematic diagram of a detailed flow chart of step S33 of the third embodiment of the method for converting a 3D model texture map of the present invention;
[0050] Figure 8 A schematic diagram of a global normal vector and a local normal vector in a method for converting a texture map of a three-dimensional model according to the present invention;
[0051] Fig. 9A schematic diagram of the coordinates corresponding to the initial key points in the key point set when converted to the target plane in the conversion method of the three-dimensional model texture map of the present invention;
[0052] Fig.10 A schematic diagram of the Laplace coordinates of each initial key point on the target plane in the conversion method of the three-dimensional model texture map of the present invention;
[0053] Fig.11 It is a detailed flow chart of step S10 of the fourth embodiment of the method for converting a 3D model texture map of the present invention;
[0054] Fig.12 The figure is a schematic diagram of the logical structure of the conversion device of the three-dimensional model texture map of the present invention.
[0055] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0056] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0057] The main solution of the embodiment of the present invention is: determine the target plane according to the coordinates of multiple initial key points in the three-dimensional model, and obtain the key point set corresponding to each initial key point; determine the Laplace coordinates of each initial key point on the target plane according to each key point set; insert the texture map corresponding to each facet into the target plane according to a preset algorithm and the Laplace coordinates of each initial key point to obtain a two-dimensional texture map.
[0058] The present invention realizes the conversion of a three-dimensional model into a two-dimensional texture map, and the generated two-dimensional texture map retains the detail information of the texture map, thereby improving the accuracy of the texture map of the unfolded three-dimensional model.
[0059] As an implementation scheme, the conversion device of the 3D model texture map can be as follows Figure 1 shown.
[0060] The embodiment of the present invention relates to a 3D model texture map conversion device, which includes: a processor 101, such as a CPU, a memory 102, and a communication bus 103. The communication bus 103 is used to realize connection and communication between these components.
[0061] The memory 102 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. Figure 1As shown, the memory 102 as a computer-readable storage medium may include a conversion program for a 3D model texture map; and the processor 101 may be used to call the conversion program for a 3D model texture map stored in the memory 102, and perform the following operations:
[0062] Determining a target plane according to coordinates of a plurality of initial key points in a three-dimensional model, wherein the three-dimensional model is divided into a plurality of facets, and the initial key points are boundary vertices of the facets;
[0063] Acquire a key point set corresponding to each of the initial key points, wherein the key point set corresponding to each of the initial key points includes the coordinates of the initial key point and the initial key points in the neighborhood of the initial key point;
[0064] Determine the Laplace coordinates of each of the initial key points on the target plane according to each of the key point sets;
[0065] The texture map corresponding to each of the face patches is inserted into the target plane according to a preset algorithm and the Laplace coordinates of each of the initial key points to obtain a two-dimensional texture map.
[0066] In one embodiment, the processor 101 may be used to call a conversion program of a 3D model texture map stored in the memory 102, and perform the following operations:
[0067] Determine a projection plane of the key point set corresponding to each of the initial key points, wherein the projection plane is determined by the sum of the distances from each of the initial key points in the key point set to the projection plane;
[0068] Determine the projection coordinates of each of the initial key point coordinates in each of the key point sets on the projection plane;
[0069] The Laplace coordinates of each initial key point on the target plane are determined according to the projection coordinates corresponding to each key point set.
[0070] In one embodiment, the processor 101 may be used to call a conversion program of a 3D model texture map stored in the memory 102, and perform the following operations:
[0071] Obtaining a global normal vector of the target plane;
[0072] Determining a local normal vector of the projection plane;
[0073] Determine a rotation matrix according to a preset unit vector, the global normal vector and the local normal vector;
[0074] Determine, according to the rotation matrix, the rotation coordinates on the target plane corresponding to the projection coordinates on the projection plane;
[0075] The Laplace coordinates are determined based on the rotated coordinates on the target plane.
[0076] In one embodiment, the processor 101 may be used to call a conversion program of a 3D model texture map stored in the memory 102, and perform the following operations:
[0077] Determine the Laplace equation according to each of the rotation coordinates on the target plane;
[0078] The Laplace coordinates of each of the initial key points are determined according to the preset anchor point and the Laplace equation corresponding to each of the key point sets.
[0079] In one embodiment, the processor 101 may be used to call a conversion program of a 3D model texture map stored in the memory 102, and perform the following operations:
[0080] Determine a rotation angle according to the global normal vector and the local normal vector;
[0081] The rotation matrix is determined according to a preset unit vector and the rotation angle.
[0082] In one embodiment, the processor 101 may be used to call a conversion program of a 3D model texture map stored in the memory 102, and perform the following operations:
[0083] Determine a global normal vector according to the coordinates of the multiple initial key points;
[0084] Determine two global basis vectors corresponding to the global normal vector according to a preset rule, wherein the global normal vector is perpendicular to the two global basis vectors;
[0085] The target plane is determined according to the two global basis vectors.
[0086] In one embodiment, the processor 101 may be used to call a conversion program of a 3D model texture map stored in the memory 102, and perform the following operations:
[0087] Determine a coordinate matrix according to the coordinates of the plurality of initial key points;
[0088] Determining the average of the values in each row of the coordinate matrix;
[0089] Subtract the average value of the row from the value in the coordinate matrix to obtain a target matrix;
[0090] A singular vector corresponding to the minimum singular value of the target matrix is determined as the global normal vector.
[0091] Based on the hardware architecture of the above-mentioned three-dimensional model texture mapping conversion device, an embodiment of the three-dimensional model texture mapping conversion method of the present invention is proposed.
[0092] Reference Figure 2 , Figure 2 The first embodiment of the method for converting a 3D model texture map of the present invention comprises the following steps:
[0093] Step S10, determining a target plane according to coordinates of a plurality of initial key points in a three-dimensional model, wherein the three-dimensional model is divided into a plurality of facets, and the initial key points are boundary vertices of the facets.
[0094] Specifically, the multiple initial key points can be key points taken from the surface of a human face, and the number of the initial key points can be tens of thousands. The three-dimensional model can be a three-dimensional model of a human face, and the three-dimensional model is divided into multiple facets, and the initial key points are the boundary vertices of the facets, for example, Figure 3 As shown, the number of initial key points corresponding to the three-dimensional model can be eight, and the eight points A, B, C, D, E, F, G and H are the boundary vertices of the three-dimensional model. The coordinates of the initial key point A are (0, 1, 0), the coordinates of the initial key point B are (1, 0, 0), the coordinates of the initial key point C are (0, -1, 0), the coordinates of the initial key point D are (-1, 0, 0), the coordinates of the initial key point E are (-1, 1, -1), the coordinates of the initial key point F are (1, 1, -1), the coordinates of the initial key point G are (1, -1, -1), and the coordinates of the initial key point H are (-1, -1, -1). AEF, ABF, BFG, BCG, CGH, DCH, DEH, ADE, ABD, BCD are the facets of the three-dimensional model.
[0095] The target plane is determined according to the coordinates of multiple initial key points in the three-dimensional model. The normal vector of the three-dimensional model can be determined according to the initial key points, and a plane perpendicular to the normal vector is selected as the target plane.
[0096] Step S20, obtaining a key point set corresponding to each of the initial key points, wherein the key point set corresponding to each of the initial key points includes the coordinates of the initial key point and the initial key points within the neighborhood of the initial key point.
[0097] Specifically, a key point set corresponding to each initial key point is obtained, and the key point set corresponding to each initial key point includes the coordinates of the initial key point and the initial key point in the area of the initial key point. For example, Figure 3 As shown, the initial key points in the neighborhood of the initial key point A are B, D, E and F, and the initial key points in the neighborhood of the initial key point B are A, C, D, F and G.
[0098] Step S30: determining the Laplace coordinates of each of the initial key points on the target plane according to each of the key point sets.
[0099] Specifically, determine the projection plane corresponding to each key point set, determine the projection coordinates of each initial key point in each key point set on the projection plane corresponding to the key point set, determine the rotation coordinates of each initial key point on the target plane based on the projection coordinates, and determine the Laplace coordinates of each initial key point based on the rotation coordinates on the target plane.
[0100] Step S40: inserting the texture map corresponding to each of the face patches into the target plane according to a preset algorithm and the Laplace coordinates of each of the initial key points to obtain a two-dimensional texture map.
[0101] Specifically, the texture map corresponding to each facet is inserted into the target plane according to a preset algorithm and the Laplace coordinates of each initial key point to obtain a two-dimensional texture map. The preset algorithm may be a triangular interpolation algorithm. For example, Figure 3 As shown in FIG, after determining the Laplace coordinates of the initial key points A, B, C, D, E, F, G, and H on the target plane, the texture maps of the ten patches AEF, ABF, BFG, BCG, CGH, DCH, DEH, ADE, ABD, and BCD are transferred from the three-dimensional model to the target plane. Figure 4 As shown, Figure 4 a is a three-dimensional model, Figure 4 b is a two-dimensional texture map.
[0102] In the technical solution of this embodiment, the target plane is determined according to the coordinates of multiple initial key points in the three-dimensional model, and a key point set corresponding to each initial key point is obtained; the Laplace coordinates of each initial key point on the target plane are determined according to each key point set; the texture map corresponding to each facet is inserted into the target plane according to a preset algorithm and the Laplace coordinates of each initial key point to obtain a two-dimensional texture map. The present invention realizes the conversion of a three-dimensional model into a two-dimensional texture map, and the generated two-dimensional texture map retains the detail information of the texture map, thereby improving the accuracy of the texture map of the unfolded three-dimensional model.
[0103] Reference Figure 5 , Figure 5 This is a second embodiment of the method for converting a 3D model texture map of the present invention, based on the first embodiment, step S30 includes:
[0104] Step S31, determining a projection plane of the key point set corresponding to each of the initial key points, wherein the projection plane is determined by the sum of the distances from each of the initial key points in the key point set to the projection plane;
[0105] Step S32, determining the projection coordinates of each of the initial key point coordinates in each of the key point sets on the projection plane;
[0106] Step S33, determining the Laplace coordinates of each initial key point on the target plane according to the projection coordinates corresponding to each key point set.
[0107] Specifically, to determine the projection plane of the key point set corresponding to each initial key point, the sum of the distances from each initial key point in the key point set to the same plane can be calculated, and the plane with the smallest sum of the distances from each initial key point to the same plane is used as the projection plane of the key point set. The key point set corresponding to the initial key point A is {A, B, D, E, F}, and the coordinate matrix of the coordinate matrix corresponding to the key point set after decentralization is vA. Perform PCA (Principal Component Analysis) dimensionality reduction processing on vA to obtain the projection plane plane_A formed by the two main directions of vA, and then determine the projection coordinates of each initial key point coordinate in each key point set on the projection plane. For example, as Figure 6 As shown, the projection plane corresponding to the initial key point A is plane_A, the projection coordinates of the initial key point A on the projection plane plane_A are A', the projection coordinates of the initial key point B on the projection plane plane_A are B', the projection coordinates of the initial key point D on the projection plane plane_A are D', the projection coordinates of the initial key point E on the projection plane plane_A are E', and the projection coordinates of the initial key point F on the projection plane plane_A are F'.
[0108] The Laplace coordinates of each initial key point on the target plane are determined according to the projection coordinates corresponding to each key point set. The rotation coordinates of each initial key point on the target plane can be determined according to the projection coordinates, and the Laplace coordinates of each initial key point can be determined according to the rotation coordinates on the target plane.
[0109] In the technical solution of this embodiment, the projection plane of the key point set corresponding to each initial key point is determined, the projection coordinates of the coordinates of each initial key point in each key point set on the projection plane are determined, and the Laplace coordinates of each initial key point on the target plane are determined according to the projection coordinates corresponding to each key point set. The Laplace coordinates of each initial key point on the target plane are determined according to the projection coordinates on the projection plane, so that the texture maps corresponding to each patch are subsequently inserted into the target plane to obtain a two-dimensional texture map.
[0110] Reference Figure 7 , Figure 7This is a third embodiment of the method for converting a 3D model texture map of the present invention, based on the second embodiment, step S33 includes:
[0111] Step S331, obtaining the global normal vector of the target plane;
[0112] Step S332, determining the local normal vector of the projection plane;
[0113] Step S333, determining a rotation matrix according to a preset unit vector, the global normal vector and the local normal vector;
[0114] Step S334, determining the projection coordinates on the target plane corresponding to the projection coordinates on the projection plane according to the rotation matrix;
[0115] Step S335: determining the Laplace coordinates according to the projection coordinates on the target plane.
[0116] Specifically, the global normal vector of the target plane is perpendicular to the target plane, and the local normal vector of the projection plane is perpendicular to the projection plane.
[0117] The rotation matrix is determined based on the preset unit vector, the global normal vector, and the local normal vector. The rotation angle can be determined based on the global normal vector and the local normal vector. For example, Figure 8 As shown, the global normal vector is n_global, the local normal vector is n_local, and the rotation angle is the angle θ between the global normal vector and the local normal vector; the rotation matrix is determined according to the preset unit vector and the rotation angle.
[0118] If n_rot = n_local × n_global is the rotation axis, rotate A', B', D', E', F' around the rotation axis n_rot by θ so that n_local is rotated to the direction of n_global. Let the unit vector of the rotation axis be The rotation angle is θ, and the rotation matrix matrix_rotation_local is as follows:
[0119]
[0120] The projection points of the key point set corresponding to the initial key point A on plane_A are A', B', D', E', F', and the points after rotation are A", B", D", E", F", such as Figure 3 For the three-dimensional model shown, the coordinate matrix of A', B', D', E', F' can be multiplied by the corresponding rotation matrix to obtain the corresponding matrix point_rot of the rotation coordinates:
[0121]
[0122] The matrix point_local of the rotation coordinates of "A", "B", "D", "E", "F" on the basis vector b1×b2 on the target plane is:
[0123] point_local=(b1;b2)'*point_rot;
[0124]
[0125] Where b1 and b2 are the basis vectors of the target plane. For example, the positions of A", B", D", E", and F" on the target plane are as follows: Fig. 9 shown.
[0126] The Laplace equation is determined according to each rotation coordinate on the target plane; the Laplace coordinates of each initial key point are determined according to the preset anchor point and the Laplace equation corresponding to each key point set.
[0127] Since the coordinates of A", B", D", E", and F" in the new coordinate system have two components, for example, there are two Laplace equations corresponding to point A", and the Laplace equation for the coordinate of x is as follows:
[0128]
[0129] The Laplace equation for the y coordinate is as follows:
[0130]
[0131] The above Laplace equations about x and y coordinates are the Laplace equations corresponding to the initial key point A. By analogy, the initial key points A, B, C, D, E, F, G and H correspond to two Laplace equations respectively, and 16 Laplace coordinate equations can be obtained.
[0132] The Laplace coordinates of each initial key point are determined according to the preset anchor point and the Laplace equation corresponding to each key point set. For example, the anchor point can be selected as x A =0,y A =0; these two equations and 16 Laplace coordinate equations can be used to solve the x and y coordinates of the 8 points. The distribution of the 8 points on the target plane can be shown as follows Fig.10 shown.
[0133] In the technical solution of this embodiment, the global normal vector of the target plane is obtained; the local normal vector of the projection plane is determined; the rotation matrix is determined according to the preset unit vector, the global normal vector and the local normal vector; the rotation coordinates on the target plane corresponding to the projection coordinates on the projection plane are determined according to the rotation matrix; the Laplace coordinates are determined according to the rotation coordinates on the target plane. The Laplace coordinates of the projection coordinates on the target plane are determined by the global normal vector of the target plane and the local normal vector of the projection plane, so as to facilitate the subsequent accurate insertion of the texture map corresponding to each patch into the target plane.
[0134] Reference Fig.11 , Fig.11 This is a fourth embodiment of the method for converting a 3D model texture map of the present invention, based on any one of the first to third embodiments, wherein step S10 comprises:
[0135] Step S11, determining a global normal vector according to the coordinates of the multiple initial key points;
[0136] Step S12, determining two global basis vectors corresponding to the global normal vector according to a preset rule, wherein the global normal vector is perpendicular to the two global basis vectors;
[0137] Step S13: determining the target plane according to the two global basis vectors.
[0138] Specifically, assume that the coordinates of the initial key point A are (0,1,0), the coordinates of the initial key point B are (1,0,0), the coordinates of the initial key point C are (0,-1,0), the coordinates of the initial key point D are (-1,0,0), the coordinates of the initial key point E are (-1,1,-1), the coordinates of the initial key point F are (1,1,-1), the coordinates of the initial key point G are (1,-1,-1), and the coordinates of the initial key point H are (-1,-1,-1).
[0139] Determine a coordinate matrix according to the coordinates of a plurality of initial key points;
[0140]
[0141] Determine the mean of the values in each row of the coordinate matrix Subtract the row average from the value in the coordinate matrix to get the target matrix. The formula is as follows:
[0142]
[0143] Among them, vs[:,i] represents the i-th column of the matrix vs, and vsRaw[:,i] represents the j-th column of the matrix vsRaw.
[0144] The target matrix looks like this:
[0145]
[0146] Perform singular value decomposition on the matrix vs,
[0147] vs=u·s·v T ;
[0148] in, s = [2.449 2.449 1.414];
[0149]
[0150] Determine the singular vector corresponding to the minimum singular value of the target matrix as the global normal vector. For example, select the third column vector of the u matrix as n_global = u[:, 3] = [0, 0, 1]', and use the right-hand rule to determine the basis vectors of the target plane as b1 = u[:, 1] = [0, -1, 0]' and b2 = u[:, 2] = [1, 0, 0]';
[0151] In the technical solution of this embodiment, a coordinate matrix is determined according to the coordinates of multiple initial key points; the average value of each row in the coordinate matrix is determined; the target matrix is obtained by subtracting the average value of the row from the value in the coordinate matrix, and the singular vector corresponding to the minimum singular value of the target matrix is determined as the global normal vector. The global normal vector corresponding to the target plane is determined, and the target plane can be determined according to the basis vector of the global normal vector, so that the texture map corresponding to each patch can be accurately inserted into the target plane in the future.
[0152] Reference Fig.12 The present invention also provides a three-dimensional model texture map conversion device, the three-dimensional model texture map conversion device comprising:
[0153] A determination module 100, for determining a target plane according to coordinates of a plurality of initial key points in a three-dimensional model, wherein the three-dimensional model is divided into a plurality of facets, and the initial key points are boundary vertices of the facets;
[0154] An acquisition module 200 is used to acquire a key point set corresponding to each of the initial key points, wherein the key point set corresponding to each of the initial key points includes the coordinates of the initial key point and the initial key points in the neighborhood of the initial key point;
[0155] A calculation module 300, configured to determine the Laplace coordinates of each of the initial key points on the target plane according to each of the key point sets;
[0156] The conversion module 400 is used to insert the texture map corresponding to each of the patches into the target plane according to a preset algorithm and the Laplace coordinates of each of the initial key points to obtain a two-dimensional texture map.
[0157] In one embodiment, in determining the Laplace coordinates of each of the initial key points on the target plane according to each of the key point sets, the calculation module 300 is specifically configured to:
[0158] Determine a projection plane of the key point set corresponding to each of the initial key points, wherein the projection plane is determined by the sum of the distances from each of the initial key points in the key point set to the projection plane;
[0159] Determine the projection coordinates of each of the initial key point coordinates in each of the key point sets on the projection plane;
[0160] The Laplace coordinates of each initial key point on the target plane are determined according to the projection coordinates corresponding to each key point set.
[0161] In one embodiment, in determining the Laplace coordinates of each initial key point on the target plane according to the projection coordinates corresponding to each key point set, the calculation module 300 is specifically used to:
[0162] Obtaining a global normal vector of the target plane;
[0163] Determining a local normal vector of the projection plane;
[0164] Determine a rotation matrix according to a preset unit vector, the global normal vector and the local normal vector;
[0165] Determine, according to the rotation matrix, the rotation coordinates on the target plane corresponding to the projection coordinates on the projection plane;
[0166] The Laplace coordinates are determined based on the rotated coordinates on the target plane.
[0167] In one embodiment, in determining the Laplace coordinates according to the rotation coordinates on the target plane, the calculation module 300 is specifically used to:
[0168] Determine the Laplace equation according to each of the rotation coordinates on the target plane;
[0169] The Laplace coordinates of each of the initial key points are determined according to the preset anchor point and the Laplace equation corresponding to each of the key point sets.
[0170] In one embodiment, in determining the rotation matrix according to the preset unit vector, the global normal vector and the local normal vector, the calculation module 300 is specifically used to:
[0171] Determine a rotation angle according to the global normal vector and the local normal vector;
[0172] The rotation matrix is determined according to a preset unit vector and the rotation angle.
[0173] In one embodiment, in determining the target plane according to the coordinates of a plurality of initial key points in the three-dimensional model, the determination module 100 is specifically used to:
[0174] Determine a global normal vector according to the coordinates of the multiple initial key points;
[0175] Determine two global basis vectors corresponding to the global normal vector according to a preset rule, wherein the global normal vector is perpendicular to the two global basis vectors;
[0176] The target plane is determined according to the two global basis vectors.
[0177] In one embodiment, in determining the global normal vector according to the coordinates of the multiple initial key points, the determination module 100 is specifically used to:
[0178] Determine a coordinate matrix according to the coordinates of the plurality of initial key points;
[0179] Determining the average of the values in each row of the coordinate matrix;
[0180] Subtract the average value of the row from the value in the coordinate matrix to obtain a target matrix;
[0181] A singular vector corresponding to the minimum singular value of the target matrix is determined as the global normal vector.
[0182] The present invention also provides a three-dimensional model texture map conversion device, which includes a memory, a processor, and a three-dimensional model texture map conversion program stored in the memory and executable on the processor. When the three-dimensional model texture map conversion program is executed by the processor, the three-dimensional model texture map conversion method described in the above embodiment is implemented.
[0183] The present invention also provides a computer-readable storage medium, which stores a conversion program for a three-dimensional model texture map. When the conversion program for a three-dimensional model texture map is executed by a processor, the various steps of the three-dimensional model texture map conversion method described in the above embodiment are implemented.
[0184] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0185] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, system, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, system, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, system, article or device including the element.
[0186] Through the description of the above implementation methods, technicians in this field can clearly understand that the above-mentioned embodiment system can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a computer-readable storage medium (such as ROM / RAM, disk, CD) as described above, including a number of instructions for a terminal device (which can be a mobile phone, computer, parking management equipment, air conditioner, or network equipment, etc.) to execute the system described in each embodiment of the present invention.
[0187] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for converting a texture map of a three-dimensional model, characterized in that: The conversion method of the three-dimensional model texture map includes: Determining a target plane according to coordinates of a plurality of initial key points in a three-dimensional model, wherein the three-dimensional model is divided into a plurality of facets, and the initial key points are boundary vertices of the facets; Acquire a key point set corresponding to each of the initial key points, wherein the key point set corresponding to each of the initial key points includes the coordinates of the initial key point and the initial key points in the neighborhood of the initial key point; Determine the Laplace coordinates of each of the initial key points on the target plane according to each of the key point sets, including: determining the projection plane of the key point set corresponding to each of the initial key points, the projection plane being determined by the sum of the distances from each of the initial key points in the key point set to the projection plane; determining the projection coordinates of each of the initial key point coordinates in each of the key point sets on the projection plane; obtaining the global normal vector of the target plane; determining the local normal vector of the projection plane; determining a rotation matrix according to a preset unit vector, the global normal vector and the local normal vector; determining the rotation coordinates on the target plane corresponding to the projection coordinates on the projection plane according to the rotation matrix; determining the Laplace equation corresponding to each of the key point sets according to each of the rotation coordinates on the target plane; determining the Laplace coordinates of each of the initial key points according to a preset anchor point and the Laplace equation corresponding to each of the key point sets; The texture map corresponding to each of the face patches is inserted into the target plane according to a preset algorithm and the Laplace coordinates of each of the initial key points to obtain a two-dimensional texture map.
2. The method for converting a 3D model texture map as claimed in claim 1, characterized in that: The step of determining a rotation matrix according to a preset unit vector, the global normal vector and the local normal vector comprises: Determine a rotation angle according to the global normal vector and the local normal vector; The rotation matrix is determined according to a preset unit vector and the rotation angle.
3. The method for converting a 3D model texture map as claimed in claim 1, characterized in that: The step of determining the target plane according to the coordinates of a plurality of initial key points in the three-dimensional model comprises: Determine a global normal vector according to the coordinates of the multiple initial key points; Determine two global basis vectors corresponding to the global normal vector according to a preset rule, wherein the global normal vector is perpendicular to the two global basis vectors; The target plane is determined according to the two global basis vectors.
4. The method for converting a 3D model texture map as claimed in claim 3, characterized in that: The step of determining the global normal vector according to the coordinates of the multiple initial key points comprises: Determine a coordinate matrix according to the coordinates of the plurality of initial key points; Determining the average of the values in each row of the coordinate matrix; Subtract the average value of the row from the value in the coordinate matrix to obtain a target matrix; A singular vector corresponding to the minimum singular value of the target matrix is determined as the global normal vector.
5. A device for converting a texture map of a three-dimensional model, characterized in that: The conversion device of the three-dimensional model texture map comprises: A determination module, used to determine a target plane according to coordinates of a plurality of initial key points in a three-dimensional model, wherein the three-dimensional model is divided into a plurality of facets, and the initial key points are boundary vertices of the facets; An acquisition module, used to acquire a key point set corresponding to each of the initial key points, wherein the key point set corresponding to each of the initial key points includes the coordinates of the initial key point and the initial key points in the neighborhood of the initial key point; A calculation module, used to determine the Laplace coordinates of each initial key point on the target plane according to each key point set, including: determining the projection plane of the key point set corresponding to each initial key point, the projection plane is determined by the sum of the distances from each initial key point in the key point set to the projection plane; determining the projection coordinates of each initial key point coordinate in each key point set on the projection plane; obtaining the global normal vector of the target plane; determining the local normal vector of the projection plane; determining a rotation matrix according to a preset unit vector, the global normal vector and the local normal vector; determining the rotation coordinates on the target plane corresponding to the projection coordinates on the projection plane according to the rotation matrix; determining the Laplace equation corresponding to each key point set according to each rotation coordinate on the target plane; determining the Laplace coordinates of each initial key point according to a preset anchor point and the Laplace equation corresponding to each key point set; A conversion module is used to insert the texture map corresponding to each of the face patches into the target plane according to a preset algorithm and the Laplace coordinates of each of the initial key points to obtain a two-dimensional texture map.
6. A device for converting texture maps of three-dimensional models, characterized in that: The three-dimensional model texture map conversion device includes a memory, a processor, and a three-dimensional model texture map conversion program stored in the memory and executable on the processor. When the three-dimensional model texture map conversion program is executed by the processor, the various steps of the three-dimensional model texture map conversion method as described in any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a conversion program for a three-dimensional model texture map, and when the conversion program for a three-dimensional model texture map is executed by a processor, each step of the conversion method for a three-dimensional model texture map as described in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
High-quality texture mapping method aiming at complicated three-dimensional scene
CN104574501A
Three-dimensional model texture map conversion method and device
CN108062784A
Three-dimensional human head and face model reconstruction method based on random face image
CN110443885A
Image data processing method and device, equipment and medium
CN112102480A
Three-dimensional shape conversion system, three-dimensional shape conversion method, and program for conversion of three-dimensional shape
US20090040224A1
