WO2017185301A1 - Three-dimensional hair modelling method and device - Google Patents
Three-dimensional hair modelling method and device Download PDFInfo
- Publication number
- WO2017185301A1 WO2017185301A1 PCT/CN2016/080511 CN2016080511W WO2017185301A1 WO 2017185301 A1 WO2017185301 A1 WO 2017185301A1 CN 2016080511 W CN2016080511 W CN 2016080511W WO 2017185301 A1 WO2017185301 A1 WO 2017185301A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- hair
- point
- head model
- template
- points
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
Definitions
- the present application relates to the field of three-dimensional image processing and computer graphics technology, and in particular, to a three-dimensional hair modeling method and apparatus.
- the 3D hair modeling scheme is mainly divided into two categories, one is hair styling modeling and the other is hair model reuse.
- Hair styling modeling is currently the mainstream 3D hair modeling method.
- This method mainly uses manual to realize the creation of the model. Usually, a hair growth area is selected on the scalp of the existing human head model, and then the hair growth in the area is set. Direction, length, curl, etc. This method creates a hair model that fits exactly with the human head model, but it takes a lot of time and requires complex human intervention. For the 3D face model reconstructed by the mobile phone, if the corresponding 3D hair model is generated manually, the computing resources and time consumed by the mobile phone are unacceptable to the user.
- Hair model reuse refers to creating new hairstyles similar to existing hair models on different 3D character models.
- the prior art performs hair model reuse by pre-storing one or more 3D hair templates, receiving a frontal hair image and a 3D head model, and then deforming the 3D hair template based on the characteristics of the frontal hair image combined with the 3D head model. Processed to produce a realistic 3D hair model.
- the deformation processing of the 3D hair template requires the 3D hair model to be projected into a 2D form, and the selected key points are in the 2D form, and then the 2D key points are matched with the normal part and the personality part of the front view hair image, so
- the technique is limited by the detection results of the 2D key points, the matching precision of the 2D key points and the normal part of the face image and the personality part, and the modeling of the hair personality part, so that the hair template reuse complexity is high, and the hair template cannot be satisfied.
- Fast reuse is limited by the detection results of the 2D key points, the matching precision of the 2D key points and the normal part of the face image and the personality part, and the modeling of the hair personality part, so that the hair template reuse complexity is high, and the hair template cannot be satisfied.
- the present invention provides a three-dimensional hair modeling method and apparatus for solving the problem that the hair template reused in the prior art has high complexity and cannot satisfy the rapid reuse of the hair template.
- the present application provides a three-dimensional hair modeling method, the method comprising:
- the preset 3D hair template and the preset reference header The partial models are matched; when it is detected that the registered 3D hair template has an error area, the hair in the wrong area of the 3D hair template is deformed using a radial basis function RBF to correct the error area, wherein the error area comprises an area of the 3D hair template that does not completely obscure the scalp layer of the 3D head model or a hair root area formed by the root point in the 3D hair template blocks the 3D head model The area of the non-scalp layer.
- a 3D hair model with a perfect fit effect can be quickly constructed for a 3D head model in a terminal with relatively low storage capacity and relatively low computing power, and the realistic 3D hair model can be compared with the hair style.
- the hair model generated by the modeling method saves a lot of manual interaction and computing time; compared with the existing hair model reuse technology, the present invention does not need to be limited by the detection result of 2D key points, nor is it limited.
- the matching accuracy of the 2D key points with the normal part of the hair image and the personality part, without the need to model the hair part can effectively improve the reusability of the 3D hair template, and the hair model can retain the prototype hair more accurately. Appearance.
- determining a first coordinate transformation relationship between the 3D head model of the hair to be created and the preset reference head model, and determining the 3D head model and the preset 3D hair template The second coordinate transformation relationship between the two, and the registration of the 3D head model with the 3D hair template based on the first coordinate transformation relationship and the second coordinate transformation relationship may be implemented as follows:
- the facial key points are matched to obtain a face matching point pair; then, according to the face matching point pair, a first coordinate transformation relationship between the 3D head model and the reference head model is determined; according to the first Coordinate transformation relationship, obtaining three-dimensional coordinates of the 3D hair template in a target coordinate system, wherein the target coordinate system is a coordinate system in which the 3D head model is located; Matching the rooting point of the 3D hair template with the scalp key points of the 3D head model to obtain a pair of hair root matching points; determining the 3D head model and the 3D hair according to the pair of hair root matching points a second coordinate transformation relationship between the templates; and the 3D hair template is registered with the 3D head model according to the second coordinate transformation relationship.
- the first coordinate transformation relationship and the second coordinate transformation relationship are determined by the facial key point and the scalp key point of the 3D head model and the facial key point of the reference head model and the root point of the 3D hair template. The amount of calculation is reduced, so that it can be applied to terminal devices with relatively low storage capacity and computing power.
- the deformation of the hair in the erroneous region of the 3D hair template using the radial basis function RBF can be achieved as follows:
- Each hair in the wrong area of the 3D hair template is respectively performed as follows: at least three three-dimensional coordinate points in each of the hairs are selected as a first key point, and each first is determined by a nearest neighbor algorithm a key point is a nearest neighbor point of the scalp layer of the 3D head model as a matching point of each of the first key points, and each of the first key points and its corresponding matching point constitute a hair matching point pair; Each of the hairs is deformed by matching the hairline matching points as input parameters of a radial basis function.
- the first key point may include a rooting point and a tip point of each of the hairs.
- the nearest key algorithm is used to match the selected first key point with the coordinate point in the scalp layer, and the matching is accurate and the calculation amount is small.
- the deformation of the hair in the erroneous region of the 3D hair template using the radial basis function RBF can be achieved as follows:
- each of the hairs in the wrong area of the 3D hair template as follows: selecting at least three three-dimensional coordinate points in each of the hairs as a second key point, and determining the at least 3 by a nearest neighbor algorithm
- Each of the second key points is a nearest neighbor point of the scalp layer of the 3D head model as a matching point of each of the second key points, and each of the second key points is corresponding thereto
- the matching points constitute a pair of hair matching points; the hair matching point pairs are used as radial basis function input parameters, and each of the hairs is deformed; each hair after deformation is divided into at least two parts,
- Each part of the hair is respectively performed as follows: at least three three-dimensional coordinate points in each part of the hair are taken as a third key point, and each part of the hair is placed in a three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor of each third key point as a matching point of each third key point, and each of the third key points and their corresponding matching points constitute a segment
- the second key point may include a hair root point and a hair point point in each of the hairs; and the third key point may include two end points of each part of the hair.
- the radial basis function RBF is used to deform the hair in the wrong area of the 3D hair template, including:
- each hair in the wrong area of the 3D hair template is separately performed as follows: each hair is divided into at least two parts, and is performed separately for each part of the hair as follows: at least 3 of each part of the hair is to be The three-dimensional coordinate point is used as the fourth key point, and the nearest neighbor point of each fourth key point in each part of the hair is taken as each fourth key point in the three-dimensional coordinate point of the scalp layer of the 3D head model Matching points, and each of the fourth key points and their corresponding matching points constitute a segment hairline matching point pair; the segment hairline matching point pair is used as a radial basis function input parameter for each Some of the hair is deformed.
- the third key point may include two end points of each part of the hair.
- the present application provides a three-dimensional hair modeling device, the device comprising:
- a first determining unit configured to determine a first coordinate transformation relationship between the 3D head model of the hair to be created and the preset reference head model
- a second determining unit configured to determine a second coordinate transformation relationship between the 3D head model and a preset 3D hair template, wherein the preset 3D hair template and the preset reference head model Match
- a registration unit configured to determine the first coordinate transformation relationship and the second coordinate transformation relationship based on the determining unit, and register the 3D head model with the 3D hair template;
- a detecting unit configured to detect whether the registered 3D hair template has an error area
- a deformation unit for deforming hair in the erroneous area of the 3D hair template detected by the detecting unit using a radial basis function RBF to correct the erroneous area, wherein the erroneous area includes the 3D hair
- the area of the scalp layer in the template that does not completely obscure the 3D head model or the hair root point in the 3D hair template obscures the area of the non-skin layer of the 3D head model.
- a 3D hair model with a perfect fit effect can be quickly constructed for a 3D head model in a terminal with relatively low storage capacity and relatively low computing power, and the realistic 3D hair model can be compared with the hair style.
- the hair model generated by the modeling method saves a lot of people Work interaction and operation time; compared with the existing hair model reuse technology, the present application does not need to be limited by the detection result of the 2D key point, nor is it limited to the common part of the 2D key point and the front view hair image and the personality part. Matching accuracy, no need to model the hair part, can effectively improve the reusability of 3D hair template, and the hair model can retain the appearance of the prototype hair more accurately.
- the first determining unit is specifically configured to: determine a facial key point and a scalp key point of the 3D head model of the hair to be created; and determine a facial key point of the preset reference head model. And matching a facial key point of the 3D head model with a facial key point of the reference head model to obtain a face matching point pair; determining the 3D head model and the Referencing a first coordinate transformation relationship between the head models; the registration unit is configured to obtain three-dimensional coordinates of the 3D hair template in a target coordinate system according to the first coordinate transformation relationship, wherein the target a coordinate system is a coordinate system in which the 3D head model is located; the second determining unit is specifically configured to: a root point of the 3D hair template transformed by the first coordinate transformation relationship, and the 3D head Matching key points of the scalp layer of the model to obtain a pair of hair root matching points; determining a second coordinate transformation relationship between the 3D head model and the 3D hair template according to the pair of hair root matching points; Order ,
- the deformation unit is specifically configured to: perform, for each hair in the wrong area of the 3D hair template, respectively: selecting at least three three-dimensional coordinate points in each of the hairs As a first key point, and determining, by a nearest neighbor algorithm, a nearest neighbor point of the first key point in the scalp layer of the 3D head model as a matching point of each of the first key points, and each of the A first key point and its corresponding matching point constitute a hair matching point pair; the hair matching point pair is used as an input parameter of a radial basis function, and each of the hairs is deformed.
- the first key point may include a rooting point and a tip point of each of the hairs.
- the deformation unit is specifically configured to: perform, for each hair in the wrong area of the 3D hair template, respectively: selecting at least three three-dimensional coordinate points in each of the hairs As a second key point, and determining the at least three second levels by a nearest neighbor algorithm
- Each of the second key points in the key point is the closest neighbor point of the scalp layer of the 3D head model as a matching point of each of the second key points, and each of the second key points and their corresponding matching points Forming a pair of hair matching points; using the hair matching point pair as a radial basis function input parameter, deforming each of the hairs; dividing each deformed hair into at least two parts, for each part of the hair Performing respectively as follows: at least three three-dimensional coordinate points in each part of the hair are taken as a third key point, and each of the part of the hair is placed in a three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor of the third key point as a matching point of each third key point, and each of the
- the second key point may include a hair root point and a hair point point in each of the hairs; and the third key point may include two end points of each part of the hair.
- the deformation unit is specifically configured to: perform, for each hair in the wrong area of the 3D hair template, as follows: divide each hair into at least two parts, and for each Part of the hair is respectively performed as follows: at least three three-dimensional coordinate points in each part of the hair are taken as a fourth key point, and the three-dimensional coordinate points of the scalp layer of the 3D head model are used in each part of the hair a nearest neighbor point of each fourth key point as a matching point of each fourth key point, and each of the fourth key points and their corresponding matching points constitute a segment hairline matching point pair;
- the hairline matching point deforms each of the portions of the hair as an input parameter as a radial basis function.
- the third key point may include two end points of each part of the hair.
- the present application further provides a three-dimensional hair modeling device, comprising: a communication interface, a memory, and a processor.
- the communication interface is configured to configure a 3D head model of the hair to be created, a preset reference head model, and a preset 3D hair template, and the preset reference head model and the preset 3D hair template phase
- the memory is used to store the program code executed by the processor; the processor is configured to execute the program code stored in the memory, and specifically perform the operation performed by any one of the first aspects.
- the present application also provides a computer readable storage storing one or more programs The medium, the one or more programs comprising instructions that, when executed by an electronic device comprising a plurality of applications, cause the electronic device to perform the operations of any of the designs according to the first aspect.
- FIG. 1 is a schematic diagram of facial key points of a selected 3D head model provided by the present application.
- FIG. 2 is a schematic diagram of facial key points of a selected reference head model provided by the present application.
- FIG. 3 is a schematic diagram of key points of a scalp layer of a selected 3D head model provided by the present application.
- FIG. 4 is a schematic diagram of a correspondence between a key point of a 3D hair template and a matching point thereof provided by the present application;
- Figure 5 is a schematic view showing the deformation of the hair from the whole to the part provided by the present application.
- FIG. 6 is a flow chart of a three-dimensional hair modeling method provided by the present application.
- FIG. 7 is a flow chart of a 3D hair template and a 3D head model registration method provided by the present application.
- FIG. 8 is a schematic diagram of a three-dimensional hair modeling method provided by the present application.
- FIG. 9 is a schematic diagram of a three-dimensional hair modeling device provided by the present application.
- FIG. 10 is a schematic diagram of another three-dimensional hair modeling device provided by the present application.
- FIG. 11 is a schematic diagram of a three-dimensional hair modeling effect provided by the present application.
- the present invention provides a three-dimensional hair modeling method and apparatus for solving the problem that the hair template reused in the prior art has high complexity and cannot satisfy the rapid reuse of the hair template.
- the method and the device are based on the same inventive concept. Since the principles of the method and the device for solving the problem are similar, the implementation of the device and the method can be referred to each other, and the repeated description is not repeated.
- the application can be applied to a terminal with relatively low storage capacity and computing power, and of course
- the electronic device with high storage capacity and high computing capability is not specifically limited in this application.
- a three-dimensional (3D) head model of the hair to be created may be prepared in advance, and the 3D head model may be divided into a three-dimensional scalp region and a three-dimensional non-hair layer region. All three-dimensional coordinate points constituting this 3D head model constitute a set of 3D head model points.
- the point set in the 3D head model can be divided into two subsets, including a three-dimensional scalp area point set and a three-dimensional non-hair layer area point set.
- the three-dimensional non-scalp region point set includes all facial feature points and an area surrounded by the contours of the faces formed by these points, the ear to the chin area.
- the information corresponding to the three-dimensional (3D) head model may further include an index number of each facial feature point, and record the index numbers of the facial feature points in the three-dimensional non-scalp region point set.
- Others are three-dimensional scalp area, and the contours of the three-dimensional scalp area can be marked with the forehead, the horn, and the characteristic points of the ear circumference, which are basically symmetrical.
- the scalp layer feature points can also be indexed and recorded in the three-dimensional scalp region point set.
- the 3D hair template is prepared in advance in the present application, and corresponds to a reference head model, that is, the 3D hair template is constructed for the reference head model, and the 3D hair template matches the reference head model.
- the 3D hair template and the reference head model may be ones pre-stored in the 3D hair model library.
- the 3D hair model library correspondingly stores a plurality of 3D hair templates and reference head models, and one of the 3D hair template libraries can be selected in advance by the user. All three-dimensional coordinate points constituting this reference head model constitute a reference head model point set, and all three-dimensional coordinate points constituting the 3D hair template constitute a 3D hair template point set.
- the three-dimensional hair modeling device determines a first coordinate correspondence relationship between the 3D head model of the hair to be created and the preset reference head model.
- the facial key points of the determined 3D head model can be divided into two categories: the first type is a facial key point, which may include an eye area, a nose area, a mouth area, a chin area, and the like; the second type is a key point of the scalp layer, It may include a forehead area, a back of head area, an ear root area, and the like.
- the facial key points of the determined 3D head model include 39, R1 to R39.
- the existing feature extraction method can be used, or it can be manually selected.
- a part of the feature points is selected as the face key point in the index number of the facial feature points in the point set, and a part of the feature points is selected as the key point of the scalp layer in the index number of the scalp layer feature points in the point set of the three-dimensional scalp area.
- the facial key point of the reference head model in determining the facial key point of the reference head model on which the 3D hair template is based, may be determined to include the eye region in the same manner as determining the facial key point of the 3D head model. , nose area, mouth area, chin area, and so on.
- the face key points of the determined reference head model include 39, A1 to A39.
- the existing feature extraction method may be adopted when determining the key point, or may be manually selected, and may also be a facial key point that has been determined when the reference head model is established.
- the three-dimensional hair modeling device After determining the facial key points of the 3D head model and the facial key points of the reference head model, the three-dimensional hair modeling device matches the facial key points of the 3D head model with the facial key points of the reference head model. Get a face matching point pair.
- the face matching point pairs may be obtained by matching based on the index numbers, or the face matching point pairs may be manually selected.
- the key points matching the rear matching point pairs shown in FIG. 1 and FIG. 2 include: R1-A1, R2-A2, R6-A6, R7-A7, R10-A10, R13-A13, R14-A14, R19- A19, R20-A20, R33-A33.
- the three-dimensional hair modeling device determines a first coordinate transformation relationship between the 3D head model and the reference head model according to the face matching point pair.
- the first coordinate transformation relationship between the 3D head model and the reference head model is calculated by using the face matching point pair.
- the first coordinate transformation relationship s.R.t includes a scaling relationship and a rotation relationship. And translation relationship.
- the scaling relationship is implemented by s representing a scaling factor s
- the rotation relationship is implemented by a rotation matrix R
- the translation relationship is implemented by a translation vector t.
- x, y, and z in the formula represent the coordinates of the face key points corresponding to the 3D head model of the face key point pair, in the formula It represents the coordinates of the face key points corresponding to the reference head model in the face key point pair, and n represents the total number of face key point pairs.
- the coordinates of the 3D head model, the reference head model, and all the feature points of the 3D hair template can be normalized. Then use the face key point pair and singular value decomposition (Singular Value Decomposition, SVD) algorithm to calculate R, t.
- singular Value Decomposition singular Value Decomposition
- the essential matrix E is subjected to SVD, which is obtained as in formula (4):
- the external reference P' of the 3D hair template has the following four possible options:
- the target coordinate system is a coordinate system in which the 3D head model is located.
- coordinate transformation may be performed on all three-dimensional coordinate points included in the 3D hair template point set by the order of rotation-zoom-translation.
- the 3D hair template and the reference head model adopt the same coordinate system, and thus can refer to the first between the head model and the 3D head model.
- the coordinate transformation relationship obtains the three-dimensional coordinates of the preset 3D hair template in the target coordinate system, that is, the three-dimensional coordinates of all the three-dimensional coordinate points included in the 3D hair template point set are converted into the three-dimensional coordinates corresponding to the 3D hair template coordinate system.
- the three-dimensional hair modeling device determines a second coordinate transformation relationship between the 3D hair template and the 3D head model transformed by the first coordinate transformation relationship.
- determining a root point of the 3D hair template transformed by the first coordinate transformation relationship, and a root point and a root of the 3D hair template transformed by the first coordinate transformation relationship The key points of the scalp layer of the 3D head model are matched to obtain a pair of root matching points.
- the 3D hair template can be divided into two models, one is the hair model, which can also be called the line model; the other is the non-hair model, which can also be called the body model.
- the hairline model means that the 3D hair template is in the form of a plurality of hairs, each hair being composed of a plurality of dots. There is a hair root point for each hair of the hair model.
- the non-hair model means that the 3D hair template is present in the form of a plurality of hair regions, that is, the 3D hair template can be divided into a plurality of hair regions, which can be considered to be located in one hair. Each hair in the area has a similar shape shape.
- the point at which the 3D hair template collides with the scalp layer of the 3D head model can be determined by the collision detection algorithm as the rooting point, and several hair root points of the 3D hair template can be referred to FIG.
- the nearest neighbor algorithm may be used in the 3D hair template.
- the rooting point is matched with the scalp key points of the 3D head model to obtain a root matching point pair.
- the nearest neighbor algorithm may be any one of the existing algorithms, which is not described herein again.
- the three-dimensional hair modeling device determines a second coordinate transformation relationship between the 3D head model and the 3D hair template according to the pair of hair root matching points.
- the second coordinate transformation relationship s.R.t between the 3D head model and the 3D hair template is calculated by using the root matching point pair.
- the specific calculation method is the same as the above method for calculating the first coordinate transformation relationship, and details are not described herein again.
- the three-dimensional hair modeling device registers the 3D hair template with the 3D head model according to the second coordinate transformation relationship.
- the 3D hair may be after registration.
- the error region includes a region of the 3D hair template that does not completely obscure the scalp layer of the 3D head model or a hair root region of the hair root point in the 3D hair template that obscures the non-skin layer of the 3D head model Area.
- the hair in the erroneous region of the 3D hair template is deformed using a radial basis function RBF until the deformed 3D hair template completely obscures the scalp layer of the 3D head model and the rooting point in the 3D hair template The resulting hair root region does not obscure the non-scalp layer of the 3D head model.
- the ray casting algorithm to emit rays from the geometric center point of the 3D head model to each of the three-dimensional coordinate points constituting the 3D hair template, if the rays directed to a certain area are before the 3D head model is encountered When the 3D hair template area is encountered, the hair in the area of the 3D hair template has an incorrect occlusion relationship.
- the following operations are performed separately for each hair.
- the hair A is described as an example, and other hairs can be carried out in a manner directed to the hair A.
- the overall deformation includes:
- the key point a1 corresponds to the matching point in the scalp layer of the 3D head model is b1
- the key point a5 corresponds to the matching point in the scalp layer of the 3D head model is b5
- the key point a9 corresponds to the matching in the scalp layer of the 3D head model.
- the point is b9.
- B indicates a portion in the hair A where a1 to a9 match the scalp layer of the 3D head model.
- the hairline A is deformed using a hairline matching point pair as a radial basis function input parameter.
- Local deformation includes:
- the hairline A is divided into at least two parts. Taking the hairline A into two parts as an example, as shown in FIG. 4, the hairline A is divided into two parts A1 and A2. Select at least 3 three-dimensional coordinate points in each part as the key points, and the three key points in the three key points a1, a3, a5, and A2 in A1 are a5, a7, and a9. And determining, using the nearest neighbor algorithm, the nearest neighbor of each of the at least 3 key points in each of the portions as a matching point in the three-dimensional coordinate point of the scalp layer of the 3D head model, and each A key point and its corresponding matching point constitute a segmented hairline matching point pair.
- the matching points corresponding to a1, a3, and a5 are b1, b3, and b5, respectively, and the matching points corresponding to a5, a7, and a9 are b5, b7, and b9, respectively.
- the segment matching point formed by a1, a3, a5 and b1, b3, b5 then deforms the A1 portion of the hair A to the input parameter as a radial basis function. Then with a5, a7, a9 and b5, b7, b9 The resulting segment matching point pairs the A2 portion of the hair A as an input parameter of the radial basis function, as shown in FIG.
- numeral 1 in FIG. 5 denotes a1
- numeral 2 denotes a2
- numeral 3 denotes a3, and so on.
- the overall to local deformation includes:
- the deformed hair A is divided into at least two parts, and each part is locally deformed by 2).
- the radial basis function involved in the present application is a predefined function, and a function which is well-executed by a large number of experiments can be obtained.
- the radial basis function used in this application can be
- Deformation is performed for each hair in a deformed manner for the hair A, and then the 3D hair template is updated to determine whether the updated 3D hair template completely obscures the scalp layer of the 3D head model and the 3D hair template Whether the hair root region formed by the hair root point obscures the non-skin layer of the 3D head model.
- the updated 3D hair template does not completely obscure the scalp layer of the 3D head model or the hair root region of the hair root point in the 3D hair template partially obscures the non-scalp layer of the 3D head model, Repeating the operations in 1) or 2) or 3) above for each hair in the wrong area in the 3D hair template until the updated 3D hair template completely obscures the scalp layer of the 3D head model and the 3D hair The hair root region formed by the hair root point in the template does not obscure the non-scalp layer of the 3D head model.
- This application can quickly construct a 3D hair model with perfect fit for the 3D head model in the terminal with relatively low storage capacity and computing power.
- the realistic 3D hair model can be compared with the hair modeling model.
- the hair model generated by the method saves a lot of manual interaction and computing time; compared with the existing hair model reuse technology, the present application does not need to be limited by the detection result of 2D key points, and is not limited to the 2D key.
- the matching accuracy of the point and the normal part of the hair image and the personality part, without the need to model the hair part can effectively improve the reusability of the 3D hair template, and the hair model constructed can more accurately retain the appearance of the prototype hair. .
- FIG. 6 a flow chart of a three-dimensional hair modeling method provided by the present application is provided.
- S601 determining a third between a 3D head model of the hair to be created and a preset reference head model a coordinate transformation relationship, and determining a second coordinate transformation relationship between the 3D head model and a preset 3D hair template, and the 3D head based on the first coordinate transformation relationship and the second coordinate transformation relationship
- the model is registered with the 3D hair template.
- the above S601 can be referred to as a rigid registration process.
- the preset 3D hair template matches the preset reference head model.
- the error area comprises an area of the 3D hair template that does not completely obscure the scalp layer of the 3D head model or a hair root area formed by the root point in the 3D hair template blocks the 3D head model The area of the non-scalp layer.
- the rigid registration process can be implemented as follows, as shown in FIG.
- the target coordinate system is a coordinate system in which the 3D head model is located.
- the first coordinate transformation relationship may include a rotation relationship, a scaling relationship, and a translation relationship.
- the first coordinate transformation relationship s.R.t includes a scaling relationship, a rotation relationship, and a translation relationship.
- the scaling relationship is implemented by a scaling factor s1
- the rotation relationship is implemented by a rotation matrix R1
- the translation relationship is implemented by a translation vector t1.
- the rotation matrix R1, and the translation vector t1 refer to the corresponding description above, and the present application will not be repeated here.
- FIG. 8 a schematic diagram of a three-dimensional hair modeling method provided by the present application is provided.
- a 3D head model and a face matching point pair of the reference head model are obtained based on steps S701 and S702.
- determining a first coordinate transformation relationship between the 3D head model and the reference head model according to the face matching point pair may be implemented as follows:
- s1, R1, and t1 are calculated according to the face matching point pair.
- the three-dimensional coordinates of the 3D hair template in the coordinate system in which the 3D head model is located are obtained by sequentially rotating, scaling, and translating the three-dimensional coordinate points of the 3D hair template using the rotation relationship, the zoom relationship, and the translation relationship.
- the 3D hair template is converted into a coordinate system of the 3D head model.
- the second coordinate transformation relationship may include a rotation relationship, a scaling relationship, and a translation relationship; wherein the first coordinate transformation relationship s.R.t includes a scaling relationship, a rotation relationship, and a translation relationship.
- the scaling relationship is implemented by a scaling factor s2
- the rotation relationship is implemented by a rotation matrix R2
- the translation relationship is implemented by a translation vector t2.
- a 3D head model and a root matching point pair of the 3D hair template are obtained.
- determining a second coordinate transformation relationship between the 3D head model and the 3D hair template according to the pair of hair root matching points may be implemented as follows:
- s2, R2, and t2 are calculated according to the pair of root-matching points.
- registering the 3D hair template with the 3D head model according to the second coordinate transformation relationship may be implemented as follows:
- the 3D hair template is registered with the 3D head model by sequentially rotating, scaling, and translating the three-dimensional coordinate points of the 3D hair template using the rotation relationship, the zoom relationship, and the translation relationship.
- the radial basis function RBF is used to deform the hair in the wrong area of the 3D hair template, and specifically, the hair in the wrong area of the 3D hair template may be integrally deformed using a radial basis function RBF. Or from the whole to the local deformation, or local deformation.
- the overall deformation for each hair includes:
- Each hair in the wrong area of the 3D hair template is performed as follows:
- Each of the hairs is deformed using a hairline matching point pair as a radial basis function input parameter.
- the first key point includes a hair root point and a hair point of each of the hairs.
- Other first key points can select other three-dimensional coordinate points in each hair. Specifically, three-dimensional coordinate points close to the root point and the midpoint of the tip point can be selected.
- the overall to local deformation for each hair includes:
- each hair in the wrong area of the 3D hair template is performed as follows:
- the nearest neighbor of the model scalp layer serves as a matching point for each of the second key points, and each of the The two key points and their corresponding matching points constitute a pair of hair matching points; the hair matching point pairs are used as radial basis function input parameters, and each of the hairs is deformed;
- A2 divide each hair after deformation into at least two parts, and perform the following for each part of hair separately:
- each third key point in each part of the hair in the three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor point as a matching point of each third key point, and each of the third key points and their corresponding matching points constitute a segment hairline matching point pair;
- the input parameters of the radial basis function deform the hair of each portion.
- the second key point includes a rooting point and a tip point in each of the hairs
- the third key point includes two endpoints of each portion of the hair.
- Local deformations for each hair include:
- Each hair in the wrong area of the 3D hair template is performed as follows:
- each fourth key point in each part of the hair in a three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor as a matching point for each of the fourth key points, and each of the fourth key points and their corresponding matching points constitute a segmented hair matching point pair;
- the input parameters of the radial basis function deform the hair of each portion.
- the third key point comprises two endpoints of the hair of each portion.
- the present application also provides a three-dimensional hair modeling device, as shown in FIG. 9, the device includes:
- a first determining unit 901 configured to determine a first coordinate transformation relationship between a 3D head model of the hair to be created and a preset reference head model
- a second determining unit 902 configured to determine a second coordinate transformation relationship between the 3D head model and a preset 3D hair template, wherein the preset 3D hair template and the preset reference header The models match;
- a registration unit 903 configured to determine, according to the first determining unit 901, the first coordinate transformation off And the second coordinate transformation relationship determined by the second determining unit 902, registering the 3D head model with the 3D hair template;
- the detecting unit 904 is configured to detect whether the registered 3D hair template has an error area
- a deformation unit 905 configured to deform the hair in the wrong area of the 3D hair template by the detecting unit 904 using the radial basis function RBF when the detecting unit 904 detects the wrong area, to correct the An error area, wherein the error area includes an area of the 3D hair template that does not completely obscure the scalp layer of the 3D head model or a hair root area formed by the root point in the 3D hair template blocks the 3D The area of the non-scalp layer of the head model.
- This application can quickly construct a 3D hair model with perfect fit for the 3D head model in the terminal with relatively low storage capacity and computing power.
- the realistic 3D hair model can be compared with the hair modeling model.
- the hair model generated by the method saves a lot of manual interaction and computing time; compared with the existing hair model reuse technology, the present application does not need to be limited by the detection result of 2D key points, and is not limited to the 2D key.
- the matching accuracy of the point and the normal part of the hair image and the personality part, without the need to model the hair part can effectively improve the reusability of the 3D hair template, and the hair model constructed can more accurately retain the appearance of the prototype hair. .
- the first determining unit 901 is specifically configured to:
- the registration unit 903 is configured to obtain, according to the first coordinate transformation relationship, three-dimensional coordinates of the 3D hair template in a target coordinate system, where the target coordinate system is a coordinate of the 3D head model system;
- the second determining unit 902 is specifically configured to: match a root point of the 3D hair template transformed by the first coordinate transformation relationship with a key point of the scalp layer of the 3D head model to obtain a root matching a pair of points; determining a second coordinate transformation relationship between the 3D head model and the 3D hair template according to the pair of hair root matching points;
- the registration unit 903 is configured to register the 3D hair template with the 3D head model according to the second coordinate transformation relationship.
- the deformation unit 905 is specifically configured to:
- Each hair in the wrong area of the 3D hair template is performed as follows:
- Each of the hairs is deformed by matching the hairline matching points as input parameters of a radial basis function.
- the first key point includes a rooting point and a tip point of each of the hairs.
- the deformation unit 905 is specifically configured to:
- Each hair in the wrong area of the 3D hair template is performed as follows:
- each of the hairs using a hairline matching point pair as a radial basis function input parameter; dividing each deformed hair into at least two portions, respectively performing the following for each portion of the hair: At least 3 three-dimensional coordinate points in each part of the hair as a third key point, and the nearest neighbor of each third key point in each part of the hair in the three-dimensional coordinate point of the scalp layer of the 3D head model a point as a matching point of each third key point, and each of the third key points and their corresponding matching points constitute a segment hairline matching point pair; the segment hairline matching point pair is used as a radial basis
- the input parameters of the function deform each of the portions of the hair.
- the second key point may include a hair root point and a hair point in each of the hairs; and the third key point includes two end points of each part of the hair.
- the deformation unit 905 is specifically configured to:
- each hair is divided into at least two parts, and the hair is separately executed for each part as follows:
- each fourth key point in each part of the hair in a three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor as a matching point for each of the fourth key points, and each of the fourth key points and their corresponding matching points constitute a segmented hair matching point pair;
- the input parameters of the radial basis function deform the hair of each portion.
- the third key point may include two endpoints of each portion of the hair.
- each functional unit in each embodiment of the present application may be integrated into one processor. It can also be physically present alone, or two or more units can be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the form of a software function module.
- the first determining unit 901, the second determining unit 902, the registering unit 903, the detecting unit 904, and the deforming unit 905 are corresponding to the physical hardware of the three-dimensional hair modeling device. It may be the processor 1001 as shown in FIG.
- the 3D hair modeling device may further include a memory 1002 for storing program code executed by the processor 1001.
- the memory 1002 may be a volatile memory (English: volatile memory), such as a random access memory (English: random-access memory, abbreviation: RAM); the memory may also be a non-volatile memory (English: non-volatile memory).
- volatile memory such as a random access memory (English: random-access memory, abbreviation: RAM
- non-volatile memory English: non-volatile memory
- read-only memory English: read-only memory, abbreviation: ROM
- flash memory English: flash memory
- hard disk English: hard disk drive, abbreviation: HDD
- SSD solid state drive
- the memory can be a combination of the above memories.
- the 3D hair modeling device may further include a communication interface 1003, configured to configure a 3D head model of the hair to be created, a preset reference head model, and a preset 3D hair template, the preset The reference head model and the preset 3D hair template are matched. After the configuration is completed, it is saved in the memory 1002.
- the 3D hair modeling device can also include a display 1004 due to the 3D head model displaying the hair to be created, the preset reference head model, and the preset 3D hair template.
- the processor 1001, the memory 1002, the communication interface 1003, and the display 1004 may be connected by a bus 1005.
- the manner of connection between other components is merely illustrative and not limited.
- the bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in FIG. 10, but it does not mean that there is only one bus or one type of bus.
- the processor 1001 is configured to execute the program code stored by the memory 1002, and specifically perform the following operations:
- the above S601 can be referred to as a rigid registration process.
- the preset 3D hair template matches the preset reference head model.
- the hair in the erroneous area of the 3D hair template is deformed using a radial basis function RBF to correct the erroneous area.
- the error area comprises an area of the 3D hair template that does not completely obscure the scalp layer of the 3D head model or a hair root area formed by the root point in the 3D hair template blocks the 3D head model The area of the non-scalp layer.
- the processor 1001 When performing the rigid registration process operation, the processor 1001 can be implemented as follows:
- a facial key point and a scalp key point of the 3D head model of the hair to be created, and determining a facial key point of the preset reference head model; a facial key point of the 3D head model and the reference head Matching facial key points of the model to obtain a face matching point pair; determining, according to the face matching point pair, a first coordinate transformation relationship between the 3D head model and the reference head model; according to the first coordinate transformation Relation, obtaining a three-dimensional coordinate of the 3D hair template in a target coordinate system; wherein the target coordinate system is a coordinate system in which the 3D head model is located; Matching the root point of the 3D hair template and the key point of the 3D head model to obtain a root matching point pair; determining the 3D head according to the root matching point pair a second coordinate transformation relationship between the part model and the 3D hair template; and the 3D hair template is registered with the 3D head model according to the second coordinate transformation relationship.
- the face may be selected by the 3D head model displayed on the display 1004.
- Key points and scalp key points through the user input selected face key points and scalp key points, and then the processor 1001 determines the facial key points and scalp key of the 3D head model of the hair to be created after receiving the user input point.
- the same method can also be used in determining the facial key points of the preset reference head model.
- the processor 1001 deforms the hair in the wrong area of the 3D hair template using a radial basis function RBF, and specifically may use the radial basis function RBF to make the hair in the wrong area of the 3D hair template as a whole. Deformation, or deformation from whole to local, or local deformation.
- the overall deformation for each hair includes:
- Each hair in the wrong area of the 3D hair template is performed as follows:
- Each of the hairs is deformed using a hairline matching point pair as a radial basis function input parameter.
- the first key point includes a hair root point and a hair point of each of the hairs.
- Other first key points can select other three-dimensional coordinate points in each hair. Specifically, three-dimensional coordinate points close to the root point and the midpoint of the tip point can be selected.
- the overall to local deformation for each hair includes:
- the following is performed: selecting at least three three-dimensional coordinate points in each of the hairs as the second key point, and adopting the nearest neighbor algorithm Determining, at each of the at least 3 second key points, a nearest neighbor point of the scalp layer of the 3D head model as a matching point of each of the second key points, and each of the The two key points and their corresponding matching points constitute a pair of hair matching points; the hair matching point pairs are used as radial basis function input parameters, and each of the hairs is deformed;
- Dividing each of the deformed hairs into at least two parts, respectively, for each part of the hair is performed as follows: at least three three-dimensional coordinate points in each part of the hair are regarded as a third key point, and in the 3D head a three-dimensional coordinate point of the scalp layer of the model, a nearest neighbor point of each third key point in each part of the hair as a matching point of each third key point, and corresponding to each third key point
- the matching points constitute a segmented hairline matching point pair; the segment hairline matching point pair is deformed as an input parameter of a radial basis function.
- the second key point includes a rooting point and a tip point in each of the hairs
- the third key point includes two endpoints of each portion of the hair.
- Local deformations for each hair include:
- each hair in the wrong area of the 3D hair template is separately performed as follows: each hair is divided into at least two parts, and is performed separately for each part of the hair as follows: at least 3 of each part of the hair is to be The three-dimensional coordinate point is used as the fourth key point, and the nearest neighbor point of each fourth key point in each part of the hair is taken as each fourth key point in the three-dimensional coordinate point of the scalp layer of the 3D head model Matching points, and each of the fourth key points and their corresponding matching points constitute a segment hairline matching point pair; the segment hairline matching point pair is used as a radial basis function input parameter for each Some of the hair is deformed.
- the third key point comprises two endpoints of the hair of each portion.
- the rigid matching of the pre-built 3D head model with the pre-stored 3D hair template is first completed.
- the 3D hair template is aligned with the scalp layer of the 3D head model, and some areas may have an incorrect occlusion relationship, such as the area marked by the ring in FIG.
- the key points of the 3D head model scalp are then used to guide the 3D hair model from overall to local deformation. Deformation eliminates false occlusion relationships and results in a 3D hair template that fits well with the 3D head model.
- This application can quickly construct a 3D hair model with perfect fit for the 3D head model in the terminal with relatively low storage capacity and computing power.
- the realistic 3D hair model can be compared with the hair modeling model.
- the hair model generated by the method saves a lot of manual interaction and computing time; compared with the existing hair model reuse technology, the present application does not need to be limited by the detection result of 2D key points, and is not limited to the 2D key.
- the matching accuracy of the point and the normal part of the hair image and the personality part, without the need to model the hair part can effectively improve the reusability of the 3D hair template, and the hair model constructed can more accurately retain the appearance of the prototype hair. .
- embodiments of the present application can be provided as a method, system, or computer program product.
- the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment in combination of software and hardware.
- the application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
- the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
- the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
- These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. Instructions are provided for implementation in the flowchart The steps of a process or a plurality of processes and/or block diagrams of a function specified in a block or blocks.
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Geometry (AREA)
- Software Systems (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Processing Or Creating Images (AREA)
Abstract
A three-dimensional hair modelling method and device, which are used for solving the problem that hair template reuse is highly complex, and thus the requirements for the rapid reuse of hair templates cannot be met. The method comprises: determining a first coordinate conversion relationship between a 3D head model of hair to be established and a pre-set reference head model, determining a second coordinate conversion relationship between the 3D head model and a pre-set 3D hair template, and registering the 3D head model with the 3D hair template based on the first coordinate conversion relationship and the second coordinate conversion relationship; matching the 3D hair template with a reference head model; and when it is detected that there is an error area in the registered 3D hair template, using a radial basis function (RBF) to deform hair in the error area of the 3D hair template so as to correct the error area, wherein the error area comprises a scalp layer area not completely shielding the 3D head model in the 3D hair template or a non-scalp layer area with a hair root area shielding the 3D head model in the 3D hair template.
Description
本申请涉及三维图像处理和计算机图形学技术领域,尤其涉及一种三维头发建模方法及装置。The present application relates to the field of three-dimensional image processing and computer graphics technology, and in particular, to a three-dimensional hair modeling method and apparatus.
随着微处理器(Advanced RISC Machines,简称:ARM)性能的不断提高,基于手机的高质量三维(3D)人物重建已经成为现实,并且备受各大手机厂商和广大用户的青睐。人的头发在人物肖像和数字人物动画中是非常重要的部分,头发的创建可以显著增强虚拟形象和娱乐应用中虚拟角色的真实感。因此,针对3D角色的头发建模成为3D人物重建过程中需要解决的关键问题。With the continuous improvement of the performance of microprocessors (Advanced RISC Machines, ARM for short), high-quality three-dimensional (3D) character reconstruction based on mobile phones has become a reality, and is favored by major mobile phone manufacturers and users. Human hair is a very important part of character portraits and digital character animations. The creation of hair can significantly enhance the realism of virtual characters in avatars and entertainment applications. Therefore, hair modeling for 3D characters has become a key issue to be solved in the 3D character reconstruction process.
3D头发建模的方案主要分为两类,一类是头发造型建模,另一类是头发模型重用。其中头发造型建模是目前主流的3D头发建模方法,该类方法主要通过手动来实现模型的创建,通常是在已有人头模型的头皮上选取一块生发区域,然后设定该区域头发的生长方向、长度、卷曲度等,这种方法创建出的头发模型能够与人头模型准确地贴合在一起,但是会耗费大量的时间,而且需要复杂的人为参与。对于手机重建出的3D人脸模型,倘若采用手动方式生成对应的3D头发模型,其占用的计算资源以及消耗的时间对用户而言是无法接受的。The 3D hair modeling scheme is mainly divided into two categories, one is hair styling modeling and the other is hair model reuse. Hair styling modeling is currently the mainstream 3D hair modeling method. This method mainly uses manual to realize the creation of the model. Usually, a hair growth area is selected on the scalp of the existing human head model, and then the hair growth in the area is set. Direction, length, curl, etc. This method creates a hair model that fits exactly with the human head model, but it takes a lot of time and requires complex human intervention. For the 3D face model reconstructed by the mobile phone, if the corresponding 3D hair model is generated manually, the computing resources and time consumed by the mobile phone are unacceptable to the user.
头发模型重用是指在不同3D角色模型上创建与已有头发模型相似的新发型。现有技术通过如下方式进行头发模型重用:预先存储一个或多个3D头发模板,接收正视头发图像和3D头部模型,然后基于正视头发图像的特点并结合3D头部模型对3D头发模板进行变形处理,从而产生真实的3D头发模型。Hair model reuse refers to creating new hairstyles similar to existing hair models on different 3D character models. The prior art performs hair model reuse by pre-storing one or more 3D hair templates, receiving a frontal hair image and a 3D head model, and then deforming the 3D hair template based on the characteristics of the frontal hair image combined with the 3D head model. Processed to produce a realistic 3D hair model.
在对3D头发模板进行变形处理时,首先定义3D头发模板的关键点以及
依据关键点划分的区域;然后检测正视头发图像的头发形状;将检测到的头发形状划分为普通部分和个性部分,其中普通部分指头发在不同个体之间比较类似的部分,个性部分指头发在不同个体之间差异较大的部分;对划分出的个性部分进行近似处理,对近似处理后的个性部分的发片进行头发造型建模;结合3D头部模型,将所定义的3D头发模型的边界关键点与划分出来的普通部分的边界进行匹配,对匹配的结果区域进行3D数据内插;将头发造型建模后的各个3D发片与3D数据内插结果相结合,产生真实的3D头发模型。When morphing a 3D hair template, first define the key points of the 3D hair template and
The area divided according to the key points; then the hair shape of the hair image is detected; the detected hair shape is divided into a normal part and a personality part, wherein the common part refers to a similar part of the hair between different individuals, and the personality part refers to the hair in the The part with different differences between different individuals; approximating the divided individual parts, modeling the hair piece of the approximated part of the hair piece; combining the 3D head model, the defined 3D hair model The boundary key points are matched with the boundaries of the divided common parts, and the matching result areas are subjected to 3D data interpolation; the 3D hair pieces modeled by the hair modeling are combined with the 3D data interpolation results to generate real 3D hair. model.
现有技术中对3D头发模板进行变形处理需要将3D头发模型投影为2D形式,选择的关键点均为2D形式,然后将2D关键点与正视头发图像的普通部分以及个性部分进行匹配,因此现有技术受限于2D关键点的检测结果、2D关键点与正视头发图像的普通部分以及个性部分的匹配精度以及针对头发个性部分的建模,使得头发模板重用复杂度较高,无法满足头发模板的快速重用。In the prior art, the deformation processing of the 3D hair template requires the 3D hair model to be projected into a 2D form, and the selected key points are in the 2D form, and then the 2D key points are matched with the normal part and the personality part of the front view hair image, so The technique is limited by the detection results of the 2D key points, the matching precision of the 2D key points and the normal part of the face image and the personality part, and the modeling of the hair personality part, so that the hair template reuse complexity is high, and the hair template cannot be satisfied. Fast reuse.
发明内容Summary of the invention
本申请提供一种三维头发建模方法及装置,用于解决现有技术存在的头发模板重用复杂度较高,无法满足头发模板的快速重用的问题。The present invention provides a three-dimensional hair modeling method and apparatus for solving the problem that the hair template reused in the prior art has high complexity and cannot satisfy the rapid reuse of the hair template.
第一方面,本申请提供了一种三维头发建模方法,方法包括:In a first aspect, the present application provides a three-dimensional hair modeling method, the method comprising:
确定待创建头发的3D头部模型以及预设的参考头部模型之间的第一坐标变换关系,以及确定所述3D头部模型与预设的3D头发模板之间的第二坐标变换关系,然后基于所述第一坐标变换关系以及第二坐标变换关系将所述3D头部模型与所述3D头发模板进行配准;其中,所述预设的3D头发模板和所述预设的参考头部模型相匹配;当检测到配准后的所述3D头发模板存在错误区域时,使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,以矫正所述错误区域,其中,所述错误区域包括所述3D头发模板中未完全遮挡住所述3D头部模型的头皮层的区域或者所述3D头发模板中的发根点构成的发根区域遮挡住所述3D头部模型的非头皮层的区域。
Determining a first coordinate transformation relationship between the 3D head model of the hair to be created and the preset reference head model, and determining a second coordinate transformation relationship between the 3D head model and the preset 3D hair template, And then registering the 3D head model with the 3D hair template based on the first coordinate transformation relationship and the second coordinate transformation relationship; wherein the preset 3D hair template and the preset reference header The partial models are matched; when it is detected that the registered 3D hair template has an error area, the hair in the wrong area of the 3D hair template is deformed using a radial basis function RBF to correct the error area, Wherein the error area comprises an area of the 3D hair template that does not completely obscure the scalp layer of the 3D head model or a hair root area formed by the root point in the 3D hair template blocks the 3D head model The area of the non-scalp layer.
通过上述方案,可以快速为存储能力、计算能力相对较低的终端中的3D头部模型构建出具有完好贴合效果的3D头发模型,构建出的3D头发模型的真实感可媲美于采用头发造型建模方法生成的头发模型,却省去了大量的人工交互与运算时间;与现有的头发模型重用技术相比,本申请中无需受限于2D关键点的检测结果、也不受限于2D关键点与正视头发图像的普通部分以及个性部分的匹配精度、无需针对头发个性部分的建模,能够有效提高3D头发模板的重用性,并且构建出的头发模型能够更为精确地保留原型头发的外观。Through the above scheme, a 3D hair model with a perfect fit effect can be quickly constructed for a 3D head model in a terminal with relatively low storage capacity and relatively low computing power, and the realistic 3D hair model can be compared with the hair style. The hair model generated by the modeling method saves a lot of manual interaction and computing time; compared with the existing hair model reuse technology, the present invention does not need to be limited by the detection result of 2D key points, nor is it limited. The matching accuracy of the 2D key points with the normal part of the hair image and the personality part, without the need to model the hair part, can effectively improve the reusability of the 3D hair template, and the hair model can retain the prototype hair more accurately. Appearance.
在一种可能的设计中,确定待创建头发的3D头部模型以及预设的参考头部模型之间的第一坐标转换关系,以及确定所述3D头部模型与预设的3D头发模板之间的第二坐标转换关系,并基于所述第一坐标转换关系以及第二坐标转换关系将所述3D头部模型与所述3D头发模板进行配准,可以通过如下方式实现:In a possible design, determining a first coordinate transformation relationship between the 3D head model of the hair to be created and the preset reference head model, and determining the 3D head model and the preset 3D hair template The second coordinate transformation relationship between the two, and the registration of the 3D head model with the 3D hair template based on the first coordinate transformation relationship and the second coordinate transformation relationship may be implemented as follows:
确定待创建头发的3D头部模型的面部关键点和头皮层关键点以及确定预设的参考头部模型的面部关键点;对所述3D头部模型的面部关键点与所述参考头部模型的面部关键点进行匹配,得到面部匹配点对;然后根据所述面部匹配点对,确定所述3D头部模型与所述参考头部模型之间的第一坐标变换关系;根据所述第一坐标变换关系,得到所述3D头发模板在目标坐标系中的三维坐标,其中,所述目标坐标系为所述3D头部模型所在的坐标系;对经过第一坐标变换关系变换后的所述3D头发模板的发根点和所述3D头部模型的头皮层关键点进行匹配,得到发根匹配点对;根据所述发根匹配点对,确定所述3D头部模型与所述3D头发模板之间的第二坐标变换关系;根据所述第二坐标变换关系,将所述3D头发模板与所述3D头部模型进行配准。Determining facial key points and scalp key points of the 3D head model of the hair to be created and determining facial key points of the preset reference head model; facial key points of the 3D head model and the reference head model The facial key points are matched to obtain a face matching point pair; then, according to the face matching point pair, a first coordinate transformation relationship between the 3D head model and the reference head model is determined; according to the first Coordinate transformation relationship, obtaining three-dimensional coordinates of the 3D hair template in a target coordinate system, wherein the target coordinate system is a coordinate system in which the 3D head model is located; Matching the rooting point of the 3D hair template with the scalp key points of the 3D head model to obtain a pair of hair root matching points; determining the 3D head model and the 3D hair according to the pair of hair root matching points a second coordinate transformation relationship between the templates; and the 3D hair template is registered with the 3D head model according to the second coordinate transformation relationship.
上述设计中,通过3D头部模型的面部关键点和头皮层关键点以及参考头部模型的面部关键点和3D头发模板的发根点来确定第一坐标变换关系以及第二坐标变换关系,能够减少计算量,从而能够应用在存储能力以及计算能力相对较低的终端设备上。
In the above design, the first coordinate transformation relationship and the second coordinate transformation relationship are determined by the facial key point and the scalp key point of the 3D head model and the facial key point of the reference head model and the root point of the 3D hair template. The amount of calculation is reduced, so that it can be applied to terminal devices with relatively low storage capacity and computing power.
在一种可能的设计中,所述使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,可以通过如下方式实现:In one possible design, the deformation of the hair in the erroneous region of the 3D hair template using the radial basis function RBF can be achieved as follows:
针对所述3D头发模板的错误区域中每一根头发分别执行如下:选择所述每一根头发中的至少3个三维坐标点作为第一关键点,并通过最近邻点算法确定每一第一关键点在所述3D头部模型头皮层的最近邻点作为所述每一第一关键点的匹配点,并将所述每一第一关键点与其对应的匹配点构成发丝匹配点对;将发丝匹配点对作为径向基函数的输入参数,对所述每一根头发进行形变。Each hair in the wrong area of the 3D hair template is respectively performed as follows: at least three three-dimensional coordinate points in each of the hairs are selected as a first key point, and each first is determined by a nearest neighbor algorithm a key point is a nearest neighbor point of the scalp layer of the 3D head model as a matching point of each of the first key points, and each of the first key points and its corresponding matching point constitute a hair matching point pair; Each of the hairs is deformed by matching the hairline matching points as input parameters of a radial basis function.
其中,所述第一关键点中可以包括所述每一个头发的发根点以及发梢点。Wherein, the first key point may include a rooting point and a tip point of each of the hairs.
上述设计中,使用最近邻点算法将选择的第一关键点与头皮层中的坐标点进行匹配,匹配准确且计算量小。In the above design, the nearest key algorithm is used to match the selected first key point with the coordinate point in the scalp layer, and the matching is accurate and the calculation amount is small.
在一种可能的设计中,所述使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,可以通过如下方式实现:In one possible design, the deformation of the hair in the erroneous region of the 3D hair template using the radial basis function RBF can be achieved as follows:
针对所述3D头发模板的错误区域中每一根头发分别执行如下:选择所述每一根头发中的至少3个三维坐标点作为第二关键点,并通过最近邻点算法确定所述至少3个第二关键点中每一第二关键点在所述3D头部模型头皮层的最近邻点作为所述每一第二关键点的匹配点,并将所述每一第二关键点与其对应的匹配点构成发丝匹配点对;使用发丝匹配点对作为径向基函数输入参数,对所述每一根头发进行形变;将形变后的每一根头发分为至少两个部分,针对每一部分头发分别执行如下:将所述每一部分头发中的至少3个三维坐标点作为第三关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第三关键点的最近邻点作为每一第三关键点的匹配点,并将所述每一第三关键点与其对应的匹配点构成分段发丝匹配点对;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。Performing each of the hairs in the wrong area of the 3D hair template as follows: selecting at least three three-dimensional coordinate points in each of the hairs as a second key point, and determining the at least 3 by a nearest neighbor algorithm Each of the second key points is a nearest neighbor point of the scalp layer of the 3D head model as a matching point of each of the second key points, and each of the second key points is corresponding thereto The matching points constitute a pair of hair matching points; the hair matching point pairs are used as radial basis function input parameters, and each of the hairs is deformed; each hair after deformation is divided into at least two parts, Each part of the hair is respectively performed as follows: at least three three-dimensional coordinate points in each part of the hair are taken as a third key point, and each part of the hair is placed in a three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor of each third key point as a matching point of each third key point, and each of the third key points and their corresponding matching points constitute a segment hairline matching point pair; Segment hairline matching The input parameters is performed as a radial basis function of the deformation of each part of the hair.
其中,所述第二关键点中可以包括所述每一根头发中的发根点以及发梢点;所述第三关键点中可以包括所述每一部分头发的两个端点。
Wherein, the second key point may include a hair root point and a hair point point in each of the hairs; and the third key point may include two end points of each part of the hair.
在一种可能的设计中,所述使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,包括:In one possible design, the radial basis function RBF is used to deform the hair in the wrong area of the 3D hair template, including:
针对所述3D头发模板的错误区域中每一根头发分别执行如下:将每一根头发分为至少两个部分,并针对每一部分头发分别执行如下:将所述每一部分头发中的至少3个三维坐标点作为第四关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第四关键点的最近邻点作为每一第四关键点的匹配点,并将所述每一第四关键点与其对应的匹配点构成分段发丝匹配点对;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。Each hair in the wrong area of the 3D hair template is separately performed as follows: each hair is divided into at least two parts, and is performed separately for each part of the hair as follows: at least 3 of each part of the hair is to be The three-dimensional coordinate point is used as the fourth key point, and the nearest neighbor point of each fourth key point in each part of the hair is taken as each fourth key point in the three-dimensional coordinate point of the scalp layer of the 3D head model Matching points, and each of the fourth key points and their corresponding matching points constitute a segment hairline matching point pair; the segment hairline matching point pair is used as a radial basis function input parameter for each Some of the hair is deformed.
其中,所述第三关键点可以包括所述每一部分头发的两个端点。Wherein, the third key point may include two end points of each part of the hair.
第二方面,本申请提供了一种三维头发建模装置,装置包括:In a second aspect, the present application provides a three-dimensional hair modeling device, the device comprising:
第一确定单元,用于确定待创建头发的3D头部模型以及预设的参考头部模型之间的第一坐标变换关系;a first determining unit, configured to determine a first coordinate transformation relationship between the 3D head model of the hair to be created and the preset reference head model;
第二确定单元,用于确定所述3D头部模型与预设的3D头发模板之间的第二坐标变换关系,其中,所述预设的3D头发模板和所述预设的参考头部模型相匹配;a second determining unit, configured to determine a second coordinate transformation relationship between the 3D head model and a preset 3D hair template, wherein the preset 3D hair template and the preset reference head model Match
配准单元,用于基于所述确定单元确定所述第一坐标变换关系以及所述第二坐标变换关系,将所述3D头部模型与所述3D头发模板进行配准;a registration unit, configured to determine the first coordinate transformation relationship and the second coordinate transformation relationship based on the determining unit, and register the 3D head model with the 3D hair template;
检测单元,用于检测配准后的所述3D头发模板是否存在错误区域;a detecting unit, configured to detect whether the registered 3D hair template has an error area;
形变单元,用于使用径向基函数RBF对所述检测单元检测到所述3D头发模板的错误区域中的头发进行形变,以矫正所述错误区域,其中,所述错误区域包括所述3D头发模板中未完全遮挡住所述3D头部模型的头皮层的区域或者所述3D头发模板中的发根点构成的发根区域遮挡住所述3D头部模型的非头皮层的区域。a deformation unit for deforming hair in the erroneous area of the 3D hair template detected by the detecting unit using a radial basis function RBF to correct the erroneous area, wherein the erroneous area includes the 3D hair The area of the scalp layer in the template that does not completely obscure the 3D head model or the hair root point in the 3D hair template obscures the area of the non-skin layer of the 3D head model.
通过上述方案,可以快速为存储能力、计算能力相对较低的终端中的3D头部模型构建出具有完好贴合效果的3D头发模型,构建出的3D头发模型的真实感可媲美于采用头发造型建模方法生成的头发模型,却省去了大量的人
工交互与运算时间;与现有的头发模型重用技术相比,本申请中无需受限于2D关键点的检测结果、也不受限于2D关键点与正视头发图像的普通部分以及个性部分的匹配精度、无需针对头发个性部分的建模,能够有效提高3D头发模板的重用性,并且构建出的头发模型能够更为精确地保留原型头发的外观。Through the above scheme, a 3D hair model with a perfect fit effect can be quickly constructed for a 3D head model in a terminal with relatively low storage capacity and relatively low computing power, and the realistic 3D hair model can be compared with the hair style. The hair model generated by the modeling method saves a lot of people
Work interaction and operation time; compared with the existing hair model reuse technology, the present application does not need to be limited by the detection result of the 2D key point, nor is it limited to the common part of the 2D key point and the front view hair image and the personality part. Matching accuracy, no need to model the hair part, can effectively improve the reusability of 3D hair template, and the hair model can retain the appearance of the prototype hair more accurately.
在一种可能的设计中,所述第一确定单元,具体用于:确定待创建头发的3D头部模型的面部关键点和头皮层关键点;确定预设的参考头部模型的面部关键点;对所述3D头部模型的面部关键点与所述参考头部模型的面部关键点进行匹配,得到面部匹配点对;根据所述面部匹配点对,确定所述3D头部模型与所述参考头部模型之间的第一坐标变换关系;所述配准单元,用于根据所述第一坐标变换关系,得到所述3D头发模板在目标坐标系中的三维坐标,其中,所述目标坐标系为所述3D头部模型所在的坐标系;所述第二确定单元,具体用于:对经过第一坐标变换关系变换后的所述3D头发模板的发根点和所述3D头部模型的头皮层关键点进行匹配,得到发根匹配点对;根据所述发根匹配点对,确定所述3D头部模型与所述3D头发模板之间的第二坐标变换关系;所述配准单元,用于根据所述第二坐标变换关系,将所述3D头发模板与所述3D头部模型进行配准。In a possible design, the first determining unit is specifically configured to: determine a facial key point and a scalp key point of the 3D head model of the hair to be created; and determine a facial key point of the preset reference head model. And matching a facial key point of the 3D head model with a facial key point of the reference head model to obtain a face matching point pair; determining the 3D head model and the Referencing a first coordinate transformation relationship between the head models; the registration unit is configured to obtain three-dimensional coordinates of the 3D hair template in a target coordinate system according to the first coordinate transformation relationship, wherein the target a coordinate system is a coordinate system in which the 3D head model is located; the second determining unit is specifically configured to: a root point of the 3D hair template transformed by the first coordinate transformation relationship, and the 3D head Matching key points of the scalp layer of the model to obtain a pair of hair root matching points; determining a second coordinate transformation relationship between the 3D head model and the 3D hair template according to the pair of hair root matching points; Order , According to the second coordinate transformation relationship, the hair 3D template registration with the 3D head model.
在一种可能的设计中,所述形变单元,具体用于:针对所述3D头发模板的错误区域中每一根头发分别执行如下:选择所述每一根头发中的至少3个三维坐标点作为第一关键点,并通过最近邻点算法确定每一第一关键点在所述3D头部模型头皮层的最近邻点作为所述每一第一关键点的匹配点,并将所述每一第一关键点与其对应的匹配点构成发丝匹配点对;将发丝匹配点对作为径向基函数的输入参数,对所述每一根头发进行形变。In a possible design, the deformation unit is specifically configured to: perform, for each hair in the wrong area of the 3D hair template, respectively: selecting at least three three-dimensional coordinate points in each of the hairs As a first key point, and determining, by a nearest neighbor algorithm, a nearest neighbor point of the first key point in the scalp layer of the 3D head model as a matching point of each of the first key points, and each of the A first key point and its corresponding matching point constitute a hair matching point pair; the hair matching point pair is used as an input parameter of a radial basis function, and each of the hairs is deformed.
其中,所述第一关键点中可以包括所述每一个头发的发根点以及发梢点。Wherein, the first key point may include a rooting point and a tip point of each of the hairs.
在一种可能的设计中,所述形变单元,具体用于:针对所述3D头发模板的错误区域中每一根头发分别执行如下:选择所述每一根头发中的至少3个三维坐标点作为第二关键点,并通过最近邻点算法确定所述至少3个第二关
键点中每一第二关键点在所述3D头部模型头皮层的最近邻点作为所述每一第二关键点的匹配点,并将所述每一第二关键点与其对应的匹配点构成发丝匹配点对;使用发丝匹配点对作为径向基函数输入参数,对所述每一根头发进行形变;将形变后的每一根头发分为至少两个部分,针对每一部分头发分别执行如下:将所述每一部分头发中的至少3个三维坐标点作为第三关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第三关键点的最近邻点作为每一第三关键点的匹配点,并将所述每一第三关键点与其对应的匹配点构成分段发丝匹配点对;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。In a possible design, the deformation unit is specifically configured to: perform, for each hair in the wrong area of the 3D hair template, respectively: selecting at least three three-dimensional coordinate points in each of the hairs As a second key point, and determining the at least three second levels by a nearest neighbor algorithm
Each of the second key points in the key point is the closest neighbor point of the scalp layer of the 3D head model as a matching point of each of the second key points, and each of the second key points and their corresponding matching points Forming a pair of hair matching points; using the hair matching point pair as a radial basis function input parameter, deforming each of the hairs; dividing each deformed hair into at least two parts, for each part of the hair Performing respectively as follows: at least three three-dimensional coordinate points in each part of the hair are taken as a third key point, and each of the part of the hair is placed in a three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor of the third key point as a matching point of each third key point, and each of the third key points and their corresponding matching points constitute a segment hairline matching point pair; The matching point pairs each of the partial hairs as an input parameter that is a radial basis function.
其中,所述第二关键点中可以包括所述每一根头发中的发根点以及发梢点;所述第三关键点中可以包括所述每一部分头发的两个端点。Wherein, the second key point may include a hair root point and a hair point point in each of the hairs; and the third key point may include two end points of each part of the hair.
在一种可能的设计中,所述形变单元,具体用于:针对所述3D头发模板的错误区域中每一根头发分别执行如下:将每一根头发分为至少两个部分,并针对每一部分头发分别执行如下:将所述每一部分头发中的至少3个三维坐标点作为第四关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第四关键点的最近邻点作为每一第四关键点的匹配点,并将所述每一第四关键点与其对应的匹配点构成分段发丝匹配点对;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。In a possible design, the deformation unit is specifically configured to: perform, for each hair in the wrong area of the 3D hair template, as follows: divide each hair into at least two parts, and for each Part of the hair is respectively performed as follows: at least three three-dimensional coordinate points in each part of the hair are taken as a fourth key point, and the three-dimensional coordinate points of the scalp layer of the 3D head model are used in each part of the hair a nearest neighbor point of each fourth key point as a matching point of each fourth key point, and each of the fourth key points and their corresponding matching points constitute a segment hairline matching point pair; The hairline matching point deforms each of the portions of the hair as an input parameter as a radial basis function.
其中,所述第三关键点可以包括所述每一部分头发的两个端点。Wherein, the third key point may include two end points of each part of the hair.
第三方面,本申请还提供了一种三维头发建模装置,其特征在于,包括:通信接口、存储器以及处理器。所述通信接口,用于配置待创建头发的3D头部模型、预设的参考头部模型、以及预设的3D头发模板,所述预设的参考头部模型以及预设的3D头发模板相匹配;所述存储器,用于存储所述处理器执行的程序代码;所述处理器,用于执行所述存储器存储的程序代码,具体执行第一方面中任意一种设计所执行操作。In a third aspect, the present application further provides a three-dimensional hair modeling device, comprising: a communication interface, a memory, and a processor. The communication interface is configured to configure a 3D head model of the hair to be created, a preset reference head model, and a preset 3D hair template, and the preset reference head model and the preset 3D hair template phase The memory is used to store the program code executed by the processor; the processor is configured to execute the program code stored in the memory, and specifically perform the operation performed by any one of the first aspects.
第四方面,本申请还提供了一种存储一个或多个程序的计算机可读存储
介质,所述一个或多个程序包括指令,所述指令当被包括多个应用程序的电子设备执行时使所述电子设备执行根据第一方面任意设计所述的操作。In a fourth aspect, the present application also provides a computer readable storage storing one or more programs
The medium, the one or more programs comprising instructions that, when executed by an electronic device comprising a plurality of applications, cause the electronic device to perform the operations of any of the designs according to the first aspect.
图1为本申请提供的选择的3D头部模型的面部关键点示意图;1 is a schematic diagram of facial key points of a selected 3D head model provided by the present application;
图2为本申请提供的选择的参考头部模型的面部关键点示意图;2 is a schematic diagram of facial key points of a selected reference head model provided by the present application;
图3为本申请提供的选择的3D头部模型的头皮层关键点示意图;3 is a schematic diagram of key points of a scalp layer of a selected 3D head model provided by the present application;
图4为本申请提供的3D头发模板的关键点与其匹配点对应关系示意图;4 is a schematic diagram of a correspondence between a key point of a 3D hair template and a matching point thereof provided by the present application;
图5为本申请提供的头发由整体到局部的形变原理图;Figure 5 is a schematic view showing the deformation of the hair from the whole to the part provided by the present application;
图6为本申请提供的一种三维头发建模方法流程图;6 is a flow chart of a three-dimensional hair modeling method provided by the present application;
图7为本申请提供的3D头发模板与3D头部模型配准方法流程图;7 is a flow chart of a 3D hair template and a 3D head model registration method provided by the present application;
图8为本申请提供的一种三维头发建模方法示意图;FIG. 8 is a schematic diagram of a three-dimensional hair modeling method provided by the present application; FIG.
图9为本申请提供的一种三维头发建模装置示意图;9 is a schematic diagram of a three-dimensional hair modeling device provided by the present application;
图10为本申请提供的另一种三维头发建模装置示意图;10 is a schematic diagram of another three-dimensional hair modeling device provided by the present application;
图11为本申请提供的三维头发建模效果示意图。FIG. 11 is a schematic diagram of a three-dimensional hair modeling effect provided by the present application.
为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。The present invention will be further described in detail with reference to the accompanying drawings, in which FIG. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope are the scope of the present application.
本申请提供一种三维头发建模方法及装置,用于解决现有技术存在的头发模板重用复杂度较高,无法满足头发模板的快速重用的问题。其中,方法和装置是基于同一发明构思的,由于方法及装置解决问题的原理相似,因此装置与方法的实施可以相互参见,重复之处不再赘述。The present invention provides a three-dimensional hair modeling method and apparatus for solving the problem that the hair template reused in the prior art has high complexity and cannot satisfy the rapid reuse of the hair template. The method and the device are based on the same inventive concept. Since the principles of the method and the device for solving the problem are similar, the implementation of the device and the method can be referred to each other, and the repeated description is not repeated.
本申请可以应用于存储能力、计算能力相对较低的终端,当然也可以应
用存储能力、计算能力较高的电子设备,本申请对此不作具体限定。The application can be applied to a terminal with relatively low storage capacity and computing power, and of course
The electronic device with high storage capacity and high computing capability is not specifically limited in this application.
本申请提供的三维头发建模方法的一实施例包括:An embodiment of the three-dimensional hair modeling method provided by the present application includes:
可以预先准备待创建头发的三维(3D)头部模型,该3D头部模型可以划分为三维头皮层区域和三维非头发层区域。构成此3D头部模型的所有三维坐标点构成了3D头部模型点集。在3D头部模型的点集中可以划分为两个子集,包括三维头皮层区域点集以及三维非头发层区域点集。A three-dimensional (3D) head model of the hair to be created may be prepared in advance, and the 3D head model may be divided into a three-dimensional scalp region and a three-dimensional non-hair layer region. All three-dimensional coordinate points constituting this 3D head model constitute a set of 3D head model points. The point set in the 3D head model can be divided into two subsets, including a three-dimensional scalp area point set and a three-dimensional non-hair layer area point set.
三维非头皮层区域点集中包括所有面部特征点以及被这些点形成的脸部轮廓围起来的区域,耳朵至下巴区域。三维(3D)头部模型对应的信息中还可以包括每个面部特征点的索引编号,并将这些面部特征点的索引编号记录在三维非头皮层区域点集中。其它为三维头皮层区域,三维头皮层区域的轮廓上可以标出额部,鬓角,耳周的特征点,左右基本对称。当然也可以对头皮层特征点进行索引编号,并记录在三维头皮层区域点集中。The three-dimensional non-scalp region point set includes all facial feature points and an area surrounded by the contours of the faces formed by these points, the ear to the chin area. The information corresponding to the three-dimensional (3D) head model may further include an index number of each facial feature point, and record the index numbers of the facial feature points in the three-dimensional non-scalp region point set. Others are three-dimensional scalp area, and the contours of the three-dimensional scalp area can be marked with the forehead, the horn, and the characteristic points of the ear circumference, which are basically symmetrical. Of course, the scalp layer feature points can also be indexed and recorded in the three-dimensional scalp region point set.
本申请中预先准备好3D头发模板,并且其对应一个参考头部模型,即该3D头发模板是针对参考头部模型构建的,3D头发模板与参考头部模型相匹配。3D头发模板以及参考头部模型可以是预先存储在3D头发模型库中的一个。该3D头发模型库中对应存储多个3D头发模板和参考头部模型,可以预先由用户在3D头发模板库中选择一个。构成此参考头部模型的所有三维坐标点构成了参考头部模型点集,构成此3D头发模板的所有三维坐标点构成了3D头发模板点集。The 3D hair template is prepared in advance in the present application, and corresponds to a reference head model, that is, the 3D hair template is constructed for the reference head model, and the 3D hair template matches the reference head model. The 3D hair template and the reference head model may be ones pre-stored in the 3D hair model library. The 3D hair model library correspondingly stores a plurality of 3D hair templates and reference head models, and one of the 3D hair template libraries can be selected in advance by the user. All three-dimensional coordinate points constituting this reference head model constitute a reference head model point set, and all three-dimensional coordinate points constituting the 3D hair template constitute a 3D hair template point set.
三维头发建模装置确定待创建头发的3D头部模型与预设的参考头部模型的第一坐标对应关系。The three-dimensional hair modeling device determines a first coordinate correspondence relationship between the 3D head model of the hair to be created and the preset reference head model.
具体的,在确定第一坐标对应关系时,首先确定待创建头发的3D头部模型的面部关键点、所述3D头部模型的头皮层关键点;以及确定参考头部模型的的面部关键点,并对所述3D头部模型的面部关键点与参考头部模型的面部关键点进行匹配得到面部匹配点对。Specifically, when determining the first coordinate correspondence, first determining a facial key point of the 3D head model of the hair to be created, a scalp key point of the 3D head model, and determining a facial key point of the reference head model And matching the facial key points of the 3D head model with the facial key points of the reference head model to obtain a face matching point pair.
本申请中,在确定待创建头发的3D头部模型的面部关键点、所述3D头部模型的头皮层关键点时,可以通过如下方式实现:
In the present application, when determining the facial key point of the 3D head model of the hair to be created and the key layer of the scalp layer of the 3D head model, the following can be achieved:
确定的3D头部模型的面部关键点可以分为两类:第一类为面部关键点,可以包括眼睛区域、鼻子区域、嘴巴区域、下巴区区域等等;第二类为头皮层关键点,可以包括额头区域、后脑勺区域、耳朵发根区域等等。例如,如图1所示,确定的3D头部模型的面部关键点包括39个,R1~R39。The facial key points of the determined 3D head model can be divided into two categories: the first type is a facial key point, which may include an eye area, a nose area, a mouth area, a chin area, and the like; the second type is a key point of the scalp layer, It may include a forehead area, a back of head area, an ear root area, and the like. For example, as shown in FIG. 1, the facial key points of the determined 3D head model include 39, R1 to R39.
在确定关键点时可以采用现有的特征提取方式,也可以人工选取,当然还可以是在建立3D头部模型已经确定好的面部关键点以及头皮层关键点,还可以在三维非头皮层区域点集中的面部特征点的索引编号中选择一部分特征点作为面部关键点,在三维头皮层区域点集中的头皮层特征点的索引编号中选择一部分特征点作为头皮层关键点。In the determination of the key points, the existing feature extraction method can be used, or it can be manually selected. Of course, it is also possible to establish a key point of the face and a key point of the scalp layer that have been determined by the 3D head model, and also in the three-dimensional non-scalp area. A part of the feature points is selected as the face key point in the index number of the facial feature points in the point set, and a part of the feature points is selected as the key point of the scalp layer in the index number of the scalp layer feature points in the point set of the three-dimensional scalp area.
本申请中,在确定3D头发模板所基于的参考头部模型的面部关键点可以采用与确定3D头部模型的面部关键点同样的方式,确定的参考头部模型的面部关键点可以包括眼睛区域、鼻子区域、嘴巴区域、下巴区区域等等。如图2所示,确定的参考头部模型的面部关键点包括39个,A1~A39。在确定关键点时可以采用现有的特征提取方式,也可以人工选取,当然还可以是在建立参考头部模型时已经确定好的面部关键点。In the present application, in determining the facial key point of the reference head model on which the 3D hair template is based, the facial key point of the reference head model may be determined to include the eye region in the same manner as determining the facial key point of the 3D head model. , nose area, mouth area, chin area, and so on. As shown in FIG. 2, the face key points of the determined reference head model include 39, A1 to A39. The existing feature extraction method may be adopted when determining the key point, or may be manually selected, and may also be a facial key point that has been determined when the reference head model is established.
在确定所述3D头部模型的面部关键点与参考头部模型的面部关键点后,三维头发建模装置对所述3D头部模型的面部关键点与参考头部模型的面部关键点进行匹配得到面部匹配点对。After determining the facial key points of the 3D head model and the facial key points of the reference head model, the three-dimensional hair modeling device matches the facial key points of the 3D head model with the facial key points of the reference head model. Get a face matching point pair.
由于对所述3D头部模型的面部关键点与参考头部模型的面部关键点选择的方式相同,因此可以基于索引编号进行匹配得到面部匹配点对,也可以人工选择面部匹配点对。例如,图1和图2所示的关键点匹配后面部匹配点对包括:R1-A1、R2-A2、R6-A6、R7-A7、R10-A10、R13-A13、R14-A14、R19-A19、R20-A20、R33-A33。Since the face key points of the 3D head model are the same as the face key points of the reference head model, the face matching point pairs may be obtained by matching based on the index numbers, or the face matching point pairs may be manually selected. For example, the key points matching the rear matching point pairs shown in FIG. 1 and FIG. 2 include: R1-A1, R2-A2, R6-A6, R7-A7, R10-A10, R13-A13, R14-A14, R19- A19, R20-A20, R33-A33.
三维头发建模装置根据所述面部匹配点对确定所述3D头部模型与参考头部模型之间的第一坐标变换关系。The three-dimensional hair modeling device determines a first coordinate transformation relationship between the 3D head model and the reference head model according to the face matching point pair.
具体实施时,利用面部匹配点对计算3D头部模型与参考头部模型之间的第一坐标变换关系。其中第一坐标变换关系s.R.t包括缩放关系、旋转关系以
及平移关系。其中,缩放关系通过s表示缩放因子s实现,旋转关系通过旋转矩阵R实现,平移关系通过平移向量t实现。In a specific implementation, the first coordinate transformation relationship between the 3D head model and the reference head model is calculated by using the face matching point pair. The first coordinate transformation relationship s.R.t includes a scaling relationship and a rotation relationship.
And translation relationship. The scaling relationship is implemented by s representing a scaling factor s, the rotation relationship is implemented by a rotation matrix R, and the translation relationship is implemented by a translation vector t.
本申请中假设3D头发模型中的中心点为世界坐标系的原点。则通过下述公式(1)计算缩放因子s:It is assumed in the present application that the center point in the 3D hair model is the origin of the world coordinate system. Then calculate the scaling factor s by the following formula (1):
其中,公式中x,y,z表示的是面部关键点对中3D头部模型对应的面部关键点的坐标,公式中表示的是面部关键点对中参考头部模型对应的面部关键点的坐标,n表示面部关键点对的总数量。Wherein, x, y, and z in the formula represent the coordinates of the face key points corresponding to the 3D head model of the face key point pair, in the formula It represents the coordinates of the face key points corresponding to the reference head model in the face key point pair, and n represents the total number of face key point pairs.
通过如下方式来计算旋转矩阵R、平移向量t的方法:The method of calculating the rotation matrix R and the translation vector t by:
计算R、t之前先统一尺度,可以先将3D头部模型、以及参考头部模型以及3D头发模板所有特征点的坐标进行归一化处理。然后利用面部关键点对和奇异值分解(英文:Singular Value Decomposition,简称:SVD)算法计算R、t。To calculate the uniform scale before R and t, the coordinates of the 3D head model, the reference head model, and all the feature points of the 3D hair template can be normalized. Then use the face key point pair and singular value decomposition (Singular Value Decomposition, SVD) algorithm to calculate R, t.
假设匹配的面部关键点对分别为Xi和Yi,则本质矩阵E的定义如公式(2):Assuming that the matching key point pairs are X i and Y i , respectively, the essential matrix E is defined as equation (2):
假设3D头部模型的外参为P=[I|0],I表示标准矩阵,即不发生旋转时的标准矩阵,0表示不发生平移。参考头部模型的外参为P’=[R|t],则3D头部模型和3D头发模板之间的本质矩阵E如公式(3):Assume that the external parameter of the 3D head model is P=[I|0], I represents the standard matrix, that is, the standard matrix when no rotation occurs, and 0 means that no translation occurs. The outer parameter of the reference head model is P'=[R|t], then the essential matrix E between the 3D head model and the 3D hair template is as in formula (3):
E=[t]xR 公式(3)E=[t] x R formula (3)
将本质矩阵E进行SVD,可得如公式(4):The essential matrix E is subjected to SVD, which is obtained as in formula (4):
E=U diag(1,1,0)VT 公式(4)E=U diag(1,1,0)V T formula (4)
那么3D头发模板的外参P’有下列四种可能的选择:Then the external reference P' of the 3D hair template has the following four possible options:
P’=[UWVT|u3];[UWVT|-u3];[UWTVT|u3];[UWTVT|-u3];
P'=[UWV T |u 3 ];[UWV T |-u 3 ];[UW T V T |u 3 ];[UW T V T |-u 3 ];
任选一组匹配好的面部关键点对对P’的四种可能值进行验证,即可从四个不同解中确定唯一的正确解。假设P’=[UWVT|u3]为正确解,那么R=UWVT,t=u3。An optional set of matching facial key points verifies the four possible values of P' to determine the only correct solution from the four different solutions. Assuming P'=[UWV T |u 3 ] is the correct solution, then R=UWV T , t=u 3 .
在得到上述第一坐标变换关系s.R.t后,根据所述第一坐标变换关系,得到预设的3D头发模板在目标坐标系中的三维坐标。其中,所述目标坐标系为所述3D头部模型所在的坐标系。After the first coordinate transformation relationship s.R.t is obtained, the three-dimensional coordinates of the preset 3D hair template in the target coordinate system are obtained according to the first coordinate transformation relationship. The target coordinate system is a coordinate system in which the 3D head model is located.
具体实施时,可以通过旋转-缩放-平移的顺序将3D头发模板点集中包括的所有三维坐标点进行坐标变换。In a specific implementation, coordinate transformation may be performed on all three-dimensional coordinate points included in the 3D hair template point set by the order of rotation-zoom-translation.
本申请中,由于3D头发模板是基于参考头部模型制作成的,因此3D头发模板和参考头部模型采用的坐标系相同,因此可以通过参考头部模型与3D头部模型之间的第一坐标变换关系得到预设的3D头发模板在目标坐标系中的三维坐标,即将3D头发模板点集中包括的所有三维坐标点的三维坐标转化到3D头发模板坐标系对应的三维坐标。In the present application, since the 3D hair template is made based on the reference head model, the 3D hair template and the reference head model adopt the same coordinate system, and thus can refer to the first between the head model and the 3D head model. The coordinate transformation relationship obtains the three-dimensional coordinates of the preset 3D hair template in the target coordinate system, that is, the three-dimensional coordinates of all the three-dimensional coordinate points included in the 3D hair template point set are converted into the three-dimensional coordinates corresponding to the 3D hair template coordinate system.
三维头发建模装置确定经过第一坐标变换关系变换后的3D头发模板与3D头部模型之间的第二坐标变换关系。The three-dimensional hair modeling device determines a second coordinate transformation relationship between the 3D hair template and the 3D head model transformed by the first coordinate transformation relationship.
具体的,在确定第二坐标变换关系时,确定经过第一坐标变换关系变换后的3D头发模板的发根点,并对经过第一坐标变换关系变换后的3D头发模板的发根点与所述3D头部模型的头皮层关键点进行匹配,得到发根匹配点对。Specifically, when determining the second coordinate transformation relationship, determining a root point of the 3D hair template transformed by the first coordinate transformation relationship, and a root point and a root of the 3D hair template transformed by the first coordinate transformation relationship The key points of the scalp layer of the 3D head model are matched to obtain a pair of root matching points.
其中,3D头发模板可以分为两种模型,一种是发丝模型,也可以称为线模型;另一种是非发丝模型,也可以称为体模型。发丝模型是指3D头发模板是以多根头发的形式存在的,每根头发由多个点构成。针对发丝模型每根头发都有一个发根点。非发丝模型是指3D头发模板是通过多个头发区域的形式的存在的,即3D头发模板可以被分成多个头发区域,可以认为位于一个头发
区域中的每根头发形状相似度较高。针对非发丝模型可以通过碰撞检测算法确定3D头发模板与3D头部模型的头皮层发生碰撞的点作为发根点,3D头发模板的若干发根点可以参照图3所示。Among them, the 3D hair template can be divided into two models, one is the hair model, which can also be called the line model; the other is the non-hair model, which can also be called the body model. The hairline model means that the 3D hair template is in the form of a plurality of hairs, each hair being composed of a plurality of dots. There is a hair root point for each hair of the hair model. The non-hair model means that the 3D hair template is present in the form of a plurality of hair regions, that is, the 3D hair template can be divided into a plurality of hair regions, which can be considered to be located in one hair.
Each hair in the area has a similar shape shape. For the non-hairline model, the point at which the 3D hair template collides with the scalp layer of the 3D head model can be determined by the collision detection algorithm as the rooting point, and several hair root points of the 3D hair template can be referred to FIG.
具体实施时,对所述3D头发模板中的发根点与所述3D头部模型的头皮层关键点进行匹配得到发根匹配点对时,可以通过最近邻点算法对所述3D头发模板中的发根点与所述3D头部模型的头皮层关键点进行匹配得到发根匹配点对。最近邻点算法可以是现有提供的任一种算法,本申请在此不再赘述。In a specific implementation, when the rooting point in the 3D hair template is matched with the scalp key point of the 3D head model to obtain a root matching point pair, the nearest neighbor algorithm may be used in the 3D hair template. The rooting point is matched with the scalp key points of the 3D head model to obtain a root matching point pair. The nearest neighbor algorithm may be any one of the existing algorithms, which is not described herein again.
三维头发建模装置根据所述发根匹配点对确定所述3D头部模型与所述3D头发模板之间的第二坐标变换关系。The three-dimensional hair modeling device determines a second coordinate transformation relationship between the 3D head model and the 3D hair template according to the pair of hair root matching points.
具体实施时,利用所述发根匹配点对计算3D头部模型与3D头发模板之间的第二坐标变换关系s.R.t。具体计算方法与上述计算第一坐标变换关系的方式相同,本申请在此不再赘述。In a specific implementation, the second coordinate transformation relationship s.R.t between the 3D head model and the 3D hair template is calculated by using the root matching point pair. The specific calculation method is the same as the above method for calculating the first coordinate transformation relationship, and details are not described herein again.
三维头发建模装置根据所述第二坐标变换关系,将所述3D头发模板与所述3D头部模型进行配准。The three-dimensional hair modeling device registers the 3D hair template with the 3D head model according to the second coordinate transformation relationship.
由于3D头部模型与参考头部模型之间的差异,因此在上述通过第二坐标变换关系将所述3D头发模板与所述3D头部模型进行配准后,可能在配准后的3D头发模型中存在错误区域。错误区域包括所述3D头发模板中未完全遮挡住所述3D头部模型的头皮层的区域或者所述3D头发模板中的发根点构成的发根区域遮挡住所述3D头部模型的非头皮层的区域。因此,在确定所述3D头发模板未完全遮挡住所述3D头部模型的头皮层或者所述3D头发模板中的发根点构成的发根区域遮挡住所述3D头部模型的非头皮层时,使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,直到变形后的3D头发模板完全遮挡住所述3D头部模型的头皮层且所述3D头发模板中的发根点构成的发根区域未遮挡住所述3D头部模型的非头皮层。Due to the difference between the 3D head model and the reference head model, after the 3D hair template is registered with the 3D head model by the second coordinate transformation relationship, the 3D hair may be after registration. There is an error area in the model. The error region includes a region of the 3D hair template that does not completely obscure the scalp layer of the 3D head model or a hair root region of the hair root point in the 3D hair template that obscures the non-skin layer of the 3D head model Area. Therefore, when it is determined that the 3D hair template does not completely obscure the scalp layer of the 3D head model or the hair root region formed by the hair root point in the 3D hair template blocks the non-scalp layer of the 3D head model, The hair in the erroneous region of the 3D hair template is deformed using a radial basis function RBF until the deformed 3D hair template completely obscures the scalp layer of the 3D head model and the rooting point in the 3D hair template The resulting hair root region does not obscure the non-scalp layer of the 3D head model.
在确定上述错误区域时,可以但不仅限于通过如下方式实现:When determining the above error area, it can be, but is not limited to, implemented as follows:
利用光线投射算法从3D头部模型的几何中心点向构成3D头发模板的每个三维坐标点发射射线,如果投向某个区域的射线在碰到3D头部模型之前先
碰到3D头发模板区域,则3D头发模板中该区域的头发存在错误的遮挡关系。Using the ray casting algorithm to emit rays from the geometric center point of the 3D head model to each of the three-dimensional coordinate points constituting the 3D hair template, if the rays directed to a certain area are before the 3D head model is encountered
When the 3D hair template area is encountered, the hair in the area of the 3D hair template has an incorrect occlusion relationship.
在使用径向基函数RBF对所述3D头发模板进行形变时,可以针对所述3D头发模板的错误区域中的每根头发进行整体上的形变、或者由整体到局部的形变、或者局部的形变。When the 3D hair template is deformed using the radial basis function RBF, overall deformation, or overall to local deformation, or local deformation may be performed for each hair in the wrong area of the 3D hair template. .
针对由整体到局部的形变、在具体实施时,针对每根头发分别执行如下操作。本申请中以发丝A为例进行说明,其他发丝均可以以针对发丝A的方式进行实施。For the deformation from the whole to the local, in the specific implementation, the following operations are performed separately for each hair. In the present application, the hair A is described as an example, and other hairs can be carried out in a manner directed to the hair A.
整体形变包括:The overall deformation includes:
1)、选择发丝A中的至少3个三维坐标点作为关键点,本申请中以3个为例进行说明,例如图4所示的发丝A中的3个三维坐标点a1、a5、a9,a1为发梢点、a9为发根点,a5则为其它任意一个三维坐标点。通过最近邻点算法确定每一关键点在3D头部模型头皮层的最近邻点作为所述每个关键点的匹配点并将每一关键点与其对应的匹配点构成发丝匹配点对;其中关键点a1对应在3D头部模型头皮层中的匹配点为b1,关键点a5对应在3D头部模型头皮层中的匹配点为b5,关键点a9对应在3D头部模型头皮层中的匹配点为b9。图4中,B表示发丝A中a1~a9匹配到3D头部模型头皮层的部分。使用发丝匹配点对作为径向基函数输入参数,对所述发丝A进行形变。1) Select at least three three-dimensional coordinate points in the hairline A as key points. In the present application, three are described as an example, for example, three three-dimensional coordinate points a1 and a5 in the hair A shown in FIG. A9, a1 is the tip point, a9 is the root point, and a5 is any other three-dimensional coordinate point. Determining, by a nearest neighbor algorithm, a nearest neighbor of each key point in the scalp layer of the 3D head model as a matching point of each of the key points, and each key point and its corresponding matching point constitute a hair matching point pair; The key point a1 corresponds to the matching point in the scalp layer of the 3D head model is b1, the key point a5 corresponds to the matching point in the scalp layer of the 3D head model is b5, and the key point a9 corresponds to the matching in the scalp layer of the 3D head model. The point is b9. In Fig. 4, B indicates a portion in the hair A where a1 to a9 match the scalp layer of the 3D head model. The hairline A is deformed using a hairline matching point pair as a radial basis function input parameter.
局部形变包括:Local deformation includes:
2)、将发丝A分为至少两个部分。以将发丝A分为两个部分为例,如图4所示,将发丝A分为A1和A2两个部分。在每个部分中选择至少3个三维坐标点为关键点,A1中的3个关键点a1、a3、a5,A2中的3个关键点为a5、a7和a9。然后使用最近邻点算法在所述3D头部模型的头皮层的三维坐标点中确定所述每个部分中的至少3个关键点中每一关键点的最近邻点作为匹配点,并将每一关键点及其对应的匹配点构成分段发丝匹配点对。a1、a3、a5分别对应的匹配点为b1、b3、b5,a5、a7、a9分别对应的匹配点为b5、b7、b9。然后以a1、a3、a5和b1、b3、b5构成的分段匹配点对作为径向基函数的输入参数对发丝A的A1部分进行形变。然后以a5、a7、a9和b5、b7、b9构
成的分段匹配点对作为径向基函数的输入参数对发丝A的A2部分进行形变,如图5所示。为了描述方便,图5中的用数字1表示a1,数字2表示a2,数字3表示a3,以此类推。2), the hairline A is divided into at least two parts. Taking the hairline A into two parts as an example, as shown in FIG. 4, the hairline A is divided into two parts A1 and A2. Select at least 3 three-dimensional coordinate points in each part as the key points, and the three key points in the three key points a1, a3, a5, and A2 in A1 are a5, a7, and a9. And determining, using the nearest neighbor algorithm, the nearest neighbor of each of the at least 3 key points in each of the portions as a matching point in the three-dimensional coordinate point of the scalp layer of the 3D head model, and each A key point and its corresponding matching point constitute a segmented hairline matching point pair. The matching points corresponding to a1, a3, and a5 are b1, b3, and b5, respectively, and the matching points corresponding to a5, a7, and a9 are b5, b7, and b9, respectively. The segment matching point formed by a1, a3, a5 and b1, b3, b5 then deforms the A1 portion of the hair A to the input parameter as a radial basis function. Then with a5, a7, a9 and b5, b7, b9
The resulting segment matching point pairs the A2 portion of the hair A as an input parameter of the radial basis function, as shown in FIG. For convenience of description, numeral 1 in FIG. 5 denotes a1, numeral 2 denotes a2, numeral 3 denotes a3, and so on.
整体到局部形变包括:The overall to local deformation includes:
3)通过1)对发丝A进行整体形变后,然后将形变后的发丝A分为至少两个部分,对每个部分通过2)进行局部形变。3) After 1) the whole deformation of the hair A, the deformed hair A is divided into at least two parts, and each part is locally deformed by 2).
本申请中涉及的径向基函数为预先定义好的函数,具体可以经过大量试验得到的效果较好的函数。本申请中使用的径向基函数可以是
The radial basis function involved in the present application is a predefined function, and a function which is well-executed by a large number of experiments can be obtained. The radial basis function used in this application can be
针对每根头发均执行以针对发丝A的变形方式进行变形,然后对3D头发模板进行更新,确定更新后的3D头发模板是否完全遮挡住所述3D头部模型的头皮层且所述3D头发模板中的发根点构成的发根区域是否遮挡住所述3D头部模型的非头皮层。在确定更新后的3D头发模板未完全遮挡住所述3D头部模型的头皮层或者所述3D头发模板中的发根点构成的发根区域有部分遮挡住所述3D头部模型的非头皮层,重复对3D头发模板中的错误区域中每根头发执行上述1)或2)或3)中的操作,直到更新后的3D头发模板完全遮挡住所述3D头部模型的头皮层且所述3D头发模板中的发根点构成的发根区域未遮挡住所述3D头部模型的非头皮层。Deformation is performed for each hair in a deformed manner for the hair A, and then the 3D hair template is updated to determine whether the updated 3D hair template completely obscures the scalp layer of the 3D head model and the 3D hair template Whether the hair root region formed by the hair root point obscures the non-skin layer of the 3D head model. Determining that the updated 3D hair template does not completely obscure the scalp layer of the 3D head model or the hair root region of the hair root point in the 3D hair template partially obscures the non-scalp layer of the 3D head model, Repeating the operations in 1) or 2) or 3) above for each hair in the wrong area in the 3D hair template until the updated 3D hair template completely obscures the scalp layer of the 3D head model and the 3D hair The hair root region formed by the hair root point in the template does not obscure the non-scalp layer of the 3D head model.
本申请可以快速为存储能力、计算能力相对较低的终端中的3D头部模型构建出具有完好贴合效果的3D头发模型,构建出的3D头发模型的真实感可媲美于采用头发造型建模方法生成的头发模型,却省去了大量的人工交互与运算时间;与现有的头发模型重用技术相比,本申请中无需受限于2D关键点的检测结果、也不受限于2D关键点与正视头发图像的普通部分以及个性部分的匹配精度、无需针对头发个性部分的建模,能够有效提高3D头发模板的重用性,并且构建出的头发模型能够更为精确地保留原型头发的外观。This application can quickly construct a 3D hair model with perfect fit for the 3D head model in the terminal with relatively low storage capacity and computing power. The realistic 3D hair model can be compared with the hair modeling model. The hair model generated by the method saves a lot of manual interaction and computing time; compared with the existing hair model reuse technology, the present application does not need to be limited by the detection result of 2D key points, and is not limited to the 2D key. The matching accuracy of the point and the normal part of the hair image and the personality part, without the need to model the hair part, can effectively improve the reusability of the 3D hair template, and the hair model constructed can more accurately retain the appearance of the prototype hair. .
参见图6,为本申请提供的一种三维头发建模方法流程图。Referring to FIG. 6, a flow chart of a three-dimensional hair modeling method provided by the present application is provided.
S601,确定待创建头发的3D头部模型以及预设的参考头部模型之间的第
一坐标变换关系,以及确定所述3D头部模型与预设的3D头发模板之间的第二坐标变换关系,并基于所述第一坐标变换关系以及第二坐标变换关系将所述3D头部模型与所述3D头发模板进行配准。上述S601可以称为刚性配准过程。S601, determining a third between a 3D head model of the hair to be created and a preset reference head model
a coordinate transformation relationship, and determining a second coordinate transformation relationship between the 3D head model and a preset 3D hair template, and the 3D head based on the first coordinate transformation relationship and the second coordinate transformation relationship The model is registered with the 3D hair template. The above S601 can be referred to as a rigid registration process.
其中,所述预设的3D头发模板和所述预设的参考头部模型相匹配。The preset 3D hair template matches the preset reference head model.
S602,检测到配准后的所述3D头发模板存在错误区域时,使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,以矫正所述错误区域。S602. When it is detected that the registered 3D hair template has an error area, the hair in the wrong area of the 3D hair template is deformed by using a radial basis function RBF to correct the error area.
其中,所述错误区域包括所述3D头发模板中未完全遮挡住所述3D头部模型的头皮层的区域或者所述3D头发模板中的发根点构成的发根区域遮挡住所述3D头部模型的非头皮层的区域。Wherein the error area comprises an area of the 3D hair template that does not completely obscure the scalp layer of the 3D head model or a hair root area formed by the root point in the 3D hair template blocks the 3D head model The area of the non-scalp layer.
可选地,刚性配准过程可以通过如下方式实现,如图7所示。Alternatively, the rigid registration process can be implemented as follows, as shown in FIG.
S701,确定待创建头发的3D头部模型的面部关键点和头皮层关键点,并确定预设的参考头部模型的面部关键点。S701. Determine a facial key point and a scalp key point of the 3D head model of the hair to be created, and determine a facial key point of the preset reference head model.
S702,对所述3D头部模型的面部关键点与所述参考头部模型的面部关键点进行匹配,得到面部匹配点对。S702. Match a facial key point of the 3D head model with a facial key point of the reference head model to obtain a face matching point pair.
S703,根据所述面部匹配点对,确定所述3D头部模型与参考头部模型之间的第一坐标变换关系。S703. Determine a first coordinate transformation relationship between the 3D head model and the reference head model according to the face matching point pair.
S704,根据所述第一坐标变换关系,得到所述3D头发模板在目标坐标系中的三维坐标。S704. Obtain a three-dimensional coordinate of the 3D hair template in a target coordinate system according to the first coordinate transformation relationship.
其中,所述目标坐标系为所述3D头部模型所在的坐标系。The target coordinate system is a coordinate system in which the 3D head model is located.
S705,对经过第一坐标变换关系变换后的所述3D头发模板的发根点和所述3D头部模型的头皮层关键点进行匹配,得到发根匹配点对。S705. Match a root point of the 3D hair template transformed by the first coordinate transformation relationship with a key point of the scalp layer of the 3D head model to obtain a root matching point pair.
S706,根据所述发根匹配点对,确定所述3D头部模型与所述3D头发模板之间的第二坐标变换关系。S706. Determine a second coordinate transformation relationship between the 3D head model and the 3D hair template according to the pair of hair root matching points.
S707,根据所述第二坐标变换关系,将所述3D头发模板与所述3D头部模型进行配准。
S707. Register the 3D hair template with the 3D head model according to the second coordinate transformation relationship.
在图6、图7描述的实施例的基础上,在刚性配准过程中,第一坐标变换关系可以包括旋转关系、缩放关系以及平移关系。其中第一坐标变换关系s.R.t包括缩放关系、旋转关系以及平移关系。其中,缩放关系通过缩放因子s1实现,旋转关系通过旋转矩阵R1实现,平移关系通过平移向量t1实现。缩放因子s1、旋转矩阵R1以及平移向量t1的计算方法可以参见上述对应的描述,本申请在此不再赘述。参见图8,为本申请提供的一种三维头发建模方法示意图。Based on the embodiments described in FIG. 6 and FIG. 7, in the rigid registration process, the first coordinate transformation relationship may include a rotation relationship, a scaling relationship, and a translation relationship. The first coordinate transformation relationship s.R.t includes a scaling relationship, a rotation relationship, and a translation relationship. The scaling relationship is implemented by a scaling factor s1, the rotation relationship is implemented by a rotation matrix R1, and the translation relationship is implemented by a translation vector t1. For the calculation method of the scaling factor s1, the rotation matrix R1, and the translation vector t1, refer to the corresponding description above, and the present application will not be repeated here. Referring to FIG. 8, a schematic diagram of a three-dimensional hair modeling method provided by the present application is provided.
首先基于步骤S701、S702得到3D头部模型以及参考头部模型的面部匹配点对。First, a 3D head model and a face matching point pair of the reference head model are obtained based on steps S701 and S702.
在S703中,在根据所述面部匹配点对确定所述3D头部模型与参考头部模型之间的第一坐标变换关系,可以通过如下方式实现:In S703, determining a first coordinate transformation relationship between the 3D head model and the reference head model according to the face matching point pair may be implemented as follows:
根据所述面部匹配点对确定所述3D头部模型与参考头部模型之间旋转关系、缩放关系以及平移关系。Determining a rotation relationship, a scaling relationship, and a translation relationship between the 3D head model and the reference head model according to the face matching point pair.
具体的,根据所述面部匹配点对计算s1、R1以及t1。Specifically, s1, R1, and t1 are calculated according to the face matching point pair.
在S704中,根据所述第一坐标变换关系,得到3D头发模板的三维坐标点在所述3D头部模型所在的坐标系中的三维坐标,可以通过如下方式实现:In S704, according to the first coordinate transformation relationship, the three-dimensional coordinates of the three-dimensional coordinate point of the 3D hair template in the coordinate system of the 3D head model are obtained, which can be implemented as follows:
通过对所述3D头发模板的三维坐标点使用所述旋转关系、缩放关系以及平移关系依次进行旋转、缩放以及平移操作得到3D头发模板在所述3D头部模型所在的坐标系中的三维坐标。即将所述3D头发模板转化到3D头部模型的坐标系中。The three-dimensional coordinates of the 3D hair template in the coordinate system in which the 3D head model is located are obtained by sequentially rotating, scaling, and translating the three-dimensional coordinate points of the 3D hair template using the rotation relationship, the zoom relationship, and the translation relationship. The 3D hair template is converted into a coordinate system of the 3D head model.
同理,第二坐标变换关系可以包括旋转关系、缩放关系以及平移关系;其中第一坐标变换关系s.R.t包括缩放关系、旋转关系以及平移关系。其中,缩放关系通过缩放因子s2实现,旋转关系通过旋转矩阵R2实现,平移关系通过平移向量t2实现。Similarly, the second coordinate transformation relationship may include a rotation relationship, a scaling relationship, and a translation relationship; wherein the first coordinate transformation relationship s.R.t includes a scaling relationship, a rotation relationship, and a translation relationship. The scaling relationship is implemented by a scaling factor s2, the rotation relationship is implemented by a rotation matrix R2, and the translation relationship is implemented by a translation vector t2.
然后经过S705得到3D头部模型以及3D头发模板的发根匹配点对。在S706中,根据所述发根匹配点对确定所述3D头部模型与所述3D头发模板之间的第二坐标变换关系,可以通过如下方式实现:
Then, through S705, a 3D head model and a root matching point pair of the 3D hair template are obtained. In S706, determining a second coordinate transformation relationship between the 3D head model and the 3D hair template according to the pair of hair root matching points may be implemented as follows:
根据所述发根匹配点对确定所述3D头部模型与所述3D头发模板之间旋转关系、缩放关系以及平移关系。Determining a rotation relationship, a scaling relationship, and a translation relationship between the 3D head model and the 3D hair template according to the pair of hair root matching points.
具体的,根据所述发根匹配点对计算s2、R2以及t2。Specifically, s2, R2, and t2 are calculated according to the pair of root-matching points.
在S707中,根据所述第二坐标变换关系,将所述3D头发模板与所述3D头部模型进行配准,可以通过如下方式实现:In S707, registering the 3D hair template with the 3D head model according to the second coordinate transformation relationship may be implemented as follows:
通过对所述3D头发模板的三维坐标点使用所述旋转关系、缩放关系以及平移关系依次进行旋转、缩放以及平移操作,将所述3D头发模板与所述3D头部模型进行配准。The 3D hair template is registered with the 3D head model by sequentially rotating, scaling, and translating the three-dimensional coordinate points of the 3D hair template using the rotation relationship, the zoom relationship, and the translation relationship.
可选地,所述使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,具体可以使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行整体形变、或者由整体到局部的形变、或者局部形变。Optionally, the radial basis function RBF is used to deform the hair in the wrong area of the 3D hair template, and specifically, the hair in the wrong area of the 3D hair template may be integrally deformed using a radial basis function RBF. Or from the whole to the local deformation, or local deformation.
针对每一根头发进行整体形变包括:The overall deformation for each hair includes:
针对所述3D头发模板的错误区域中每一根头发分别执行如下:Each hair in the wrong area of the 3D hair template is performed as follows:
选择所述每一根头发中的至少3个三维坐标点作为第一关键点,并通过最近邻点算法确定每一第一关键点在所述3D头部模型头皮层的最近邻点作为所述每一第一关键点的匹配点,并将所述每一第一关键点与其对应的匹配点构成发丝匹配点对;Selecting at least three three-dimensional coordinate points in each of the hairs as a first key point, and determining, by a nearest neighbor algorithm, a nearest neighbor point of each first key point in the scalp layer of the 3D head model as the Matching points of each first key point, and each of the first key points and their corresponding matching points constitute a pair of hair matching points;
使用发丝匹配点对作为径向基函数输入参数,对所述每一根头发进行形变。Each of the hairs is deformed using a hairline matching point pair as a radial basis function input parameter.
可选地,所述第一关键点中包括所述每一根头发的发根点以及发梢点。其它第一关键点可以选择每一根头发中的其它三维坐标点。具体可以选择靠近发根点和发梢点中点位置的三维坐标点。Optionally, the first key point includes a hair root point and a hair point of each of the hairs. Other first key points can select other three-dimensional coordinate points in each hair. Specifically, three-dimensional coordinate points close to the root point and the midpoint of the tip point can be selected.
针对每一根头发进行由整体到局部的形变包括:The overall to local deformation for each hair includes:
A1,针对所述3D头发模板的错误区域中每一根头发分别执行如下:A1, each hair in the wrong area of the 3D hair template is performed as follows:
选择所述每一根头发中的至少3个三维坐标点作为第二关键点,并通过最近邻点算法确定所述至少3个第二关键点中每一第二关键点在所述3D头部模型头皮层的最近邻点作为所述每一第二关键点的匹配点,并将所述每一第
二关键点与其对应的匹配点构成发丝匹配点对;使用发丝匹配点对作为径向基函数输入参数,对所述每一根头发进行形变;Selecting at least three three-dimensional coordinate points in each of the hairs as a second key point, and determining, by the nearest neighbor algorithm, each of the at least three second key points in the 3D head The nearest neighbor of the model scalp layer serves as a matching point for each of the second key points, and each of the
The two key points and their corresponding matching points constitute a pair of hair matching points; the hair matching point pairs are used as radial basis function input parameters, and each of the hairs is deformed;
A2,将形变后的每一根头发分为至少两个部分,针对每一部分头发分别执行如下:A2, divide each hair after deformation into at least two parts, and perform the following for each part of hair separately:
将所述每一部分头发中的至少3个三维坐标点作为第三关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第三关键点的最近邻点作为每一第三关键点的匹配点,并将所述每一第三关键点与其对应的匹配点构成分段发丝匹配点对;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。Taking at least 3 three-dimensional coordinate points in each part of the hair as a third key point, and each third key point in each part of the hair in the three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor point as a matching point of each third key point, and each of the third key points and their corresponding matching points constitute a segment hairline matching point pair; The input parameters of the radial basis function deform the hair of each portion.
可选地,所述第二关键点中包括所述每一根头发中的发根点以及发梢点;Optionally, the second key point includes a rooting point and a tip point in each of the hairs;
所述第三关键点包括所述每一部分头发的两个端点。The third key point includes two endpoints of each portion of the hair.
针对每一根头发进行局部的形变包括:Local deformations for each hair include:
针对所述3D头发模板的错误区域中每一根头发分别执行如下:Each hair in the wrong area of the 3D hair template is performed as follows:
将每一根头发分为至少两个部分,并针对每一部分头发分别执行如下:Divide each hair into at least two parts and perform the following for each part of the hair:
将所述每一部分头发中的至少3个三维坐标点作为第四关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第四关键点的最近邻点作为每一第四关键点的匹配点,并将所述每一第四关键点与其对应的匹配点构成分段发丝匹配点对;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。Taking at least 3 three-dimensional coordinate points in each part of the hair as a fourth key point, and each fourth key point in each part of the hair in a three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor as a matching point for each of the fourth key points, and each of the fourth key points and their corresponding matching points constitute a segmented hair matching point pair; The input parameters of the radial basis function deform the hair of each portion.
可选地,所述第三关键点包括所述每一部分头发的两个端点。Optionally, the third key point comprises two endpoints of the hair of each portion.
本申请还提供了一种三维头发建模装置,如图9所示,该装置包括:The present application also provides a three-dimensional hair modeling device, as shown in FIG. 9, the device includes:
第一确定单元901,用于确定待创建头发的3D头部模型以及预设的参考头部模型之间的第一坐标变换关系;a first determining unit 901, configured to determine a first coordinate transformation relationship between a 3D head model of the hair to be created and a preset reference head model;
第二确定单元902,用于确定所述3D头部模型与预设的3D头发模板之间的第二坐标变换关系,其中,所述预设的3D头发模板和所述预设的参考头部模型相匹配;a second determining unit 902, configured to determine a second coordinate transformation relationship between the 3D head model and a preset 3D hair template, wherein the preset 3D hair template and the preset reference header The models match;
配准单元903,用于基于所述第一确定单元901确定所述第一坐标变换关
系以及所述第二确定单元902确定的所述第二坐标变换关系,将所述3D头部模型与所述3D头发模板进行配准;a registration unit 903, configured to determine, according to the first determining unit 901, the first coordinate transformation off
And the second coordinate transformation relationship determined by the second determining unit 902, registering the 3D head model with the 3D hair template;
检测单元904,用于检测配准后的所述3D头发模板是否存在错误区域;The detecting unit 904 is configured to detect whether the registered 3D hair template has an error area;
形变单元905,用于在所述检测单元904检测到错误区域时,使用径向基函数RBF对所述检测单元904检测到所述3D头发模板的错误区域中的头发进行形变,以矫正所述错误区域,其中,所述错误区域包括所述3D头发模板中未完全遮挡住所述3D头部模型的头皮层的区域或者所述3D头发模板中的发根点构成的发根区域遮挡住所述3D头部模型的非头皮层的区域。a deformation unit 905, configured to deform the hair in the wrong area of the 3D hair template by the detecting unit 904 using the radial basis function RBF when the detecting unit 904 detects the wrong area, to correct the An error area, wherein the error area includes an area of the 3D hair template that does not completely obscure the scalp layer of the 3D head model or a hair root area formed by the root point in the 3D hair template blocks the 3D The area of the non-scalp layer of the head model.
本申请可以快速为存储能力、计算能力相对较低的终端中的3D头部模型构建出具有完好贴合效果的3D头发模型,构建出的3D头发模型的真实感可媲美于采用头发造型建模方法生成的头发模型,却省去了大量的人工交互与运算时间;与现有的头发模型重用技术相比,本申请中无需受限于2D关键点的检测结果、也不受限于2D关键点与正视头发图像的普通部分以及个性部分的匹配精度、无需针对头发个性部分的建模,能够有效提高3D头发模板的重用性,并且构建出的头发模型能够更为精确地保留原型头发的外观。This application can quickly construct a 3D hair model with perfect fit for the 3D head model in the terminal with relatively low storage capacity and computing power. The realistic 3D hair model can be compared with the hair modeling model. The hair model generated by the method saves a lot of manual interaction and computing time; compared with the existing hair model reuse technology, the present application does not need to be limited by the detection result of 2D key points, and is not limited to the 2D key. The matching accuracy of the point and the normal part of the hair image and the personality part, without the need to model the hair part, can effectively improve the reusability of the 3D hair template, and the hair model constructed can more accurately retain the appearance of the prototype hair. .
可选地,所述第一确定单元901,具体用于:Optionally, the first determining unit 901 is specifically configured to:
确定待创建头发的3D头部模型的面部关键点和头皮层关键点;确定预设的参考头部模型的面部关键点;对所述3D头部模型的面部关键点与所述参考头部模型的面部关键点进行匹配,得到面部匹配点对;根据所述面部匹配点对,确定所述3D头部模型与所述参考头部模型之间的第一坐标变换关系;Determining a facial key point and a scalp key point of the 3D head model of the hair to be created; determining a facial key point of the preset reference head model; a facial key point of the 3D head model and the reference head model The facial key points are matched to obtain a face matching point pair; and the first coordinate transformation relationship between the 3D head model and the reference head model is determined according to the face matching point pair;
所述配准单元903,用于根据所述第一坐标变换关系,得到所述3D头发模板在目标坐标系中的三维坐标,其中,所述目标坐标系为所述3D头部模型所在的坐标系;The registration unit 903 is configured to obtain, according to the first coordinate transformation relationship, three-dimensional coordinates of the 3D hair template in a target coordinate system, where the target coordinate system is a coordinate of the 3D head model system;
所述第二确定单元902,具体用于:对经过第一坐标变换关系变换后的所述3D头发模板的发根点和所述3D头部模型的头皮层关键点进行匹配,得到发根匹配点对;根据所述发根匹配点对,确定所述3D头部模型与所述3D头发模板之间的第二坐标变换关系;
The second determining unit 902 is specifically configured to: match a root point of the 3D hair template transformed by the first coordinate transformation relationship with a key point of the scalp layer of the 3D head model to obtain a root matching a pair of points; determining a second coordinate transformation relationship between the 3D head model and the 3D hair template according to the pair of hair root matching points;
所述配准单元903,用于根据所述第二坐标变换关系,将所述3D头发模板与所述3D头部模型进行配准。The registration unit 903 is configured to register the 3D hair template with the 3D head model according to the second coordinate transformation relationship.
在一种可能的实现方式中,所述形变单元905,具体用于:In a possible implementation, the deformation unit 905 is specifically configured to:
针对所述3D头发模板的错误区域中每一根头发分别执行如下:Each hair in the wrong area of the 3D hair template is performed as follows:
选择所述每一根头发中的至少3个三维坐标点作为第一关键点,并通过最近邻点算法确定每一第一关键点在所述3D头部模型头皮层的最近邻点作为所述每一第一关键点的匹配点,并将所述每一第一关键点与其对应的匹配点构成发丝匹配点对;Selecting at least three three-dimensional coordinate points in each of the hairs as a first key point, and determining, by a nearest neighbor algorithm, a nearest neighbor point of each first key point in the scalp layer of the 3D head model as the Matching points of each first key point, and each of the first key points and their corresponding matching points constitute a pair of hair matching points;
将发丝匹配点对作为径向基函数的输入参数,对所述每一根头发进行形变。Each of the hairs is deformed by matching the hairline matching points as input parameters of a radial basis function.
可选地,所述第一关键点中包括所述每一个头发的发根点以及发梢点。Optionally, the first key point includes a rooting point and a tip point of each of the hairs.
在一种可能的实现方式中,所述形变单元905,具体用于:In a possible implementation, the deformation unit 905 is specifically configured to:
针对所述3D头发模板的错误区域中每一根头发分别执行如下:Each hair in the wrong area of the 3D hair template is performed as follows:
选择所述每一根头发中的至少3个三维坐标点作为第二关键点,并通过最近邻点算法确定所述至少3个第二关键点中每一第二关键点在所述3D头部模型头皮层的最近邻点作为所述每一第二关键点的匹配点,并将所述每一第二关键点与其对应的匹配点构成发丝匹配点对;Selecting at least three three-dimensional coordinate points in each of the hairs as a second key point, and determining, by the nearest neighbor algorithm, each of the at least three second key points in the 3D head The nearest neighbor of the model scalp layer serves as a matching point of each of the second key points, and each of the second key points and its corresponding matching point constitute a pair of hair matching points;
使用发丝匹配点对作为径向基函数输入参数,对所述每一根头发进行形变;将形变后的每一根头发分为至少两个部分,针对每一部分头发分别执行如下:将所述每一部分头发中的至少3个三维坐标点作为第三关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第三关键点的最近邻点作为每一第三关键点的匹配点,并将所述每一第三关键点与其对应的匹配点构成分段发丝匹配点对;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。Deforming each of the hairs using a hairline matching point pair as a radial basis function input parameter; dividing each deformed hair into at least two portions, respectively performing the following for each portion of the hair: At least 3 three-dimensional coordinate points in each part of the hair as a third key point, and the nearest neighbor of each third key point in each part of the hair in the three-dimensional coordinate point of the scalp layer of the 3D head model a point as a matching point of each third key point, and each of the third key points and their corresponding matching points constitute a segment hairline matching point pair; the segment hairline matching point pair is used as a radial basis The input parameters of the function deform each of the portions of the hair.
可选地,所述第二关键点中可以包括所述每一根头发中的发根点以及发梢点;所述第三关键点中包括所述每一部分头发的两个端点。Optionally, the second key point may include a hair root point and a hair point in each of the hairs; and the third key point includes two end points of each part of the hair.
在一种可能的实现方式中,所述形变单元905,具体用于:
In a possible implementation, the deformation unit 905 is specifically configured to:
针对所述3D头发模板的错误区域中每一根头发分别执行如下:将每一根头发分为至少两个部分,并针对每一部分头发分别执行如下:Each of the hairs in the wrong area of the 3D hair template is performed as follows: each hair is divided into at least two parts, and the hair is separately executed for each part as follows:
将所述每一部分头发中的至少3个三维坐标点作为第四关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第四关键点的最近邻点作为每一第四关键点的匹配点,并将所述每一第四关键点与其对应的匹配点构成分段发丝匹配点对;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。Taking at least 3 three-dimensional coordinate points in each part of the hair as a fourth key point, and each fourth key point in each part of the hair in a three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor as a matching point for each of the fourth key points, and each of the fourth key points and their corresponding matching points constitute a segmented hair matching point pair; The input parameters of the radial basis function deform the hair of each portion.
可选地,所述第三关键点可以包括所述每一部分头发的两个端点。Optionally, the third key point may include two endpoints of each portion of the hair.
本申请中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,另外,在本申请各个实施例中的各功能单元可以集成在一个处理器中,也可以是单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。The division of the unit in the present application is schematic, and is only a logical function division. In actual implementation, there may be another division manner. In addition, each functional unit in each embodiment of the present application may be integrated into one processor. It can also be physically present alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software function module.
其中,集成的单元既可以采用硬件的形式实现时,上述第一确定单元901、第二确定单元902、配准单元903、检测单元904以及形变单元905对应在三维头发建模装置的实体硬件中可以是处理器1001,如图10所示。三维头发建模装置中还可以包括存储器1002,用于存储处理器1001执行的程序代码。Wherein, when the integrated unit can be implemented in the form of hardware, the first determining unit 901, the second determining unit 902, the registering unit 903, the detecting unit 904, and the deforming unit 905 are corresponding to the physical hardware of the three-dimensional hair modeling device. It may be the processor 1001 as shown in FIG. The 3D hair modeling device may further include a memory 1002 for storing program code executed by the processor 1001.
存储器1002可以是易失性存储器(英文:volatile memory),例如随机存取存储器(英文:random-access memory,缩写:RAM);存储器也可以是非易失性存储器(英文:non-volatile memory),例如只读存储器(英文:read-only memory,缩写:ROM),快闪存储器(英文:flash memory),硬盘(英文:hard disk drive,缩写:HDD)或固态硬盘(英文:solid-state drive,缩写:SSD)、或者存储器是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器可以是上述存储器的组合。The memory 1002 may be a volatile memory (English: volatile memory), such as a random access memory (English: random-access memory, abbreviation: RAM); the memory may also be a non-volatile memory (English: non-volatile memory). For example, read-only memory (English: read-only memory, abbreviation: ROM), flash memory (English: flash memory), hard disk (English: hard disk drive, abbreviation: HDD) or solid state drive (English: solid-state drive, Abbreviations: SSD), or memory, are any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory can be a combination of the above memories.
三维头发建模装置中还可以包括通信接口1003,用于配置待创建头发的3D头部模型、预设的参考头部模型、以及预设的3D头发模板,所述预设的
参考头部模型以及预设的3D头发模板相匹配。其中配置完成后保存在存储器1002中。The 3D hair modeling device may further include a communication interface 1003, configured to configure a 3D head model of the hair to be created, a preset reference head model, and a preset 3D hair template, the preset
The reference head model and the preset 3D hair template are matched. After the configuration is completed, it is saved in the memory 1002.
三维头发建模装置中还可以包括显示器1004,由于显示待创建头发的3D头部模型、预设的参考头部模型、以及预设的3D头发模板。The 3D hair modeling device can also include a display 1004 due to the 3D head model displaying the hair to be created, the preset reference head model, and the preset 3D hair template.
其中,处理器1001,存储器1002、通信接口1003、显示器1004可以通过总线1005连接。其它部件之间的连接方式,仅是进行示意性说明,并不引以为限。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图10中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The processor 1001, the memory 1002, the communication interface 1003, and the display 1004 may be connected by a bus 1005. The manner of connection between other components is merely illustrative and not limited. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in FIG. 10, but it does not mean that there is only one bus or one type of bus.
所述处理器1001,用于执行所述存储器1002存储的程序代码,具体执行如下操作:The processor 1001 is configured to execute the program code stored by the memory 1002, and specifically perform the following operations:
确定待创建头发的3D头部模型以及预设的参考头部模型之间的第一坐标变换关系,以及确定所述3D头部模型与预设的3D头发模板之间的第二坐标变换关系,并基于所述第一坐标变换关系以及第二坐标变换关系将所述3D头部模型与所述3D头发模板进行配准。上述S601可以称为刚性配准过程。Determining a first coordinate transformation relationship between the 3D head model of the hair to be created and the preset reference head model, and determining a second coordinate transformation relationship between the 3D head model and the preset 3D hair template, And registering the 3D head model with the 3D hair template based on the first coordinate transformation relationship and the second coordinate transformation relationship. The above S601 can be referred to as a rigid registration process.
其中,所述预设的3D头发模板和所述预设的参考头部模型相匹配。The preset 3D hair template matches the preset reference head model.
检测到配准后的所述3D头发模板存在错误区域时,使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,以矫正所述错误区域。When it is detected that the registered 3D hair template has an erroneous area, the hair in the erroneous area of the 3D hair template is deformed using a radial basis function RBF to correct the erroneous area.
其中,所述错误区域包括所述3D头发模板中未完全遮挡住所述3D头部模型的头皮层的区域或者所述3D头发模板中的发根点构成的发根区域遮挡住所述3D头部模型的非头皮层的区域。Wherein the error area comprises an area of the 3D hair template that does not completely obscure the scalp layer of the 3D head model or a hair root area formed by the root point in the 3D hair template blocks the 3D head model The area of the non-scalp layer.
处理器1001在执行刚性配准过程操作时,可以通过如下方式实现:When performing the rigid registration process operation, the processor 1001 can be implemented as follows:
确定待创建头发的3D头部模型的面部关键点和头皮层关键点,并确定预设的参考头部模型的面部关键点;对所述3D头部模型的面部关键点与所述参考头部模型的面部关键点进行匹配,得到面部匹配点对;根据所述面部匹配点对,确定所述3D头部模型与参考头部模型之间的第一坐标变换关系;根据所述第一坐标变换关系,得到所述3D头发模板在目标坐标系中的三维坐标;其中,所述目标坐标系为所述3D头部模型所在的坐标系;对经过第一坐标变
换关系变换后的所述3D头发模板的发根点和所述3D头部模型的头皮层关键点进行匹配,得到发根匹配点对;根据所述发根匹配点对,确定所述3D头部模型与所述3D头发模板之间的第二坐标变换关系;根据所述第二坐标变换关系,将所述3D头发模板与所述3D头部模型进行配准。Determining a facial key point and a scalp key point of the 3D head model of the hair to be created, and determining a facial key point of the preset reference head model; a facial key point of the 3D head model and the reference head Matching facial key points of the model to obtain a face matching point pair; determining, according to the face matching point pair, a first coordinate transformation relationship between the 3D head model and the reference head model; according to the first coordinate transformation Relation, obtaining a three-dimensional coordinate of the 3D hair template in a target coordinate system; wherein the target coordinate system is a coordinate system in which the 3D head model is located;
Matching the root point of the 3D hair template and the key point of the 3D head model to obtain a root matching point pair; determining the 3D head according to the root matching point pair a second coordinate transformation relationship between the part model and the 3D hair template; and the 3D hair template is registered with the 3D head model according to the second coordinate transformation relationship.
在上述确定待创建头发的3D头部模型的面部关键点和头皮层关键点,并确定预设的参考头部模型的面部关键点时,可以通过在显示器1004显示的3D头部模型中选择面部关键点和头皮层关键点,通过用户输入选择的面部关键点和头皮层关键点,然后处理器1001在接收到用户输入后,确定待创建头发的3D头部模型的面部关键点和头皮层关键点。在确定预设的参考头部模型的面部关键点时,也可以通过同样的方式。When the facial key points and the scalp key points of the 3D head model of the hair to be created are determined as described above, and the facial key points of the preset reference head model are determined, the face may be selected by the 3D head model displayed on the display 1004. Key points and scalp key points, through the user input selected face key points and scalp key points, and then the processor 1001 determines the facial key points and scalp key of the 3D head model of the hair to be created after receiving the user input point. The same method can also be used in determining the facial key points of the preset reference head model.
可选地,处理器1001使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,具体可以使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行整体形变、或者由整体到局部的形变、或者局部形变。Optionally, the processor 1001 deforms the hair in the wrong area of the 3D hair template using a radial basis function RBF, and specifically may use the radial basis function RBF to make the hair in the wrong area of the 3D hair template as a whole. Deformation, or deformation from whole to local, or local deformation.
针对每一根头发进行整体形变包括:The overall deformation for each hair includes:
针对所述3D头发模板的错误区域中每一根头发分别执行如下:Each hair in the wrong area of the 3D hair template is performed as follows:
选择所述每一根头发中的至少3个三维坐标点作为第一关键点,并通过最近邻点算法确定每一第一关键点在所述3D头部模型头皮层的最近邻点作为所述每一第一关键点的匹配点,并将所述每一第一关键点与其对应的匹配点构成发丝匹配点对;Selecting at least three three-dimensional coordinate points in each of the hairs as a first key point, and determining, by a nearest neighbor algorithm, a nearest neighbor point of each first key point in the scalp layer of the 3D head model as the Matching points of each first key point, and each of the first key points and their corresponding matching points constitute a pair of hair matching points;
使用发丝匹配点对作为径向基函数输入参数,对所述每一根头发进行形变。Each of the hairs is deformed using a hairline matching point pair as a radial basis function input parameter.
可选地,所述第一关键点中包括所述每一根头发的发根点以及发梢点。其它第一关键点可以选择每一根头发中的其它三维坐标点。具体可以选择靠近发根点和发梢点中点位置的三维坐标点。Optionally, the first key point includes a hair root point and a hair point of each of the hairs. Other first key points can select other three-dimensional coordinate points in each hair. Specifically, three-dimensional coordinate points close to the root point and the midpoint of the tip point can be selected.
针对每一根头发进行由整体到局部的形变包括:The overall to local deformation for each hair includes:
针对所述3D头发模板的错误区域中每一根头发分别执行如下:选择所述每一根头发中的至少3个三维坐标点作为第二关键点,并通过最近邻点算法
确定所述至少3个第二关键点中每一第二关键点在所述3D头部模型头皮层的最近邻点作为所述每一第二关键点的匹配点,并将所述每一第二关键点与其对应的匹配点构成发丝匹配点对;使用发丝匹配点对作为径向基函数输入参数,对所述每一根头发进行形变;For each hair in the wrong area of the 3D hair template, respectively, the following is performed: selecting at least three three-dimensional coordinate points in each of the hairs as the second key point, and adopting the nearest neighbor algorithm
Determining, at each of the at least 3 second key points, a nearest neighbor point of the scalp layer of the 3D head model as a matching point of each of the second key points, and each of the The two key points and their corresponding matching points constitute a pair of hair matching points; the hair matching point pairs are used as radial basis function input parameters, and each of the hairs is deformed;
将形变后的每一根头发分为至少两个部分,针对每一部分头发分别执行如下:将所述每一部分头发中的至少3个三维坐标点作为第三关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第三关键点的最近邻点作为每一第三关键点的匹配点,并将所述每一第三关键点与其对应的匹配点构成分段发丝匹配点对;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。Dividing each of the deformed hairs into at least two parts, respectively, for each part of the hair is performed as follows: at least three three-dimensional coordinate points in each part of the hair are regarded as a third key point, and in the 3D head a three-dimensional coordinate point of the scalp layer of the model, a nearest neighbor point of each third key point in each part of the hair as a matching point of each third key point, and corresponding to each third key point The matching points constitute a segmented hairline matching point pair; the segment hairline matching point pair is deformed as an input parameter of a radial basis function.
可选地,所述第二关键点中包括所述每一根头发中的发根点以及发梢点;Optionally, the second key point includes a rooting point and a tip point in each of the hairs;
所述第三关键点包括所述每一部分头发的两个端点。The third key point includes two endpoints of each portion of the hair.
针对每一根头发进行局部的形变包括:Local deformations for each hair include:
针对所述3D头发模板的错误区域中每一根头发分别执行如下:将每一根头发分为至少两个部分,并针对每一部分头发分别执行如下:将所述每一部分头发中的至少3个三维坐标点作为第四关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第四关键点的最近邻点作为每一第四关键点的匹配点,并将所述每一第四关键点与其对应的匹配点构成分段发丝匹配点对;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。Each hair in the wrong area of the 3D hair template is separately performed as follows: each hair is divided into at least two parts, and is performed separately for each part of the hair as follows: at least 3 of each part of the hair is to be The three-dimensional coordinate point is used as the fourth key point, and the nearest neighbor point of each fourth key point in each part of the hair is taken as each fourth key point in the three-dimensional coordinate point of the scalp layer of the 3D head model Matching points, and each of the fourth key points and their corresponding matching points constitute a segment hairline matching point pair; the segment hairline matching point pair is used as a radial basis function input parameter for each Some of the hair is deformed.
可选地,所述第三关键点包括所述每一部分头发的两个端点。Optionally, the third key point comprises two endpoints of the hair of each portion.
如图11所示,本申请中首先完成预先构建的3D头部模型与预先存储的3D头发模板的刚性匹配。完成刚性匹配操作后,3D头发模板与3D头部模型的头皮层对齐,部分区域可能存在错误的遮挡关系,如图11中圆环标注的区域。然后利用3D头部模型头皮层的关键点来指导3D头发模型进行由整体到局部的形变。形变可消除错误的遮挡关系,得到与3D头部模型呈现完好贴合效果的3D头发模板。
As shown in FIG. 11, in the present application, the rigid matching of the pre-built 3D head model with the pre-stored 3D hair template is first completed. After the rigid matching operation is completed, the 3D hair template is aligned with the scalp layer of the 3D head model, and some areas may have an incorrect occlusion relationship, such as the area marked by the ring in FIG. The key points of the 3D head model scalp are then used to guide the 3D hair model from overall to local deformation. Deformation eliminates false occlusion relationships and results in a 3D hair template that fits well with the 3D head model.
本申请可以快速为存储能力、计算能力相对较低的终端中的3D头部模型构建出具有完好贴合效果的3D头发模型,构建出的3D头发模型的真实感可媲美于采用头发造型建模方法生成的头发模型,却省去了大量的人工交互与运算时间;与现有的头发模型重用技术相比,本申请中无需受限于2D关键点的检测结果、也不受限于2D关键点与正视头发图像的普通部分以及个性部分的匹配精度、无需针对头发个性部分的建模,能够有效提高3D头发模板的重用性,并且构建出的头发模型能够更为精确地保留原型头发的外观。This application can quickly construct a 3D hair model with perfect fit for the 3D head model in the terminal with relatively low storage capacity and computing power. The realistic 3D hair model can be compared with the hair modeling model. The hair model generated by the method saves a lot of manual interaction and computing time; compared with the existing hair model reuse technology, the present application does not need to be limited by the detection result of 2D key points, and is not limited to the 2D key. The matching accuracy of the point and the normal part of the hair image and the personality part, without the need to model the hair part, can effectively improve the reusability of the 3D hair template, and the hair model constructed can more accurately retain the appearance of the prototype hair. .
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present application can be provided as a method, system, or computer program product. Thus, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment in combination of software and hardware. Moreover, the application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
本申请是参照根据本申请的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the present application. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图
一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. Instructions are provided for implementation in the flowchart
The steps of a process or a plurality of processes and/or block diagrams of a function specified in a block or blocks.
尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。While the preferred embodiment of the present application has been described, those skilled in the art can make further changes and modifications to these embodiments once they are aware of the basic inventive concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and the modifications and
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。
It will be apparent to those skilled in the art that various modifications and changes can be made in the present application without departing from the spirit and scope of the application. Thus, it is intended that the present invention cover the modifications and variations of the present invention.
Claims (17)
- 一种三维头发建模方法,其特征在于,包括:A three-dimensional hair modeling method, comprising:确定待创建头发的3D头部模型以及预设的参考头部模型之间的第一坐标变换关系,以及确定所述3D头部模型与预设的3D头发模板之间的第二坐标变换关系,并基于所述第一坐标变换关系以及第二坐标变换关系将所述3D头部模型与所述3D头发模板进行配准;其中,所述预设的3D头发模板和所述预设的参考头部模型相匹配;Determining a first coordinate transformation relationship between the 3D head model of the hair to be created and the preset reference head model, and determining a second coordinate transformation relationship between the 3D head model and the preset 3D hair template, And registering the 3D head model with the 3D hair template based on the first coordinate transformation relationship and the second coordinate transformation relationship; wherein the preset 3D hair template and the preset reference header The model is matched;检测到配准后的所述3D头发模板存在错误区域时,使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,以矫正所述错误区域,其中,所述错误区域包括所述3D头发模板中未完全遮挡住所述3D头部模型的头皮层的区域或者所述3D头发模板中的发根点构成的发根区域遮挡住所述3D头部模型的非头皮层的区域。When it is detected that the registered 3D hair template has an error area, the hair in the wrong area of the 3D hair template is deformed using a radial basis function RBF to correct the error area, wherein the error area Including the region of the 3D hair template that does not completely obscure the scalp layer of the 3D head model or the hair root region of the 3D hair template obscures the non-skin layer region of the 3D head model .
- 如权利要求1所述的方法,其特征在于,确定待创建头发的3D头部模型以及预设的参考头部模型之间的第一坐标转换关系,以及确定所述3D头部模型与预设的3D头发模板之间的第二坐标转换关系,并基于所述第一坐标转换关系以及第二坐标转换关系将所述3D头部模型与所述3D头发模板进行配准,包括:The method of claim 1 , wherein determining a first coordinate transformation relationship between the 3D head model of the hair to be created and the preset reference head model, and determining the 3D head model and the preset Corresponding to the second coordinate transformation relationship between the 3D hair templates, and registering the 3D head model with the 3D hair template based on the first coordinate transformation relationship and the second coordinate transformation relationship, including:确定待创建头发的3D头部模型的面部关键点和头皮层关键点;Determining facial key points and scalp key points of the 3D head model of the hair to be created;确定预设的参考头部模型的面部关键点;Determining a facial key point of the preset reference head model;对所述3D头部模型的面部关键点与所述参考头部模型的面部关键点进行匹配,得到面部匹配点对;Matching a facial key point of the 3D head model with a facial key point of the reference head model to obtain a face matching point pair;根据所述面部匹配点对,确定所述3D头部模型与所述参考头部模型之间的第一坐标变换关系;Determining, according to the pair of face matching points, a first coordinate transformation relationship between the 3D head model and the reference head model;根据所述第一坐标变换关系,得到所述3D头发模板在目标坐标系中的三维坐标,其中,所述目标坐标系为所述3D头部模型所在的坐标系;Obtaining a three-dimensional coordinate of the 3D hair template in a target coordinate system according to the first coordinate transformation relationship, wherein the target coordinate system is a coordinate system in which the 3D head model is located;对经过第一坐标变换关系变换后的所述3D头发模板的发根点和所述3D 头部模型的头皮层关键点进行匹配,得到发根匹配点对;a root point of the 3D hair template transformed by the first coordinate transformation relationship and the 3D The key points of the scalp layer of the head model are matched to obtain a pair of root matching points;根据所述发根匹配点对,确定所述3D头部模型与所述3D头发模板之间的第二坐标变换关系;Determining, according to the pair of hair root matching points, a second coordinate transformation relationship between the 3D head model and the 3D hair template;根据所述第二坐标变换关系,将所述3D头发模板与所述3D头部模型进行配准。And registering the 3D hair template with the 3D head model according to the second coordinate transformation relationship.
- 如权利要求1或2所述的方法,其特征在于,所述使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,包括:The method according to claim 1 or 2, wherein said deforming the hair in the erroneous region of said 3D hair template using a radial basis function RBF comprises:针对所述3D头发模板的错误区域中每一根头发分别执行如下:Each hair in the wrong area of the 3D hair template is performed as follows:选择所述每一根头发中的至少3个三维坐标点作为第一关键点,并通过最近邻点算法确定每一第一关键点在所述3D头部模型头皮层的最近邻点作为所述每一第一关键点的匹配点,并将所述每一第一关键点与其对应的匹配点构成发丝匹配点对;Selecting at least three three-dimensional coordinate points in each of the hairs as a first key point, and determining, by a nearest neighbor algorithm, a nearest neighbor point of each first key point in the scalp layer of the 3D head model as the Matching points of each first key point, and each of the first key points and their corresponding matching points constitute a pair of hair matching points;将发丝匹配点对作为径向基函数的输入参数,对所述每一根头发进行形变。Each of the hairs is deformed by matching the hairline matching points as input parameters of a radial basis function.
- 如权利要求3所述的方法,其特征在于,所述第一关键点中包括所述每一个头发的发根点以及发梢点。The method of claim 3 wherein said first key point comprises a root point and a tip point of said each hair.
- 如权利要求1或2所述的方法,其特征在于,所述使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,包括:The method according to claim 1 or 2, wherein said deforming the hair in the erroneous region of said 3D hair template using a radial basis function RBF comprises:针对所述3D头发模板的错误区域中每一根头发分别执行如下:Each hair in the wrong area of the 3D hair template is performed as follows:选择所述每一根头发中的至少3个三维坐标点作为第二关键点,并通过最近邻点算法确定所述至少3个第二关键点中每一第二关键点在所述3D头部模型头皮层的最近邻点作为所述每一第二关键点的匹配点,并将所述每一第二关键点与其对应的匹配点构成发丝匹配点对;Selecting at least three three-dimensional coordinate points in each of the hairs as a second key point, and determining, by the nearest neighbor algorithm, each of the at least three second key points in the 3D head The nearest neighbor of the model scalp layer serves as a matching point of each of the second key points, and each of the second key points and its corresponding matching point constitute a pair of hair matching points;使用发丝匹配点对作为径向基函数输入参数,对所述每一根头发进行形变;Deforming each of the hairs using a hairline matching point pair as a radial basis function input parameter;将形变后的每一根头发分为至少两个部分,针对每一部分头发分别执行如下: Divide each hair after deformation into at least two parts, and perform the following for each part of the hair separately:将所述每一部分头发中的至少3个三维坐标点作为第三关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第三关键点的最近邻点作为每一第三关键点的匹配点,并将所述每一第三关键点与其对应的匹配点构成分段发丝匹配点对;Taking at least 3 three-dimensional coordinate points in each part of the hair as a third key point, and each third key point in each part of the hair in the three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor point as a matching point of each third key point, and each of the third key points and its corresponding matching point constitute a segment hairline matching point pair;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。Each of the portions of hair is deformed by the segmented hairline matching point pair as an input parameter to a radial basis function.
- 如权利要求5所述的方法,其特征在于,所述第二关键点中包括所述每一根头发中的发根点以及发梢点;The method according to claim 5, wherein said second key point comprises a hair root point and a hair point in said each hair;所述第三关键点中包括所述每一部分头发的两个端点。The third key point includes two endpoints of each portion of the hair.
- 如权利要求1或2所述的方法,其特征在于,所述使用径向基函数RBF对所述3D头发模板的错误区域中的头发进行形变,包括:The method according to claim 1 or 2, wherein said deforming the hair in the erroneous region of said 3D hair template using a radial basis function RBF comprises:针对所述3D头发模板的错误区域中每一根头发分别执行如下:Each hair in the wrong area of the 3D hair template is performed as follows:将每一根头发分为至少两个部分,并针对每一部分头发分别执行如下:Divide each hair into at least two parts and perform the following for each part of the hair:将所述每一部分头发中的至少3个三维坐标点作为第四关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第四关键点的最近邻点作为每一第四关键点的匹配点,并将所述每一第四关键点与其对应的匹配点构成分段发丝匹配点对;Taking at least 3 three-dimensional coordinate points in each part of the hair as a fourth key point, and each fourth key point in each part of the hair in a three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor point as a matching point of each fourth key point, and each of the fourth key points and their corresponding matching points constitute a segment hairline matching point pair;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。Each of the portions of hair is deformed by the segmented hairline matching point pair as an input parameter to a radial basis function.
- 如权利要求7所述的方法,其特征在于,所述第三关键点包括所述每一部分头发的两个端点。The method of claim 7 wherein said third key point comprises two endpoints of said each portion of hair.
- 一种三维头发建模装置,其特征在于,包括:A three-dimensional hair modeling device, comprising:第一确定单元,用于确定待创建头发的3D头部模型以及预设的参考头部模型之间的第一坐标变换关系;a first determining unit, configured to determine a first coordinate transformation relationship between the 3D head model of the hair to be created and the preset reference head model;第二确定单元,用于确定所述3D头部模型与预设的3D头发模板之间的第二坐标变换关系,其中,所述预设的3D头发模板和所述预设的参考头部模型相匹配; a second determining unit, configured to determine a second coordinate transformation relationship between the 3D head model and a preset 3D hair template, wherein the preset 3D hair template and the preset reference head model Match配准单元,用于基于所述确定单元确定所述第一坐标变换关系以及所述第二坐标变换关系,将所述3D头部模型与所述3D头发模板进行配准;a registration unit, configured to determine the first coordinate transformation relationship and the second coordinate transformation relationship based on the determining unit, and register the 3D head model with the 3D hair template;检测单元,用于检测配准后的所述3D头发模板是否存在错误区域;a detecting unit, configured to detect whether the registered 3D hair template has an error area;形变单元,用于使用径向基函数RBF对所述检测单元检测到所述3D头发模板的错误区域中的头发进行形变,以矫正所述错误区域,其中,所述错误区域包括所述3D头发模板中未完全遮挡住所述3D头部模型的头皮层的区域或者所述3D头发模板中的发根点构成的发根区域遮挡住所述3D头部模型的非头皮层的区域。a deformation unit for deforming hair in the erroneous area of the 3D hair template detected by the detecting unit using a radial basis function RBF to correct the erroneous area, wherein the erroneous area includes the 3D hair The area of the scalp layer in the template that does not completely obscure the 3D head model or the hair root point in the 3D hair template obscures the area of the non-skin layer of the 3D head model.
- 如权利要求9所述的装置,其特征在于,所述第一确定单元,具体用于:The device according to claim 9, wherein the first determining unit is specifically configured to:确定待创建头发的3D头部模型的面部关键点和头皮层关键点;确定预设的参考头部模型的面部关键点;对所述3D头部模型的面部关键点与所述参考头部模型的面部关键点进行匹配,得到面部匹配点对;根据所述面部匹配点对,确定所述3D头部模型与所述参考头部模型之间的第一坐标变换关系;Determining a facial key point and a scalp key point of the 3D head model of the hair to be created; determining a facial key point of the preset reference head model; a facial key point of the 3D head model and the reference head model The facial key points are matched to obtain a face matching point pair; and the first coordinate transformation relationship between the 3D head model and the reference head model is determined according to the face matching point pair;所述配准单元,用于根据所述第一坐标变换关系,得到所述3D头发模板在目标坐标系中的三维坐标,其中,所述目标坐标系为所述3D头部模型所在的坐标系;The registration unit is configured to obtain, according to the first coordinate transformation relationship, three-dimensional coordinates of the 3D hair template in a target coordinate system, where the target coordinate system is a coordinate system in which the 3D head model is located ;所述第二确定单元,具体用于:对经过第一坐标变换关系变换后的所述3D头发模板的发根点和所述3D头部模型的头皮层关键点进行匹配,得到发根匹配点对;根据所述发根匹配点对,确定所述3D头部模型与所述3D头发模板之间的第二坐标变换关系;The second determining unit is specifically configured to: match a root point of the 3D hair template transformed by the first coordinate transformation relationship with a key point of the scalp layer of the 3D head model to obtain a root matching point Determining, according to the pair of hair root matching points, determining a second coordinate transformation relationship between the 3D head model and the 3D hair template;所述配准单元,用于根据所述第二坐标变换关系,将所述3D头发模板与所述3D头部模型进行配准。The registration unit is configured to register the 3D hair template with the 3D head model according to the second coordinate transformation relationship.
- 如权利要求9或10所述的装置,其特征在于,所述形变单元,具体用于:The device according to claim 9 or 10, wherein the deformation unit is specifically configured to:针对所述3D头发模板的错误区域中每一根头发分别执行如下:Each hair in the wrong area of the 3D hair template is performed as follows:选择所述每一根头发中的至少3个三维坐标点作为第一关键点,并通过 最近邻点算法确定每一第一关键点在所述3D头部模型头皮层的最近邻点作为所述每一第一关键点的匹配点,并将所述每一第一关键点与其对应的匹配点构成发丝匹配点对;Selecting at least 3 three-dimensional coordinate points in each of the hairs as the first key point and passing The nearest neighbor algorithm determines a nearest neighbor point of the first key point in the scalp layer of the 3D head model as a matching point of each of the first key points, and corresponding each of the first key points The matching points constitute a pair of hair matching points;将发丝匹配点对作为径向基函数的输入参数,对所述每一根头发进行形变。Each of the hairs is deformed by matching the hairline matching points as input parameters of a radial basis function.
- 如权利要求11所述的装置,其特征在于,所述第一关键点中包括所述每一个头发的发根点以及发梢点。The device of claim 11 wherein said first key point comprises a root point and a tip point of said each hair.
- 如权利要求9或10所述的装置,其特征在于,所述形变单元,具体用于:The device according to claim 9 or 10, wherein the deformation unit is specifically configured to:针对所述3D头发模板的错误区域中每一根头发分别执行如下:Each hair in the wrong area of the 3D hair template is performed as follows:选择所述每一根头发中的至少3个三维坐标点作为第二关键点,并通过最近邻点算法确定所述至少3个第二关键点中每一第二关键点在所述3D头部模型头皮层的最近邻点作为所述每一第二关键点的匹配点,并将所述每一第二关键点与其对应的匹配点构成发丝匹配点对;Selecting at least three three-dimensional coordinate points in each of the hairs as a second key point, and determining, by the nearest neighbor algorithm, each of the at least three second key points in the 3D head The nearest neighbor of the model scalp layer serves as a matching point of each of the second key points, and each of the second key points and its corresponding matching point constitute a pair of hair matching points;使用发丝匹配点对作为径向基函数输入参数,对所述每一根头发进行形变;Deforming each of the hairs using a hairline matching point pair as a radial basis function input parameter;将形变后的每一根头发分为至少两个部分,针对每一部分头发分别执行如下:Divide each hair after deformation into at least two parts, and perform the following for each part of the hair separately:将所述每一部分头发中的至少3个三维坐标点作为第三关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第三关键点的最近邻点作为每一第三关键点的匹配点,并将所述每一第三关键点与其对应的匹配点构成分段发丝匹配点对;Taking at least 3 three-dimensional coordinate points in each part of the hair as a third key point, and each third key point in each part of the hair in the three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor point as a matching point of each third key point, and each of the third key points and its corresponding matching point constitute a segment hairline matching point pair;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。Each of the portions of hair is deformed by the segmented hairline matching point pair as an input parameter to a radial basis function.
- 如权利要求13所述的装置,其特征在于,所述第二关键点中包括所述每一根头发中的发根点以及发梢点;The device according to claim 13, wherein said second key point includes a hair root point and a hair point in said each hair;所述第三关键点中包括所述每一部分头发的两个端点。 The third key point includes two endpoints of each portion of the hair.
- 如权利要求9或10所述的装置,其特征在于,所述形变单元,具体用于:The device according to claim 9 or 10, wherein the deformation unit is specifically configured to:针对所述3D头发模板的错误区域中每一根头发分别执行如下:Each hair in the wrong area of the 3D hair template is performed as follows:将每一根头发分为至少两个部分,并针对每一部分头发分别执行如下:Divide each hair into at least two parts and perform the following for each part of the hair:将所述每一部分头发中的至少3个三维坐标点作为第四关键点,并在所述3D头部模型的头皮层的三维坐标点中将所述每一部分头发中的每一第四关键点的最近邻点作为每一第四关键点的匹配点,并将所述每一第四关键点与其对应的匹配点构成分段发丝匹配点对;Taking at least 3 three-dimensional coordinate points in each part of the hair as a fourth key point, and each fourth key point in each part of the hair in a three-dimensional coordinate point of the scalp layer of the 3D head model a nearest neighbor point as a matching point of each fourth key point, and each of the fourth key points and their corresponding matching points constitute a segment hairline matching point pair;将所述分段发丝匹配点对作为径向基函数的输入参数对所述每一部分头发进行形变。Each of the portions of hair is deformed by the segmented hairline matching point pair as an input parameter to a radial basis function.
- 如权利要求15所述的装置,其特征在于,所述第三关键点包括所述每一部分头发的两个端点。The device of claim 15 wherein said third key point comprises two endpoints of said each portion of hair.
- 一种三维头发建模装置,其特征在于,包括:A three-dimensional hair modeling device, comprising:通信接口、存储器以及处理器;Communication interface, memory, and processor;所述通信接口,用于配置待创建头发的3D头部模型、预设的参考头部模型、以及预设的3D头发模板,所述预设的参考头部模型以及预设的3D头发模板相匹配;The communication interface is configured to configure a 3D head model of the hair to be created, a preset reference head model, and a preset 3D hair template, and the preset reference head model and the preset 3D hair template phase match;所述存储器,用于存储所述处理器执行的程序代码;The memory is configured to store program code executed by the processor;所述处理器,用于执行所述存储器存储的程序代码,具体执行权利要求1至8任一项所述的方法。 The processor is configured to execute the program code stored in the memory, and specifically execute the method according to any one of claims 1 to 8.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2016/080511 WO2017185301A1 (en) | 2016-04-28 | 2016-04-28 | Three-dimensional hair modelling method and device |
CN201680025609.1A CN107615337B (en) | 2016-04-28 | 2016-04-28 | Three-dimensional hair modeling method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2016/080511 WO2017185301A1 (en) | 2016-04-28 | 2016-04-28 | Three-dimensional hair modelling method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2017185301A1 true WO2017185301A1 (en) | 2017-11-02 |
Family
ID=60161663
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2016/080511 WO2017185301A1 (en) | 2016-04-28 | 2016-04-28 | Three-dimensional hair modelling method and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN107615337B (en) |
WO (1) | WO2017185301A1 (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112419487A (en) * | 2020-12-02 | 2021-02-26 | 网易(杭州)网络有限公司 | Three-dimensional hair reconstruction method and device, electronic equipment and storage medium |
CN112426716A (en) * | 2020-11-26 | 2021-03-02 | 网易(杭州)网络有限公司 | Three-dimensional hair model processing method, device, equipment and storage medium |
CN113713387A (en) * | 2021-08-27 | 2021-11-30 | 网易(杭州)网络有限公司 | Virtual curling model rendering method, device, equipment and storage medium |
CN114373057A (en) * | 2021-12-22 | 2022-04-19 | 聚好看科技股份有限公司 | Method and equipment for matching hair with head model |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109002553B (en) * | 2018-08-08 | 2021-10-01 | 北京旷视科技有限公司 | Method and device for constructing hair model, electronic equipment and computer readable medium |
CN109408653B (en) * | 2018-09-30 | 2022-01-28 | 叠境数字科技(上海)有限公司 | Human body hairstyle generation method based on multi-feature retrieval and deformation |
CN114202597B (en) * | 2021-12-07 | 2023-02-03 | 北京百度网讯科技有限公司 | Image processing method and apparatus, device, medium and product |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102800129A (en) * | 2012-06-20 | 2012-11-28 | 浙江大学 | Hair modeling and portrait editing method based on single image |
CN103606186A (en) * | 2013-02-02 | 2014-02-26 | 浙江大学 | Virtual hair style modeling method of images and videos |
CN103955962A (en) * | 2014-04-21 | 2014-07-30 | 华为软件技术有限公司 | Device and method for virtualizing human hair growth |
CN105405163A (en) * | 2015-12-28 | 2016-03-16 | 北京航空航天大学 | Vivid static-state hair modeling method based on multiple direction fields |
US9317970B2 (en) * | 2010-01-18 | 2016-04-19 | Disney Enterprises, Inc. | Coupled reconstruction of hair and skin |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101344373A (en) * | 2008-08-14 | 2009-01-14 | 中国人民解放军总后勤部军需装备研究所 | Standardization processing method based on three-dimensional head and face curved surface modeling |
JP5035372B2 (en) * | 2010-03-17 | 2012-09-26 | カシオ計算機株式会社 | 3D modeling apparatus, 3D modeling method, and program |
CN102419868B (en) * | 2010-09-28 | 2016-08-03 | 三星电子株式会社 | Equipment and the method for 3D scalp electroacupuncture is carried out based on 3D hair template |
CN103035030B (en) * | 2012-12-10 | 2015-06-17 | 西北大学 | Hair model modeling method |
CN103366400B (en) * | 2013-07-24 | 2017-09-12 | 深圳市华创振新科技发展有限公司 | A kind of three-dimensional head portrait automatic generation method |
-
2016
- 2016-04-28 CN CN201680025609.1A patent/CN107615337B/en active Active
- 2016-04-28 WO PCT/CN2016/080511 patent/WO2017185301A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9317970B2 (en) * | 2010-01-18 | 2016-04-19 | Disney Enterprises, Inc. | Coupled reconstruction of hair and skin |
CN102800129A (en) * | 2012-06-20 | 2012-11-28 | 浙江大学 | Hair modeling and portrait editing method based on single image |
CN103606186A (en) * | 2013-02-02 | 2014-02-26 | 浙江大学 | Virtual hair style modeling method of images and videos |
CN103955962A (en) * | 2014-04-21 | 2014-07-30 | 华为软件技术有限公司 | Device and method for virtualizing human hair growth |
CN105405163A (en) * | 2015-12-28 | 2016-03-16 | 北京航空航天大学 | Vivid static-state hair modeling method based on multiple direction fields |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112426716A (en) * | 2020-11-26 | 2021-03-02 | 网易(杭州)网络有限公司 | Three-dimensional hair model processing method, device, equipment and storage medium |
CN112419487A (en) * | 2020-12-02 | 2021-02-26 | 网易(杭州)网络有限公司 | Three-dimensional hair reconstruction method and device, electronic equipment and storage medium |
CN112419487B (en) * | 2020-12-02 | 2023-08-22 | 网易(杭州)网络有限公司 | Three-dimensional hair reconstruction method, device, electronic equipment and storage medium |
CN113713387A (en) * | 2021-08-27 | 2021-11-30 | 网易(杭州)网络有限公司 | Virtual curling model rendering method, device, equipment and storage medium |
CN114373057A (en) * | 2021-12-22 | 2022-04-19 | 聚好看科技股份有限公司 | Method and equipment for matching hair with head model |
Also Published As
Publication number | Publication date |
---|---|
CN107615337B (en) | 2020-08-25 |
CN107615337A (en) | 2018-01-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2017185301A1 (en) | Three-dimensional hair modelling method and device | |
US11055906B2 (en) | Method, device and computing device of face image fusion | |
KR102616010B1 (en) | System and method for photorealistic real-time human animation | |
WO2021135627A1 (en) | Method for constructing three-dimensional model of target object, and related apparatus | |
WO2020042975A1 (en) | Face pose estimation/three-dimensional face reconstruction method and apparatus, and electronic device | |
CN110060348B (en) | Face image shaping method and device | |
US9202312B1 (en) | Hair simulation method | |
US10467793B2 (en) | Computer implemented method and device | |
KR20100138648A (en) | Image processing apparatus and method | |
CN111833236B (en) | Method and device for generating three-dimensional face model for simulating user | |
WO2021062998A1 (en) | Image processing method, apparatus and electronic device | |
WO2024103890A1 (en) | Model construction method and apparatus, reconstruction method and apparatus, and electronic device and non-volatile readable storage medium | |
KR102689515B1 (en) | Methods and apparatus, electronic devices and storage media for processing facial information | |
CN112419144B (en) | Face image processing method and device, electronic equipment and storage medium | |
CN110322571B (en) | Page processing method, device and medium | |
TWI763205B (en) | Method and apparatus for key point detection, electronic device, and storage medium | |
CN106558042B (en) | Method and device for positioning key points of image | |
JP2020177615A (en) | Method of generating 3d facial model for avatar and related device | |
Wither et al. | Realistic hair from a sketch | |
CN116433812A (en) | Method and device for generating virtual character by using 2D face picture | |
CN116092152A (en) | Hairstyle matching method and device, electronic equipment and storage medium | |
CN115082640A (en) | Single image-based 3D face model texture reconstruction method and equipment | |
Pal | A reconstruction method using geometric subdivision and NURBS interpolation | |
CN114998554B (en) | Three-dimensional cartoon face modeling method and device | |
CN109117736B (en) | Method and computing device for judging visibility of face points |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16899814 Country of ref document: EP Kind code of ref document: A1 |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 16899814 Country of ref document: EP Kind code of ref document: A1 |