The method of a kind of people's face eye location and distance measuring and calculatingTechnical field
The present invention relates to the method for a kind of people's face eye location and distance measuring and calculating, belong to people's face detection and location technical field.
Background technology
It is the very work of difficulty that people's face detects, and its complexity to a certain extent even surpassed recognition of face.
Through years of researches, the method that plurality of human faces detects has appearred being permitted.And because eyes are face one of notable attribute the most, so eye location becomes the committed step of many method for detecting human face.In case the position of left and right sides eyes is decided, the position at people's face place is also just basic have been determined.According to the length and the direction of line between two, the size and Orientation of human face region also can roughly estimate.
Some effective eye locating methods have appearred at present.For example, people such as Bala proposes a kind of eye locating method based on genetic algorithm and decision tree.This method adopts a kind of blending heredity structure that basic ocular rules is constantly evolved, and finally obtains can be used for the ocular rules of the form of decision tree of eye location.People such as Reinders propose a kind of eye locating method based on neural network, and this method is with the input as neural network of the pixel of search window, if this window comprises eye image, then the output of neural network is bigger.Wu and Zhou propose a kind of eye locating method based on intensity contrast.This method utilizes big these characteristics of the gray scale of eye areas to find out the position of eyes.Yet said method only can provide the approximate location of eyes, can not accurately locate the center of eyes.Therefore, in order to improve the accuracy rate that people's face detects, be necessary to study the pinpoint method of eyes.
Projection is a kind of method of effective extraction characteristics of image.Usually, a width of cloth two dimensional image can be analyzed by the one dimension projection function of two quadratures.The feature of analysis image is convenient in the reduction of dimension, and has reduced calculated amount, so projection becomes a kind of important images analytical approach.Up to the present, existing a lot of scholars successfully apply to locate facial characteristics with projection function.Kanade successfully is applied to recognition of face with the integral projection function the earliest, and he at first carries out binaryzation with Laplace operator to original gray-scale map, with the integral projection function binary map is analyzed then.Brunelli and Poggio have done improvement to the algorithm of Kanade, and they are applied to the boundary graph analysis with the integral projection function, thereby determine the position of facial each feature.The notion of variance projection function is proposed by Feng and Yuen the earliest, and has proposed a kind of straightforward procedure of utilizing variance projection function location eyes simultaneously.Afterwards, they proposed the method for a kind of multi thread location eyes again, wherein used a kind of eyes variance filter (eye variance filter), and this filtrator utilized just the variance projection function to produce.This shows that projection is actually a kind of location technology that often adopts in the recognition of face.
But the eye detection result that traditional mixing integration projection function obtains after for whole face area integration is not satisfactory, and in the simple detection of round difference operator projection function for whole face, relatively accurately bigger for the detection of eyes ordinate but detect the influence that is subjected to ear and hair on the temple for two horizontal ordinate, and speed is slower.So still leave some room for improvement.
Summary of the invention
In order to address the above problem, the present invention proposes the method for a kind of people's face eye location and distance measuring and calculating, improved the accuracy and the speed of eye location and distance measuring and calculating during people's face detects.
The present invention adopts following technical scheme for solving its technical matters:
The method of a kind of people's face eye location and distance measuring and calculating comprises the steps:
1) utilize circle difference operator projection function to find the ordinate of eyes;
The definition of circle difference operator: set up the xy coordinate system on image, initial point is at the image middle position usually; If image (x, y) gray-scale value on the coordinate points is f(x, y); The threshold value of setting difference is h; So that (x y) is the center of circle, makes the circle that radius is r, and all form circle upper set S near the pixel of circumference, and sum of all pixels is n; If the gray-scale value of centre point be f (x, y), then in the S all gray scale (x, y)+number of pixels of h is designated as nl, (x, y)-number of pixels of h is designated as n2, the average gray of all pixels is designated as Favg to all gray scales in the S smaller or equal to f in the S more than or equal to f., 3 round coefficients of variation of definition centre point are as follows:
Circle dark coefficient of variation: b (x, y)=n1/n;
Circle bright coefficient of variation: c (x, y)=n2/n;
Circle mean difference coefficient: v (x, y)=Favg-f (x, y);
Circle difference operator CDO (x, y): if v (x, y)<=0 or b (x, y)<0.6 then CDO (x, y)=0;
if?v(x,y)>0?and?b(x,y)>=0.6
then?CDO(x,y)?=?v(x,y);
In algorithm, generally get 1<=h<=10,2<=r<=10, concrete value will obtain in practical operation;
2) utilize mixed projection function to find two horizontal ordinate;
Mixed projection function is defined as the integral projection function and adds the upside deviation projection function;
Integral projection function: suppose that (x y) represents that (the vertical integral projection function representation in interval [y1, y2] is Sv (x) to point for x, the grey scale pixel value of y) locating to I;
Average integral projection function Mv (x) is expressed as:
Formula two: Mv (x)=Sv (x)/(y2-y1) (2)
The variance projection function: the vertical variance projection function that is located in the interval [y1, y2] is expressed as2v (x)
Formula three:
2v (x)=
2/ (y2-y1) (3)
Vertical mixed projection function Hv (x) is defined as:
Formula four: Hv (x)=
/ 2+
/ 2 (4)
Earlier image is justified the horizontal integral projection of difference operator, find the highest vertical coordinate that is defined as eyes of peak value, each horizontal ordinate to this coordinate vertically mixes integral projection then, and two crests about finding are as the horizontal ordinate of eyes;
3) integral projection curve of demonstration both direction;
4) ordinate that will obtain eyes is defined as y, and the horizontal ordinate that obtains two according to two crests of integral projection is x1, x2, and then two distance is | x1-x2|, two eye coordinateses are: (x1, y), (x2, y).
Beneficial effect of the present invention is as follows:
1, seeks the ordinate of eyes finds eyes then with mixing integration projection function horizontal ordinate method to justify the difference projection function, on the complexity of algorithm and accuracy, all have better effect than single method.
2, because the time complexity of circle difference operator projection function is O (n4), and the time complexity that mixes the integration projection function is O (n2), only to ordinate circle difference operator projection function, and to horizontal ordinate mixing integration projection function, used time ratio all uses the required time of circle difference operator projection function short to horizontal ordinate.The used time of this method approximates 1/2 of the simple round difference operator used time of projection function.Therefore to be better than the positive effect of classic method be that speed is fast to this method, the accuracy height.
Description of drawings
Fig. 1 processing flow chart.
Embodiment
Below in conjunction with accompanying drawing the invention is described in further details.
Treatment scheme as shown in Figure 1, the prerequisite of this method is that recognition of face has been finished and carried out carrying out on the basis of image pre-service (image noise reduction, figure image intensifying, image reconstruction).Implementation step is as follows:
1, utilize circle difference operator projection function to find the ordinate of eyes, the definition of circle difference operator: set up the xy coordinate system on image, initial point is at the image middle position usually.If image (x, y) gray-scale value on the coordinate points is f(x, y); The threshold value of setting difference is h; So that (x y) is the center of circle, makes the circle that radius is r, and all form circle upper set S near the pixel of circumference, and sum of all pixels is n.If the gray-scale value of centre point be f (x, y), then in the S all gray scale (x, y)+number of pixels of h is designated as nl, (x, y)-number of pixels of h is designated as n2, the average gray of all pixels is designated as Favg to all gray scales in the S smaller or equal to f in the S more than or equal to f., 3 round coefficients of variation of definition centre point are as follows:
Circle dark coefficient of variation: b (x, y)=n1/n; Circle bright coefficient of variation: c (x, y)=n2/n;
Circle mean difference coefficient: v (x, y)=Favg-f (x, y).
Circle difference operator CDO (x, y): if v (x, y)<=0 or b (x, y)<0.6 then CDO (x, y)=0;
if?v(x,y)>0?and?b(x,y)>=0.6
then?CDO(x,y)?=?v(x,y);
In algorithm, generally get 1<=h<=10,2<=r<=10, concrete value will obtain in practical operation.
2, utilize mixed projection function to find two horizontal ordinate then.
Mixed projection function is defined as the integral projection function and adds the upside deviation projection function.
Integral projection function: suppose that (x y) represents that (the vertical integral projection function representation in interval [y1, y2] is Sv (x) to point for x, the grey scale pixel value of y) locating to I;
Average integral projection function Mv (x) is expressed as:
Formula two: Mv (x)=Sv (x)/(y2-y1) (2)
The variance projection function: the vertical variance projection function that is located in the interval [y1, y2] is expressed as
2v (x);
Formula three:
2v (x)=
2/ (y2-y1) (3)
Vertical mixed projection function Hv (x) is defined as:
Formula four: Hv (x)=
/ 2+
/ 2 (1)
In this paper algorithm, earlier image is justified the horizontal integral projection of difference operator, find the highest vertical coordinate that is defined as eyes of peak value, each horizontal ordinate to this coordinate vertically mixes integral projection then, two crests about finding are as the horizontal ordinate of eyes.
3, the integral projection curve that shows both direction.
4, the ordinate that will obtain eyes is defined as y, and the horizontal ordinate that obtains two according to two crests of integral projection is x1, x2, and then two distance is | x1-x2|, two eye coordinateses are: (x1, y), (x2, y).