Face recognition in controlled access points
Full text
PROJECTE DE FI DE CARRERA TÍTOL DEL PFC: Facial recognition in controlled access points TITULACIÓ: Enginyeria de Telecomunicació (segon cicle i màster) AUTOR: Olga Mur Escartín DIRECTOR: Francesc Tarrés Ruiz DATA: 15/07/2009
Abstract Humans have always possessed the ability to recognize and distinguish between faces. Scientists have been working on using the computer to recognize human faces during the past decades. In recent face detection applications, the goal is not only giving machines abilities that allow them to recognize the people, but also to remember their preferences, to know what they are looking at, to interpret their gestures, and body language. Facial recognition software has many applications in different fields such as law enforcement, security applications, health care, entertainment or video indexing. The aim of this project is to evaluate and study a family of image processing techniques for face detection and recognition, in order to develop a videobased face recognition system. The system uses video sequences, captured by low resolution cameras where lighting conditions has a great variability. Our access control implementation consists of three modules: a Face Detection module, a Face Selection module and a Face Recognition module. Given a frame of a video sequence, the detection module locates and determines face candidates, while the selection module extracts a picture from its position in the current frame. The recognition module identifies the face. Different algorithms have been studied and implemented for each stage. They have been tested and evaluated in order to choose the solutions that best fit for the specific requirements of a control access scenario.
“Yo nunca olvido una cara, pero en su caso haré una excepción.” Groucho Marx
ÍNDEX INTRODUCTION ................................................................................................ 1 CHAPTER 1. RELATED SCENARIO ................................................................ 4 1.1. Introduction ........................................................................................................................ 4 1.2. Scenario description and requirements .......................................................................... 5 CHAPTER 2. FACE DETECTION ...................................................................... 7 2.1. Introduction ........................................................................................................................ 7 2.2. Skin detection .................................................................................................................... 8 2.2.1. Introduction ............................................................................................................. 8 2.2.2. General process ..................................................................................................... 8 2.2.3. Methods evaluated ................................................................................................. 9 2.2.3.1 Explicitly defined skin region. ................................................................... 10 2.2.3.2 Nonparametric skin distribution modelling: The Bayes classifier. ............ 11 2.2.3.3 Parametric skin distribution modelling: The single Gaussian .................. .12 2.2.4. Tests and results .................................................................................................. 12 2.2.5. Conclusions .......................................................................................................... 15 2.3. Face localization .............................................................................................................. 16 2.3.1. Introduction ........................................................................................................... 16 2.3.2. General process ................................................................................................... 16 2.3.3. Filtering skin areas ............................................................................................... 17 2.3.4. Features detection ................................................................................................ 19 2.3.4.1 Colour feature-invariant based method ................................................... .19 2.3.4.2 Variation on colour-feature-invariant based method ............................... .21 2.3.4.3 DGJ-LDA appearance-based method ..................................................... .23 2.3.5. Topology verification ............................................................................................. 25 2.4. Face Selection.................................................................................................................. 28 2.4.1. Face cropping ....................................................................................................... 28 2.4.2. Smile shooter ........................................................................................................ 29 2.5. Tests and results ............................................................................................................. 30 2.6. Conclusions ..................................................................................................................... 32 CHAPTER 3. FACE RECOGNITION ............................................................... 34 3.1. Introduction ...................................................................................................................... 34 3.2. General process............................................................................................................... 34 3.3. Methods evaluated .......................................................................................................... 35 3.3.1. Principal Component Analysis (PCA) ................................................................... 35 3.3.2. Linear Discriminant Analysis (LDA) ...................................................................... 36 3.4. Tests and results ............................................................................................................. 37 3.5. Conclusions ..................................................................................................................... 38
CHAPTER 4. SYSTEM IMPLEMENTATION ................................................... 39 CHAPTER 5. CONCLUSIONS ......................................................................... 42 BIBLIOGRAPHY .............................................................................................. 44 FIGURES Figure 1.1 System‟s modules structure ....................................................................................... 2 Figure 1.2 Corridor and laboratory entrance ............................................................................... 5 Figure 1.3 System‟s general operation structure. ........................................................................ 6 Figure 2.1 Face detection process. ............................................................................................. 7 Figure 2.2 Skin pixel values are grouped in RGB space ............................................................. 8 Figure 2.3 EPFL Skin labelled image and its corresponding skin map ....................................... 9 Figure 2.4 Skin detection algorithms. ........................................................................................ 10 Figure 2.5 Precision and recall comparison between methods ................................................ . 13 Figure 2.6 PR curves for 12, 32 and 64 bins and threshold 0,1 to 0,9 ..................................... . 14 Figure 2.7 Process of cleaning up a skin map ......................................................................... . 17 Figure 2.8 Possible candidates for being face ......................................................................... . 19 Figure 2.9 Mouth map construction .......................................................................................... . 20 Figure 2.10 Eye map chrominance............................................................................................ 20 Figure 2.11 Eye map luminance ................................................................................................ 20 Figure 2.12 Binary eye-map ...................................................................................................... 21 Figure 2.13 Eye candidates marked in white and mouth candidates marked in blue ............... 21 Figure 2.14 Mouth map construction ......................................................................................... 22 Figure 2.15 Eye map construction ............................................................................................. 22 Figure 2.16 Eye candidates marked in white and mouth candidates marked in blue ............... 23 Figure 2.17 Type I and II DGJ computed in the interest point ................................................... 24 Figure 2.18 Canny edge detection ............................................................................................ 25
Figure 2.19 Features classification ........................................................................................... . 25 Figure 2.20 Face area marked in red, eye candidates marked in white and mouth candidates marked in blue ............................................................................................................................ 26 Figure 2.21 Face candidates .................................................................................................... . 26 Figure 2.22 Face graph ............................................................................................................ . 27 Figure 2.23 Detected faces for 1.28, 1.3 and 1.32 scales ......................................................... 28 Figure 2.24 Face cropping ........................................................................................................ . 29 Figure 2.25 Grey scale smile variation ..................................................................................... . 30 Figure 2.26 α mouth performance. ............................................................................................ 30 Figure 2.27 α eye performance. ................................................................................................ 30 Figure 2.28 Precision and recall in mouth methods .................................................................. 31 Figure 2.29 Precision and recall in eye methods. ..................................................................... 31 Figure 2.30 FRR percentages in face detection methods ........................................................ . 32 Figure 3.1 User‟s images on recognition training ..................................................................... . 34 Figure 3.2 Three principal eigenvectors .................................................................................... 35 Figure 4.1 Used methods flow chart .......................................................................................... 39 Figure 4.2 Testing video sequence frames samples ................................................................. 39 Figure 4.3 User 1 images on recognition training ...................................................................... 40 TABLES Table 2.1 Parameters of DGJ used .......................................................................................... . 24 Table 2.2 Average elapsed time used for face detection .......................................................... 32 Table 3.1 Verification rates ........................................................................................................ 38 Table 3.2 Identification rates. ..................................................................................................... 38
Introduction 1 INTRODUCTION Video has become widely one of the most common sources of information, not just in the context of television, film or multimedia; but also in other areas such as traffic monitoring, industrial applications or human-oriented security surveillance. Although digital video images contain a huge amount of visual information, in recent years many techniques of image analysis and understanding have been developed. Face detection and recognition are some of those techniques. As face is a unique feature of human beings, its location and identification over a video sequence is one of the available mechanisms for personal identification and access control. Localizing and recognizing a face in any image or sequence is a challenge in computer vision, because a face is a variant object that is influenced by many factors. For instance, ambient lighting varies between indoor and outdoor environments and among days. Changes on lightning conditions cause different facial appearance on the same subject, due to the presence of brightness and shadows that might emphasize or diminish the presence of nose, mouth and other facial features. Besides, gamma correction, contrast, and exposure in the camera settings also cause illumination changes in images. Furthermore, the face is a non-rigid object. Humans express emotions through face, and there are a lot of facial expressions that change the face appearance. The face may be also occluded by glasses, scarves, hands or other objects in the scene. Even the same face changes over time. There are changes on hair style, makeup, facial hair, glasses, jewellery, and so on. Finally, the appearance of a face can change due to the user‟s pose. We can see different parts of a face depending on the viewing angle. People have the ability to store up to thousands of different faces during their lifes and anyone can recognize people who meet many years ago. Human brain process occurs in three stages [1]. The first one is facial features‟ perception through eyesight. The brain then determines whether these features are known or not. If so, the next step is to associate the face with the related name. All this happens in milliseconds and involves three different parts of the brain. During the past years, several methods have been devised for the computer based detection of human faces‟ images, taking into account the wide range of variations a face image is subject to. The aim of this project is to evaluate and study a family of image processing techniques for face detection and recognition, in order to develop a real-time video-based face recognition system. The system has to detect and allow the GTAV laboratory access to a reduced set of selected users, which identities are stored in a database as a set of several still frontal images. The video sequences are captured by a low resolution camera, which will be installed on the laboratory entrance. Our video-based face recognition system consists of three modules: a Face Detection module, a Face Selection module and a Face Recognition module.
Introduction 2 Given a frame of a video sequence, the detection module locates and determines face candidates, while the selection module extracts a picture from its position in the current frame. The recognition module identifies the face. Figure 1.1 System‟s modules structure In this project we have used a skin colour based filter as the first tool for locating faces. Skin colour based detection algorithms are computationally fast, which allows us to fulfill computational real-time constrains, but they are sensitive to noise, lighting conditions‟ changes and other objects‟ colour present in the scene. In this project, a set of seven different skin colour detection algorithms have been implemented and evaluated, choosing the algorithmic strategy that best fits to the current scenario. Because of the nature of the algorithms used, the output of the skin filtering stage contains pixels of not only human skin, but also isolated non-skin pixels or complete objects which have the same colour range as that of the human skin colour. In order to reduce this undesirable effect, other filtering stages are applied; obtaining smoothed homogeneous areas of connected skin pixels. Eventually we obtain a selection of areas in the image, which become candidates to probably contain a face. Face detection techniques applied for still images have been employed in order to find the exact location of faces in the candidate areas. As done with the skin detection, two different techniques have been implemented and evaluated. Once a face has been detected, it must be recognized. When using face recognition techniques, it is advisable to use frontal face images. In this project, a smile shooting trigger has been developed as the way for taking and normalizing the users‟ image. Taking the smile at the camera as a requirement for access permission, we obtain still and frontal images, which are required in next stage. By using this approach, we try to overcome the most common problem of all face detection algorithms that is the robustness to pose variations. Face Detection •Skin detection •Skin-area filtering •Face localization Face Selection •Face cropping •Smile shooter Face Recognition •Face identity recognition
Introduction 3 Finally the face recognition stage confirms or rejects the identity of the input face image. Two different approaches have been performed and studied, but just one was selected in the final solution. The present document has been structured in five chapters. Through chapter one the problem of the facial analysis is introduced and the project constrains and goals are defined, as well as the developed solution architecture. In chapter two we can find the face detection study, revising available methods in literature and proposing an extension to video sequences of different face detection algorithms for static images. It is also described the smile triggering analysis and solution for acquiring users‟ image shoots. Face recognition techniques are presented and compared in chapter three and their fine tuning for the final system solution is discussed. Chapter four details the final solution as well as its performance, accompanied with the results to different performance tests. Finally in chapter five conclusions and future work lines that have been opened during the development of this project are presented in some detail.
Face detection 10 Figure 2.4 Skin detection algorithms 2.2.3.1. Explicitly defined skin region As previously said, explicitly defined skin region methods define the boundaries of the skin tone cluster in a certain colour space. RGB is the most common colour space used to represent images as a combination of three colour primaries (red, green and blue). Kovac, Peer and Solina [5] determine a pixel as skin classification rule if it accomplishes some threshold values for each of its components. Kovak, Peer and Solina [5] also describe skin colours within a cluster determined by curves over the YCbCr colour space. They determined the curve parameters by evaluating them from training samples of skin. For every pixel of the input image components Y, Cb and Cr are transformed from RGB values. A pixel is then determined as skin if it satisfies a threshold condition. In the same paper, they offer another way to evaluate skin tone pixels when the chromaticity (Cb,Cr) leads to a point that is inside the area that has an ellipse form in the colour space This ellipse describes the skin colour cluster. This other criterion is invariant to the luminance (Y) component. Normalized RGB is a representation, which is easily obtained from the RGB values by a simple normalization procedure. As the sum of the three normalized Explicitly defined skin region S1: RGB colour space. Represent skin as a combination of three colour rays (red, green and blue) in a cluster [5]. S2: Normalized RGB colour space. Classify pixels as skin within another cluster [7]. S3: HSV color space. Choose a region equivalent to a hexagon defined among red and yellow [8]. S4 and S5 : YCbCr colour space. Describe skin colours within a cluster determined by curves [5]. Nonparametric skin distribution modelling S6: Bayes classifier. Calculate the skin colour distribution from a set of skin images, creating a Skin Probability Map [6]. Parametric skin distribution modelling S7: Gaussian classifier. Skin colour distribution can be modelled by an elliptical Gaussian joint probability density function (PFD). The model parameters are estimated from a set of skin images [6].
Face detection 11 components is r+g+b = 1, the third component can be omitted, reducing the space dimension. Vezhnevets, Sazonov and Andreeva [6] proved that RGB normalized space is invariant to the luminance too, under certain assumptions. Based on this assumption, Mota and Velhote [7] classify a pixel as skin if it satisfies another threshold values for normalized RGB space. In a completely different approach, Sobottka y Pitas [8] choose a HSV colour space and a region equivalent to a hexagon defined among red and yellow. This method requires the conversion of the input image to the HSV space, which is invariant to highlight at white light sources [6]. A pixel is classified as skin if it accomplishes a minimum and maximum values condition for Hue and Saturation components. Although using definition of regions models we obtain fast algorithms, the models always have to choose between two extremes: being very tolerant (many parts of the background are classified as skin) or being very restrictive. Besides, illumination will make the algorithms classify incorrectly the skin tone if it differs considerably from the illumination used to model the skin region. 2.2.3.2. Nonparametric skin distribution modelling: The Bayes classifier. The non-parametric skin methods calculate the skin colour distribution from a set of only-skin images without describing explicit models. Generally, the result of these methods turns on a Skin Probability Map [6] that establishes a probability value to each point of a discretized colour space. The method starts by quantifying RGB colour space into a number of bins. Each bin corresponds to a range of component values. So, colour space is turned into a 3D histogram, named lookup table (LUT). Each bin stores the number of times this range colour appears in a training set which contains a set of onlyskin images. Then, the histogram counts are normalized, divided by the sum of all histogram bin values or maximum bin value. By doing this, the LUT turns to discrete probability distribution. Now each bin stores the conditional probability that a known pixel belongs to skin. Obviously, another consideration is needed, as we are interested in knowing the probability of observing skin, given a concrete colour value. To compute this probability, the Bayes rule is used. All the probabilities are calculated from skin and non-skin colour histograms using training images. The detection rule is done by an inequality and a threshold value. All the previous demonstrations can be consulted on appendix A.1.2.
Face detection 12 The bin size selection determines the computational time of the method. Vezhnevets, Sazonov and Andreeva [6] show that 32x32x32 is the best size for an RGB histogram. The advantages of the non-parametric methods are their fast training and usage. On the other hand, they require high storage space and unfortunately training data cannot be generalized. The computed probabilities will depend on the number and kind of training images used. 2.2.3.3. Parametric skin distribution modelling: The single Gaussian. As it has been said on the previous section 2.2.3.2, histogram-based nonparametric skin models require high storage space depending on the selected number of bins. The highest the number of bins and size of training set (number and size of images), the more storing space needed. This means that the performance will be worst if the colour distribution in the scenario is affected by the current illumination, as it will differ greatly from the one used to calculate the probability distribution. As long as we use a training set with the largest range of illuminations possible, we will have a great tolerance with different types of lights. On the other hand, the computational cost will increase, as well as the training set storage needed. Parametric skin distribution models need not so big model representation, so they are more suitable for faster applications. But the most important fact is that they allow generalizing and interpolating the training data. Skin colour distribution can be modelled by an elliptical Gaussian joint probability density function (PFD). The model parameters are estimated from the training data sets of skin samples. The probability that a given “c” colour pixel is skin p(c|skin) can be used directly as the measure of how skin-like the colour is. Detailed calculation equations are shown on appendix A.1.3. 2.2.4. Tests and results All the previous methods have been developed in Matlab. For analyzing the algorithm performance, different still colour images have been used. Part of these images belongs to the EPFL database and other images have been specially acquired for evaluation purposes. Next it is shown a comparison of the effectiveness of the algorithms in terms of two standard measures for judging quality of any detector: precision and recall.
Face detection 13 All binary classifiers‟ decision can be represented as either positive (1) or negative (0). Results can be organized in four categories. True positives (TP) are examples correctly labelled as positives. False positives (FP) are negative examples incorrectly labelled as positive. True negatives (TN) correspond to negatives correctly labelled as negative. Finally, false negatives (FN) are positive examples incorrectly labelled as negative. Precision and recall are defined by equation (2.1) and equation (2.2): 𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛= 𝑇𝑃 𝑇𝑃+𝐹𝑃 (2.1) 𝑅𝑒𝑐𝑎𝑙𝑙 = 𝑇𝑃 𝑇𝑃+𝐹𝑁 (2.2) Precision gives us an idea about how many skin the algorithm detects, but it does not tell us how many of those detections are true skin. The recall parameter gives us the relation about how many detected skin pixels are correctly labelled. The ideal method would have 1.0 precision and 1.0 recall values, which means detecting correctly all the skin in the scene. In fact, the best method will be the one having the best trade-off among both parameters. Skin detection is the first stage in our system. The detection of faces is done over the areas filtered as skin. That is why we are interested in the algorithms that have highest precision, since we would rather have many areas where faces are found later than not to detect anything. Figure 2.5 Precision and recall comparison between methods 0,0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1,0 S1 S2 S3 S4 S5 S6 S7 Precision Recall 38% 9% 32% 16% 25% 40%
Face detection 14 In Fig. 2.5 it has been plotted the arithmetic media of the precision and recall parameters calculated with a representative set of 200 random still images from EPFL dataset; as well as 100 only-skin images and 200 non-skin images for training the parametric algorithms. The algorithms that offer the best trade off are the non parametric, corresponding to the algorithms of Kovac, Peer and Solina [5] called S5 and S1 respectively (see section 2.2.3.1 and Fig. 2.4), as well as the Bayes classifier called S6. Anyway, the results, although showing a good estimation, are not exact since some of the EPFL skin images are not correctly labelled. As we said before, the aim of the skin detection is to make a filter in order to make continuous face detection stages faster. Therefore, it will be better for our system to use the algorithms that perform a higher precision index, as we can deal with false skin positives and discard them as part of a face in further processing. Following this conservative decision we ensure a greater margin in the later detection of faces. The next figure shows the Precision-Recall (PR) curves for the Bayes classifier method, for different bins and a probability threshold (see appendix A.1.2) increasing from 0.1 up to 0.9, with 0.1 steps. Figure 2.6 PR curves for 12, 32 and 64 bins and threshold 0,1 to 0,9 As it can be seen from the previous Fig. 2.5, the higher the threshold the lower the curve is. It is logical, as there will be fewer pixels whose bin‟s probability will raise the minimum value defined by the threshold and therefore being classified as skin. There is not a big difference between PR curves corresponding to 32x32x32 and 64x64x64 bins, but the computational cost becomes lower when 32x32x32 bins sized are chosen. 0,55 0,60 0,65 0,70 0,75 0,80 0,85 0,90 0,95 1,00 0,13 0,15 0,17 0,19 0,21 0,23 0,25 0,27 Recall Precision 12 bins 32 bins 64 bins
Face detection 15 2.2.5. Conclusions Using colour as a tracking method is easy when colours do not change. However, when we have to deal with variation in the colours due to sudden lightning changes in the scene, it becomes a problem, and it is not easy to solve. An added problem with colour as visual information is that if there are objects with a colour similar to the object followed, we cannot avoid confusion. However, colour is a general feature into the entire image, which allows finding all possible candidates quickly, becoming a very useful tool as an initial step in the system. In our system, losing a few pixels due to bad skin classification is not significant, since this stage is a previous filter designed to select certain areas in the entire image. The candidates selected are analyzed in more detail at later stages.
Face detection 16 2.3. Face localization 2.3.1. Introduction Using the skin detected image, one knows whether a pixel is skin or not, but cannot distinguish whether it belongs to a face or not. We need to categorize the skin pixels into different groups so that they will represent something meaningful as a group, for example a face, a hand etc. Once pixels that are connected to each other have been grouped, we have different regions and we have to classify each of these regions as a human face or non human face. Yang, Kriegman and Ahuja [9] classified face detection methods into four main categories: - Top down methods: Based on morphological human knowledge of what constitutes a typical face. - Feature-invariant approaches: Based on finding non variant structural features that exist even when the pose, viewpoint, or lighting conditions vary. - Template matching methods: Based on stored patterns of a standard face, correlating the input image with the patterns for detection. - Appearance-based methods: Patterns templates learned from a set of training images. The system has to identify the mouth area separately, as a consequence of the use of the smile shooting trigger. It is possible to carry out this search in two ways: detecting the constituent parts of the face as a separated process once the face is detected or as part of the face detection process. Based on the time processing constrains and sticking at the simplicity of the system, it was decided to focus the face detection methods into the top down, feature-invariant and appearance-based methods. 2.3.2. General process All the methods use the colour image obtained by the previous skin detection filters as input image. This image contains the skin tone areas selected as possible places for containing a face. The face localization process is performed in each of those areas. The output generated is a set of facial features located and marked. All the possible eyes, mouths and nose found are later analyzed in order to make a face/non-face classification, based on the distance between the detected feature points. All the tests and results are shown on section 2.5.
Face detection 17 2.3.3. Filtering skin areas After obtaining a skin map (binary image) a previous filter is recommended before starting further operations. The aim is to clean the noise and obtain smooth areas of connected regions. This pre-process uses non-linear operators based on binary morphology. Firstly, an opening operation is performed. Here, the small and fine particles that are only components of noise and have little chance of being skin are removed. Later, a closing operation is made, in order to seal areas where we have created gaps in places where there is likely to be a face. Finally, there is a replenishment of the related components. This is necessary since for next stages it is needed to have the greatest possible number of connected regions without holes. The structure element chosen for morphological operations can be either a disk or a square. Anyway, a disk is more suitable, since it has the advantage that the filter has an isotropic behaviour, which is necessary if we do not know the pose of the face. The binary morphology operations bases are detailed in appendix B. In Fig. 2.7 the cleaning up process of the initial skin map as a binary image can be observed. Figure 2.7 Process of cleaning up a skin map Human skin colour pixels region should be the largest area of pixels in the binary image. After filtering, we obtain smoothed homogeneous areas of connected pixels. Hence, another special treatment is considered before extracting the face from the obtained binary skin colour image [10]. After applying morphology to the binary image, it is necessary to implement a mechanism that allows deciding which detected areas are most likely to be faces. As a solution, some of the descriptors determined by Kuchi, Gabbur, Bhat, and David [11] are used. They are based on the scalar form of the related components, having always in mind that our goal is the detection of faces whose forms have particular characteristics. The descriptors are: Original Image Skin-Map Filtered Skin-Map Original Image Skin-Map Filtered Skin-Map Original Image Skin-Map Filtered Skin-Map
Face detection 18 - Pixel Area: In our case we have decided that a necessary condition any face area needs to meet is that its area proportion should be at least greater than 1/128 of the whole image area. This means 600 pixels when a 320x240 webcam resolution is used. The proportion was determined by the minimum distance at which the user should be placed in order to have a skin area size that we consider big enough to start detecting faces. In our application scenario, the distance between the camera and the user has been defined in such a way that the proportions previously mentioned are good enough. - Form Factor: This parameter quantifies the regularity of a region. Its maximum value is 1 and tends to zero while the region is more elongated. In our system, the minimal form factor was chosen empirically and it was 0.3. 𝐹𝑜𝑟𝑚 𝐹𝑎𝑐𝑡𝑜𝑟=4 𝜋∙𝐴𝑟𝑒𝑎 𝑃𝑒𝑟𝑖𝑚𝑒𝑡𝑒𝑟 2 (2.3) Faces use to be little flattened ellipses, the problem with the algorithm is that sometimes it also detects necks, and so the candidate regions are generally elongated and decrease the form factor. - Solidity: It is defined as the ratio of its area to the area of the min-max box (rectangular bounding box1), and gives a measure of area occupancy of a connected component within its min-max box dimensions. If the solidity of a candidate is smaller than 0.5218, it is eliminated [11]. 𝑆𝑜𝑙𝑖𝑑𝑖𝑡𝑦 = 𝐴𝑟𝑒𝑎 𝐷𝑥𝐷𝑦 (2.4) Although there are many possible parameters in the task of filtering false candidates, it has been determined that using few of them is actually a reasonable way to filter regions that are not possible faces. The result of these operations is the original image with a bounding-box containing the selected skin pixels areas. Its operation can be seen in Fig. 2.8. 1 Bounding box: Minimum or smallest rectangle containing the region.
Face detection 19 Figure 2.8 Possible candidates for being face Anyway, we have to take into account some constrains when trying to detect faces on the candidate areas when: - A face region is merged with other objects due to their similar colour characteristics. - A candidate region is split up into unconnected regions not valid for detection, as they should be part of the same entity. This situation usually occurs when there is a closer face in the scene or when strong brightness changes among the skin colour information occurs due to flashes on the skin or lighting conditions that suddenly changes. However, this only indicates that regions similar to face-shape have been selected. Next module must determine if they are really faces. 2.3.4. Features detection Selected techniques exposed on section 2.3.1 will be analyzed next. Following the same approach as Cooray and O'Connor [12], while there are several facial features being utilized in face detection such as eyes, mouth, nose, eyebrows, ears, etc., we will only consider mouth, nose and eye feature points as the ones to be localized in our approaches. 2.3.4.1. Colour feature-invariant based method Cooray and O'Connor [12] employ a hybrid technique for feature detection, also proposed by Hsu, Abdel and Jain [13] for detection based on measurements derived from the colour space components of an image. It is important to notice that this criterion does not explicitly classify mouth and eyes features, but its regions location. Mouth is localized based on its redness characteristics‟ pixels. Hsu, Abdel and Jain [13] noticed that mouth region contains more red component and less blue component than the rest of the facial regions. This means that in the YCrCb colour space, the chrominance component Cr is greater than Cb near the mouth Current Frame Detected Skin Candidates Current Frame Detected Skin Candidates Current Frame Detected Skin Candidates
Face detection 26 In colour feature-invariant methods we look for eyes and mouth features. Then, a valid face will be formed by a triangle which angles are formed by the vectors that connect every facial feature. Taking the set of possible eyes and mouths found previously, we can determine all the triangle combinations that can form a possible face, for choosing later the most suitable one. In Fig. 2.20 we can see all the possible eyes marked in white, as well as all the possible mouths marked in blue. Figure 2.20 Face area marked in red, eye candidates marked in white and mouth candidates marked in blue Triangles are connected starting from mouth, and selecting all the possible pair of eyes combinations, and taking into account some rules [12] [13]: - Once a mouth candidate is selected, all the detected eyes placed under its position are discarded. - Mouth must be between eyes in the order left eye - mouth - right eye. - The angle A formed among eye-mouth-eye is part of an isosceles triangle, which never will be greater than 90º. - The other angles must form an isosceles triangle (B=C=1/2(180º-A)) with a 25% variation margin. - Euclidean distance between two eyes is among an 80%-160% of the one from eyes to mouth. - Euclidean distances between eyes and mouth differs a maximum of 20%. By doing this we can obtain a list with more than one face candidates, as it is shown in Fig. 2.21. Figure 2.21 Face candidates Current Frame Detected Skin Candidates Faces Faces Current Frame Detected Skin Candidates
Face detection 27 In order to select one candidate among the resulting list, we use the next selection variables: - Face, meaning the area of the eye-mouth-eye triangle. - Eye-to-mouth distances, as they must be relatively equal in a normal frontal view of a face. - Farkas relation [17] that sets the distance among eye to mouth as 1.2 times the distance between eyes. The final candidate is the best one, which means choosing the candidate with more equal “eye to mouth” distances; its “face area” has a proportional relation with the whole image, and if it has a good Farkas distance proportion. With the appearance based method, after classifying all of the edge points as some of the trained classes (eyes and nostrils features), graph matching is performed, as done previously. Now the reference graph consists of mean distances between the chosen feature points: inner left eye corner; inner right eye corner; left nostril and right nostril. The distances between facial points indicate their displacement in the corners of a square, and compose a face matching graph. Fig. 2.22 shows the matching graph and the Farkas distances relations [17] between them. Figure 2.22 Face graph All the facial points previously classified are organized in groups of four, forming possible faces. Their distances are normalized by the distance of the eye‟s corners, and then compared to the reference graph. If the Euclidean distance of both graphs is below a specified threshold, the possible face is considered a real face. Next Fig. 2.23 shows the final result for the three scales in a still frontal image. Current Frame Detected Skin Candidates Final Detected Face 1.41 x 1.42 x o o 0.98 1.05 0.99
Face detection 28 Figure 2.23 Detected faces for 1.28, 1.3 and 1.32 scales As it happened with the previous methods, we can obtain more than one possible combinations. This is the reason why we use a grade criterion which is defined in next equation (2.13). 𝑔 = 1 𝑒𝑑 (2.13) All of the possible faces have a grade g associated, which depends on the distance d to the graphical model. In order to select one candidate, we choose the one closer to the ideal model, meaning the highest g grade. 2.4. Face Selection In our system users have to smile in order to check the entrance permission. Once faces have been detected we need to make further analysis in order to normalize the face image and detect smiling. Face selection is divided in two parts: face cropping and smile shooter. Face cropping gets the potential facial region that will cover the eyebrows, both eyes and some area below the mouth. The smile shooter analyses the mouth area of each cropped face, looking for that smile, and normalizes the obtained facial region to the requirements of the following recognition stage. 2.4.1. Face cropping Once the final face‟s features have been chosen, we act in order to get the potential facial region. It should cover the eyebrows, two eyes and some area below the mouth. Following the criteria of Singh, Chauhan and Vasta [18] the face area is selected by the points that form the features topology (triangle or square) and Current Frame Detected Skin Candidates Candidates
Face detection 29 the Euclidean distance between the right eye and left eye. Spatial calculations can be consulted on appendix A.3. Figure 2.24 Face cropping Fig. 2.24 shows how the face is being cropped when using colour-based feature-invariant method with αmouth = 3.5; αeyes = 1 and non parametric skin method (S5) over two different person. 2.4.2. Smile shooter We all can recognize a smile as a facial expression, formed by flexing muscles nearest to both ends of the mouth. Smiling is a fast movement. When acquiring a video sequence with 30 fps, experimentally we found a smile sequence is produced in just 3-5 frames. When smiling, changes on colours happen because of the appearance of white teeth or dark areas corresponding to holes among teeth and the corners of the mouth. As it happens with skin detection, this variation will depend on luminance state and selected colour space. An empirical study was made over RGB, YCbCr and grayscale colour spaces, and can be consulted on appendix A.4. Observing samples of smile sequences and looking for a pattern to apply to the system, we decided to take grey images‟ histogram variance as a quick parameter that indicates sudden changes over the mouth area. When smile occurs on grey colour space, more black and white components appear due to the presence of teeth (more white) and dark areas within the mouth (more black). Comparing two mouth area images (smile and non smile), there is an increase of approximately a 40% of the grey‟s histogram variance, as it can be shown in Fig. 2.25: Current Frame Detected Skin Candidates Faces Current Frame Detected Skin Candidates Faces Current Frame Detected Skin Candidates Faces Current Frame Detected Skin Candidates Faces
Face detection 30 Figure 2.25 Grey scale smile variation The smile shooter then checks if the variance percentage of the detected mouth area increases from the past two frames. The threshold value that decides if smiling occurs is a determined percentage, which must be empirically tuned. 2.5. Tests and results As it might happen with any colour based method, algorithms will be influenced by lightning changes in the scene. The method explained on section 2.3.4.1 uses a threshold value for detecting both mouth and eye areas. The decision is a linear combination between the average and the maximum value of the resulting maps, compensated with an α variable. The α value is determined experimentally and its correct selection highly influences the performance of the algorithm. In Fig. 2.26 and Fig. 2.27 are shown the total amount of true feature positives and true feature negatives detections depending on α value, determined over a set of 25 face images. Blue line represents true positive detections, while red line represents false positive detections. Figure 2.26 α mouth performance Figure 2.27 α eye performance Serious 0 2 4 6 8 Gray Histogram 050 100 150 200 250 Smiling 0 2 4 6 8 Gray Histogram 050 100 150 200 250 Serious 0 2 4 6 8 Gray Histogram 050 100 150 200 250 Smiling 0 2 4 6 8 Gray Histogram 050 100 150 200 250 Serious 0 2 4 6 8 Gray Histogram 050 100 150 200 250 Smiling 0 2 4 6 8 Gray Histogram 050 100 150 200 250 Serious 0 2 4 6 8 Gray Histogram 050 100 150 200 250 Smiling 0 2 4 6 8 Gray Histogram 050 100 150 200 250 0 5 10 15 20 1 2 3 4 5 6 7 8 9 10 Detections α value Mouth detection 0 10 20 30 40 50 60 70 80 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Detections α value Eye detection
Face detection 31 As it can be seen, the best performance for this algorithm will be when using α value among 3 and 4 for mouth detection, as well as α range among 0.83 and 0.95 for eye detection. Anyway, this variable modifies the threshold value that finally determines the maps, and it will always depend on the stability of the colour of the image. Next we will show the efficiency of face detection methods, which will be named onwards with the next acronyms: - M1 Colour feature-invariant-based method. - M2 Variation on colour feature-invariant-based method. - M3 DGJ-LDA appearance-based method. Fig. 2.28 and Fig. 2.29 show the precision and recall of the M1 and M2 algorithms when detecting features: Figure 2.28 Precision and recall in mouth methods Figure 2.29 Precision and recall in eye methods When comparing precision and recall with each algorithm, the variation over the colour based eye detection is better as it makes more detections, and this is basic for further analysis, while the mouth detection is a little less effective. It must be taken into account that tests were made over 25 face images and with α value of 3 and 0.9, as they were the best values, as previously reported. Now we have proved the M2 method works better, we have to compare it with the other face detection algorithm M3. When evaluating the face detection methods, percentage or ratio of false rejections (FRR) has been the chosen measure. FRR is the number of faces that have not been detected from all the faces of the GTAV database. Fig. 2.30 shows the FRR percentage for all methods. 0% 20% 40% 60% 80% M1 M2 Eyes Detection Precision Recall 0% 20% 40% 60% 80% 100% M1 M2 Mouth Detection Precision Recall
Face detection 32 Figure 2.30 FRR percentages in face detection methods We can see how the DGJ-LDA appearance-based method (M3) has the best performance. Testing allowed us to study the conditions under which the methods failed. As it happened with skin detection, illumination is crucial in obtaining good results with colour based face detection methods. Images must be sharp, clear, without shadows or saturated colours. On the other hand, with appearance based method, the election of the scales and the resolution of the images are decisive for its good performance. Contrary to what we expected, we have empirically verified how choosing fewer DGJ number (type 1 and type 2), the algorithm becomes more efficient. The images‟ resolution affects the results too. The detection in images much smaller than the ones used for training is quite bad, even with DGJ scaling. 2.6. Conclusions We have shown how the two proposed methods are valid for detecting faces. However, the most reliable one (meaning the number of faces detected) is the LDA DGJ-appearance-based method, because it has a lower FRR ratio. Based on this ratio, this should be the method used in our system. Recapturing the real time restrictions, it is important to take into account computational costs. The following table 2.2 shows the estimated average in seconds for each algorithm used to determine the existence of a face, using the GTAV faces database. Table 2.2 Average elapsed time used for face detection Type M1 M2 M3 Seconds 0.115820 0.142460 19.284162 43% 61% 83% False Rejections Ratio (FRR) M3 M2 M1
Face detection 33 We observe how colour based methods (M1 and M2) are faster, with little variation among them. Unfortunately, the most reliable method is also the slowest. This is mainly due to DGJ scaling, leading to triple all calculations on the same image. Scaling allows the detection of features on various faces‟ size, so using a single scale reduces computation time, but involves an increase of the FFR ratio. There is a clear trade off between speed and efficiency. Using M2 method we can achieve computational speed that enables us to perform calculations over almost every frame of the video sequence. However, the reliability of the detection is compromised. The visual information redundancy between frames provides a margin of operability. That is, if a face is not detected in a frame, it probably will in the following. Using M3 method leads us to adapt the frame processing frequency, as well as the used scales, jeopardizing the system‟s real time response.
Face recognition 34 CHAPTER 3. FACE RECOGNITION 3.1. Introduction Once faces are detected, last stage of the system is face recognition. There are many strategies for face recognition, but only two of the more representative have been analyzed in this work [19]: Principal Components Analysis (PCA) and Linear Discriminant Analysis (LDA). 3.2. General process Both methods are appearance based, using a principal value decomposition analysis as the main classifier procedure. The general method is composed of two stages: a training stage and a recognition stage. A selection of the GTAV database‟s pictures has been used. Training set consists of 3 images from 10 different persons, which construct the user‟s identity on the appointed database. Eventually, the total amount of training images is 30 which size is 122x100 pixels. Next Fig. 3.1 shows images for three users: Figure 3.1 Users‟ images on recognition training The PCA main idea is to decompose all the face images of the training database into a small set of characteristic feature images called eigenfaces, which may be thought as the principal components of the original images. These eigenfaces work as the orthogonal basis vectors of a linear subspace called “face-space''. By doing this approach, the space size is drastically reduced, since any image in the training set can be expressed as a combination of those eigenfaces. Besides, LDA is more
Face recognition 35 focused on data classification. The main goal is to obtain a projection of the training images in a same size (or smaller) subspace, with the aim of grouping them in the way that best discriminates between classes (users in our case). There are several LDA implementations, being Fisher-LDA the one studied here. Testing is performed by projecting a new face image into the new face-space and then comparing its position in the face-space with those of known faces. The minimum Mahalanobis distance is searched and if it accomplishes a minimum distance criterion, then it is classified as a known face. 3.3. Methods evaluated 3.3.1. Principal Component Analysis (PCA) Basic eigenfaces algorithm was determined by Turk and Pentland [20][21][22]. Training stage use a face database made up of a set of 30 frontal face images of 100x122 size. Each image is reorganized as a vector and concatenated in rows, creating a matrix of image-vectors. Then it is calculated the average of all the images and subtracted to each of the image-vectors. Next, the correlation of the matrix is obtained, and its eigenvectors computed. Pentland [22] proved that superior face recognition results are achieved when the three first eigenvectors are not used. Anyway, we don‟t remove any of them, as they represent changes in illumination. Figure 3.2 Three principal eigenvectors The obtained matrix is descending ordered. Then a pattern of each image-vector is obtained, which means that every image on the data base is projected over the new face space. As we said on section 3.2, the GTAB training database is composed of 30 images, 3 images per 10 users. Compared with other PCA recognition algorithms, this set might seem small. The GTAV training set has the identities of the users we really want to be allowed by the system. The implementation allows the training set to be increased whenever we want new users to be introduced in the system. Finally, training set has been transformed from M size (12200x30) to M‟ size (30x30). Appendix A.3 has deeper information on PCA algorithm. Eigenfaces Eigenfaces Eigenfaces
Face recognition 42 CHAPTER 5. CONCLUSIONS In this project we have developed an access control system based on face recognition for images acquired by a webcam. The nature of these images makes the face detection and recognition difficult, as we can hardly control the illumination, although we suppose a semi-controlled environment similar to an access point. In addition, the characteristics and settings of the camera also have a lot of variability and the resolution of the images is poor. Despite this, we have achieved good results in experiments with skin colour detection methods, highlighting the acceptable working of the parametric skin detection algorithm, combined with the improved colour feature-based approach and LDA recognition methods. Although results are promising, there are still some aspects that should be considered in the future. For instance, trying new colour spaces methods in the skin detection, combined with the already proven ones, in order to achieve an automatic adjustment to changes in lighting conditions. It would be also possible to develop a multi Gaussian method [7], increasing the only-skin images database too. The best way would be by computing a self adapting skin detection algorithm, combining the already proven methods with a lightning checker. The main idea is to select in every frame the most suitable skin detection method, depending on the illumination. In order to work in real time, we could increase computing speed using higher programming languages, such as GPU parallel processing using NVIDIA CUDA or programming the image processing system with FPGAs. Adding a tracking stage once a face has been detected would also increase the system‟s speed, as we wouldn‟t have to compute all face detection stages during next frames. The system‟s robustness can be contrasted with other face detection techniques described in [9], such as deformable pattern methods. Another possible line of work is to add robustness against changes in rotation and face occlusions. Finally, as an added security action, it could be designed a system to avoid cheating in detection, such as the malicious use of face pictures to impersonate known users‟ identity. The system is devised to be placed at the entrance of urban facilities. The environmental impacts produced will be related to the components‟ making, the possible need of building works and the resources and logistics necessary for its installation. The amount of energy consumed in order to install and run the system is significant, too. The prototype consists of a computer and a webcam, and therefore it does not need any particular installation nor consumes any energy apart from that of the computer itself. In the event that further development of the prototype is considered, it would be advisable to fit the camera and the FGPA programmed system into an only object. This way, the hardware‟s low consumption would allow adding a self-supply electric system during the day based on photovoltaic
Face recognition 43 cells, while storing the database in the department‟s server, and monitoring the system with just one computer when updating and maintenance works are required. As for the inevitable impact caused by the components‟ manufacture, the best way to minimize them is to seek suppliers ISO 14001 certified, committed to environmental issues.
Face recognition 44 BIBLIOGRAPHY [1] Bruce V., Young A., “Understanding face recognition”, British Journal of Psychology, 77, 305-327, 1986. [2] Yang, M. H. Kriegman, D. J. And Ahuja, N., “Detecting Faces in Images: A Survey”, IEEE transactions on pattern analysis and machine intelligence, Vol. 24, NO 1, January 2002. [3] Rossoti H., “Colour: Why the World isn't Grey”, Princeton, NJ: Princeton University Press, 1983. [4] Zarit, B. D. , “Skin detection in video images”, Technical Report, VisLab-99- 01, Wrigth State University, Ohio, USA, February 1999. [5] Peer, P., Kovac, J., and Solina, F., “Human skin colour clustering for face detection”, submitted as a tool on EUROCON, International Conference on Computer, 2003. [6] Vezhnevets V., Sazonov V. y Andreeva A., “A Survey on Pixel-Based Skin Colour Detection Techniques”, Proc. Graphicon, 85-92, September 2003. [7] Mota Ferreira, A. and Velhote Correia, V., “Face Detection Based on Skin Colour in Video Images with Dynamic Background”, ICIAR07, 254-262, 2007. [8] Sobottka,k and Pitas, I., “Extraction of facial regions and features using colour and shape information”, Proceedings of the International Conference Of Pattern Recognition (ICPR ‟96 ), 1996. [9] Ming-Hsuan Yang, David J. Kriegman, Narendra Ahuja, "Detecting Faces in Images: A Survey," IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 24, no. 1, pp. 34-58, January, 2002. [10] El_Sayed M. Saad, Mohiy M. Hadhoud, Moawad I., “Frontal-view face detection in the presence of skin-tone regions using a new symmetry approach”, Journal of Computer Science & Technology, vol. 6, no2, pp 85-87, Oct. 2006. [11] Prem Kuchi, Prasad Gabbur, Subbanna Bhat, Sumam David S., "Human Face Detection and Tracking using Skin Colour Modelling and Connected Component Operators", IETE journal of research vol. 48, no3-4, pp. 289-293, 2002. [12] S. Cooray, N. O'Connor, "A hybrid technique for face detection in colour images," Advanced Video and Signal Based Surveillance, IEEE Conference on, vol. 0, no. 0, pp. 253-258, IEEE Conference on Advanced Video and Signal Based Surveillance, 2005., 2005.
Face recognition 45 [13] R.-L. Hsu, M. Abdel-Mottaleb, and A. K. Jain, “Face detction in colour images,” IEEE Tran. on PAMI, vol. 24, pp. 696–706, May 2002. [14] Hoffmann, U. ; Naruniec, J. ; Yazdani, A. ; Ebrahimi, T., “Face Detection Using Discrete Gabor Jets And Colour Information”, ICETE 2008, Porto, July 26-29, 2008. [15] http://gps-tsc.upc.es/GTAV/ResearchAreas/UPCFaceDatabase/ GTAVFaceDatabase.htm, July 2009. [16] Canny, J.F., “A computational approach to edge detection”, IEEE Trans Pattern Analysis and Machine Intelligence, 8(6): 679-698, Nov 1986. [17] L. G. Farkas, “Anthropometry of the Head and Face”, Raven Press, 2nd edition, 1995. [18] Sanjay Kr. Singh, D. S. Chauhan, Mayank Vatsa, Richa Singh, “A Robust Skin Colour Based Face Detection Algorithm”, Journal of Science and Engineering, 2003. [19] Zhao, W., Chellappa, R., Phillips, P. J., and Rosenfeld, A., ”Face recognition: A literature survey”, ACM Comput. Surv. 35, 4 (Dec. 2003), 399- 458. [20] Gonzalez J.G., “Face Recognition and Detection Using Eigenfaces”, 1997. [21] Correa M., Chichizola F., “Sistema de Reconocimiento de Rostros”, Trabajo de grado de Licenciatura, 2001. [22] Pentland, T. Starner, N. Etcoff, A. Masoiu, O. Oliyide, and M. Turk, “Experiments with Eigenfaces”, Looking At People Workshop, IJCAI‟93, France, August 1993. [23] Etemad, K. and Chellappa, R., “Discriminant Analysis for Recognition of Human Face Images (Invited Paper)”, Proceedings of the First international Conference on Audio- and Video-Based Biometric Person Authentication (March 12 - 14, 1997). J. Bigün, G. Chollet, and G. Borgefors, Eds. Lecture Notes In Computer Science, vol. 1206. Springer-Verlag, London, 127-142, 1997. [24] A. Martinez and A. Kak, “PCA versus LDA”, IEEE Trans. Pattern Analysis and Machine Intelligence, vol. 23, no. 2, pp. 228-233, Feb. 2001. [25] P. Belhumeur, J. Hespanha, D. Kriegman, "Eigenfaces vs. Fisherfaces: Recognition Using Class Specific Linear Projection", Proc. of the Fourth European Conference on Computer Vision, Vol. 1, 14-18 April 1996, Cambridge, UK, pp. 45-58
APPENDIX TÍTOL DEL PFC: Facial recognition in controlled access points TITULACIÓ: Enginyeria de Telecomunicació (segon cicle i master) AUTOR: Olga Mur Escartín DIRECTOR: Francesc Tarrés Ruiz DATA: 15/07/2009
ÍNDEX APPENDIX A. METHODS STUDIED A.1 Skin detection methods ....................................................................................................... 1 A.1.1 Explicitly defined skin region ................................................................................. 1 A.1.2 Nonparametric skin distribution modeling: the Bayes classifier ....................... 3 A.1.3 Parametric skin distribution modelling: single Gaussian ................................... 4 A.2 Face detection methods ....................................................................................................... 5 A.2.1Colour based feature-invariant method. ................................................................. 5 A.2.2 Variation on colour feature-invariant-based method .......................................... .6 A.2.3DGJ-LDA appearance-based method .................................................................... .7 A.2.3.1Training .................................................................................................................. .7 A.2.3.2Test ......................................................................................................................... .8 A.3 Face selection ....................................................................................................................... 9 A.4 Smile detection method ....................................................................................................... 9 A.5 Face recognition methods ................................................................................................. 12 A.5.1 PCA .......................................................................................................................... 12 A.5.2 LDA .......................................................................................................................... 14 APPENDIX B. MORPHOLOGIC OPERATIONS B.1 Set operations ..................................................................................................................... 16 B.2 Dilatation.............................................................................................................................. 16 B.3 Erosion ................................................................................................................................. 17 B.4 Replenishment .................................................................................................................... 18 B.4 Opening ............................................................................................................................... 19 B.5 Closing ................................................................................................................................. 20 APPENDIX C. ALGORITHMS SUMMARY ...................................................... 21
Appendix I 1 APPENDIX A. Methods studied A.1 Skin detection methods A.1.1 Explicitly defined skin region S1: RGB is the most common colour space used to represent images as a combination of three colour rays (red, green and blue). Kovac and Solina [5] determine a pixel as skin if it accomplishes the conditions shown in the equation 1.1: 𝑅 > 95 𝑎𝑛𝑑 𝐺 > 40 𝑎𝑛𝑑 𝐵 > 20 𝑎𝑛𝑑 𝑚𝑎𝑥{𝑅,𝐺,𝐵}−𝑚𝑖𝑛{𝑅,𝐺,𝐵} > 15 𝑎𝑛𝑑 |𝑅−𝐺| > 15 𝑎𝑛𝑑 𝑅 > 𝐺 𝑎𝑛𝑑 𝑅 > 𝐵 𝑜𝑟 𝑅 > 220 𝑎𝑛𝑑 𝐺 > 210 𝑎𝑛𝑑 𝐵 > 170 𝑎𝑛𝑑 |𝑅 − 𝐺| ≤ 15 𝑎𝑛𝑑 𝑅 > 𝐵 𝑎𝑛𝑑 𝐺 > 𝐵 (A.1) S2: Normalized RGB is a representation, which is easily obtained from the RGB values by a simple normalization procedure: 𝑟 = 𝑅 𝑅+𝐺+𝐵 𝑔 = 𝐺 𝑅+𝐺+𝐵 𝑏 = 𝐵 𝑅+𝐺+𝐵 (A.2) As the sum of the three normalized components is r+g+b = 1, the third component can be omitted, reducing the space dimension. RGB normalized space is invariant to the luminance [6] under certain assumptions. Mota and Velhote [7] classifies as pixel as skin if accomplishes the conditions shown in the equation A.3: μr − k ×σr < r < μr + k ×σr and μg − k ×σg < r < μg + k ×σg Where μr =0.454; σr = 0.04; μg = 0.313; σg = 0.02 (A.3) S3: Sobottka y Pitas [8], chooses a HSV colour space and a region equivalent to a hexagon defined among ref and yellow. This method requires the conversion of the input image to HSV space (equation A.4), which is invariant to highlight at white light sources [6]. A pixel is classified as skin if accomplishes the conditions shown in the equation A.5: 𝐻 = arccos 1 2((𝑅−𝐺) + (𝑅−𝐵)) ((𝑅−𝐺)2+ (𝑅−𝐵)(𝐺−𝐵)) 𝑆 = 1 −3𝑚𝑖𝑛(𝑅,𝐺,𝐵) 𝑅+𝐺+𝐵
Appendix I 2 𝑉= 1 3(𝑅+𝐺+𝐵) (A.4) Smin < S < Smax and Hmin < H < Hmax (A.5) Where Smin=0.23; Smax=0.68; Hmin=0º; Hmax=50º. S4: Kovak and Solina [5] also describe skin colours with cluster determined by two central curves (the centers) Cb Y and Cr Y and by deviation curves (spread of the cluster) WCb Y and WCr Y , depend on Y component, which represents the luminance. YCrCb colour space transformation is shown in the equation A.6 and equations of mentioned curves are the expressed in the equation A.7: 𝑌 = 0.299𝑅+ 0.587𝐺+ 0.114𝐵 𝐶𝑟 = 𝑅−𝑌 (9) 𝐶𝑏 = 𝐵−𝑌 (A.6) WCi Y = WLCi+ Y−Ymin (WCi−WLCi) Ki−Ymin ; Y < 𝐾i WHCi+ Ymax −Y (WCi−WHCi) Ymax −Kh ; Kh<𝑌 WCi; sino Cb Y = 108 +10 Ki−Y Ki−Ymin ; Y < 𝐾i 108 +10 Y−Kh Ymax −Kh ; Kh<𝑌 108; sino Cr Y = 154 +10 Ki−Y Ki−Ymin ; Y < 𝐾i 154 +22 Y−Kh Ymax −Kh ; Kh<𝑌 108; sino (A.7) Where WCi Y is b or r; WCb = 46.97; WLCb = 23; WHCb = 14; WCr = 38.76; WLCr= 20; WHCr = 10; Kl= 125; Kh = 188; Ymin = 16 and Ymax = 235; α = 0, 56. These parameters are evaluated from training samples of skin. For every pixel of the input image components Y , Cb and Cr are transformed from RGB values, and it is determined as skin if it accomplishes the conditions shown in the equation A.8: Cb Y −∝WCb < Cb < Cb Y +∝WCb Cr Y −∝WCr < Cr < Cr Y +∝WCr (A.8)
Appendix I 3 In the same paper, Kovak and Solina [5] offers another way to evaluate skin tone. A pixel is classified as skin when the chromaticity (Cb,Cr) leads to the pair (x,y) that is inside the area that has a form of an ellipse, with which is described the skin colour cluster, ellipse that can be written as it is shown in the equation A.9: (𝑥 − 𝑒𝐶𝑥 )2 𝑎2+ (𝑦 −𝑒𝐶𝑦 )2 𝑏2≤ 1 𝑥 𝑦 = cosθsinθ −sinθcosθ 𝐶𝑏− 𝑐𝑥 𝐶𝑟− 𝑐𝑦 (A.9) Where 𝑐𝑥 = 109.38, 𝑐𝑦 = 152.02, θ = 2.53 radian, 𝑒𝐶𝑥 = 1.6, 𝑒𝐶𝑦 = 2.41, a = 25.39 and b = 14.03. S5: Using the same colour space Y Cb Cr, Kovac, Peer and Solina [5] establishes another threshold criteria invariant to the luminance for classifying a pixel as skin, also defined in A.10: 𝐼𝑚_𝑌𝐶𝑏𝐶𝑟(𝑖,𝑗,2) > 130 𝑜𝑟 𝐼𝑚_𝑌𝐶𝑏𝐶𝑟(𝑖,𝑗,2) < 80 𝑜𝑟 𝐼𝑚_𝑌𝐶𝑏𝐶𝑟(𝑖,𝑗, 3) > 175 𝑜𝑟 𝐼𝑚_𝑌𝐶𝑏𝐶𝑟(𝑖,𝑗, 3) < 140 (A.10) A.1.2 Nonparametric skin distribution modelling: the Bayes classifier The non-parametric skin methods calculate the skin colour distribution from the training data without describing an explicit model of the skin colour. The result of these methods turns on a Skin Probability Map [6] that establishes a probability value to each point of a discretized colour space. The colour space (usually, the chrominance plane only but we performed also RGB space) is quantized into a number of bins. Each bin corresponds to a range of component values. In case of chrominance Cr-Cb values or R-G-B values on the other side. So, colour space is turned into a 2D or 3D histogram, named lookup table (LUT). Each bin stores the number of times this range colour occurred in the training set of only-skin images. Then, the histogram counts are normalized, divided by the sum of all histogram bin values or maximum bin value. By doing this, the LUT turns to discrete probability distribution, as shown in the equation A.11: 𝑃𝑠𝑘𝑖𝑛 𝑐 =𝑠𝑘𝑖𝑛 𝑐 𝑁𝑜𝑟𝑚 (A.11) Where skin[c] gives the value of the histogram bin, and 𝑃𝑠𝑘𝑖𝑛 𝑐 is the conditional probability that we will find the colour 𝑐 knowing that it is skin.
Appendix I 4 Obviously, another consideration is needed, as we are interested in knowing the probability of observing skin, given a concrete 𝑐 colour value. To compute this probability, the Bayes rule described in the equation A.12 is used. 𝑃 𝑠𝑘𝑖𝑛|𝑐 =𝑃 𝑐|𝑠𝑘𝑖𝑛 𝑃 𝑠𝑘𝑖𝑛 𝑃 𝑐|𝑠𝑘𝑖𝑛 𝑃 𝑠𝑘𝑖𝑛 +𝑃 𝑐|¬𝑠𝑘𝑖𝑛 𝑃 ¬𝑠𝑘𝑖𝑛 (A.12) 𝑃 𝑐|𝑠𝑘𝑖𝑛 and 𝑃 𝑐|¬𝑠𝑘𝑖𝑛 are calculated from skin and non-skin colour histograms, as well as the prior priorities 𝑃 𝑠𝑘𝑖𝑛 and 𝑃 ¬𝑠𝑘𝑖𝑛 , using the set of skin and non-skin images of the training sets. The skin detection rule is done by an inequality and a threshold value, which after some manipulations can be written as shown in equation A.13: 𝑃 𝑐|𝑠𝑘𝑖𝑛 𝑃 𝑐|¬𝑠𝑘𝑖𝑛 > 𝜃 𝜃= 𝐾× 1−𝑃(𝑠𝑘𝑖𝑛) 𝑃(𝑠𝑘𝑖𝑛) (A.13) The advantages of the non-parametric methods are fast in training and usage. On the other hand, they require high storage space required and the training data cannot be generalized. Vezhnevets , Sazonov and Andreeva [6] shows that 32x32x32 is the best size for RGB histogram. A.1.3 Parametric skin distribution modelling: Single Gaussian As it has been said on the previous section, histogram-based non-parametric skin models require high storage space depending on the selected number of bins. Furthermore, its performance depends on the selected training images set. This means that the performance will be worst if the colour of the illumination makes colour distribution very different from that with which the probability distribution was calculated. Anyway, if it is calculated with the largest possible range of illuminations, we will have a great tolerance, working well with most types of lights. On the other hand, it will incorrectly classify parts of the background as skin. Parametric skin distribution models need not so big model representation, so they are more suitable for faster applications. But the most important fact is that they allow generalizing and interpolating the training data. Skin colour distribution can be modelled by an elliptical Gaussian joint probability density function (PFD) defined in equation A.14: 𝑝(𝑐|𝑠𝑘𝑖𝑛) = 1 2𝜋|ΣS|1/2 ·𝑒− 1 2(𝑐−𝜇𝑠)𝑇 ΣS−1 (𝑐−𝜇𝑠) (A.14) Here, c is a colour vector, 𝜇𝑠 the mean vector and ΣS the covariance matrix. The model parameters are estimated from the training data by the equation A.15:
Appendix I 11 Figure A.3 YCbCr mouth histogram Figure A.4 Greyscale face histogram Serious 0 2 4 6 8 Y 0100 200 0 5 10 15 20 25 Cb 0100 200 0 5 10 15 20 Cr 0100 200 Smiling 0 2 4 6 8 Y 0100 200 0 5 10 15 20 25 30 Cb 0100 200 0 5 10 15 20 25 Cr 0100 200 Serious 0 10 20 30 40 Gray Histogram 050 100 150 200 250 Smiling 0 10 20 30 40 Gray Histogram 050 100 150 200 250
Appendix I 12 Figure A.5 Greyscale mouth histogram A.5 Face recognition methods A.5.1 PCA Principal components analysis (PCA) is a common technique, also known as Karhunen-Loeve method. It is widely used in face recognition, as the result is a new reduced dimension which linear projection maximizes the scatter of all projected samples. PCA does not consider similar image elements as random variables, so they can be described by a lower dimensional space. Having a M size training set {Γ1, Γ2, Γ3… ΓM}, composed by NxN face images, firstly each image is constructed as a vector of N2 dimension, composing a matrix of N2xM. 𝜓= 1 𝑀 Γn 𝑀 𝑛=1 (A.39) The average face of the set is computed by equation A.40, and subtracted from each of the images Γi, obtaining a new set of vectors: 𝜙𝑖= Γi−𝜓 (A.40) Those vectors compose a matrix of N2xM size defined by equation A.41: Serious 0 2 4 6 8 Gray Histogram 050 100 150 200 250 Smiling 0 2 4 6 8 Gray Histogram 050 100 150 200 250
Appendix I 13 Λ= 𝜙1,𝜙2,𝜙3,…𝜙𝑀 (A.41) The principal component analysis is made, which looks for a set of M orthonormal vectors and their associated values that best describes the distribution of the data. The vectors uk and their scalars λk are named the eigenvectors and eigenvalues of the covariance matrix respectively. 𝐶= 1 𝑀 𝜙𝑛 𝑀 𝑛=1 𝜙1𝑇=𝐴𝐴𝑇 (A.42) Where the matrix A = 𝜙1,𝜙2,𝜙3,…𝜙𝑀 . C matrix is too large N2x N2 for determining the eigenvectors and eigenvalues. In order to reduce de computational cost, by solving a reduced covariance matrix of dimension MxM, and taking linear combinations of the resulting vectors. 𝐿= 1 𝑀ΛΛ𝑇 (A.43) The eigenvectors of L are obtained, which, ordered from greater to lesser according to their corresponding eigenvalues, making up matrix v. Eigenvectors C are approximated through equation A.44, where each column of u represents an eigenvector. 𝑢= Λ∙𝑣 (A.44) Doing this approximation, the computational cost is reduced, from N2 to the order of the images in the training set M. In general M << N2. Once the new face space is created, the recognition stage becomes easy. M‟ most significant vectors of the L matrix are chosen. The number of the eigenfaces used depends heuristically from eigenvalues. A pattern of the new image Γ is obtained (projected into the new face space) as follows: 𝑤𝑘= 𝑢𝑘 𝑇 Γ −𝜓 𝑓𝑜𝑟 𝑘= 1 …𝑀′ (A.45) The recognition process tries to find the minimum weight from a vector that describes the contribution of each eigenface in representing the input image. ΩT=[𝑤1,𝑤2,𝑤3,…𝑤𝑀′] (A.46) The simplest method id by finding the k that minimizes the Euclidean distance as shown in equation A.47: ϵk= min( Ω−Ωk )2 (A.47) A face is classified as class k when ϵk is below some chosen threshold θk. Otherwise the face cannot be classified as known.
Appendix I 14 A.5.2 LDA PCA extracts features (or components) that well describe the pattern. LDA instead searches for those vectors in the subspace that best discriminate among classes. Then it is used for distinguishing between classes and separating patterns. For all the samples of all the classes it is defined a measure called within-class scatter matrix following next equation A.48: Sw= xi j−μj Nj i=1 c j=1 xi j−μj T (A.48) Where xi j is the i sample of the class j; μj is the mean of class j; c is the number of classes and Nj the number of samples of class j. For all the samples of all the classes it is also defined a measure called between-class scatter matrix following next equation A.49: Sb= μj−μ Nj i=1 c j=1 μj−μ T (A.49) Where μ represents the mean of all classes. The goal of the LDA algorithm is to maximize the separability between-class and minimize the separability withinclass, maximizing the ratio: det |Sb| det |Sw| (A.50) If Sw is nonsingular, the optimal projection Wopt is chosen as the matrix with orthonormal columns which maximizes the ratio of the determinant of the between-class scatter matrix of the projected samples to the determinant of the within-class scatter matrix of the projected samples: Wopt = argmax |WTSbW| |WTSwW| = [w1,w2,…, wm] (A.51) where wi is the set of generalized eigenvectors of Sb and Sw corresponding to the m largest generalized eigenvalues. It is possible to choose the matrix W such that the within-class scatter of the projected samples can be made exactly zero. The Fisherfaces algorithm reduces the complication of finding Sw by projecting the image set to a lower dimensional space so that the resulting within-class scatter matrix Sw is non-singular. This is achieved by using PCA to reduce the dimension of the feature space to N - c, and then applying the equation defined by equation A.52 to reduce the dimension to c – 1:
Appendix I 15 Wopt = argmax |WTWPCA TSbWPCA W| |WTWPCA TSwWPCA W| (A.52)
Appendix I 16 APPENDIX B. Morphologic operations Morphological filtering is a common binary or gray-scale image processing, where the spatial form of objects within an image is modified. Open-Close, dilation, erosion and replenishment are the main fundamental morphological operations. Next we will deal only with binary images for a basic understanding of the techniques. Morphological processing for gray scale images requires more sophisticated mathematical development. B.1 Set operations Let A and B be sets. If a is the index of a pixel in A, then we write a ∈A . If a is not in A we write a ∉A. If every element that is in A is also in B then A is a subset of B, written A ⊆ B. This is equivalent to the statement a ∈A→ a ∈B . The union of A and B is the collection of all elements that are in one or both set. The union is the set represented by C = A B. Next figure shows the basic set operations: Figure B.1 (a) two sets A and B. (b) the union of A and B (c) the intersection of A and B. (d) the complement of A. (e) the difference between A and B B.2 Dilatation Given an image A, and a structural element B (two binary images with white background), the dilation of A by B is defined as: A ⊕B = x| B x⋂A≠∅ (B.1)
Appendix I 17 Notice that the intersection only considers black pixels in A and B. The first element of the expansion, A, is associated with the processed image and the second is called structural element, and it is the form that acts on A in the dilatation A ⊕B. Next figure shows a sample of dilatation: Figure B.2 Dilatation operation B.3 Erosion Given an image A, and a structural element B (two binary images with white background), the erosion of an image A, by a structural element B, is the set of all elements x for which B translated by x is contained in A: A ⊖B = x|B x⊆A (B.2) Notice that in the condition B x⊆A, we consider only the black pixels in A and B. Erosion is usually conceived as a reduction of the original image and it is the morphological dual operation of dilation. Figure B.3 Erosion operation Next figure shows a typical erosion application: Origin Origin
Appendix I 18 Figure B.4 (a) image of squares of size 1, 3, 5, 7 and 9, and 15 pixels on the side. (b) erosion of (a) with a square structuring element of 1‟s, 13 pixels on the side. (c) dilatation of (b) with the same structuring element Dilation and erosion are very similar in the sense that what one makes to an object, the other one does it in the background. B.4 Replenishment We started from the edge of an 8-related region, and a point p in the interior of A. The following procedure fills the interior of A: X0 = p (B.3) X k= X k−1⊕ B ⋂ Ac k = 1, 2, 3. .. (B.4) Where B is the following structural element: Figure B.5 Structural element Next figure shows the replenishment procedure previously described:
Appendix I 19 Figure B.5 Replenishment procedure B.4 Opening As we have seen, when the structural element is containing the origin, dilation expands the image and erosion reduces it. Other morphological operations are opening and closing. Opening operation generally smoothes the contours of an image. You can also remove areas of an object that are narrower than the structural element. The closing operation removes small holes (replenishment) and links close related components. The opening of A, by a structural element K, is defined as: A∘K = A⊖K ⊕K (B.5) So the opening of A by K is simply the erosion of A by K, followed by the dilation of the result by K. Next figure shows how if we take a disc as a structural element, the opening smoothes contours, breaks narrow joints between parts of sets and removes outgoing straits.
Appendix I 20 Figure B.6 Opening operation B.5 Closing The closing of A, by a structural element K, is defined as: A∙K A⊕K ⊖K (B.6) Therefore, the closure of A by K is the dilation of A by K, followed by the erosion of the result by K. Next figure shows how if we take a disc as a structural element, the closing tends to smooth sections of contours but in reverse: combines narrow separations and eliminates gaps. Figure B.7 Closing operation
Annex I 27 FUNCTION INPUTS OUTPUTS DESCRIPTION Merge Face Candidates structTopologyOut structTopologyIn Merges the possible face candidates detected by the graph matching. Facial Features 3 Image Image to be processed in order to look for nostrils and eyes. MULTI_LDA Structure containing for each scale: Feature_Space; Mean_Vector; Weights; Class_ID; Features_Class and Norm_Vector. MULTI_THRESHOLD Thresholds of each feature for each scale. FACE_GRAPHS Graphical structure with the distances and angles between the different facial features computed for each scale. DGJ_SCALES Vector with the used scales. Face_Candidates Struct with the final face candidates marked (x,y) with their corresponding class. This algorithms looks into the possible faces candidates for possible mouth and nose using features training. Paint Face Candidates outputImg Image with coloured feature points. structTopology Struct with the feature points (x,y) and their classes. inputImg Input image. This function paints in an image the input features list. Most Probable Face 3 Valid_Faces Structure with the possible faces information. Image Input image. Face Structure with the B&W face area image and the B&W mouth area image. This algorithms selects from a range of detected faces as a combination of lefteye-leftnose-rightnose-righteye squares, the one that is most probable the real face. Face Area FF Face_Graph List of the 4 features points. Image Input image. Face Cropped face image. Mouth Cropped mouth image. This algorithm extracts/cropps the face area from the picture.
Annex I 28 FUNCTION INPUTS OUTPUTS DESCRIPTION Load GTAV Database PATH To images DB to be loaded. Num_Per Number of people in the DB. Num_Im Number of images per person in the DB. DB_Matrix Matrix with the loaded images from the DB, each image is a column in the matrix. DB_Im_Size Size of the images. DB_Num_Im Number of images. DB_Classes Structure with next information for each DB class: Images -> Matrix with the loaded images from the DB. ID Identification number of the class. DB_Num_Im Number of images of the class. This algorithm loads the images from the GTAB DB. PCA Recognition Training DB_Loaded Matrix with the loaded images from the DB DB_Im_Size Size of the images. Trainning_mean Mean from all the vector images. DB_Eigenvectors Computed subspace. Weigths Projected images. Threshold Computed minimum distance to the projected images. This algorithm trains the images from the loaded database and returns the PCA subspace. LDA Recognition Training DB_Classes Matrix with images, each column is one image. The end row of the matrix is the Class identification. LDA_FACES Structure with: Feature_Space Featurespace that span the subspace for all classes. These are computed using all the face training images. Mean_Vector Vector with the mean of all the samples. Weights Weights for each training class in the database. Class_ID ID of the person related to each vector of weights. Features_Class Matrix with the input values without class information. TRESHOLD_FACES Vector with the computed minimum distances to each class. This algorithm trains the images from the loaded database and returns the LDA subspace.
Annex I 29 FUNCTION INPUTS OUTPUTS DESCRIPTION PCA Recognition Test Image Face to be recognized in the trained DB. DB_Im_Size Size of the images. DB_Loaded Matrix with the loaded images from the DB, each image is a column in the matrix. DB_Trainning_mean Mean from all the vector images. DB_Eigenvectors Computed subspace. DB_Weights Projected images. DB_Threshold Computed minimum distance to the projected images. Veredict 0 not recognized, 1 else. Minimun_Distance Distance to nearest projected DB image. ID_Image Nearest image when recognized. This algorithm uses the eigenface system based on pricipal component analysis - PCA to recognize faces loaded by Load_Database algorithm. LDA Recognition Test Image Face to be recognized in the trainned DB. DB_Im_Size Size of the images. DB_Loaded Matrix with the loaded images from the DB, each image is a column in the matrix and the end of the column has the class ID. LDA Structure with the LDA Feature Space. Thresholds Vector with the LDA thresholds. Veredict 0 if not recognized class ID else. Min_Distances Distance to nearest class. ID_Image Nearest class when recognized. This algorithm uses the eigenface system based on principal component analysis - LDA to recognize faces loaded by Load_Database algorithm.