Invention content
The embodiment of the present invention provide face-image flaw determine method and apparatus, can to the flaw in face-image into
Row is accurately detected and is handled.
In a first aspect, the embodiment of the present invention, which provides a kind of flaw of face-image, determines method, including:
Obtain initial face-image;
Gray proces are carried out to the face-image and obtain the corresponding gray level image of the face-image;
Median filter process is carried out to the gray level image and obtains the corresponding filtering image of the gray level image;
The corresponding flaw image of the face-image is determined according to the gray level image and the filtering image;
By comparing the flaw image and the face-image, the flaw in the face-image is determined.
With reference to first aspect, in one possible implementation, described to be schemed according to the gray level image and the filtering
Picture determines that the corresponding flaw image of the face-image includes:
Calculus of differences is carried out to the gray level image and the filtering image to handle to obtain the corresponding difference of the face-image
It is worth image;
Binary conversion treatment is carried out to the error image and obtains the corresponding flaw image of the face-image.
With reference to first aspect, in one possible implementation, described to the gray level image and the filtering image
Progress calculus of differences handles to obtain the corresponding error image of the face-image:
The gray value of each pixel in the gray level image and the filtering image is determined respectively;
The absolute value of the difference of the gray value of first pixel and the gray value of the second pixel is determined as third pixel
The gray value of point, first pixel are the pixel in the gray level image, and second pixel is in the filter
Position pixel corresponding with first pixel in wave image, the third pixel be the error image in position with
The corresponding pixel of first pixel.
With reference to first aspect, in one possible implementation, described that binary conversion treatment is carried out to the error image
Obtaining the corresponding flaw image of the face-image includes:
Determine that the 4th pixel and the 5th pixel, the 4th pixel are more than for gray value in the error image
Or the pixel equal to gray threshold, the 5th pixel are the pixel that gray value is less than the gray threshold;
The gray value of the 4th pixel is adjusted to the first gray value in the error image, and by the 5th picture
The gray value of vegetarian refreshments is adjusted to the second gray value, forms flaw image.
With reference to first aspect, in one possible implementation, described by comparing the flaw image and the face
Portion's image determines that the flaw in the face-image includes:
Determine that first position is gathered, first position set includes gray value in the flaw image equal to described the
Position of the pixel of one gray value in the flaw image;
Determine that the second position is gathered, the second position set includes being not belonging to facial characteristics in the face-image
Position of the image characteristic point in described image, and, the image characteristic point of face feature is belonged in the face-image in institute
State the position in image;
The third place set, the third place collection are determined according to first position set and second position set
It closes and is included in the set of the first position and the not position in the second position is gathered;
The pixel that target location is in the face-image is determined as the flaw in the face-image, the mesh
Cursor position belongs to the third place set.
With reference to first aspect, in one possible implementation, described by comparing the flaw image and the face
Portion's image determines that the flaw in the face-image further includes later:
Determine the size of the flaw;
According to the size adjusting medium filtering coefficient of the flaw, the medium filtering coefficient and the size positive correlation;
The flaw progress median filter process in the face-image is obtained according to the medium filtering coefficient after adjustment light
Change the face-image after flaw.
With reference to first aspect, in one possible implementation, further include before the size of the determination flaw:
The flaw is classified to obtain the classification of each flaw;
Obtain the clearance order of the flaw for target category;
The flaw of the target category is removed according to the classification of each flaw in the face-image.
With reference to first aspect, in one possible implementation, described to be schemed according to the gray level image and the filtering
Further include as determining the corresponding flaw image of the face-image later:
Export the face-image and the flaw image.
Second aspect, the embodiment of the present invention provide a kind of flaw determination device of face-image, including:
Acquisition module, for obtaining initial face-image;
First processing module obtains the corresponding gray scale of the face-image for carrying out gray proces to the face-image
Image;
Second processing module, it is corresponding for obtaining the gray level image to gray level image progress median filter process
Filtering image;
Third processing module, for determining that the face-image is corresponding according to the gray level image and the filtering image
Flaw image;
Flaw determining module, for by comparing the flaw image and the face-image, determining the face-image
In flaw.
The third aspect, the present invention implement to provide the flaw determination device of another face-image, including processor, memory
And input/output interface, the processor, memory and input/output interface are connected with each other, wherein the input and output connect
Mouth is for input or output data data, and the memory is for storing program code, and the processor is for calling the journey
Sequence code executes any one method in above-mentioned first aspect and the various possible realization methods of first aspect.
Fourth aspect, the embodiment of the present invention provide a kind of computer storage media, and the computer storage media is stored with
Computer program, the computer program include program instruction, and described program instruction makes the calculating when executed by a computer
Machine executes any one method in above-mentioned first aspect and each possible realization method of first aspect.
In the embodiment of the present invention, by carrying out gray proces respectively to original face-image and median filter process obtains
Its corresponding gray level image and filtering image, gray level image can reflect the feature of original face-image, filtering image reflection
Be situation after beautifying to original face-image, the flaw image handled gray level image and filtering image can
To reflect the difference of the image after original face-image and beautification, then by comparing original image and flaw image,
In detail and the flaw in face-image then can be accurately detected out, so as to realize the accurate feedback to flaw and handle.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation describes, it is clear that described embodiment is only a part of the embodiment of the present invention, instead of all the embodiments.Based on this
Embodiment in invention, every other reality obtained by those of ordinary skill in the art without making creative efforts
Example is applied, shall fall within the protection scope of the present invention.
The flow signal of method is determined referring to the flaw that Fig. 1, Fig. 1 are a kind of face-images provided in an embodiment of the present invention
Figure, as shown, the method includes:
S101 obtains initial face-image.
In the embodiment of the present invention, initial face-image can be to have using digital camera, camera, slr camera etc.
Face-image that the equipment or component of shooting function are shot and untreated.It can be obtained initially by input interface
Face-image.In some possible realization methods, initial face-image, example can be directly acquired by the input interface
Such as, the device for executing the method for the embodiment of the present invention be mobile phone, laptop etc., then mobile phone or laptop by its from
The camera that body has shoots facial image, which is to be schemed by the initial face that camera is directly obtained
Picture;In other possible realization methods, can also by the initial face-image of the input interface indirect gain, for example,
The device for executing the method for the embodiment of the present invention is laptop, and initial face-image is the people obtained by slr camera
Face image, the facial image are stored in safe digital (SecureDigital, the SD) card of slr camera, then can will be single anti-
The SD card of camera is inserted into the card reading interface of laptop etc., and laptop passes through the initial face of card reading interface indirect gain
Portion's image.
S102 carries out gray proces to the face-image and obtains the corresponding gray level image of the face-image.
In the embodiment of the present invention, obtaining the corresponding gray level image of face-image to face-image progress gray proces is substantially
Change the brightness of the pixel in face-image or the process of coloration.The color of each pixel in coloured image is by red (R), green
(G), blue (B) three components determine, the value range of each component is 1~255.Gray level image is taking for tri- components of R, G, B
It is worth a kind of identical special coloured image.
In the embodiment of the present invention, following two methods may be used to carry out gray proces to face-image:
1, the value of the corresponding R, G of each pixel in determining face-image, B component, then determining each picture respectively respectively
This average value is determined as R, G of each pixel, the value of B component by the average value of the corresponding R, G of vegetarian refreshments, B component.
For example, the R, G of pixel 1, the value of B component in face-image are respectively 200,180,190, it is determined that pixel
1 R, G, the average value of B component are 190, are determined as R, G of pixel 1, the value of B component by 190.
The component of R, G, B of each pixel in face-image are adjusted to the average value of R, G, B component, then can be incited somebody to action
Face-image processing is gray level image.
2, the gray value that image is expressed with brightness value establishes brightness Y according to the variation relation of RGB and YUC color spaces
It is corresponding with tri- color components of R, G, B:Y=0.3R+0.59G+0.11B determines the bright of each pixel according to this formula
After angle value, the brightness value of each pixel in face-image is modified, then can be gray level image by face-image processing.
In the specific implementation, can carry out gray proces to face-image by function tool obtains the corresponding ash of face-image
Image is spent, for example, the library function in can calling the cross-platform computer vision library (OpenCV) for permitting hair style based on BSD is to coloured silk
The face-image of color carries out gray proces, to obtain the corresponding gray level image of face-image.
S103 carries out median filter process according to the gray level image and obtains the corresponding filtering image of the gray level image.
In the embodiment of the present invention, median filter process is carried out to gray level image and obtains the corresponding filtering image reality of gray level image
Matter is the process for the gray value for changing each pixel in gray level image.Median filtering algorithm is with to each in an image-region
Based on the sequence of the gray value of a pixel, the pixel in image-region center is replaced with the Mesophyticum of gray scale in image-region
The value of point, wherein the dimension relationship of image-region is in medium filtering coefficient.
For example, medium filtering coefficient is 3*3, then the size of image-region is 3 pixel *, 3 pixels, totally 9 pixels.
It is illustrated below to be illustrated to median filtering algorithm, still by taking medium filtering coefficient is 3*3 as an example, as shown in Fig. 2,
Image-region respectively includes 1~pixel of pixel 9, and corresponding gray value distinguishes 220,200,200,200,220,190,
180,210,200, then in these gray values, the intermediate value of gray scale is 200, and the pixel in image-region center is pixel 5,
The gray value of pixel 5 is then adjusted to 200 by 220.
The corresponding image-region of medium filtering coefficient is moved in gray level image, changes be in image-region center successively
The gray value of pixel then can will be at gray level image so as to change the gray value of each pixel in gray level image
Reason is filtering image.
It specifically can be as shown in Figure 3, it is assumed that the size of gray level image is 10*10, is the image of 3*3 with medium filtering coefficient
It is moved in gray level image in region.The pixel at the center in image-region can be 12~19,22~29 ..., 82~89,
The gray value of pixel 12~19,22~29 ..., 82~89 is sequentially adjusted according to intermediate value principle shown in Fig. 2, then it can be by face
Portion's image procossing is filtering image.
Medium filtering coefficient can also have other values, such as can also be 5*5, and 7*7 etc., the embodiment of the present invention does not limit
System.Wherein, medium filtering coefficient is bigger, then filter effect is better.
S104 determines the corresponding flaw image of the face-image according to the gray level image and the filtering image.
Specifically, determining that the corresponding flaw image of face-image may include following step according to gray level image and filtering image
Suddenly:Calculus of differences is carried out to gray level image and filtering image to handle to obtain the corresponding error image of face-image;To the differential chart
The corresponding flaw image of the face-image is obtained as carrying out binary conversion treatment.
In the embodiment of the present invention, to gray level image and filtering image carry out calculus of differences handle to obtain face-image it is corresponding
Error image is substantially by the gray scale of the gray value of the pixel in gray level image and the corresponding pixel points in filtering gray level image
Value subtracts each other the process so that it is determined that the gray value of corresponding pixel points in error image.It is poor to be carried out to gray level image and filtering image
The process that point calculation process obtains the corresponding error image of face-image may include:It determines in gray level image and filtering image respectively
Each pixel gray value;The gray value of first pixel and the absolute value of the difference of the gray value of the second pixel is true
It is set to the gray value of third pixel, first pixel is the pixel in the gray level image, second pixel
Point is the position pixel corresponding with first pixel in the filtering image, and the third pixel is the difference
Position pixel corresponding with first pixel in image.
It is above-mentioned that gray level image and filtering image progress calculus of differences are handled to obtain the corresponding error image of face-image
Process can be indicated with following formula:
Id(x, y)=|Igray(x,y)-Ifiling(x,y)|X=1,2 ..., M;Y=1,2 ..., N
Wherein, Id(x, y) is the gray value of third pixel, Igray(x, y) is the gray value of the first pixel, Ifiling
(x, y) is the gray value of the second pixel.M and N refers to the height and width of face-image, is highly picture with the unit of width
Element, such as face-image are the image of 10*10 pixels, then M=10, N=10.The combination of x and y can indicate pixel in image
In specific location, for example, as shown in figure 4, establish coordinate-system in the picture, then x is equal to 1 and y=1 and indicates pixel 1
Position in the picture.
Coordinate-system is established in gray level image and in the same fashion in filtering image, then x, y value are identical
Igray(x, y) and Ifiling(x, y) is respectively the gray value of the first pixel and the second pixel in corresponding position, for example,
Igray(1,2) indicate that the coordinate in gray level image is the gray value of the pixel A of (1,2), Ifiling(1,2) it indicates filtering
Coordinate in image is the gray value of the pixel B of (1,2), and pixel B is position pixel corresponding with pixel A.
The gray value for determining the third pixel of each position successively according to above-mentioned formula, then with gray level image or filtering
Based on image, the gray value of each pixel in gray level image or filtering image is adjusted to the third pixel of corresponding position
The gray value of point, then can obtain the corresponding error image of face-image.
It illustrates below and handles to obtain the corresponding difference of face-image to carry out calculus of differences to gray level image and filtering image
Image illustrates, as shown in figure 5, gray level image and filtering image are 10*12 pixels, gray level image a include pixel 1~
Pixel 120, filtering image b include pixel 1'~pixel 120', then the ash of 1~pixel of pixel 120 is determined respectively
Angle value, and, pixel 1'~pixel 120'Gray value, due to position of the pixel 1 in gray level image and pixel
1'Position in filtering image is identical, then by the gray value g1 of pixel 1 and pixel 1'Gray value g1'Difference it is exhausted
Gray value g1 " is determined as to value;Due to position of the pixel 2 in gray level image and pixel 2'Position in filtering image
It is identical, then by the gray value g2 of pixel 2 and pixel 2'Gray value g2'The absolute value of difference be determined as gray value g2 ";
Due to position of the pixel 3 in gray level image and pixel 3'Position in filtering image is identical, then by the ash of pixel 3
Angle value g3 and pixel 3'Gray value g3'The absolute value of difference be determined as gray value g3 ";And so on, until by pixel
The gray value g120 and pixel 120&apos of point 120;Gray value g120'The absolute value of difference be determined as gray value g120 ";So
Afterwards, the gray value of the pixel of gray level image 1 is adjusted to gray value g1 ", the gray value of the pixel 2 of gray level image is adjusted
For gray value g2 ", and so on, until the gray value of the pixel 120 of gray level image is adjusted to gray value g120 ", adjust
The corresponding error image of gray level image, that is, face-image after gray value.
In the embodiment of the present invention, binary conversion treatment is carried out to error image and obtains the corresponding flaw image tool of the face-image
Body may include:Determine that the 4th pixel and the 5th pixel, the 4th pixel are greater than or equal to for gray value in error image
The pixel of gray threshold, the 5th pixel are the pixel that gray value is less than gray threshold;By the 4th pixel in error image
The gray value of point is adjusted to the first gray value, and the gray value of the 5th pixel is adjusted to the second gray value, forms flaw
Image.
Here, the first gray value and the second gray value can the larger gray value of two differences, for example, the first gray value can
Think 0, the second gray value can be 255;Alternatively, the first gray value can be 255, the second gray value can be 0;Or
First gray value can be 2, and the second gray value can be 254 or 255, etc..
Gray threshold can be a bigger numerical value, such as can be 200~249 in one of numerical value, by
In filtering image obtained by median filter process by gray level image, the gray value and gray level image of pixel in filtering image
The difference of the pixel of middle corresponding position is larger, illustrates changing greatly for the pixel of the position, then illustrates the pixel and its
Neighbouring pixel differs greatly, then the pixel is then higher for the possibility of flaw point.That is, in error image, as
The 4th pixel that vegetarian refreshments is more than gray threshold is the possibility higher of flaw point, and is carried out at binaryzation to error image
After reason, the gray value of the 4th pixel is adjusted to the first gray value, that is, in flaw image, gray value is the first gray value
Pixel is the possibility higher of flaw point.
Optionally, after determining the corresponding flaw image of face-image, the face-image and flaw image, example can be exported
Such as, the face-image and flaw image can be shown by display screen.By exporting the face-image and flaw image, Yong Huke
To determine the flaw in face-image according to flaw image.
S105 determines the flaw in the face-image by comparing the flaw image and the face-image.
By step S104 it is found that in flaw image, gray value is that the pixel of the first gray value may be flaw point,
The as pixel larger with the grey value difference of other pixels, and in face-image, in addition to flaw point and other pixels
The gray value of point differs greatly, and the part of the face feature such as eyebrow, eyes on face and others are not belonging to face
Part is also larger with the difference of the face skin of face-image, and therefore, it is necessary in the pixel that gray value is the first gray value
It excludes to represent the pixel that face feature is not belonging to face with other.
By above-mentioned introduction it is found that comparison flaw image determines that the flaw in face-image is substantially to determine with face-image and looks for
To the process of the set of flaw point, can specifically include:Determine that first position is gathered, the first position set includes flaw
Gray value in image is equal to position of the pixel of the first gray value in the flaw image;Determine that the second position is gathered, institute
It includes position of the image characteristic point for being not belonging to facial characteristics in described image in the face-image to state second position set
It sets, and, position of the image characteristic point of face feature in described image is belonged in the face-image;According to described first
Location sets and second position set determine that the third place set, the third place set are included in the first position
In the set and not position in the second position is gathered;The pixel that target location is in the face-image is true
The flaw being set in the face-image, the target location belong to the third place set.
Since gray level image is compared with original face-image, other than the brightness of pixel is different, the figure of gray level image
As feature in alternate embodiments, can also pass through comparison with the characteristics of image in the original face-image of accurate feedback
Gray level image determines that the flaw in face-image, specific implementation can refer to comparison flaw image and face with flaw image
Image determines the process of the flaw in face-image.
In the embodiment of the present invention, gray proces, median filter process, difference fortune are being carried out successively to original face-image
After calculating processing and binary conversion treatment, obtained flaw image can reflect the difference of the image after original face-image and beautification
It is different, then by comparing original image and flaw image, then in detail and the flaw in face-image can be accurately detected out
Defect, so as to realize to the accurate feedback of flaw and processing.
After the flaw during face-image is determined, can targetedly to the flaw in face-image at
Reason, to retain the other details in face-image while beautifying picture.It is provided in an embodiment of the present invention referring to Fig. 6, Fig. 6
The flaw of another face-image determines the flow diagram of method, as shown, the method includes:
S201 obtains initial face-image.
S202 carries out gray proces to the face-image and obtains the corresponding gray level image of the face-image.
S203 carries out median filter process according to the gray level image and obtains the corresponding filtering image of the gray level image.
S204 determines the corresponding flaw image of the face-image according to the gray level image and the filtering image.
S205 determines the flaw in the face-image by comparing the flaw image and the face-image.
Here, the specific implementation of step S201~S205 can refer to step S101 in the corresponding embodiments of Fig. 1~
The specific implementation of S105, details are not described herein again.
S206 determines the size of the flaw.
In the embodiment of the present invention, flaw is made of continuous one or more pixel in the picture, the size of flaw
Can be characterized with the number for the pixel that the flaw is included, for example, as shown in fig. 7, image be 20*20 pixels, flaw 1 by
1~pixel of pixel 3 forms, and the size of flaw 1 is 3 pixels, flaw 2 by pixel 21, pixel 22, pixel 32, as
Vegetarian refreshments 33 forms, then the size of flaw 2 is 4 pixels.
S207, according to the size adjusting medium filtering coefficient of the flaw, the medium filtering coefficient and the size are just
It is related.
Flaw only there are one in the case of, can be according to the size adjusting medium filtering coefficient of the flaw;Have in flaw
In the case of multiple, it may be determined that the maximum flaw of size in this multiple flaw, then according to the size of the maximum flaw of size
Adjust medium filtering coefficient.Wherein, flaw size is bigger, then medium filtering coefficient is bigger, the big little finger of toe of medium filtering coefficient
It is the size of the corresponding image-region of medium filtering coefficient.
S208 carries out median filter process to the flaw in the face-image according to the medium filtering coefficient after adjustment and obtains
Face-image to after desalination flaw.
In one possible implementation, the corresponding image-region of medium filtering coefficient may be used in face-image
Flaw carry out the median filter process of part, i.e. the corresponding image-region of moving median filter coefficient makes in image-region
Center is followed successively by each pixel in flaw, so as to adjust the gray value of each pixel in flaw.For example, flaw point packet
The pixel contained is pixel 13~16, and pixel 24~27, for the medium filtering coefficient used for 3*3, then it is 9 to make size first
The center of the image-region of pixel is pixel 13, and the gray value of pixel 13 is then adjusted according to median filtering algorithm, then,
The center of image-region is adjusted to pixel 14 again, the gray value of pixel 14 is adjusted according to median filtering algorithm, is moved successively
Motion video region, it is pixel 15,16 and 24~27 to make the center of image-region, so as to adjust pixel 15,16 and 24
~27 gray value makes the gray value of the pixel in these flaws close to the gray value of its neighbouring pixel, to rise
To the effect of desalination flaw.
It is further possible that in realization method, in order to realize better filter effect and make image seem more from
So, after the flaw in portion's image carries out local median filter process over there, medium filtering coefficient can also be used corresponding
Image-region carries out whole filtering to face-image, wherein the mode integrally filtered to face-image can be right with reference chart 1
The description of step S103 in the embodiment answered, details are not described herein again.
In the embodiment of the present invention, after the flaw during face-image is determined, local median filter process is carried out to flaw,
Due to changing the gray value of the pixel in flaw, makes it closer to the gray value of its neighbouring pixel, retaining image
Edge while play the role of desalinate flaw;After carrying out local filtering, image is carried out at whole medium filtering
Reason, on the one hand, play the role of further desalinating flaw, on the other hand, relative to directly to face-image progress entirety
Median filter process, since the gray value of the pixel in flaw is once adjusted excessively so that phase between the gray value of image
It is smaller to the adjustment of the amplitude of the gray value of each pixel in entirety to close, so that image is more natural.
In some possible scenes, it can also classify to the flaw detected, so as to clear according to the demand of user
Except the flaw of a certain classification.Method is determined referring to the flaw that Fig. 8, Fig. 8 are another face-images provided in an embodiment of the present invention
Flow chart, as shown, the method includes:
S301 obtains initial face-image.
S302 carries out gray proces to the face-image and obtains the corresponding gray level image of the face-image.
S303 carries out median filter process according to the gray level image and obtains the corresponding filtering image of the gray level image.
S304 determines the corresponding flaw image of the face-image according to the gray level image and the filtering image.
S305 determines the flaw in the face-image by comparing the flaw image and the face-image.
Here, the specific implementation of step S301~S305 can refer to step S101 in the corresponding embodiments of Fig. 1~
The description of S105, details are not described herein again.
S306 classifies the flaw to obtain the classification of each flaw.
In one possible implementation, can be classified to flaw according to the flaws type such as small pox, spot, mole,
In further realize, can also further it be classified to small pox and spot, for example, can powder be further divided into small pox
Thorn, acne, tumour etc.;For another example, spot can be further divided into chloasma, sunburn, color spot, freckle etc..
In alternatively possible realization method, can also according to the shade of the size of flaw or flaw to flaw into
Row classification.For example, flaw can be divided into big flaw, medium flaw, nibs three by being classified to flaw according to the size of flaw
A classification;For another example, flaw can be divided into dark flaw and light flaw by being classified to flaw according to the shade of flaw.
In another possible realization method, the size of flaw, shade, flaw type are can be combined with to flaw
Classify.
In the specific implementation, the factors such as position that can be according to the size, shade situation, flaw of flaw in face-image
Classify to flaw.
S307 obtains the clearance order of the flaw for target category.
In the embodiment of the present invention, it can be sent out, can be passed through by user for the clearance order of the flaw of target category
Several options of the classification of flaw are shown to user, are then selected to determine target category according to user.
For example, classified to flaw according to flaw type, and the classification of flaw respectively includes small pox, spot, three kinds of mole
Classification then can show that three kinds of small pox, spot, mole options, user can select at least one from these three options to user
Kind classification, determines target category according to the user's choice, for example, user has selected small pox and spot from these three options,
Then determine that target category is small pox and spot.
S308 removes the flaw of the target category in the face-image according to the classification of each flaw.
In the specific implementation, can according to the classification of each flaw from all flaws determine target category flaw and
Position of the flaw of target category in face-image, then corresponding position in face-image remove the flaw of target category
Defect, wherein the mode for removing the flaw of target category can refer in the corresponding embodiments of above-mentioned Fig. 6 and remove all facial defects
Mode.
In the embodiment of the present invention, after the flaw on face-image is determined by a series of processing, flaw is divided
Class can remove specified flaw when getting the clearance order for being directed to a certain classification according to the classification of flaw, and realization has
Pointedly remove flaw.
The device of inventive embodiments is described below in the method that inventive embodiments are described above.
It is a kind of structural representation of the flaw determination device of face-image provided in an embodiment of the present invention referring to Fig. 9, Fig. 9
Figure, as shown, described device 40 includes:
Acquisition module 401, for obtaining initial face-image;
First processing module 402, it is corresponding for obtaining the face-image to face-image progress gray proces
Gray level image;
Second processing module 403 obtains the gray level image pair for carrying out median filter process to the gray level image
The filtering image answered;
Third processing module 404, for determining the face-image pair according to the gray level image and the filtering image
The flaw image answered;
Flaw determining module 405, for by comparing the flaw image and the face-image, determining the face figure
Flaw as in.
Optionally, the third processing module 404 includes:
Calculation process submodule handles to obtain institute for carrying out calculus of differences to the gray level image and the filtering image
State the corresponding error image of face-image;
Binary conversion treatment submodule obtains the face-image correspondence for carrying out binary conversion treatment to the error image
Flaw image.
Optionally, the calculation process submodule is specifically used for:
The gray value of each pixel in the gray level image and the filtering image is determined respectively;
The absolute value of the difference of the gray value of first pixel and the gray value of the second pixel is determined as third pixel
The gray value of point, first pixel are the pixel in the gray level image, and second pixel is in the filter
Position pixel corresponding with first pixel in wave image, the third pixel be the error image in position with
The corresponding pixel of first pixel.
Optionally, the binary conversion treatment submodule is specifically used for:
Determine that the 4th pixel and the 5th pixel, the 4th pixel are more than for gray value in the error image
Or the pixel equal to gray threshold, the 5th pixel are the pixel that gray value is less than gray threshold;
The gray value of the 4th pixel is adjusted to the first gray value in the error image, and by the 5th picture
The gray value of vegetarian refreshments is adjusted to the second gray value, forms flaw image.
Optionally, the flaw determining module 405 includes:
First set determination sub-module, for determining that first position is gathered, the first position set includes the flaw
Gray value in image is equal to position of the pixel of first gray value in the flaw image;
Second set determination sub-module, for determining that the second position is gathered, the second position set includes the face
Position of the image characteristic point for being not belonging to facial characteristics in described image in image, and, belong in the face-image
Position of the image characteristic point of face feature in described image;
Third set determination sub-module, for determining third according to first position set and second position set
Location sets, the third place set are included in the first position set and not in the second position is gathered
Position;
Flaw determination sub-module, for the pixel for being in target location in the face-image to be determined as the face
Flaw in image, the target location belong to the third place set.
Optionally, described device 40 further includes:
Size determining module 406, the size for determining the flaw;
Filter factor determining module 407, for the size adjusting medium filtering coefficient according to the flaw, the intermediate value filter
Wave system number and the size positive correlation;
Fourth processing module 408, for according to the medium filtering coefficient after adjustment to the flaw in the face-image into
Row median filter process obtains the face-image after desalination flaw.
Optionally, described device 40 further includes:
Sort module 409 obtains the classification of each flaw for being classified to the flaw;
Clearance order acquisition module 410, the clearance order for obtaining the flaw for target category;
Flaw processing module 411, for removing the mesh according to the classification of each flaw in the face-image
Mark the flaw of classification.
Optionally, described device further includes:
Output module 412, for exporting the face-image and the flaw image.
It should be noted that unmentioned content can be found in the description of embodiment of the method in the corresponding embodiments of Fig. 9, here
It repeats no more.
In the embodiment of the present invention, the flaw determination device of face-image by carrying out gray scale respectively to original face-image
Processing obtains its corresponding gray level image and filtering image with median filter process, and gray level image can reflect original face figure
The feature of picture, what filtering image reflected is the situation after beautifying to original face-image, is schemed to gray level image and filtering
As the obtained flaw image of processing can reflect the difference of the image after original face-image and beautification, then by by original graph
Picture and flaw image are compared, then in detail and can accurately detect out the flaw in face-image, so as to realize pair
The accurate feedback of flaw and processing.
It is the composition knot of the flaw determination device of another face-image provided in an embodiment of the present invention referring to Figure 10, Figure 10
Structure schematic diagram, as shown, the device 50 includes processor 501, memory 502 and input/output interface 503.Processor
501 are connected to memory 502 and input/output interface 503, such as processor 501 can be connected to memory 502 by bus
With input/output interface 503.
Processor 501 is configured as supporting the face that the flaw determination device of the face-image executes described in Fig. 1-Fig. 8
The flaw of image determines corresponding function in method.The processor 501 can be central processing unit (Central Processing
Unit, CPU), network processing unit (Network Processor, NP), hardware chip or its arbitrary combine.Above-mentioned hardware core
Piece can be application-specific integrated circuit (Application-Specific Integrated Circuit, ASIC), programmable logic
Device (Programmable Logic Device, PLD) or combinations thereof.Above-mentioned PLD can be Complex Programmable Logic Devices
(Complex Programmable Logic Device, CPLD), field programmable gate array (Field-
Programmable Gate Array, FPGA), Universal Array Logic (Generic Array Logic, GAL) or its arbitrary group
It closes.
Memory 502 is for storing program code etc..Memory 502 includes internal storage, and internal storage can wrap
It includes at least one of following:Volatile memory (such as dynamic random access memory (DRAM), static state RAM (SRAM), synchronize it is dynamic
State RAM (SDRAM) etc.) and nonvolatile memory (such as disposable programmable read only memory (OTPROM), programming ROM
(PROM), erasable programmable ROM (EPROM), electrically erasable ROM (EEPROM).Memory 502 can also include outer
Portion's memory, external memory may include at least one of following:Hard disk (Hard Disk Drive, HDD) or solid state disk
(Solid-State Drive, SSD), flash drive, for example, high density flash memory (CF), secure digital (SD), miniature SD, mini SD,
Extreme digital (xD), memory stick etc..
The input/output interface 503 is for input or output data.
Processor 501 can call said program code to execute following operation:
Obtain initial face-image;
Gray proces are carried out to the face-image and obtain the corresponding gray level image of the face-image;
Median filter process is carried out to the gray level image and obtains the corresponding filtering image of the gray level image;
The corresponding flaw image of the face-image is determined according to the gray level image and the filtering image;
By comparing the flaw image and the face-image, the flaw in the face-image is determined.
It should be noted that the realization of each operation can also correspond to the phase of referring to Fig.1-embodiment of the method shown in Fig. 8
It should describe;The processor 501 can be also used for executing other operations in above method embodiment.
The embodiment of the present invention also provides a kind of computer storage media, and the computer storage media is stored with computer journey
Sequence, the computer program include program instruction, and described program instruction makes the computer execute such as when executed by a computer
Method described in previous embodiment, the computer can be one of the flaw determination device of face-image mentioned above
Point.For example, above-mentioned processor 501.
One of ordinary skill in the art will appreciate that realizing all or part of flow in above-described embodiment method, being can be with
Relevant hardware is instructed to complete by computer program, the program can be stored in a computer read/write memory medium
In, the program is when being executed, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, the storage medium can be magnetic
Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access
Memory, RAM) etc..
The above disclosure is only the preferred embodiments of the present invention, cannot limit the right model of the present invention with this certainly
It encloses, therefore equivalent changes made in accordance with the claims of the present invention, is still within the scope of the present invention.