CN104463777B - A method of the real time field depth based on face - Google Patents
A method of the real time field depth based on face Download PDFInfo
- Publication number
- CN104463777B CN104463777B CN201410631708.7A CN201410631708A CN104463777B CN 104463777 B CN104463777 B CN 104463777B CN 201410631708 A CN201410631708 A CN 201410631708A CN 104463777 B CN104463777 B CN 104463777B
- Authority
- CN
- China
- Prior art keywords
- face
- realtime graphic
- facial contour
- transformation
- masking
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/50—Depth or shape recovery
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10028—Range image; Depth image; 3D point clouds
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
- Processing Or Creating Images (AREA)
Abstract
The invention discloses a kind of methods of the real time field depth based on face, it obtains realtime graphic by obtaining the camera data of live preview, and Face datection is carried out to realtime graphic and obtains human face region and face key point, then pass through default facial contour figure and its corresponding face key point, and transformation facial contour figure is acquired using affine transformation according to the human face region and face key point got, the transformation facial contour figure is finally subjected to transparency to realtime graphic and the blurred picture as the masking-out of the human face region of the realtime graphic, face depth image is calculated, on the screen using face depth image as display image live preview, without hardware cost, and it is operated without manual intervention, to realize automatic field depth effect process when self-timer, keep the effect of self-timer more preferably more natural.
Description
Technical field
The present invention relates to technique for taking field, the method for especially a kind of real time field depth based on face.
Background technology
With the continuous improvement of living standard and scientific and technological level, take pictures as a kind of common row in our daily lifes
For we can optionally shoot desired image, to record the value of a memorable moment or scene.In order to highlight shooting
Main body, it will usually make the main body of shooting clear and blurred background using Deep Canvas, to allow shooting main body from background
It pulls out and, allow shooting main body can be more attractive, especially in portrait self-timer.However the depth of field this function needs to image
Head hardware supported, can just make to support the depth of field when shooting, for common capture apparatus, need after the picture is taken again to image into
The processing of the row depth of field, operation is very troublesome, and is a larger problem for layman.
Invention content
The present invention is to solve the above problems, provide a kind of method of the real time field depth based on face, in conjunction with face illiteracy
Version carries out depth of field processing to human face region automatically, convenient and efficient.
To achieve the above object, the technical solution adopted by the present invention is:
A method of the real time field depth based on face, which is characterized in that include the following steps:
10. obtaining the camera data of live preview, realtime graphic is obtained;
20. pair realtime graphic carries out Face datection;If detecting face, obtains human face region and face is crucial
Point otherwise using realtime graphic as display image, and executes step 70;
30. pair realtime graphic carries out Fuzzy Processing, blurred picture is obtained;
40. default facial contour figure and its corresponding face key point, and according to the human face region and face got
Key point acquires transformation facial contour figure using affine transformation;
50. using the transformation facial contour figure as the masking-out of the human face region of the realtime graphic;
60. the realtime graphic described in pair with human face region masking-out carries out transparency with the blurred picture and people is calculated
Face depth image, using face depth image as display image;
70. image live preview will be shown on the screen, and continue to execute step 10.
Preferably, Fuzzy Processing is carried out to realtime graphic in the step 30, the Fuzzy Processing includes:Intermediate value mould
Paste processing, Gaussian Blur processing, the one or more of of mean value Fuzzy Processing, process of convolution combine.
Preferably, using the transformation facial contour figure as the human face region of the realtime graphic in the step 50
Masking-out, a profile diagram, the white representative in the profile diagram mainly is generated in advance using the generality of facial contour
Face contour area, black represent non-face contour area, and grey represents transitional region.
Preferably, the realtime graphic with human face region masking-out and the blurred picture are carried out in the step 60
Face depth image is calculated in transparency, which is:
Alpha=FaceColor/255.0;
Wherein, FaceColor is the color value of the transformation facial contour figure;Alpha is the transformation facial contour figure
Transparency as masking-out.
Preferably, the realtime graphic with human face region masking-out and the blurred picture are carried out in the step 60
Face depth image is calculated in transparency, and the computational methods of the face depth image are:
ResultColor=Color*Alpha+BlurColor* (1.0-Alpha);
Wherein, ResultColor is the color value of face depth image;Color is the color value of realtime graphic;Alpha
For the transparency of the transformation facial contour figure as masking-out;BlurColor is the color value of blurred picture.
The beneficial effects of the invention are as follows:
A kind of method of real time field depth based on face of the present invention, the camera data by obtaining live preview obtain
To realtime graphic, and Face datection is carried out to realtime graphic and obtains human face region and face key point, then by presetting people
Face profile diagram and its corresponding face key point, and affine transformation is used according to the human face region and face key point got
Transformation facial contour figure is acquired, finally using the transformation facial contour figure as the human face region of the realtime graphic
Masking-out carries out transparency to realtime graphic and the blurred picture and face depth image is calculated, using face depth image as
Show image live preview on the screen, be not necessarily to hardware cost, and operate without manual intervention, when to realize self-timer from
Dynamic Deep Canvas processing, keeps the effect of self-timer more preferably more natural.
Description of the drawings
Attached drawing described herein is used to provide further understanding of the present invention, and constitutes the part of the present invention, this hair
Bright illustrative embodiments and their description are not constituted improper limitations of the present invention for explaining the present invention.In the accompanying drawings:
Fig. 1 is a kind of general flow chart of the method for the real time field depth based on face of the present invention;
Fig. 2 is the camera realtime graphic of a specific embodiment of the invention;
Fig. 3 is to use the transformation facial contour figure that affine transformation acquires to Fig. 2;
Fig. 4 be to Fig. 2 using real time field depth of the present invention treated show image.
Specific implementation mode
In order to keep technical problems, technical solutions and advantages to be solved clearer, clear, tie below
Closing accompanying drawings and embodiments, the present invention will be described in further detail.It should be appreciated that specific embodiment described herein is only used
To explain the present invention, it is not intended to limit the present invention.
As shown in Figure 1, a kind of method of real time field depth based on face of the present invention comprising following steps:
10. obtaining the camera data of live preview, realtime graphic, such as Fig. 2 are obtained;
20. pair realtime graphic carries out Face datection;If detecting face, obtains human face region and face is crucial
Point otherwise using realtime graphic as display image, and executes step 70;
30. pair realtime graphic carries out Fuzzy Processing, blurred picture is obtained;
40. default facial contour figure and its corresponding face key point, and according to the human face region and face got
Key point acquires transformation facial contour figure, such as Fig. 3 using affine transformation;
50. using the transformation facial contour figure as the masking-out of the human face region of the realtime graphic;
60. the realtime graphic described in pair with human face region masking-out carries out transparency with the blurred picture and people is calculated
Face depth image, using face depth image as display image, such as Fig. 4;
70. image live preview will be shown on the screen, and continue to execute step 10.
Face datection in the step 20 uses the prior art, such as document " P.Viola and M.Jones.Rapid
Object Detection using a Boosted Cascade of Simple Features,in:Computer
Vision and Pattern Recognition,2001.CVPR2001.Proceedings of the2001IEEE
Computer Society Conference on".Therefore without repeating.It detects and obtains face further according to positioning after face
Approximate region position.
Fuzzy Processing is carried out to realtime graphic in the step 30, the Fuzzy Processing includes:Intermediate value Fuzzy Processing,
Gaussian Blur processing, the one or more of of mean value Fuzzy Processing, process of convolution combine.It is specific as follows:
Intermediate value Fuzzy Processing, i.e. median filter process, mainly to the N*N template pixels around pixel to be processed
Color value carry out sequence from big to small or from small to large, that most intermediate color value, i.e. median after being sorted,
Then the color value of the pixel is arranged with to the color value of digit;Wherein, N is fuzzy radius.
Gaussian Blur processing mainly uses normal distribution to calculate the transformation of each pixel in image, wherein in N-dimensional sky
Between normal distribution equation be:
It is in the normal distribution equation of two-dimensional space:
Wherein r is blur radius, r2=u2+v2, σ is the standard deviation of normal distribution, and u is position of the preimage vegetarian refreshments in x-axis
Deviant is set, v is the position offset value of preimage vegetarian refreshments on the y axis.
Mean value Fuzzy Processing is typical linear filtering algorithm, it refer on the image to object pixel give a template,
The template includes surrounding adjacent pixels;The adjacent pixels refer to centered on target pixel around 8 pixels, constitute
One Filtering Template, that is, remove target pixel itself;Again original pixel value is replaced with the average value of the entire pixels in template.
Process of convolution:Convolution is the operation carried out to each element in matrix, and the function that convolution is realized is by it
What the form of convolution kernel determined, convolution kernel is the matrix that a size fixes, has numerical parameter to constitute, and the center of matrix is reference
The size of point or anchor point, matrix is known as core support;The color value after the convolution of a pixel is calculated, first by the reference of core
Point location is to the pixel, corresponding local ambient point in remaining element set covering theory of core;For in each core
Pixel obtains the value of this pixel and the product of the value of specified point in convolution kernel array and asks the cumulative of all these products
With the i.e. convolution value of the specified point substitutes the color value of the pixel with this result;By moving convolution on the entire image
Core repeats this operation to each pixel of image.
In the step 40, facial contour figure and its corresponding face key point are preset, and according to the face got
Region and face key point acquire transformation facial contour figure using affine transformation, and the face key point includes mainly
Eye contour, mouth, eyebrow, face mask line, forehead etc..
The basic thought that face grid generates is first to design the standard triangle for meeting basic face shape and organ distribution
Grid, by defining each vertex of a triangle serial number, to obtain between the relative position of mesh point and triangle gridding dough sheet
Topological relation;Then the control point coordinate pair standard grid obtained with human face characteristic point extraction algorithm carries out calibration deformation, to
Realize that the facial grid of the personalization of different human face photos generates.
The match point put between curve is calculated using Lagrange's interpolation.
The generating algorithm of mesh point is described as follows:
Eye contour:About 16 points that have of eye contour in 88 characteristic points, and we need among standard grid
Calibration positioning is carried out to 20 points.We generate eyes upper parabolical according to left eye angle point, right eye angle point and top midpoint;Pass through
Left eye angle point, right eye angle point and following midpoint generate parabola under eyes.An acquisition is taken in four first-class horizontal distances of parabola
All 20 points.
Mouth:Mouth profile has 22 points in 88 characteristic points, needs to carry out calibration positioning to 34 points in standard grid.
It generates parabola 9~12 to be fitted, obtains all 34 points.
Eyebrow:Eyebrow has 16 points in 88 characteristic points, needs to carry out calibration positioning to 20 points in standard grid.It generates
Parabola 1,2,3 and 4 is fitted, and obtains all 20 points.
Face mask line:There are 21 points to indicate face mask line in 88 characteristic points.And 33 points are shared in grid chart
Indicate contour line.Contour line is divided into 4 sections, uses parabola 13~16 to be fitted respectively.
Forehead:By the forehead trichion of practical face and standard face, both sides cheek peak calculates affine transformation matrix.
Brow portion plays the role of less, therefore the method that the grid of brow portion uses affine transformation in human face expression action
Carry out approximate generation.
Other point:Such as the point of forehead, cheek, mouth periphery etc., their coordinate is according to the grid for having set position
Point calculates in proportion.
Using the transformation facial contour figure as the masking-out of the human face region of the realtime graphic in the step 50,
A profile diagram mainly is generated in advance using the generality of facial contour, the white in the profile diagram represents face profile region
Domain, black represent non-face contour area, and grey represents transitional region.
Transparency is carried out to the realtime graphic with human face region masking-out and the blurred picture in the step 60
Face depth image is calculated, it is specific as follows:
Transparency computational methods are:
Alpha=FaceColor/255.0;
Wherein, FaceColor is the color value of the transformation facial contour figure;Alpha is the transformation facial contour figure
Transparency as masking-out.
The computational methods of face depth image are:
ResultColor=Color*Alpha+BlurColor* (1.0-Alpha);
Wherein, ResultColor is the color value of face depth image;Color is the color value of realtime graphic;Alpha
For the transparency of the transformation facial contour figure as masking-out;BlurColor is the color value of blurred picture.
The present invention without camera support the depth of field processing, hardware cost is low, and without to pending human face region into
Row manual contours are delineated, and are operated without manual intervention, and to realize automatic field depth effect process when self-timer, operation is easier,
And the effect of self-timer is more preferably more natural.
The preferred embodiment of the present invention has shown and described in above description, it should be understood that the present invention is not limited to this paper institutes
The form of disclosure is not to be taken as excluding other embodiments, and can be used for other combinations, modifications, and environments, and energy
Enough in this paper invented the scope of the idea, modifications can be made through the above teachings or related fields of technology or knowledge.And people from this field
The modifications and changes that member is carried out do not depart from the spirit and scope of the present invention, then all should be in the protection of appended claims of the present invention
In range.
Claims (5)
1. a kind of method of the real time field depth based on face, which is characterized in that include the following steps:
10. obtaining the camera data of live preview, realtime graphic is obtained;
20. pair realtime graphic carries out Face datection;If detecting face, human face region and face key point are obtained, it is no
Then using realtime graphic as display image, and execute step 70;
30. pair realtime graphic carries out Fuzzy Processing, blurred picture is obtained;
40. default facial contour figure and its corresponding face key point, and it is crucial according to the human face region and face got
Point acquires transformation facial contour figure using affine transformation;
50. using the transformation facial contour figure as the masking-out of the human face region of the realtime graphic;
60. the realtime graphic described in pair with human face region masking-out carries out transparency with the blurred picture and face scape is calculated
Deep image, using face depth image as display image;
70. image live preview will be shown on the screen, and continue to execute step 10.
2. a kind of method of real time field depth based on face according to claim 1, it is characterised in that:The step 30
In Fuzzy Processing is carried out to realtime graphic, the Fuzzy Processing includes:Intermediate value Fuzzy Processing, Gaussian Blur processing, mean value mould
Paste processing, the one or more of of process of convolution combine.
3. a kind of method of real time field depth based on face according to claim 1, it is characterised in that:The step 50
It is middle using the transformation facial contour figure as the masking-out of the human face region of the realtime graphic, mainly utilize facial contour
A profile diagram is generated in advance in generality, and the white in the profile diagram represents face contour area, and black represents non-face wheel
Wide region, grey represent transitional region.
4. a kind of method of real time field depth based on face according to claim 1 or 3, it is characterised in that:The step
Transparency is carried out to the realtime graphic with human face region masking-out and the blurred picture in 60, the face depth of field is calculated
Image, the transparency computational methods are:
Alpha=FaceColor/255.0;
Wherein, FaceColor is the color value of the transformation facial contour figure;Alpha is the transformation facial contour figure conduct
The transparency of masking-out.
5. a kind of method of real time field depth based on face according to claim 4, it is characterised in that:In the step 60
Transparency is carried out to the realtime graphic with human face region masking-out and the blurred picture, face depth image is calculated,
The computational methods of the face depth image are:
ResultColor=Color*Alpha+BlurColor* (1.0-Alpha);
Wherein, ResultColor is the color value of face depth image;Color is the color value of realtime graphic;Alpha is should
Convert transparency of the facial contour figure as masking-out;BlurColor is the color value of blurred picture.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410631708.7A CN104463777B (en) | 2014-11-11 | 2014-11-11 | A method of the real time field depth based on face |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410631708.7A CN104463777B (en) | 2014-11-11 | 2014-11-11 | A method of the real time field depth based on face |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104463777A CN104463777A (en) | 2015-03-25 |
CN104463777B true CN104463777B (en) | 2018-11-06 |
Family
ID=52909765
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410631708.7A Active CN104463777B (en) | 2014-11-11 | 2014-11-11 | A method of the real time field depth based on face |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104463777B (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104778712B (en) * | 2015-04-27 | 2018-05-01 | 厦门美图之家科技有限公司 | A kind of face chart pasting method and system based on affine transformation |
CN106919899B (en) * | 2017-01-18 | 2020-07-28 | 北京光年无限科技有限公司 | Method and system for simulating facial expression output based on intelligent robot |
CN107563329B (en) * | 2017-09-01 | 2021-03-30 | Oppo广东移动通信有限公司 | Image processing method, image processing device, computer-readable storage medium and mobile terminal |
CN107948517B (en) * | 2017-11-30 | 2020-05-15 | Oppo广东移动通信有限公司 | Preview picture blurring processing method, device and equipment |
CN109285160B (en) * | 2018-08-29 | 2022-08-02 | 成都品果科技有限公司 | Image matting method and system |
CN109325924B (en) * | 2018-09-20 | 2020-12-04 | 广州酷狗计算机科技有限公司 | Image processing method, device, terminal and storage medium |
CN111754415B (en) * | 2019-08-28 | 2022-09-27 | 北京市商汤科技开发有限公司 | Face image processing method and device, image equipment and storage medium |
CN111126344B (en) * | 2019-12-31 | 2023-08-01 | 杭州趣维科技有限公司 | Method and system for generating key points of forehead of human face |
CN113362357B (en) * | 2021-06-03 | 2022-08-16 | 北京三快在线科技有限公司 | Feature point determination method, device, equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1889129A (en) * | 2006-07-20 | 2007-01-03 | 北京中星微电子有限公司 | Fast human face model building method and system based on single-sheet photo |
CN102592141A (en) * | 2012-01-04 | 2012-07-18 | 南京理工大学常熟研究院有限公司 | Method for shielding face in dynamic image |
CN103593834A (en) * | 2013-12-03 | 2014-02-19 | 厦门美图网科技有限公司 | Image enhancement method achieved by intelligently increasing field depth |
CN103973977A (en) * | 2014-04-15 | 2014-08-06 | 联想(北京)有限公司 | Blurring processing method and device for preview interface and electronic equipment |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020081003A1 (en) * | 2000-12-27 | 2002-06-27 | Sobol Robert E. | System and method for automatically enhancing graphical images |
-
2014
- 2014-11-11 CN CN201410631708.7A patent/CN104463777B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1889129A (en) * | 2006-07-20 | 2007-01-03 | 北京中星微电子有限公司 | Fast human face model building method and system based on single-sheet photo |
CN102592141A (en) * | 2012-01-04 | 2012-07-18 | 南京理工大学常熟研究院有限公司 | Method for shielding face in dynamic image |
CN103593834A (en) * | 2013-12-03 | 2014-02-19 | 厦门美图网科技有限公司 | Image enhancement method achieved by intelligently increasing field depth |
CN103973977A (en) * | 2014-04-15 | 2014-08-06 | 联想(北京)有限公司 | Blurring processing method and device for preview interface and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN104463777A (en) | 2015-03-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104463777B (en) | A method of the real time field depth based on face | |
KR102362544B1 (en) | Method and apparatus for image processing, and computer readable storage medium | |
CN105335722B (en) | Detection system and method based on depth image information | |
US11836880B2 (en) | Adjusting a digital representation of a head region | |
CN106909875B (en) | Face type classification method and system | |
JP5463866B2 (en) | Image processing apparatus, image processing method, and program | |
TWI544426B (en) | Image processing method and electronic apparatus | |
CN108846807B (en) | Light effect processing method and device, terminal and computer-readable storage medium | |
KR100930994B1 (en) | Method and apparatus for generating 3D image model, image recognition method and apparatus using same, and recording medium recording program for performing the methods | |
US20100189357A1 (en) | Method and device for the virtual simulation of a sequence of video images | |
AU2013258866B2 (en) | Reducing the dynamic range of image data | |
KR20200095873A (en) | Apparatus and method for extracting regioin of persion in image and system using the method | |
CN110264396A (en) | Video human face replacement method, system and computer readable storage medium | |
RU2697627C1 (en) | Method of correcting illumination of an object on an image in a sequence of images and a user's computing device which implements said method | |
CN113344837B (en) | Face image processing method and device, computer readable storage medium and terminal | |
CN111652795A (en) | Face shape adjusting method, face shape adjusting device, live broadcast method, live broadcast device, electronic equipment and storage medium | |
CN116612263B (en) | Method and device for sensing consistency dynamic fitting of latent vision synthesis | |
WO2022258013A1 (en) | Image processing method and apparatus, electronic device and readable storage medium | |
CN113379623A (en) | Image processing method, image processing device, electronic equipment and storage medium | |
CN108986052A (en) | A kind of adaptive image removes illumination method and system | |
JP2006004090A (en) | Image normalization apparatus and image normalization program | |
CN113837018B (en) | Cosmetic progress detection method, device, equipment and storage medium | |
CN113408531B (en) | Target object shape frame selection method and terminal based on image recognition | |
CN113837020B (en) | Cosmetic progress detection method, device, equipment and storage medium | |
CN115861110A (en) | Image processing method, image processing device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |