Summary of the invention
In order to overcome the deficiencies of the above existing technologies, purpose of the present invention is to provide a kind of style image generation methodsAnd device, polygon is established to carry out line according to adjacent characteristic point, according to the color value for the pixel that each polygon includesColor is taken to be filled each polygon, to realize the mesh for processing the image into low polygon (Low Poly) style image automatically's.
In view of the above and other objects, the present invention proposes a kind of style image generation method, include the following steps:
Step S1 establishes the article identification model of people or all kinds of birds, the face recognition model of animal and various objects;
Step S2 obtains image to be processed, established face recognition model and article identification model is utilized, in imageThe facial and each human subject article of the people for including or all kinds of birds, animal identifies;
Step S3 finds out adjacent nearest point and establishes company according to the facial key point of extraction or the characteristic point of articleLine;
Step S4 carries out color filling to the image each region for establishing line.
Preferably, crucial by the face for establishing key point and various birds, animal based on human face in step S1Point establishes the face recognition model.
Preferably, the face recognition model foundation process is as follows:
Sample image is obtained, the facial key point of people or all kinds of birds, animal in the sample image of acquisition are markedNote, and record the coordinate position of facial key point;
The sample image inputted is handled according to the coordinate information of the facial key point of label, and by treatedSample image is sent into the crucial point prediction network of training in advance, obtains key point prediction result;
The key point prediction result is adjusted, the mark of the facial key point of people or all kinds of birds, animal is obtainedPoint;
The face recognition model is established according to the facial key point of acquisition.
Preferably, in step S1, the establishment process of the article identification model is as follows:
By the mass picture of all kinds of articles of search engine collecting, pre-processed;
From by pre-processing in all kinds of item pictures, according to different types of article, correspond to close using all kinds of article spacesColor, texture, pattern, shape, the transparency arrangement situation feature of degree, extract the feature vector of certain dimension;
By recognition training repeatedly, it is stored in file from standard form is extracted in each sorting articles of training set, thusEstablish the article identification model of corresponding all kinds of articles.
Preferably, the step of feature vector for extracting certain dimension is that images of items is divided into M*N grid zoneDomain, calculates points in each grid and the ratio between article is always counted, to obtain M*N dimensional feature vector.
Preferably, in step S2, image to be processed is obtained, compares the face recognition model pre-established and article identificationModel identifies facial, each human subject article of the people or all kinds of birds, animal that include in image;If recognizing imageIn the facial area comprising people or all kinds of birds, animal, then according to each face for including in face recognition model extraction facial areaPortion's key point;If recognizing all kinds of articles for including in image, profile, the side of each article are extracted according to article identification modelThe characteristic points such as edge, corner.
Preferably, in step S3, when carrying out line, it is ensured that every line does not intersect when establishing with other lines.
Preferably, in step S4, each pixel color of each tie region is determined, obtaining each region respectively includesAll pixels point HSB value, the HSB value for taking color point most is filled the region.
Preferably, in step S4, each pixel color of each tie region is determined, obtaining each region respectively includesAll pixels point HSB value, take the dominant hue HSB average value in each region to the area filling.
In order to achieve the above objectives, the present invention also provides a kind of style image generating means, comprising:
Identification model establishes unit, for establishing the face recognition model and various objects of people or all kinds of birds, animalArticle identification model;
Recognition unit utilizes established face recognition model and article identification model for obtaining image to be processed, rightThe facial and each human subject article of the people for including in image or all kinds of birds, animal identifies;
Characteristic point line unit, for according to the facial key point of extraction or the characteristic point of article, find out it is adjacent mostClose point establishes line;
Color filling unit, for carrying out color filling to the image each region for establishing line.
Compared with prior art, a kind of style image generation method of the present invention and device are connected according to adjacent characteristic pointLine establishes polygon, and the color value for the pixel for including according to each polygon takes color to be filled each polygon, thus realShow the purpose for processing the image into low polygon (Low Poly) style image automatically, solves the drafting of designer's hand-drawingThe problem of node, the long-time for taking color, coloring in many and diverse operation, saved design time, and do not need designer grasp it is higherDrawing and software operate basic grounding in basic skills, so that it may reach and realize effect well.
Specific embodiment
Below by way of specific specific example and embodiments of the present invention are described with reference to the drawings, those skilled in the art canUnderstand further advantage and effect of the invention easily by content disclosed in the present specification.The present invention can also pass through other differencesSpecific example implemented or applied, details in this specification can also be based on different perspectives and applications, without departing substantially fromVarious modifications and change are carried out under spirit of the invention.
Fig. 2 is a kind of step flow chart of style image generation method of the present invention.As shown in Fig. 2, a kind of style of the present inventionImage generating method includes the following steps:
Step S1 establishes the article identification model of people or all kinds of birds, the face recognition model of animal and various objects.
In general, the face structure of people, birds, animal etc. and face form families are respectively provided with respective significant spySign, the present invention is by study and constantly correction, respectively according to people, all kinds of birds, the eyebrow of animal face, eyes, canthus, noseStructure, the profile combination feature of the face face such as son, nostril, mouth, lip, cheekbone and each component part, finding out can embodyIt people or all kinds of birds, the facial assemblage characteristic of animal and projects under external environment influence in various light, each angle offset of faceWhen, stable facial key point, based on face each key point establish face recognition model.Therefore, it is embodied in the present inventionIn example, for face recognition model, the facial key point by establishing 72 points and various birds, animal based on human face is builtFacade portion identification model.Specifically, the face recognition model foundation process is as follows:
Sample image is obtained, hand is carried out to the facial key point of people or all kinds of birds, animal in the sample image of acquisitionDynamic label, and record the coordinate position of key point;
The sample image inputted is handled according to the facial key point coordinate information of label, which includes but notIt is limited to the transformation such as the sample image of input to be cut out, scale and rotated, and sample image is sent into instruction in advance by treatedExperienced crucial point prediction network obtains key point prediction result;
The key point prediction result is adjusted, the mark of the facial key point of people or all kinds of birds, animal is obtainedPoint.Adjustment mentioned here can adjust key point prediction result by manually dragging the movements such as mouse, keep its more acurrate, butInvention is not limited thereto;
The face recognition model of people or all kinds of birds, animal are established according to the facial key point of acquisition.
In the specific embodiment of the invention, for article identification model, establishment process is as follows:
By the mass picture of all kinds of articles of search engine collecting, pre-processed;
From by pre-processing in all kinds of item pictures, according to different types of article, correspond to close using all kinds of article spacesThe arrangement situation feature such as color, texture, pattern, shape, transparency of degree, extracts the feature vector of certain dimension, specifically,Images of items can be divided into M*N grid spaces, points in each grid are calculated and the ratio between article is always counted, to obtain M*NDimensional feature vector;
By recognition training repeatedly, it is stored in file from standard form is extracted in each sorting articles of training set, thusEstablish the identification model of corresponding all kinds of articles.
Step S2 obtains image to be processed, established face recognition model and article identification model is utilized, in imageThe facial and each human subject article of the people for including or all kinds of birds, animal identifies.Specifically, being obtained in step S2Image to be processed is taken, the face recognition model pre-established and article identification model are compared, to the people that includes in image or all kinds ofBirds, animal facial, each human subject article identified: such as recognize the face in image comprising people or all kinds of birds, animalPortion region, then according to each facial key point for including in face recognition model extraction facial area;It such as recognizes in image and includesAll kinds of articles, then the characteristic points such as the profile, edge, corner of each article are extracted according to article identification model.
Step S3 finds out adjacent nearest point and establishes company according to the facial key point of extraction or the characteristic point of articleLine, and ensure that every line does not intersect when establishing with other lines, i.e., it cannot cross existing line and establish between two o'clockLine.
Step S4 carries out color filling to the image each region for establishing line.
In an embodiment of the present invention, it in step S4, determines each pixel color of each tie region, obtains respectivelyH (Hues, form and aspect) S (Saturation, the saturation degree) B (brightness, brightness) for all pixels point that each region includesValue, the HSB value for taking color point most are filled the region.I.e. according to color point quantity trace, the HSB color on vertex is takenValue.
In an alternative embodiment of the invention, it in step S4, determines each pixel color of each tie region, obtains respectivelyThe all pixels point for taking each region to include H (Hues, form and aspect) S (Saturation, saturation degree) B (brightness, it is brightDegree) value, it takes the dominant hue HSB average value in each region to the area filling, that is, extracts the HSB color value of each point in each region,The color mean value in the region is obtained after calculating separately out the average value of H, S, B.
Fig. 3 is a kind of system architecture diagram of style image generating means of the present invention.As shown in figure 3, a kind of style of the present inventionVideo generation device, comprising:
Identification model establishes unit 301, establishes face recognition model and various objects for people or all kinds of birds, animalArticle identification model.
In general, the face structure of people, birds, animal etc. and face form families are respectively provided with respective significant spySign, the present invention is by study and constantly correction, respectively according to people, all kinds of birds, the eyebrow of animal face, eyes, canthus, noseStructure, the profile combination feature of the face face such as son, nostril, mouth, lip, cheekbone and each component part, finding out can embodyIt people or all kinds of birds, the facial assemblage characteristic of animal and projects under external environment influence in various light, each angle offset of faceWhen, stable facial key point, based on face each key point establish face recognition model.Therefore, it is embodied in the present inventionIn example, identification model establishes unit 301 and passes through the facial key point of 72 points and various birds, animal of the foundation based on human faceEstablish face recognition model.Specifically, the identification model establish unit 301 face recognition model foundation process it is as follows:
Sample image is obtained, hand is carried out to the facial key point of people or all kinds of birds, animal in the sample image of acquisitionDynamic label, and record the coordinate position of key point;
The sample image inputted is handled according to the facial key point coordinate information of label, which includes but notIt is limited to the transformation such as the sample image of input to be cut out, scale and rotated, and sample image is sent into instruction in advance by treatedExperienced crucial point prediction network obtains key point prediction result;
The key point prediction result is adjusted, the mark of the facial key point of people or all kinds of birds, animal is obtainedPoint.Adjustment mentioned here can adjust key point prediction result by manually dragging the movements such as mouse, keep its more acurrate, butInvention is not limited thereto.
In the specific embodiment of the invention, the identification model establishes the article identification model establishment process of unit 301 such asUnder:
By the mass picture of all kinds of articles of search engine collecting, pre-processed;
From by pre-processing in all kinds of item pictures, according to different types of article, correspond to close using all kinds of article spacesThe arrangement situation feature such as color, texture, pattern, shape, transparency of degree, extracts the feature vector of certain dimension, specifically,Images of items can be divided into M*N grid spaces, points in each grid are calculated and the ratio between article is always counted, to obtain M*NDimensional feature vector;
By recognition training repeatedly, it is stored in file from standard form is extracted in each sorting articles of training set, thusEstablish the identification model of corresponding all kinds of articles.
Recognition unit 302 utilizes established face recognition model and article identification mould for obtaining image to be processedType identifies the facial and each human subject article of the people or all kinds of birds, animal that include in image.Specifically, knowingOther unit 302 obtains image to be processed first, the face recognition model pre-established and article identification model is compared, in imageFacial, each human subject article for the human or animal for including identifies: such as recognizing in image comprising people or all kinds of birds, animalFacial area, then according to each facial key point for including in face recognition model extraction facial area;Such as recognize in imageAll kinds of articles for including then extract the characteristic points such as the profile, edge, corner of each article according to article identification model.
Characteristic point line unit 303, for finding out adjacent according to the facial key point of extraction or the characteristic point of articleNearest point establishes line, and ensures that every line does not intersect when establishing with other lines, i.e., cannot cross existing lineEstablish the line between two o'clock.
Color filling unit 304, for carrying out color filling to the image each region for establishing line.
In an embodiment of the present invention, for the color filling in each region, color filling unit 304 determines each company firstEach pixel color in line region obtains H (Hues, the form and aspect) S for all pixels point that each region includes respectively(Saturation, saturation degree) B (brightness, brightness) value, the HSB value for taking color point most are filled the region.I.e. according to color point quantity trace, the HSB color value on vertex is taken.
In an alternative embodiment of the invention, for the color filling in each region, color filling unit 304 determines each firstEach pixel color of tie region obtains H (Hues, the form and aspect) S for all pixels point that each region includes respectively(Saturation, saturation degree) B (brightness, brightness) value, takes the dominant hue HSB average value in each region to fill out the regionIt fills, that is, extracts the HSB color value of each point in each region, obtain the color in the region after calculating separately out the average value of H, S, BMean value.
In conclusion a kind of style image generation method of the present invention and device carry out line foundation according to adjacent characteristic pointPolygon, and the color value for the pixel for including according to each polygon takes color to be filled each polygon, to realize certainlyThe dynamic purpose for processing the image into low polygon (Low Poly) style image, solve designer's hand-drawing draw node,Take color, many and diverse operation of the long-time that colors in the problem of, saved design time, and do not need designer grasp higher drawing andSoftware operates basic grounding in basic skills, so that it may reach and realize effect well.
The above-described embodiments merely illustrate the principles and effects of the present invention, and is not intended to limit the present invention.AnyWithout departing from the spirit and scope of the present invention, modifications and changes are made to the above embodiments by field technical staff.Therefore,The scope of the present invention, should be as listed in the claims.