Method for beautifying faces and electronic equipment in a kind of instant video
【Technical field】
The present invention relates to image technique field, more particularly to method for beautifying faces and electronics in a kind of instant video are set
It is standby.
【Background technology】
There are many image cosmetic applications on intelligent terminal (such as mobile phone, PAD) at present, for carrying out picture beautification
Operation:Mill skin, thin face, whitening, goes livid ring around eye, removes pouch, goes mole, removing the cosmetology functions such as acne print at anti-acne.
Existing image beautifies technology, and most of is to be based on still image, and there are no the dynamics being applied to video file
Image carries out real-time landscaping treatment.With instant video application popularizing on mobile terminals so that more and more users are logical
The interaction for crossing instant video application to realize and between other people.However, the limitation due to mobile terminal device and interaction field
The influence of scape imaging environment causes the face image quality in the second-rate of instant video, especially instant video poor, institute
To need to provide the method for beautifying faces in a kind of instant video.
【Invention content】
Technical problem to be solved by the present invention lies in the method for beautifying faces provided in a kind of instant video and electronics to set
It is standby, the efficiency of beautifying faces in instant video is improved, user experience effect is increased.
The present invention adopts the following technical scheme that:
A kind of method for beautifying faces in instant video, the method includes:
Video frame is obtained by camera;
Area of skin color and non-area of skin color are determined by Face Detection, and it is empty that original image is transformed into HSV and RGB respectively
Between in, according to range threshold of the colour of skin on two color spaces of HSV and RGB is limited, area of skin color is regarded as in range,
Others are non-area of skin color, and skin area is separated from image;
Pyramid bilateral filtering is integrally carried out for original image, i.e., artwork is first carried out to multiple dimensioned down-sampling, is generated
Down-sampling figure and the corresponding guiding figure of each scale, are filtered the picture of smallest dimension, and by guiding figure to release upper one
The picture of subdimension, layer by layer iteration finally obtain the filtered image of artwork, be arranged when being filtered smaller fuzzy parameter and
Template size, then in area of skin color by for current pixel and around it in a certain range pixel difference, if greatly
It is taken as noise in certain threshold value, medium filtering is carried out again for noise;
Image of the area of skin color of artwork after being filtered directly is replaced, non-area of skin color is by artwork and filtered
Image merges by a certain percentage.
Further, the non-area of skin color merges artwork and filtered image by a certain percentage, is the two of artwork
/ mono- and filtered image half blend acquisition gained image, then carry out emergence in edge and handle to obtain most
Whole image.
A kind of electronic equipment, the equipment include:
Video frame acquisition module:Video frame is obtained by camera;
Colour of skin discriminating module:Area of skin color and non-area of skin color are determined by Face Detection, and original image is turned respectively
Change into HSV and rgb space, according to range threshold of the restriction colour of skin on two color spaces of HSV and RGB, in range
Area of skin color is regarded as, others are non-area of skin color, and skin area is separated from image;
Filter module:Pyramid bilateral filtering is integrally carried out for original image, i.e., first by artwork carry out it is multiple dimensioned under
Sampling generates down-sampling figure and the corresponding guiding figure of each scale, is filtered to the picture of smallest dimension, and schemed by guiding
The picture of last scale is released, iteration finally obtains the filtered image of artwork layer by layer, and smaller mould is arranged when being filtered
Paste parameter and template size, then in area of skin color by for current pixel and around it in a certain range pixel difference
Value, is taken as noise if it is greater than certain threshold value, medium filtering is carried out again for noise;
Fusion Module:Image of the area of skin color of artwork after being filtered directly is replaced, non-area of skin color is by artwork
It is merged by a certain percentage with filtered image.
Further, the non-area of skin color merges artwork and filtered image by a certain percentage, is the two of artwork
/ mono- and filtered image half blend acquisition gained image, then carry out emergence in edge and handle to obtain most
Whole image.
A kind of electronic equipment, including display screen, sending module, receiving module, memory and respectively with the display screen,
The processor that the sending module, the receiving module, the memory connect, wherein one group of journey is stored in the memory
Sequence code, the processor execute following operation for calling the program code stored in the memory:
Video frame is obtained by camera;
Area of skin color and non-area of skin color are determined by Face Detection, and it is empty that original image is transformed into HSV and RGB respectively
Between in, according to range threshold of the colour of skin on two color spaces of HSV and RGB is limited, area of skin color is regarded as in range,
Others are non-area of skin color, and skin area is separated from image;
Pyramid bilateral filtering is integrally carried out for original image, i.e., artwork is first carried out to multiple dimensioned down-sampling, is generated
Down-sampling figure and the corresponding guiding figure of each scale, are filtered the picture of smallest dimension, and by guiding figure to release upper one
The picture of subdimension, layer by layer iteration finally obtain the filtered image of artwork, be arranged when being filtered smaller fuzzy parameter and
Template size, then in area of skin color by for current pixel and around it in a certain range pixel difference, if greatly
It is taken as noise in certain threshold value, medium filtering is carried out again for noise;
Image of the area of skin color of artwork after being filtered directly is replaced, non-area of skin color is by artwork and filtered
Image merges by a certain percentage.
Further, the non-area of skin color merges artwork and filtered image by a certain percentage, is the two of artwork
/ mono- and filtered image half blend acquisition gained image, then carry out emergence in edge and handle to obtain most
Whole image.
The advantage of the invention is that:Video personage's colour of skin is obviously beautified, and beautifying faces in instant video are improved
Efficiency increases user experience effect.
【Description of the drawings】
The invention will be further described in conjunction with the embodiments with reference to the accompanying drawings.
Fig. 1 is the method for beautifying faces flow chart of instant video of the present invention.
【Specific implementation mode】
As shown in Figure 1, the method for beautifying faces in a kind of instant video, the method includes:
Video frame is obtained by camera;
Area of skin color and non-area of skin color are determined by Face Detection, and it is empty that original image is transformed into HSV and RGB respectively
Between in, according to range threshold of the colour of skin on two color spaces of HSV and RGB is limited, area of skin color is regarded as in range,
Others are non-area of skin color, and skin area is separated from image;
Pyramid bilateral filtering is integrally carried out for original image, i.e., artwork is first carried out to multiple dimensioned down-sampling, is generated
Down-sampling figure and the corresponding guiding figure of each scale, are filtered the picture of smallest dimension, and by guiding figure to release upper one
The picture of subdimension, layer by layer iteration finally obtain the filtered image of artwork, be arranged when being filtered smaller fuzzy parameter and
Template size, then in area of skin color by for current pixel and around it in a certain range pixel difference, if greatly
It is taken as noise in certain threshold value, medium filtering is carried out again for noise;
Image of the area of skin color of artwork after being filtered directly is replaced, non-area of skin color is by artwork and filtered
Image merges by a certain percentage.
Preferably, the non-area of skin color merges artwork and filtered image by a certain percentage, is two points of artwork
One of and the half of filtered image blend acquisition gained image, then edge carry out emergence handle to obtain it is final
Image.
The embodiment of the present invention also provides a kind of electronic equipment, and the equipment includes:
Video frame acquisition module:Video frame is obtained by camera;
Colour of skin discriminating module:Area of skin color and non-area of skin color are determined by Face Detection, and original image is turned respectively
Change into HSV and rgb space, according to range threshold of the restriction colour of skin on two color spaces of HSV and RGB, in range
Area of skin color is regarded as, others are non-area of skin color, and skin area is separated from image;
Filter module:Pyramid bilateral filtering is integrally carried out for original image, i.e., first by artwork carry out it is multiple dimensioned under
Sampling generates down-sampling figure and the corresponding guiding figure of each scale, is filtered to the picture of smallest dimension, and schemed by guiding
The picture of last scale is released, iteration finally obtains the filtered image of artwork layer by layer, and smaller mould is arranged when being filtered
Paste parameter and template size, then in area of skin color by for current pixel and around it in a certain range pixel difference
Value, is taken as noise if it is greater than certain threshold value, medium filtering is carried out again for noise;
Fusion Module:Image of the area of skin color of artwork after being filtered directly is replaced, non-area of skin color is by artwork
It is merged by a certain percentage with filtered image.
Preferably, the non-area of skin color merges artwork and filtered image by a certain percentage, is two points of artwork
One of and the half of filtered image blend acquisition gained image, then edge carry out emergence handle to obtain it is final
Image.
The embodiment of the present invention also provides a kind of electronic equipment, and the equipment includes:Including display screen, sending module, reception
Module, memory and the place being connect respectively with the display screen, the sending module, the receiving module, the memory
Manage device, wherein batch processing code is stored in the memory, the processor is for calling the journey stored in the memory
Sequence code executes following operation:
Video frame is obtained by camera;
Area of skin color and non-area of skin color are determined by Face Detection, and it is empty that original image is transformed into HSV and RGB respectively
Between in, according to range threshold of the colour of skin on two color spaces of HSV and RGB is limited, area of skin color is regarded as in range,
Others are non-area of skin color, and skin area is separated from image;
Pyramid bilateral filtering is integrally carried out for original image, i.e., artwork is first carried out to multiple dimensioned down-sampling, is generated
Down-sampling figure and the corresponding guiding figure of each scale, are filtered the picture of smallest dimension, and by guiding figure to release upper one
The picture of subdimension, layer by layer iteration finally obtain the filtered image of artwork, be arranged when being filtered smaller fuzzy parameter and
Template size, then in area of skin color by for current pixel and around it in a certain range pixel difference, if greatly
It is taken as noise in certain threshold value, medium filtering is carried out again for noise;
Image of the area of skin color of artwork after being filtered directly is replaced, non-area of skin color is by artwork and filtered
Image merges by a certain percentage.
Preferably, the non-area of skin color merges artwork and filtered image by a certain percentage, is two points of artwork
One of and the half of filtered image blend acquisition gained image, then edge carry out emergence handle to obtain it is final
Image.
Technical solution using the present invention, video personage's colour of skin are obviously beautified, and it is beautiful to improve face in instant video
The efficiency of change increases user experience effect.
The foregoing is merely the preferable implementation use-cases of the present invention, are not intended to limit the scope of the present invention.It is all
Within the spirit and principles in the present invention, any modification, equivalent replacement and improvement etc., should be included in the present invention's made by
Within protection domain.