This action might not be possible to undo. Are you sure you want to continue?

# ABSTRACT

The face recognition is a fairly controversial subject right now. A system such as this can recognize and track dangerous criminals and terrorists in a crowd, but some contend that it is an extreme invasion of privacy. The proponents of large-scale face recognition feel that it is a necessary evil to make our country safer. It could benefit the visually impaired and allow them to interact more easily with the environment. Also, a computer vision-based authentication system could be put in place to allow computer access or access to a specific room using face recognition. Another possible application would be to integrate this technology into an artificial intelligence system for more realistic interaction with humans. We propose a face recognition method called the PCA (Principal Component Analysis). Principal Component Analysis (PCA) is a statistical method under the broad title of factor analysis. The purpose of PCA is to reduce the large dimensionality of the data space (observed variables) to the smaller intrinsic dimensionality of feature space (independent variables), which are needed to describe the data economically. This is the case when there is a strong correlation between observed variables. The jobs which PCA can do are prediction, redundancy removal, feature extraction, data compression, etc. Because PCA is a known powerful technique which can do something in the linear domain, applications having linear models are suitable, such as signal processing, image processing, system and control theory, communications, etc. The main idea of using PCA for face recognition is to express the large 1-D vector of pixels constructed from 2-D face image into the compact principal components of the feature space. This is called eigenspace projection. Eigenspace is calculated by identifying the eigenvectors of the covariance matrix derived from a set of fingerprint images (vectors).

1|Page

The main idea of using PCA for face recognition is to express the large 1-D vector of pixels constructed from 2-D facial image into the compact principal components of the feature space. communications. applications having linear models are suitable. Let¶s suppose we have M vectors of size N (= rows of image £ columns of image) representing a set of sampled images. etc. or sex determination. pj¶s represent the pixel values. This is the case when there is a strong correlation between observed variables. PCA The Principal Component Analysis (PCA) is one of the most successful techniques that have been used in image recognition and compression. etc. mug shots matching. face classification.1. system and control theory. which are needed to describe the data economically. Because PCA is a classical technique which can do something in the linear domain. personal identification (ex. The jobs which PCA can do are prediction. data compression. entrance security. such as signal processing. This can be called eigenspace projection.2. Face recognition has many applicable areas. video content indexing. The most useful applications contain crowd surveillance. redundancy removal. (2) And let be defined as mean centred image = ±m (3) Our goal is to find a set of which have the largest possible projection onto each of the We wish to find a set of M orthonormal vectors for which the quantity (4) is maximized with the orthonormality constraint . MATHEMATICS OF PCA A 2-D facial image can be represented as 1-D vector by concatenating each row (or column) into a long thin vector. Moreover. driver¶s licence). INTRODUCTION 1. The purpose of PCA is to reduce the large dimensionality of the data space (observed variables) to the smaller intrinsic dimensionality of feature space (independent variables). 2|Page . 1. image processing. feature extraction.1. Eigenspace is calculated by identifying the eigenvectors of the covariance matrix derived from a set of facial images (vectors). Let m represent the mean image. etc. PCA is a statistical method under the broad title of factor analysis. it can be categorized into face identification. (1) The images are mean centred by subtracting the mean image from each image vector.

The eigenvectors are sorted from high to low according to their corresponding eigenvalues. The simplest method for determining which face class provides the best description of an input facial image is to find the face class k that minimizes the Euclidean distance = where is a vector describing the face class. which came to where be the principal component. The size of C is N N which could be enormous. If . meaning that the roughly 90% of the total variance is contained in the first 5% to 10% of the dimensions. describes the contribution of each eigenface in representing the facial image by treating the eigenfaces as a basis set for facial images. respectively. It is not practical to solve for the eigenvectors of C directly. For example. a face is classified as belonging to the class k. eigenimages. so called. the smallest eigenvalue is associated with the eigenvector that finds the least variance. needs to be normalized in order to be equal to Since we only sum up a finite number of image vectors. (10) is less than some predefined threshold 3|Page . So. They can be viewed as images and indeed look like faces. A common theorem in linear algebra states that the vectors and scalars can be obtained by solving for the eigenvectors and eigenvalues of the M M matrix . A facial image can be projected onto dimensions by computing (9) is the coordinate of the facial image in the new space. images of size 64 64 create the covariance matrix of size 4096 4096. (7) By multiplying left to both sides by W = (8) which means that the first M . or eigenfaces in our case. The vectors are also images. Let and be the eigenvectors and eigenvalues of . The eigenvector associated with the largest eigenvalue is one that reflects the greatest variance in the image. They decrease in exponential fashion. The eigenvectors corresponding to nonzero eigenvalues of the covariance matrix produce an orthonormal basis for the subspace within which most image data can be represented with a small amount of error. the rank of the covariance matrix cannot exceed M-1 (The -1 come from the subtraction of the mean vector m).1 eigenvectors and eigenvalues of are given by and respectively. That is. M.It has been shown that the covariance matrix C= and (5) are given by the eigenvectors and eigenvalues of the (6) where W is a matrix composed of the column vectors placed side by side.

We can handle a large input vector. As it has been said earlier. The distance determines whether the input face is near a known face. Or these two issues are altogether addressed by categorizing following four different regions: 1. When a particular face is projected onto the face space. facial image. 2. PCA computes the basis of a space which is represented by its training vectors. i. Each eigenface can be viewed a feature. However. 3. let¶s consider face identification only. actually eigenvectors. we call them eigenfaces. Each face in the training set is transformed into the face space and its components are stored in memory. two issues should be carefully considered: y y What if the image presented to the system is not a face? What if the face presented to the system has not already learned. These basis vectors. computed by PCA are in the direction of the largest variance of the training vectors. recognition of a person. its reconstruction should be similar to the original. The face is expressed in the face space by its eigenface coefficients (or weights). An input face is given to the system. where it must be decided if the individual has already been seen. not stored as a known face? The first defect is easily avoided since the first eigenface is a good face filter which can test whether each image is highly correlated with itself. Near face space and near stored face known faces Near face space but not near a known face unknown faces Distant from face space and near a face class non-faces Distant from face space and not near a known class non-faces Since a face is well represented by the face space. The images with a low correlation can be rejected.. Categorization where the face must be assigned to a certain class.e. only by taking its small weight vector in the face space. its vector into the face space describes the importance of each of those features in the face. This means that we can reconstruct the original face with some error. In this report. The face space has to be populated with these known faces. several types of decision can be made depending on the application. and then it is projected onto the face space. since the dimensionality of the image space is much larger than that of face space. 4. Non-face images will have a large reconstruction error which is larger than some threshold . 4|Page . The system computes its distance from all the stored faces.2. FACE RECOGNITION Once the eigenfaces have been computed. hence the reconstruction error will be small. What we call face recognition is a broad term which may be further specified to one of following tasks: y y y identification where the labels of individuals must be obtained.

SOFTWARE REQUIREMENTS o Windows OS o Visual Studio o Open-CV version 2.10 5|Page . HARDWARE REQUIREMENTS o Camera integrated system 3.2.3.1. REQUIREMENTS 3.

Note 2: A can have up to M eigenvalues and eigenvectors.Suppose G is an 1vector. UNDERLYING PRINCIPLE 4.1. .2.The idea is to represent mean face) into a low-dimensional space: . corresponding to an N N face image I . A and A have the same eigenvalues and their eigenvectors are related as follows: =A !! Note 1: A can have up to eigenvalues and eigenvectors. Note 3: The M eigenvalues of A (along with their corresponding 6|Page . Computation of the Eigenfaces Step 1: obtain face images (training faces) (very important: the face images must be cantered and of the same size) Step 2: represent every image as a vector Step 3: compute the average face vector : Step 4: subtract the mean face: Step 5: compute the covariance matrix C: C= where A =[ ] ( M matrix) Step 6: compute the eigenvectors of A The matrix A is very large --> not practical !! Step 6.4. Main idea behind eigenfaces .mean = (K<<N2) 4.2: compute the eigenvectors of = What is the relationship between and ? A or where A Thus.1: consider the matrix (MxM matrix) Step 6.

eigenvectors) correspond to the M largest eigenvalues of (along with their corresponding eigenvectors).3: compute the M best eigenvectors of : A (important: normalize such that || || =1) Step 7: keep only K eigenvectors (corresponding to the K largest eigenvalues) 7|Page . Step 6.

REPRESENTING FACES ONTO THIS BASIS ....3.M 8|Page .Each normalized training face is represented in this basis by a vector: ...Each face (minus the mean) in the training set can be represented as a linear combination of the best K eigenvectors: (we call the ¶s eigenfaces) .4.. i=1..2..

4. FACE RECOGNITION USING EIGEN FACES .The distance then is recognized as face l from the training set. . it has been reported that the Mahalanobis distance performs better: (variations along all axes are treated as equally significant) 9|Page . however. is called distance within the face space (difs) Comment: we can use the common Euclidean distance to compute er.Given an unknown face image (centered and of the same size like the training faces) follow these steps: Step 1: normalize Step 2: project on the eigenspace Step 3: represent as: Step 4: find Step 5: if .< .4.

.Given an unknown image Step 1: compute Step 2: compute Step 3: compute Step 4: if < .4.5. FACE DETECTION USING EIGENFACES . then is a face.The distance is called distance from face space (dffs) 10 | P a g e .

you can buy Intel¶s Integrated Performance Primitives (IPP) libraries [IPP]. OpenCV was designed for computational efficiency and with a strong focus on realtime applications. Th e library is written in C and C++ and runs under Linux. but it is general enough to be used for any machine learning problem.org) computer vision library available from http://SourceForge. user interface. Th ere is active development on interfaces for Python. Ruby. Because computer vision and machine learning often go hand-in hand. general-purpose Machine Learning Library (MLL). we will be developing win console application using OpenCV. and robotics. TECHONOLOGY USED 5. security. stereo vision. In our case. The MLL is highly useful for the vision tasks that are at the core of OpenCV¶s mission. including factory product inspection. 11 | P a g e . and other languages. 5. OPEN CV OpenCV [OpenCV] is an open source (see http://opensource. win console application etc. which consist of lowlevel optimized routines in many different algorithmic areas.2. Windows and Mac OS X. OpenCV is written in optimized C and can take advantage of multicore processors.1. Matlab. medical imaging. camera calibration. Application developed by visual C++ can be of different types such as MFC application. If you desire further automatic optimization on Intel architectures [Intel].net/projects/opencvlibrary. OpenCV automatically uses the appropriate IPP library at runtime if that library is installed. MICROSOFT VISUAL C++ Visual C++ is IDE of Microsoft to develop application using C++ & its STL (Standard Template Library). The OpenCV library contains over 500 functions that span many areas in vision. One of OpenCV¶s goals is to provide a simple-to-use computer vision infrastructure that helps people build fairly sophisticated vision applications quickly.5. OpenCV also contains a full. This sub library is focused on statistical pattern recognition and clustering.

which includes many statistical classifiers and clustering tools. 12 | P a g e . ML is the machine learning library.1 OpenCV Structure and Content OpenCV is broadly structured into fi ve main components. HighGUI contains I/O routines and functions for storing and loading video and images. four of which are shown in Figure. The CV component contains the basic image processing and higher-level computer vision algorithms.2.5. and CXCore contains the basic data structures and content.

2. It returns the index of image. 6. and provides direct access to it. 6. printusage This function is used to control the program from the command line user interface. Recognizefilelist It is used to recognize the face in each of the test images given.6. 6.xml µ. Getcameraframe It is used to grab the next camera frame.8. Findnearestneighbour This function is used to find the most likely person based on detection.4. 6.3. and load all those images listed. 6. Depending upon the user input it transfers the control of program to either training phase or testing phase or online recognition of a face from camera.5. loadTrainingdata This function is used to load the training data from the file 'facedata. and stores the confidence value into variable pConfidence. as a result it do NOT modify the returned image or free it.7. 6. and compare the results with the truth. StoreTrainingdata This function is used to store the recognition data as an xml file.xml'. It automatically initializes the camera on the first frame. loadfaceImgArray This function is used to read the names & image of people from a text file. learn This function is used for offline recognition mode where it trains from the data given in text file and store the trained data into the file µfacedata.9. 6. 6. USER DEFINED FUNCTIONS AND THEIR PURPOSE 6. It waits until the next frame is ready. 13 | P a g e .1.6. doPCA This function is used to perform PCA operation on the training faces.

Convertimageto grayscale It is used to return a new image that is always greyscale. resizeImage It creates a new image copy that is of a desired size. detectFaceInImage Perform face detection on the input image.13. 6. convertFloatImagetoUcharImage It gets an 8-bit equivalent of the 32-bit Float image. 6. 6. 6. SaveFloatImage It stores a greyscale floating-point CvMat image into a BMP/JPG/GIF/PNG image. It returns a rectangle for the detected region in the given image. It free the returned image using cvReleaseImage() when finished. using the given Haar cascade classifier. 6.since cvSaveImage() can only handle 8bit images (not 32bit float images).12.11.Depending on the number of images in the training set and number of people. it might take 30 seconds or so.14. Remember to free the new image later. so remember to call cvReleaseImage() on the result. 6. irrespective of the input type of image. It returns a new image. cropImage It returns a new image that is a cropped version of the original image. Retrainonline It is used to re-train the new face recorded in a database without shutting down.6.15.16.10. 14 | P a g e .

. Snapshots of project on running mode Figure : It represents start of the project where user have to enter a command. 15 | P a g e . Figure : It represents status of the program when user has entered recognize as its command. according to which it wil run further.

16 | P a g e . After detecting a face in the frane the program identifies it and returns name of the function and its confidence level.Figure : It represents status of the program where the program is trying to recognize a face Figure: It represents a camera frame which has been captured by camera.

This would mean that there would be a set of eigenfaces specifically for males and one specifically for females (face spaces with gender. with the sole purpose of being used to classify an image as male or female. Additionally. one could use this categorization to send an image to one of two classifiers. Perhaps learning the face projection function could increase the accuracy of the neural network classifier. One problem is image preprocessing prior to the application of the eigenface method. For example. so to speak). more experiments are needed to see if there are other ways to tweak the network configuration to produce better results. if one was able to determine if an image was of a man or a woman. Waldoestl and Nickolay [4]. it is possible to construct the network to take its input directly from the image data rather from the vector that results from an images projection into face-space. 17 | P a g e . Work in this area has been done by Lizama. As mentioned in the previously. A general face-space would be created in addition to the male and female face-spaces.8. however it would be interesting to extend it to use eigenfaces to act as the gender classifier as well. Future Work There are many interesting problems that remain in the area of face recognition. Another area of future work is improving our neural network classifier. each specifically trained with that type of individual in mind. It may be possible to gain better accuracy in classification if one segments the spectrum of people into different spaces.

IEEE Conf.A.9. 1991. Reference y Learning OpenCV ±Computer Vision with the openCV Library O¶Reilly Publication Gary Bradsk1 and Andrian Kehlar M. 586-591.P. Kyungnam Kim ´ Face Recognition using Principle Component Analysis´ y y 18 | P a g e . pp. on Computer Vision and Pattern Recognition. ³Face Recognition Using Eigenfaces´. Turk and A. Pentland.