Specific embodiment
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, completeSite preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based onEmbodiment in the present invention, those skilled in the art's every other implementation obtained without creative effortsExample, shall fall within the protection scope of the present invention.
Fig. 1 is please referred to, Fig. 1 is the flow chart for the processing method of taking pictures that the embodiment of the present invention one provides.
The processing method of taking pictures of this preferred embodiment, comprising:
Step S101 acquires the image of photograph subject, obtains original image when detecting photographing instruction.
For example, terminal takes pictures to photograph subject when user presses camera button, original image is obtained, the original graphAs for being used as base map;The terminal can be the equipment such as mobile phone, tablet computer.
Step S102 obtains the number of face in the acquisition time and the original image of the original image.
For example, terminal obtains the acquisition time of the aperture time namely original image currently taken pictures, and use recognition of faceTechnology identifies the face in original image, and obtains the number of face in the original image;And judge the face numberWhether preset quantity is greater than, to determine whether to take pictures for more people.If the face number is less than or equal to preset quantity, sentenceFixed is not that more people take pictures, therefore terminal can not be dealt with, if the face number is greater than preset quantity, judgement is that more people clapAccording to subsequent to execute step S103.
Step S103 judges whether the acquisition time is less than preset threshold when the number of the face is greater than preset quantity.
For example, whether the aperture time that terminal judgement is currently taken pictures is less than default threshold when terminal is determined as that more people take picturesValue, relatively good with the ambient light that determination is current, which can set based on experience value.If terminal determines current clapAccording to aperture time be more than or equal to preset threshold, it is determined that current ambient light is poor, then terminal can not be made to locateReason;If terminal determines that the aperture time currently taken pictures is less than preset threshold, it is determined that current ambient light is relatively good, then holdsRow step S104.
Step S104 acquires the image of each face when the acquisition time is less than preset threshold, obtains replacement faceImage.
For example, when terminal determines that the aperture time currently taken pictures is less than preset threshold namely current environment light is relatively goodWhen, terminal acquires the image of each face again, obtains replacement facial image.
Step S105 is replaced the image for corresponding to face in the original image using the replacement facial image, obtains photo.
For example, corresponding to the image of face in the image replacement base map of each face of terminal acquisition of taking pictures for the second time, obtainTo final photo.
The processing method of taking pictures of this preferred embodiment, due to when detecting photographing instruction, acquiring the image of photograph subject,Obtain original image;Obtain the number of face in the acquisition time and the original image of the original image;As of the faceWhen number is greater than preset quantity, judge whether the acquisition time is less than preset threshold;If the acquisition time is less than the preset threshold,The image for acquiring each face obtains replacement facial image;It is replaced using the replacement facial image corresponding in the original imageThe image of face, obtains photo;It takes pictures, is reused to defocused facial image replacement due to carrying out focusing to each face againFace in original image, therefore improve clarity.
Referring to figure 2., Fig. 2 is the flow chart of processing method provided by Embodiment 2 of the present invention of taking pictures.
The processing method of taking pictures of this preferred embodiment, comprising:
Step S201 acquires the image of photograph subject, obtains original image when detecting photographing instruction.
For example, terminal takes pictures to photograph subject when user presses camera button, original image is obtained, the original graphAs for being used as base map;The terminal can be the equipment such as mobile phone, tablet computer.
Step S202 obtains the number of face in the acquisition time and the original image of the original image.
For example, terminal obtains the acquisition time of the aperture time namely original image currently taken pictures, and use recognition of faceTechnology identifies the face in original image, and obtains the number of face in the original image;And judge the face numberWhether preset quantity is greater than, to determine whether to take pictures for more people.If the face number is less than or equal to preset quantity, sentenceFixed is not that more people take pictures, therefore terminal can not be dealt with, if the face number is greater than preset quantity, judgement is that more people clapAccording to subsequent to execute step S203.
Step S203 judges whether the acquisition time is less than preset threshold when the number of the face is greater than preset quantity.
For example, whether the aperture time that terminal judgement is currently taken pictures is less than default threshold when terminal is determined as that more people take picturesValue, relatively good with the ambient light that determination is current, which can set based on experience value.If terminal determines current clapAccording to aperture time be more than or equal to preset threshold, it is determined that current ambient light is poor, then terminal can not be made to locateReason;If terminal determines that the aperture time currently taken pictures is less than preset threshold, it is determined that current ambient light is relatively good, then holdsRow step S204.
Step S204 obtains the area value of each face if the acquisition time is less than the preset threshold;
For example, when terminal determines that the aperture time currently taken pictures is less than preset threshold namely current environment light is relatively goodWhen, terminal obtains the area of each human face region in original image.When relatively good due to ambient light, it just can ensure that acquisition is clearImage can be unintelligible to avoid the facial image obtained again therefore by judging the quality of ambient light, reduce terminalPower consumption.
Step S205 determines whether the face is face to be collected according to the area value of each face;
For example, terminal screens each face according to the area of human face region, to determine the need for the faceImage resurveyed, which is such as to need the face taken pictures again.
In order to improve the treatment effeciency of terminal, terminal can compare the area of each human face region and preset area valueCompared with the area value for just resurveying image namely each face of the basis to the biggish face of human face region area ratio determinesThe step of whether face is face to be collected include:
(1) judge whether the area value of the face is greater than preset area value;
(2) if the area value of the face is greater than the preset area value, it is determined that the face is face to be collected.
For example, terminal judges whether the area of each human face region is bigger, which can be based on experience valueSetting, the terminal face bigger to area is focused again to obtain its image, due to the lesser face of area ratio, even ifAgain focusing is taken pictures, and will not improve clarity, therefore terminal no longer focuses to the lesser face of area again and takes pictures, andFocusing is re-started to the biggish face of area to take pictures.
Step S206, however, it is determined that the face is the face to be collected, acquires the image of the face to be collected, obtains replacement peopleFace image.
For example, terminal carries out focusing to the face again and takes pictures, when the area of human face region is bigger to obtain the peopleThe image of face obtains replacement facial image.
Certainly, in order to improve treatment effeciency and the flexibility of terminal, terminal may determine that when taking pictures total of face to be collectedBetween, according to the image of face quantity namely the acquisition face to be collected finally to be taken pictures of total time screening, replacedThe step of facial image includes
A, the total duration for acquiring the image of all faces to be collected is obtained, the first total duration is obtained;
For example, terminal obtains the number of the face to be collected, and calculated always according to face number to be collected and acquisition timeDuration, namely obtain the first total duration.
B, the quantity that the face to be collected is adjusted according to first total duration, obtains target collecting quantity;
For example, terminal judges whether first total duration meets preset condition, if first total duration meets default itemPart, then terminal to the quantity of face to be collected without adjustment, if first total duration is unsatisfactory for preset condition, terminal pairThe quantity of face to be collected is adjusted.
Certainly, in order to further increase the treatment effeciency of terminal, the quantity namely target that can turn face to be collected down are adoptedCollect quantity of the quantity less than face to be collected namely this adjusts the quantity of the face to be collected according to first total duration, obtainsThe step of target collecting quantity includes:
B1, judge whether first total duration is greater than preset time value;
If b2, first total duration are less than or equal to the preset time value, it is to be collected which is equal to thisThe quantity of face;
If b3, first total duration are greater than the preset time value, the quantity of the face to be collected is reduced, and trigger acquisitionFirst total duration, until first total duration is less than or equal to the preset time value, by the quantity of the face to be collected after reductionAs target collecting quantity.
For example, terminal judges whether the total duration of taking pictures of all faces to be collected is less than preset time value, when this is defaultBetween value can set based on experience value, for example the preset time value is the longest photo opporunity that can bear of user.If thisOne total duration is no more than the preset time value, then terminal is not adjusted the quantity of face to be collected, i.e., finally acquires faceQuantity be equal to face to be collected quantity.If first total duration is more than the preset time value, terminal reduces to be collectedThe quantity of face, and return to step A namely terminal and reacquire the face of acquisition face quantity after reducing and take pictures alwaysDuration, judges whether the total duration of taking pictures of the face of the quantity of the face to be collected after reducing is less than preset threshold, if it is,Using the acquisition face quantity after reduction as the face quantity namely target collecting quantity finally acquired.If it is not, then continuingReduce the face quantity, the total duration of taking pictures of the face of the quantity of the face to be collected after reducing, will less than preset thresholdFace quantity at this time is as the face quantity finally acquired.
C, the image for acquiring each of the face of target collecting quantity face obtains replacement image.
For example, terminal carries out Image Acquisition to each of the quantity of face to be collected adjusted face, replacedImage.
In order to improve collecting efficiency, terminal can according to the face of target collecting quantity put in order to each face intoRow take pictures, the image of each of face of acquisition target collecting quantity face, obtain replacement image the step of include:
L, according to preset order, the image of each of the face of target collecting quantity face is acquired.
For example, terminal is taken pictures according to face of the sequence from front to back or from back to front to target collecting quantity,For the face in same row according to sequence from left to right or from right to left, to each of the face of target collecting quantityFace take pictures.
In order to improve collecting efficiency, terminal can according to the face of target collecting quantity size to each face intoRow take pictures, the image of each face in the face of the acquisition second number to be collected, obtain replacement image the step of include:
N, according to the face area value size of the target collecting quantity, to each of the face of the target collecting quantityThe image of face is acquired.
For example, the sequence that terminal is descending or ascending according to the area value of the face of target collecting quantity, according toSecondary taking pictures to each of the face of target collecting quantity face.
Step S207 is replaced the image for corresponding to face in the original image using the replacement facial image, obtains photo.
For example, corresponding to the image of face in the image replacement base map of each face of terminal acquisition of taking pictures for the second time, obtainTo final photo.
The processing method of taking pictures of this preferred embodiment, on the basis of first embodiment, due to the area pair according to faceFace in all photograph subjects is screened, and the face for being only greater than preset value to face area is taken pictures again, therefore is mentionedHigh treatment effeciency.
Referring to figure 3., Fig. 3 is the flow chart for the processing method of taking pictures that the embodiment of the present invention three provides.
The present embodiment is described in detail taking the terminal as an example, the processing method of taking pictures of this preferred embodiment, comprising:
Step S301, when detecting photographing instruction, mobile phone acquires the image of photograph subject, obtains original image.
For example, mobile phone takes pictures to photograph subject when user presses camera button, original image is obtained, the original graphAs for being used as base map.
Step S302, mobile phone obtain the number of face in the acquisition time and the original image of the original image.
For example, mobile phone obtains the generation time of the aperture time t0 namely original image that currently take pictures, and known using faceOther technology identifies the face in original image, and obtains the number of face in the original image;And judge the faceWhether number is greater than 2, to determine whether to take pictures for more people, if the face number is less than or equal to 2, determines it is not that more people clapAccording to, therefore mobile phone can not be dealt with, if the face number is greater than 2, judgement is that more people take pictures, and then executes stepS303。
Step S303, when the number of the face is greater than preset quantity, it is default that mobile phone judges whether the acquisition time is less thanThreshold value.
For example, when mobile phone is determined as that more people take pictures, the aperture time that mobile phone judgement is currently taken pictures whether less than 2 minutes,Relatively good with the ambient light that determination is current, which can set based on experience value.If mobile phone judgement is currently taken picturesAperture time be more than or equal to 2 minutes, it is determined that current ambient light is poor, then mobile phone can not be dealt with;Such asFruit mobile phone determines the aperture time currently taken pictures less than 2 minutes, it is determined that current ambient light is relatively good, thens follow the stepsS304。
Step S304, if the acquisition time is less than the preset threshold, mobile phone obtains the area value of each face.
For example, when mobile phone determines the aperture time currently taken pictures less than 2 minutes namely when relatively good current environment light,Then mobile phone obtains the area of each human face region in original image.When relatively good due to ambient light, it just can ensure that acquisition is clearImage can be unintelligible to avoid the facial image obtained again therefore by judging the quality of ambient light, reduce mobile phonePower consumption.
Step S305, mobile phone screen all faces according to the area value of the face, and obtain the face after screeningTake pictures total time.
For example, mobile phone judges whether the area value of the face is greater than preset threshold;It is preset when the area value of the face is greater thanWhen threshold value, mobile phone takes pictures again to the face, and obtains when the taking pictures total of face that all area values are greater than preset thresholdBetween t1.And when area value is less than or equal to the face of preset threshold, mobile phone does not take pictures again to the face.
Step S306, mobile phone judge whether the total time of taking pictures is less than preset time value, obtain judging result.
For example, mobile phone judges whether t1 is less than preset time value T, for example mobile phone obtains all area values and is greater than preset thresholdThe total quantity of face be the sum of face after n, namely screening be n, t1 is specifically as follows shown in formula 1:
T1=n*t0 formula 1
Step S307, mobile phone generate face acquisition queue according to the judgment result;
For example, n face is acquired queue by mobile phone when mobile phone determines that t1 is less than T;If mobile phone t1 is greater thanOr being equal to T, then mobile phone reduces the quantity n of the face after screening, and the total time of taking pictures of the face after reducing is smallIn preset time value, queue is acquired using n face after reduction as face.
Specifically, n is subtracted 1, then calculates the total time t2 that n-1 face is taken pictures, judge whether t2 is less than T, if t2 is less thanT, then face acquisition queue is n-1 face, otherwise subtracts 1 again for n-1, obtains the total time t3 that takes pictures of n-2 face again, andJudge whether t3 is less than T, if so, face acquisition queue is otherwise n-2 face continues to subtract 1 for n-2, after reducingThe total time of taking pictures of face is less than preset time value T.Such as n-x, the total time of always taking pictures of face is less than preset time valueT, then face acquisition queue is n-x face.Wherein n-x is greater than 0, and x is greater than 0 and is less than n, and n is natural number.
Step S308, mobile phone carry out Image Acquisition to each face of face acquisition queue, obtain replacement image;
For example, having 6 faces in face acquisition queue, then mobile phone focus to each of 6 faces face and take pictures,Obtain the replacement image of each face.Such as there are 4 faces in front in this 6 faces, behind there are two face.Specifically, handMachine can first take pictures according to 4 faces of the sequence from left to right to front, according still further to sequence from left to right to below2 faces take pictures.Or mobile phone carries out Image Acquisition to this 6 faces respectively according to the size of this 6 faces,For example the sequence successively decreased according to area value takes pictures to this 6 faces.
Step S309, mobile phone are replaced the image for corresponding to face in the original image using the replacement facial image, are shonePiece.
For example, corresponding to the image of face in the image replacement base map of 6 faces of mobile phone acquisition of taking pictures for the second time, obtainFinal photo.
The processing method of taking pictures of this preferred embodiment, due to mobile phone according to the area of face to the people in all photograph subjectsFace is screened, later further according to the screening of duration again to face progress of taking pictures of all photos after screening, to secondFace after screening is taken pictures, and replacement facial image is obtained, and replaced using the replacement facial image it is right in the original imageThe image of face is answered, therefore improves flexibility.
Referring to figure 4., Fig. 4 is the structural schematic diagram for the processing unit of taking pictures that the embodiment of the present invention four provides.This is preferred realApply example processing unit 40 of taking pictures include: the first acquisition module 41, obtain module 42, judgment module 43, the second acquisition module 44,Replacement module 45;
First acquisition module 41 obtains original graph for when detecting photographing instruction, acquiring the image of photograph subjectPicture;
Module 42 is obtained, the number of face in the acquisition time and the original image for obtaining the original image;
Judgment module 43, for it is pre- to judge whether the acquisition time is less than when the number of the face is greater than preset quantityIf threshold value;
Second acquisition module 44, for when the acquisition time is less than the preset threshold, then acquiring the figure of each facePicture obtains replacement facial image;
Replacement module 45 is obtained for being replaced the image for corresponding to face in the original image using the replacement facial imagePhoto.
As shown in figure 5, second acquisition module 44 includes: acquisition submodule 441, determines submodule 442 and acquisitionModule 443;
Acquisition submodule 441, for obtaining the area value of each face;
Submodule 442 is determined, for determining whether the face is face to be collected according to the area value of each face;
Submodule 443 is acquired, for acquiring the figure of the face to be collected when determining the face is the face to be collectedPicture obtains replacement facial image.
The determination submodule 442, is specifically used for:
Judge whether the area value of the face is greater than preset area value;
If the area value of the face is greater than the preset area value, it is determined that the face is face to be collected.
The acquisition submodule 443, specifically includes: acquiring unit 51, adjustment unit 52 and acquisition unit 53;
Acquiring unit 51 obtains the first total duration for obtaining the total duration for acquiring the image of all faces to be collected;
Adjustment unit 52 obtains target acquisition number for adjusting the quantity of the face to be collected according to first total durationAmount;
Acquisition unit 53, the image of each of face for acquiring target collecting quantity face, obtains replacement figurePicture.
The adjustment unit 52, is specifically used for:
Judge whether first total duration is greater than preset time value;
If first total duration is less than or equal to the preset time value, which is equal to the face to be collectedQuantity;
If first total duration is greater than the preset time value, the quantity of the face to be collected is reduced, and trigger the acquisitionFirst total duration, until first total duration is less than or equal to the preset time value, by the quantity of the face to be collected after reductionAs target collecting quantity.
The acquisition unit 53, is specifically used for:
According to preset order, Image Acquisition is carried out to each of the face of target collecting quantity face.
The acquisition unit 53, is also used to:
According to the area value size of the face of the target collecting quantity, to each of the face of the target collecting quantityFace carries out Image Acquisition.