Summary of the invention
In view of this, the invention provides a kind of hair style effect map generalization method and system, so that same face image can mate the hair style of various deflection angles.
A kind of hair style effect map generalization method comprises:
Gather user's the first face image;
Obtain described the first face image key point information;
According to described key point information the 3D of face model masterplate is made amendment, obtain the user's corresponding with described the first face image 3D model;
According to the selection instruction of user to hair style, determine the hair style image that the user is required;
Obtain described hair style image key points information;
Determine the deflection angle of described hair style image;
According to described deflection angle described user's 3D model is carried out angular deflection, so that the deflection angle of described user's 3D model is corresponding with the deflection angle of described hair style image;
3D model generation user the second face image according to the user after the deflection;
Described the second face image and described hair style image are merged, generate the hair style design sketch.
Preferably, describedly according to described key point information the 3D of face model masterplate is made amendment, obtains also to comprise before the user's corresponding with described the first face image the step of 3D model:
According to face database pivot analysis eigenwert coefficient, learn the original 3D of a face model masterplate.
Preferably, also comprise:
Golden interpolation in the curve negotiating gram of the described original 3D of the face model masterplate that obtains is carried out smooth treatment, obtain the 3D of face model masterplate.
Preferably, describedly according to described key point information the 3D of face model masterplate is made amendment, obtains the user's corresponding with described the first face image 3D model, be specially:
The 3D of face model masterplate after described key point information and the smooth treatment is shone upon, obtain the user's corresponding with described the first face image 3D model.
Preferably, described the second face image and described hair style image are being merged, are also comprising before the step of generation hair style design sketch:
Take user's the first face image of gathering as standard, described user's the first face image key point information and described hair style image key points information are carried out linear fit, so that user's face image and hair style image are complementary.
Preferably, described the first face image key point information key point position that is binocular, lip, nose and face mask.
Preferably, the described hair style image key points information key point position that is face mask.
Preferably, described the first face image is user's direct picture.
Preferably, also comprise:
According to the shared area of user's hair in described the first face image, described hair style image is carried out width and adjustment highly.
Preferably, also comprise:
Hair style design sketch interpolation background for described the second face image and described hair style image merging generation.
A kind of generation system of hair style design sketch comprises:
The first collecting unit is used for gathering user's the first face image;
The first acquiring unit is used for obtaining described the first face image key point information;
The model acquiring unit is used for according to described key point information the 3D of face model masterplate being made amendment, and obtains the user's corresponding with described the first face image 3D model;
The hair style selected cell is used for according to the selection instruction of user to hair style, determines the hair style image that the user is required;
Second acquisition unit is used for obtaining described hair style image key points information;
The angle acquiring unit is for the deflection angle of determining described hair style image;
The angle rotary unit is used for according to described deflection angle described user's 3D model being carried out angular deflection, so that corresponding with the deflection angle of described hair style image with the deflection angle of described user's 3D model;
The second collecting unit is used for 3D model generation user the second face image according to the user after the deflection;
Image generation unit is used for described the second face image and described hair style image are merged, and generates the hair style design sketch.
Preferably, also comprise:
The master pattern acquiring unit, be used for the 3D of face model masterplate being made amendment according to described key point information at described model acquiring unit, obtain before the user's corresponding with described the first face image the 3D model, according to face database pivot analysis eigenwert coefficient, learn the original 3D of a face model masterplate.
Preferably, also comprise:
The smooth treatment unit is used for golden interpolation in the curve negotiating gram of the described original 3D of the face model masterplate that obtains is carried out smooth treatment, obtains the 3D of face model template.
Preferably, described model acquiring unit specifically is set to:
Be used for the 3D of the face model masterplate after described key point information and the smooth treatment is shone upon, obtain the user's corresponding with described the first face image 3D model.
Preferably, also comprise:
The images match unit, be used at described image generation unit described the second face image and described hair style image being merged, generate before the hair style design sketch, take user's the first face image of gathering as standard, described user's the first face image key point information and described hair style image key points information are carried out linear fit, so that user's face image and hair style image are complementary.
Preferably, also comprise:
The wide height control of hair style unit is used for according to the shared area of described the first face image user hair, and described hair style image is carried out width and adjustment highly.
Preferably, also comprise:
The background adding device, the hair style design sketch that is used to described the second face image and described hair style image to merge generation adds background.
Can find out the beneficial effect that the present invention has from above-mentioned technical scheme:
The invention provides a kind of hair style effect map generalization method and system, key point (such as binocular, lip, nose and the face mask) information of the first face image of the user that obtains is made amendment to the 3D of face model masterplate, obtain user's 3D model.Obtain the key point information of the required hair style image of user, and determine the deflection angle of described hair style image.3D model to the user carries out respective angles deflection, and obtains user's the second face image according to the 3D model after the deflection.Described the second face image and described hair style image are merged, generate the hair style design sketch.The present invention adopts the technological means to user the first face image 3D reduction, is rotated by the 3D model to the user, obtains the face image of user's different angles, has solved the problem that same face image can not mate various deflection angle hair style images.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
Fig. 1 is the disclosed a kind of hair style effect map generalization method flow diagram of the embodiment of the invention, step can for:
S100, collection user the first face image;
S200, obtain described the first face image key point information;
S300, according to described key point information the 3D of face model masterplate is made amendment, obtain the user's corresponding with described the first face image 3D model;
S400, according to the selection instruction of user to hair style, determine the hair style image that the user is required;
S500, obtain described hair style image key points information;
S600, determine the deflection angle of described hair style image;
S700, according to described deflection angle described user's 3D model is carried out angular deflection, so that the deflection angle of described user's 3D model is corresponding with the deflection angle of described hair style image;
S800, according to 3D model generation user the second face image of the user after the deflection;
S900, described the second face image and described hair style image are merged, generate the hair style design sketch.
Preferably, described the first face image can be user's direct picture, in order to obtain the key point information of user's face image.
Concrete, take user's direct picture with camera, this moment, the user can do up the hair of oneself, and forehead is exposed, and avoid affects the effect of restyling the hair because of the hair of oneself as far as possible.Can adopt herein the user easily mode face is exposed, the present invention does not do restriction at this.
Preferably, described the first face image key point information can be the key point position of binocular, lip, nose and face mask.
Concrete, we can find people face position in user's direct picture by people's face location technology.Then can find the face image key point information by the critical point detection technology, such as binocular, lip, nose and face mask etc., and these key points be positioned, we just can estimate the position of user face and forehead according to these key point information.
Preferably, because the user is when taking direct picture, the extraneous factors such as the light of environment of living in, background are uncertain, thus for the visual effect that makes the user more attractive in appearance.After obtaining user's the first face image, be illustrated in figure 2 as the disclosed another kind of hair style effect map generalization method flow diagram of the embodiment of the invention, we can also comprise step:
S110, user's the first face image is processed processing.
Concrete, we can carry out the skin landscaping treatment to user's face image by wave filter, and we can also adopt the impact of adding the background removal external environment.Disposal route to user's face image also has a lot, and the present invention does not do restriction at this.
Wherein, after we can also be placed on step S200 with step S110.
Be understandable that, the purpose that user's the first face image is processed processing be for the first face image that makes the user truer.We also can carry out to user's 3D model the face image processing, or user's the second face image that obtains is processed processing, or user's face image are not processed processing, and the present invention does not do restriction at this.
Preferably, be illustrated in figure 3 as the disclosed another kind of hair style effect map generalization method flow diagram of the embodiment of the invention, be understandable that, before the step S300, can also comprise the step that obtains the 3D of face model masterplate, be specifically as follows:
S210, according to the face database pivot analysis eigenwert coefficient of (every people's face contains a large amount of pictures), learn the original 3D of a face model masterplate;
S220, golden interpolation in the curve negotiating gram of the described original 3D of the face model masterplate that obtains is carried out smooth treatment, obtain the 3D of face model masterplate.
Preferably, step S300 is specifically as follows: the 3D of the face model masterplate after described key point information and the smooth treatment is shone upon, obtain the user's corresponding with described the first face image 3D model.So just form a 3D model corresponding with user's head dummy.
Wherein, the user's of described acquisition 3D model can rotate in three dimensions, and therefore, we can obtain the image of the different faces of user deflection angle.
Be understandable that, step S210 and step S220 are that the acquisition of the 3D of face model masterplate and step S110 process between the processing user's the first face image and do not contact directly, these two processes can be to obtain first the 3D of face model masterplate, also can be first user's the first face image to be processed processing, or two processes carry out simultaneously, and the present invention does not do restriction at this.So long as according to user's the first face image it is reduced to the technical scheme of 3D model, all belong to protection scope of the present invention.
Wherein, when user's face image being carried out the 3D reduction, step S210 and step S220 are that the procurement process of the 3D of face model masterplate does not need all to carry out at every turn.To the 3D of the face model masterplate that has obtained, we can store it, like this, we only need to obtain user's the first face image, key point information according to described the first face image, shine upon with face's 3D model template of storage, can obtain the face 3D model corresponding with the first face image.
Preferably, we can according to the selection instruction of user to hair style, in the hair style storehouse, determine the hair style image that the user is required.In the wherein said hair style storehouse, can be image of a kind of hair style, described image can be the hair style image of hair style model face different angles; Image that also can a plurality of angles of same hair style.The present invention does not do restriction at this.
Preferably, we can find hair style model shape of face position by people's face location technology, if hair style model has face, then we just can find model's face image key point information by the detection of people's face and key point location technology, such as face, binocular, lip, nose and face mask etc.If hair style model does not have face, only have face mask, then we just can position model's face mask by the critical point detection technology.The purpose of hair style model face key point information being carried out detection and location is for hair style model's hair style image and user's face image are better mated.Wherein, we can also adopt the selected hair style model of manual demarcation face key point position, and the present invention does not do restriction at this.
Preferably, the deflection angle of described hair style image can be hair style model's the face angle with respect to direct picture deflection.
Preferably, user's 3D model is carried out deflection with hair style image equal angular, purpose is user's the second face image that obtains with hair style model equal deflection angle, when thereby the hair style images match that makes the hair style model arrives user's face image, unmatched situation can not appear because the deflection angle of user's face image is different with hair style picture deflection angle, the present invention has been just because of considered the deflection angle problem, so that the hair style design sketch after the coupling is truer.
Preferably, be illustrated in figure 4 as the disclosed another kind of hair style effect map generalization method flow diagram of the embodiment of the invention, before step S900, can also comprise:
S810, described user's the first face image key point information and described hair style image key points information are carried out linear fit, so that user's face image and hair style image are complementary.
Concrete, can be take the first face image of the user that collects as standard, user's first face image key point information of acquisition and the key point information of user-selected hair style image are carried out linear fit, even affined transformation is carried out in face mask position and user-selected hair style model's face mask position in user's the first face image, described hair style image and user's face image are complementary.Can find out, this technological means does not need user oneself to adjust size and the position of hair, but carries out matching treatment according to user's the first face image key point information and hair style image key points information, and operation is simple.
Wherein, the hair style image after the above-mentioned adjustment is scratched figure process, can obtain our required hair style parts of images.
Be understandable that, the purpose of step S810 is the hair style image in order to obtain to be complementary with user's face image, so step S810 can be placed on step S200 obtain the first face image key point information and step S500 and obtain hair style image key points information and all execute after and step S900 the second face image and hair style image are merged, generate any position in the step before the hair style design sketch is not carried out, the present invention does not do restriction at this.
Preferably because may there be certain difference in user's hair style quantity and hair style model's hair style quantity, so the hair style of same style on the different numbers of people, may be different on the width of hair style and height.The sense of reality of therefore restyling the hair in order to increase the user, we can be according to the area of the shared face of user's hair in described the first face image, and the hair style effect of predictive user is carried out corresponding width and adjustment highly to the hair style image after the coupling.
Be illustrated in figure 5 as the disclosed another kind of hair style effect map generalization method flow diagram of the embodiment of the invention, behind step S900, can also comprise:
S910, according to the shared area of user's hair in described the first face image, to described hair style image carry out width with the height adjustment.
Concrete: as to cause hair style to broaden in the process or the problem such as elongation for avoiding hair style amplifying in proportion to dwindle, so can in wide, high direction a minute linear change of scale function be set respectively, control hair style flexible.Be illustrated in figure 6 as a kind of process flow diagram to hair style figure image width method for adjusting height in the disclosed a kind of hair style effect map generalization method of the embodiment of the invention, thus the step of Nonlinear Scale transforming function transformation function can for:
S911, at Width the first piecewise function with origin symmetry is set, and obtains the inverse function of described the first piecewise function, be designated as the second piecewise function;
Concrete, described the first piecewise function setting principle is: described the first piecewise function can make described hair style image flexible by affined transformation equal proportion (linear scale factor equals 1) in hair style inward flange scope, in face and junction, hair edge with the curve form transition, dwindle telescopic level, at hair zones and hair with exterior domain in proportion less than 1, namely flexible less than the yardstick of affined transformation.
Wherein, described the first piecewise function be input as image pixel positions coordinate figure before the conversion, function is output as image pixel positions coordinate figure after the affined transformation.So the second piecewise function is input as the image pixel positions coordinate figure after the affined transformation, be output as the front image pixel positions coordinate figure of conversion.
Wherein, described the first piecewise function is carried out the inverse function conversion and obtain described the second piecewise function.Former because: described the first piecewise function can be regarded the master pattern that described hair style image thicknesses is regulated as, X coordinate (input of the first piecewise function) is image pixel positions coordinate position before the conversion, Y coordinate (output of the first piecewise function) is image pixel positions coordinate figure after the affined transformation, so in the zone that described hair style image need to compress, the Y coordinate figure is less than the X coordinate figure.But we finally need the process of conversion is that the pixel on the described hair style image is in a big way transformed to more among a small circle, namely the thickness of described hair style image is compressed.Therefore be described hair style image pixel positions coordinate figure after the known compression, remove to obtain the required location of pixels coordinate figure of filling up in this position (being image pixel positions coordinate position before the X conversion).Therefore the inverse function that needs described the first piecewise function of acquisition is the second piecewise function.
S912, the hair style integral image is done affined transformation;
S913, flexible to pressing the second piecewise function yardstick on the described hair style picture traverse direction;
Concrete, described hair style integral image is done affined transformation, described affined transformation can make the integral position of described hair style image and described face image position be complementary, described hair style image size and described face image equal and opposite in direction.Then at first piecewise function of Width setting with origin symmetry, described the first piecewise function can make described hair style image in the situation that inward flange is constant, the outward flange of described hair style image is carried out adjustment on the Width, so that the thickness of described hair style image is near the hair style design sketch of user's reality.
S914, flexible to pressing the second piecewise function yardstick on the described hair style image vertical direction.
Wherein, described affined transformation is in how much affined transformation or the affine maps that are defined as between two vector spaces, and it is comprised of a linear transformation and a translation.
Be understandable that, we can be according to the area of the shared face of user's hair in described the first face image, the hair style effect of predictive user, hair style design sketch after the coupling is carried out the adjustment of horizontal direction and vertical direction, thereby make hair style after the coupling more near the hair style design effect of user's reality.
Preferably, when user's face image and hair style image are mated, the hair that the user may occur exceeds the problem of hair style image, or the user has the problem of other influences matching effect behind, so we are when mating hair style image and user's face image, can pass through image processing techniques, the image that needs are mated carries out background interpolation processing.
Be that the disclosed another kind of hair style design sketch of the embodiment of the invention generates method flow diagram such as Fig. 7, behind the step S910, can also comprise:
S920, be that described the second face image and described hair style image merge the hair style design sketch that generates and add background.
Be illustrated in figure 8 as a kind of method flow diagram that adds background for the hair style design sketch in the disclosed a kind of hair style effect map generalization method of the embodiment of the invention, specifically can comprise:
S921, take user's the first face image of gathering as standard; S922, the following body contour information of acquisition user's neck; S923, utilize user's face mask information, hairline information and described body contour information, determine to need to fill the zone of background; S924, interpolation background.
Be understandable that, after background was added, we just can avoid user's hair style image section because of rear environment (comprising the supplements such as hair fastener), and the experience lf being influenced effect, so went for the occasion of circumstance complication.
Preferably, we can determine the hair style color that the user is required according to the selection instruction of user to the hair style color, the hair style image is carried out the color change process, to satisfy the user to the demand of different hair style colors.
The rgb color pattern is a kind of color standard of industry member, to obtain color miscellaneous by variation and their stacks each other to red (R), green (G), blue (B) three Color Channels, RGB namely is the color that represents three passages of red, green, blue, this standard almost comprised human eyesight can perception all colours, be to use at present one of the widest color system.Alpha channel is one 8 gray scale passage, and this passage comes transparence information in the document image with 256 grades of gray scales, defines transparent, opaque and translucent area, and black expression all-transparent wherein represents opaquely in vain, and the ash expression is translucent.
Be illustrated in figure 9 as the disclosed another kind of hair style effect map generalization method flow diagram of the embodiment of the invention, after step S920, can also comprise step:
Step S930, according to described hair style design sketch, described hair style image is carried out color change.
Concrete, data are processed the information of having stored four passages of hair style RGBA in the storehouse, and for the validity that makes hair is higher, we merge hollow or transparent design sketchs such as obtaining the hair style edge by RGB passage and alpha channel.
Wherein, when the hair style image was complementary by affined transformation and user's face image, we also can also do affined transformation simultaneously with the alpha channel of hair style image, make it to be complementary with user's face image.
Be understandable that, the hair style color of storing in the data processing storehouse can comprise the color on the barber shop dyed plate.The user can carry out the color change at design sketch like this, sees the design sketch of selected hair style color, can also make reference for the hair style that will customize simultaneously.Wherein, the change of user-selected hair style color of image can any step behind user-selected hair style image be carried out, also can the hair style color not changed.
Be understandable that, as shown in Figure 9, step S910 carries out color change to described hair style design sketch interpolation background and step S930 to the hair style image to adjustment, the step S920 that described hair style image carries out width and height, what three steps adopted is different technological means, do not have direct relation between them yet, and be independent of each other.The execution sequence of step S910, step S920 and step S930 does not limit, can first execution in step S910, or first execution in step S920, or first execution in step S930, also can only carry out any two steps wherein, such as an execution in step S910 and step S920, or only execution in step S910 and step S930, or only execution in step S920 and step S930, also can be that three steps are all carried out.In a word, need the number of execution in step and order to decide according to actual conditions in three steps, the present invention does not do restriction at this.
Be understandable that the procurement process of user's face image 3D model and be two separate processes to the processing procedure of user-selected hair style image.We can carry out first the procurement process of user's face image 3D model, also can carry out first the processing procedure of user-selected hair style image, or two processes are carried out simultaneously.The present invention does not do restriction at this.
Corresponding with the embodiment in a kind of hair style effect map generalization method provided by the invention, the present invention also provides a kind of generation system of hair style design sketch.
Figure 10 is the structural representation of the disclosed a kind of hair style design sketch of the embodiment of the invention, comprises the unit:
The first collecting unit 100 is used for gathering user's the first face image;
The first acquiring unit 200 is used for obtaining described the first face image key point information;
Model acquiring unit 300 is used for according to described key point information the 3D of face model masterplate being made amendment, and obtains the user's corresponding with described the first face image 3D model;
Hair style selected cell 400 is used for according to the selection instruction of user to hair style, determines the hair style image that the user is required;
Second acquisition unit 500 is used for obtaining described hair style image key points information;
Angle acquiring unit 600 is for the deflection angle of determining described hair style image;
Angular deflection unit 700 is used for according to described deflection angle described user's 3D model being carried out angular deflection, so that the deflection angle of described user's 3D model is corresponding with the deflection angle of described hair style image;
The second collecting unit 800 is used for 3D model generation user the second face image according to the user after the deflection;
Image generation unit 900 is used for described the second face image and described hair style image are merged, and generates the hair style design sketch.
Preferably, described the first face image can be user's direct picture, in order to obtain the key point information of user's face image.
Preferably, described the first face image key point information can be the key point position of binocular, lip, nose and face mask.
Preferably, because the user is when taking direct picture, the extraneous factors such as the light of environment of living in, background are uncertain, thus for the visual effect that makes the user more attractive in appearance.After obtaining user's the first face image, be the structural representation of the disclosed another kind of hair style design sketch of the embodiment of the invention as shown in figure 11, we can also comprise the unit:
Graphics processing unit 110 is used for user's the first face image is processed processing.
Wherein, after we can also be placed on graphics processing unit 110 the first acquiring unit 200 and obtain described the first face image key point information, the present invention did not do restriction at this.
Preferably, be the structural representation of the disclosed another kind of hair style design sketch of the embodiment of the invention as shown in figure 12, be understandable that, the 3D of face model masterplate is made amendment according to described key point information at described model acquiring unit 300, obtain before the user's corresponding with described the first face image the 3D model, the unit that obtains the 3D of face model masterplate can also be comprised, specifically the unit can be comprised:
Master pattern acquiring unit 210 is used for according to the face database pivot analysis eigenwert coefficient of (every people's face contains a large amount of pictures), learns the original 3D of a face model masterplate;
Smooth treatment unit 220 is used for golden interpolation in the curve negotiating gram of the described original 3D of the face model masterplate that obtains is carried out smooth treatment, obtains the 3D of face model masterplate.
Preferably, model acquiring unit 300 specifically is set to:
Be used for the 3D of the face model masterplate after described key point information and the smooth treatment is shone upon, obtain the user's corresponding with described the first face image 3D model.
Like this, just can generate a 3D model corresponding with user's head dummy.
Wherein, the user's of described acquisition 3D model can rotate in three dimensions, and therefore, we can obtain the image of the different faces of user deflection angle.
Be understandable that, master pattern acquiring unit 210 and smooth treatment unit 220 are that the acquisition unit of the 3D of face model masterplate and 110 pairs of user's the first face images of graphics processing unit are processed between the processing and do not contacted directly, these two processes can be to obtain first the 3D of face model masterplate, also can be first user's the first face image to be processed processing, or two processes carry out simultaneously, and the present invention does not do restriction at this.So long as according to user's the first face image it is reduced to the technical scheme of 3D model, all belong to protection scope of the present invention.
Wherein, when user's face image being carried out the 3D reduction, master pattern acquiring unit 210 and smooth treatment unit 220 are that the procurement process of the 3D of face model masterplate does not need all to carry out at every turn.To the 3D of the face model masterplate that has obtained, we can store it, like this, we only need to obtain user's the first face image, key point information according to described the first face image, shine upon with face's 3D model template of storage, can obtain the face 3D model corresponding with the first face image.
Preferably, the deflection angle of described hair style image can be hair style model's the face angle with respect to direct picture deflection.
Preferably, be the structural representation of the disclosed another kind of hair style design sketch of the embodiment of the invention as shown in figure 13,, generate before the hair style design sketch the then hair style image merging of the second face image at image generation unit 900, can also comprise the unit:
Images match unit 810 is used for described user's the first face image key point information and described hair style image key points information are carried out linear fit, so that user's face image and hair style image are complementary.
Be understandable that, 810 pairs of described user's the first face image key point information in images match unit and described hair style image key points information are carried out linear fit, purpose is the hair style image in order to obtain to be complementary with user's face image, so images match unit 810 can be placed on the first acquiring unit 200 obtain the first face image key point information and second acquisition unit 500 and obtain hair style image key points information and all execute after and image generation unit 900 the second face image and hair style image are merged, any position in before generation hair style design sketch is not carried out, the present invention does not do restriction at this.
Be the structural representation of the disclosed another kind of hair style design sketch of the embodiment of the invention as shown in figure 14, at image generation unit 900 the second face image and hair style image merged, generate after the hair style design sketch, can also comprise the unit:
The wide height control of hair style unit 910 is used for according to the shared area of described the first face image user hair, and described hair style image is carried out width and adjustment highly.
Concrete: be the structural representation of a kind of hair style figure image width height control in the disclosed a kind of hair style design sketch of the embodiment of the invention as shown in figure 15, so the Nonlinear Scale transforming function transformation function can comprise the unit:
Piecewise function acquiring unit 911 is used at first piecewise function of Width setting with origin symmetry, and obtains the inverse function of described the first piecewise function, is designated as the second piecewise function.
Concrete, described the first piecewise function setting principle is: described the first piecewise function can make described hair style image flexible by affined transformation equal proportion (linear scale factor equals 1) in hair style inward flange scope, in face and junction, hair edge with the curve form transition, dwindle telescopic level, at hair zones and hair with exterior domain in proportion less than 1, namely flexible less than the yardstick of affined transformation.
Wherein, described the first piecewise function be input as image pixel positions coordinate figure before the conversion, function is output as image pixel positions coordinate figure after the affined transformation.So the second piecewise function is input as the image pixel positions coordinate figure after the affined transformation, be output as the front image pixel positions coordinate figure of conversion.
Wherein, described the first piecewise function is carried out the inverse function conversion and obtain described the second piecewise function.Former because: described the first piecewise function can be regarded the master pattern that described hair style image thicknesses is regulated as, X coordinate (input of the first piecewise function) is image pixel positions coordinate position before the conversion, Y coordinate (output of the first piecewise function) is image pixel positions coordinate figure after the affined transformation, so in the zone that described hair style image need to compress, the Y coordinate figure is less than the X coordinate figure.But we finally need the process of conversion is that the pixel on the described hair style image is in a big way transformed to more among a small circle, namely the thickness of described hair style image is compressed.Therefore be described hair style image pixel positions coordinate figure after the known compression, remove to obtain the required location of pixels coordinate figure of filling up in this position (being image pixel positions coordinate position before the X conversion).Therefore the inverse function that needs described the first piecewise function of acquisition is the second piecewise function.
Affined transformation unit 912 is used for the hair style integral image is done affined transformation.
Width adjustment unit 913 is used for flexible by the second piecewise function yardstick on the described hair style picture traverse direction.
Vertical direction adjustment unit 914 is used for flexible by the second piecewise function yardstick on the described hair style image vertical direction.
Be understandable that, we can according to the area of the shared face of user's hair in described the first face image, carry out the flexible adjustment of yardstick to the hair style design sketch, thereby make the hair style after the coupling truer.
Be the structural representation of the disclosed another kind of hair style design sketch of the embodiment of the invention such as Figure 16, the wide height control of hair style unit 910 according to described the first face image in the shared area of user's hair, after described hair style image being carried out the adjustment of width and height, can also comprise the unit:
Background adding device 920, the hair style design sketch that is used to described the second face image and described hair style image to merge generation adds background.
Be that a kind of in the disclosed a kind of hair style design sketch of the embodiment of the invention adds for the hair style design sketch shown in the structural representation of background such as Figure 17, specifically can comprise the unit:
Image determining unit 921 is used for take user's the first face image of gathering as standard;
Profile information acquiring unit 922 is used for obtaining the following body contour information of user's neck;
Background area determining unit 923 is used for utilizing user's face mask information, hairline information and described body contour information, determines to need to fill the zone of background;
Adding device 924 is used for adding background.
Being the structural representation of the disclosed another kind of hair style design sketch of the embodiment of the invention as shown in figure 18, is after described the second face image and described hair style image merge the hair style design sketch interpolation background that generates, can also comprise the unit at background adding device 920:
Color changing unit 930 is used for according to described hair style design sketch, and described hair style image is carried out the color change.
Each embodiment adopts the mode of going forward one by one to describe in this instructions, and what each embodiment stressed is and the difference of other embodiment that identical similar part is mutually referring to getting final product between each embodiment.
To the above-mentioned explanation of the disclosed embodiments, make this area professional and technical personnel can realize or use the present invention.Multiple modification to these embodiment will be apparent concerning those skilled in the art, and General Principle as defined herein can be in the situation that do not break away from the spirit or scope of the present invention, in other embodiments realization.Therefore, the present invention will can not be restricted to these embodiment shown in this article, but will meet the widest scope consistent with principle disclosed herein and features of novelty.