Method for beautifying faces in a kind of instant video and electronic equipment
[technical field]
The present invention relates to image technique field, the method for beautifying faces particularly in a kind of instant video and electronic equipment.
[background technology]
On intelligent terminal (such as mobile phone, PAD), there is a lot of image cosmetic applications at present, having beautified operation for carrying out picture: ground skin, anti-acne, thin face, whitening, de-black eyelet, remove pouch, go mole, remove the cosmetology functions such as acne print.
Existing image beautifies technology, and great majority are based on still image, is not also applied to and carries out real-time landscaping treatment to the dynamic image of video file.Along with instant video application on mobile terminals universal, make increasing user should be used for realizing by instant video and mutual between other people.But due to the limitation of mobile terminal device and the impact of interaction scenarios imaging environment, cause the second-rate of instant video, the face image quality especially in instant video is poor, so need to provide the method for beautifying faces in a kind of instant video.
[summary of the invention]
Technical matters to be solved by this invention is to provide the method for beautifying faces in a kind of instant video and electronic equipment, improves the efficiency of beautifying faces in instant video, adding users experience effect.
The present invention adopts following technical scheme:
A method for beautifying faces in instant video, described method comprises:
Frame of video is obtained by camera;
By Face Detection determination area of skin color and non-area of skin color, original image is transformed into respectively in HSV and rgb space, according to the range threshold of the restriction colour of skin on HSV and RGB two color spaces, area of skin color is regarded as in scope, other be non-area of skin color, skin area is separated from image;
Pyramid bilateral filtering is carried out for original image entirety, namely first former figure is carried out multiple dimensioned down-sampling, generate down-sampling figure and guiding figure corresponding to each yardstick, filtering is carried out to the picture of smallest dimension, and the picture by guiding figure to release last yardstick, iteration finally draws the filtered image of former figure layer by layer, the fuzzy parameter that when carrying out filtering, setting is less and template size, then in area of skin color by for current pixel and the difference of pixel in certain limit around it, if be greater than certain threshold value just think noise, medium filtering is carried out again for noise,
Directly replaced by image after the area of skin color filtering process of former figure, former figure and filtered image merge by non-area of skin color by a certain percentage.
Further, former figure and filtered image merge by described non-area of skin color by a certain percentage, are that 1/2nd and 1/2nd of filtered image of former figure merges mutually and obtains gained image, then carry out emergence process in edge and obtain final image.
A kind of electronic equipment, described equipment comprises:
Frame of video acquisition module: obtain frame of video by camera;
Colour of skin discriminating module: by Face Detection determination area of skin color and non-area of skin color, original image is transformed into respectively in HSV and rgb space, according to the range threshold of the restriction colour of skin on HSV and RGB two color spaces, area of skin color is regarded as in scope, other be non-area of skin color, skin area is separated from image;
Filtration module: pyramid bilateral filtering is carried out for original image entirety, namely first former figure is carried out multiple dimensioned down-sampling, generate down-sampling figure and guiding figure corresponding to each yardstick, filtering is carried out to the picture of smallest dimension, and the picture by guiding figure to release last yardstick, iteration finally draws the filtered image of former figure layer by layer, the fuzzy parameter that when carrying out filtering, setting is less and template size, then in area of skin color by for current pixel and the difference of pixel in certain limit around it, if be greater than certain threshold value just think noise, medium filtering is carried out again for noise,
Fusion Module: directly replaced by the image after the area of skin color filtering process of former figure, former figure and filtered image merge by non-area of skin color by a certain percentage.
Further, former figure and filtered image merge by described non-area of skin color by a certain percentage, are that 1/2nd and 1/2nd of filtered image of former figure merges mutually and obtains gained image, then carry out emergence process in edge and obtain final image.
A kind of electronic equipment, the processor comprising display screen, sending module, receiver module, storer and be connected with described display screen, described sending module, described receiver module, described storer respectively, wherein, batch processing code is stored in described storer, described processor, for calling the program code stored in described storer, performs following operation:
Frame of video is obtained by camera;
By Face Detection determination area of skin color and non-area of skin color, original image is transformed into respectively in HSV and rgb space, according to the range threshold of the restriction colour of skin on HSV and RGB two color spaces, area of skin color is regarded as in scope, other be non-area of skin color, skin area is separated from image;
Pyramid bilateral filtering is carried out for original image entirety, namely first former figure is carried out multiple dimensioned down-sampling, generate down-sampling figure and guiding figure corresponding to each yardstick, filtering is carried out to the picture of smallest dimension, and the picture by guiding figure to release last yardstick, iteration finally draws the filtered image of former figure layer by layer, the fuzzy parameter that when carrying out filtering, setting is less and template size, then in area of skin color by for current pixel and the difference of pixel in certain limit around it, if be greater than certain threshold value just think noise, medium filtering is carried out again for noise,
Directly replaced by image after the area of skin color filtering process of former figure, former figure and filtered image merge by non-area of skin color by a certain percentage.
Further, former figure and filtered image merge by described non-area of skin color by a certain percentage, are that 1/2nd and 1/2nd of filtered image of former figure merges mutually and obtains gained image, then carry out emergence process in edge and obtain final image.
The invention has the advantages that: the video personage colour of skin is obviously beautified, and improves the efficiency of beautifying faces in instant video, adds Consumer's Experience effect.
[accompanying drawing explanation]
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 process flow diagram of instant video of the present invention.
[embodiment]
As shown in Figure 1, the method for beautifying faces in a kind of instant video, described method comprises:
Frame of video is obtained by camera;
By Face Detection determination area of skin color and non-area of skin color, original image is transformed into respectively in HSV and rgb space, according to the range threshold of the restriction colour of skin on HSV and RGB two color spaces, area of skin color is regarded as in scope, other be non-area of skin color, skin area is separated from image;
Pyramid bilateral filtering is carried out for original image entirety, namely first former figure is carried out multiple dimensioned down-sampling, generate down-sampling figure and guiding figure corresponding to each yardstick, filtering is carried out to the picture of smallest dimension, and the picture by guiding figure to release last yardstick, iteration finally draws the filtered image of former figure layer by layer, the fuzzy parameter that when carrying out filtering, setting is less and template size, then in area of skin color by for current pixel and the difference of pixel in certain limit around it, if be greater than certain threshold value just think noise, medium filtering is carried out again for noise,
Directly replaced by image after the area of skin color filtering process of former figure, former figure and filtered image merge by non-area of skin color by a certain percentage.
Preferably, former figure and filtered image merge by described non-area of skin color by a certain percentage, are that 1/2nd and 1/2nd of filtered image of former figure merges mutually and obtains gained image, then carry out emergence process in edge and obtain final image.
The embodiment of the present invention also provides a kind of electronic equipment, and described equipment comprises:
Frame of video acquisition module: obtain frame of video by camera;
Colour of skin discriminating module: by Face Detection determination area of skin color and non-area of skin color, original image is transformed into respectively in HSV and rgb space, according to the range threshold of the restriction colour of skin on HSV and RGB two color spaces, area of skin color is regarded as in scope, other be non-area of skin color, skin area is separated from image;
Filtration module: pyramid bilateral filtering is carried out for original image entirety, namely first former figure is carried out multiple dimensioned down-sampling, generate down-sampling figure and guiding figure corresponding to each yardstick, filtering is carried out to the picture of smallest dimension, and the picture by guiding figure to release last yardstick, iteration finally draws the filtered image of former figure layer by layer, the fuzzy parameter that when carrying out filtering, setting is less and template size, then in area of skin color by for current pixel and the difference of pixel in certain limit around it, if be greater than certain threshold value just think noise, medium filtering is carried out again for noise,
Fusion Module: directly replaced by the image after the area of skin color filtering process of former figure, former figure and filtered image merge by non-area of skin color by a certain percentage.
Preferably, former figure and filtered image merge by described non-area of skin color by a certain percentage, are that 1/2nd and 1/2nd of filtered image of former figure merges mutually and obtains gained image, then carry out emergence process in edge and obtain final image.
The embodiment of the present invention also provides a kind of electronic equipment, described equipment comprises: the processor comprising display screen, sending module, receiver module, storer and be connected with described display screen, described sending module, described receiver module, described storer respectively, wherein, batch processing code is stored in described storer, described processor, for calling the program code stored in described storer, performs following operation:
Frame of video is obtained by camera;
By Face Detection determination area of skin color and non-area of skin color, original image is transformed into respectively in HSV and rgb space, according to the range threshold of the restriction colour of skin on HSV and RGB two color spaces, area of skin color is regarded as in scope, other be non-area of skin color, skin area is separated from image;
Pyramid bilateral filtering is carried out for original image entirety, namely first former figure is carried out multiple dimensioned down-sampling, generate down-sampling figure and guiding figure corresponding to each yardstick, filtering is carried out to the picture of smallest dimension, and the picture by guiding figure to release last yardstick, iteration finally draws the filtered image of former figure layer by layer, the fuzzy parameter that when carrying out filtering, setting is less and template size, then in area of skin color by for current pixel and the difference of pixel in certain limit around it, if be greater than certain threshold value just think noise, medium filtering is carried out again for noise,
Directly replaced by image after the area of skin color filtering process of former figure, former figure and filtered image merge by non-area of skin color by a certain percentage.
Preferably, former figure and filtered image merge by described non-area of skin color by a certain percentage, are that 1/2nd and 1/2nd of filtered image of former figure merges mutually and obtains gained image, then carry out emergence process in edge and obtain final image.
Adopt technical scheme of the present invention, the video personage colour of skin is obviously beautified, and improves the efficiency of beautifying faces in instant video, adds Consumer's Experience effect.
The foregoing is only better enforcement use-case of the present invention, be not intended to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement and improvement etc., all should be included within protection scope of the present invention.