1. IntroductionHumans are very good at recognizing faces and complex patterns. Even a passage of time doesntaffect this capability and therefore it would help if computers become as robust as humans inface recognition. Face recognition system can help in many ways: Checking for criminal records. Enhancement of security by using surveillance cameras in conjunction with face recognition system. Finding lost childrens by using the images received from the cameras fitted at public places. Knowing in advance if some VIP is entering the hotel. Detection of a criminal at public place. Can be used in different areas of science for comparing an entity with a set of entities. Pattern Recognition.This project is a step towards developing a face recognition system which can recognize staticimages. It can be modified to work with dynamic images. In that case the dynamic imagesreceived from the camera can first be converted in to the static ones and then the same procedurecan be applied on them. But then there are lots of other things that should be considered. Likedistance between the camera and the person, magnification factor, view [top,side, front] etc.
2. Tools/Environment UsedSoftware Requirements: Operating System : Windows operating system Language : Java Front-end tool : Swing JDK : JDK 1.5 and aboveHardware Requirements: Processor :Pentium processor of 400MHz or higher. RAM : Minimum 64MB primary memory. Hard disk : Minimum 1GB hard disk space. Monitor : Preferably color monitor (16 bit color) and above. Webcamera. Compact Disk drive. A keyboard and a mouse.
3. AnalysisModules Add Image/Registration Image Capture Login Eigenface Computation IdentificationA module is a small part of our project. This plays a very important role in the project and incoding concepts. In Software Engineering concept we treat it has a small part of a system butwhereas in our programming language it is a small part of the program, which we also called asfunction in, some cases which constitute the main program.Importance of modules in any software development side is we can easily understand what thesystem we are developing and what its main uses are. At the time of project we may create manymodules and finally we combine them to form a system.Module DescriptionAdd Image/Registration Add Image is a module that is considered with adding image along with the user id for loginof the person of whom we are taking image. In this we add Image by capturing from web cameraand store them in our system. During registration four images are captured. Each image is storedfour times as minimum of sixteen images are required for the algorithm of comparison.
Image Capture Module This module is used to capture image using web camera. This is written as a separate threadto avoid system hanging. This module is used to capture image in login module and registrationmodule.LoginThis modules function is to compare the captured image with stored images in the system. Thismodule uses Eigenface computation defined in next modules for comparison.Eigenface ComputationThis module is used to compute the "face space" used for face recognition. The recognition isactually being carried out in the FaceBundle object, but the preparation of such object requiresdoing lots of computations. The steps are: * Compute an average face.* Build a covariance matrix.* Compute eigenvalues and eigenvector* Select only sixteen largest eigenvalues (and its corresponding eigenvectors)* Compute the faces using our eigenvectors* Computeeigenspace for our given images.IdentificationThis module contains the functionality to take the image from above module and it compares orsearches with the images already there in the database. If any image is matched then a success`message is shown to the user.
Flow Diagram Start Login Register Action Capture Image Enter Login Id Capture Image Compare Image Store Success Success Message Failure MessageStages of face recognition Face location detection Feature extraction Facial image classification
4. Design5.1 Mathematical BackgroundThis section will illustrate mathematical algorithm that are the back bone of PrincipalComponent Analysis. It is less important to remember the exact mechanics of mathematicaltechniques than it is to understand the intuition behind them. The topics are coveredindependently of each other and examples are given.Variance, Covariance, Covariance Matrix and Eigenvectors and Eigenvalues are basis of thedesign algorithm.a. VarianceThe variance is a measure of the spread of data. Statisticians are usually concerned with taking asample of a population. To use election polls as an example, the population is all the people inthe country, whereas a sample is a subset of the population that the statisticians measure. Thegreat thing about statistics is that by only measuring a sample of the population, we can work outwhat is most likely to be the measurement if we used the entire population.Lets take an example:X = [1 2 4 6 12 25 45 68 67 65 98]We could simply use the symbol X to refer to this entire set of numbers. For referring to anindividual number in this data set, we will use subscript on the symbol X to indicate a specificnumber. There are number of things that we can calculate about a data set. For example we cancalculate the mean of the sample. It can be given by the formulae:-mean = sum of all numbers / total no. of numbersUnfortunately, the mean doesnt tell us a lot about the data except for a sort of middle point. Forexample, these two data sets have exactly the same mean (10), but are obviously quite different:[0 8 12 20] and [8 9 11 12]
So what is different about these two sets? It is the spread of the data that is different. TheVariance is a measure of how spread out data is. It’s just like Standard Deviation.SD is "The average distance from the mean of the data set to a point". The way to calculate it isto compute the squares of the distance from each data point to the mean of the set, add them allup, divide by n-1, and take the positive square root.As formulae:b. CovarianceVariance and SD are purely 1-dimensional.Data sets like this could be: height of all the people inthe room,marks for the last CSC378 exam etc.However many data sets have more than onedimensions,and the aim of the statistical analysis of these data sets is usually to see if there is anyrelationship between the dimensions.For example, we might have as our data set both the heightof all the students in a class,and the mark they received for that paper.We could then performstatistical analysis to see if the height of a student has any effect on their mark. It is useful tohave measure to find out how much the dimensions vary from the mean with respect o eachother.Covariance is such a measure. It is always measured between 2 dimensions.If we calculate thecovariance between one dimension and itself, you get the variance.So if we had a threedimensional data set (x,y,z), then we could measure the covariance between the x and ydimensions, the x and z dimensions, and the y and z dimensions. Measuring the covariancebetween x and x, or y and y, or z and z would give us the variance of the x,y and z dimensionsrespectively.The formula for covariance is very similar to the formulae for variance.
How does this work? Let’s use some example data. Imagine we have gone into the world andcollected some 2-dimensional data,say we have asked a bunch of students how many hours intotal that they spent studying CSC309, and the mark that they received. So we have twodimensions, the first is the H dimension,the hours studied,and the second is the M dimension,themark received.So what does the covariance between H and M tells us? The exact value is not as important as itssign(ie. positive or negative). if the value is positive, then that indicates that noth dimensionsincrease together,meaning that, in general,as the number of hours of study increased, so did thefinal mark.If the value is negative, then as one dimension increase the other decreases. If we had ended upwith a negative covariance then would mean opposite that as the number of hours of studyincreased the final mark decreased.In the last case, if the covariance is zero, it indicates that the two dimensions are independent ofeach other.c. The covariance MatrixA useful way to get all the possible covariance values between all the different dimensions is tocalculate them all and put them in a matrix. Anexample. We will make up the covariance matrixfor an imaginary 3 dimensional data set, using the usual dimensions x,y and z.Then thecovariance matrix has 3 rows and 3 columns, and the values are this: cov(x,x) cov(x,y) cov(x,z)C= cov(y,x) cov(y,y) cov(y,z)
cov(z,x) cov(z,y) cov(z,z)Point to note: Down the main diagonal, we see that the covariance value is between one of thedimensions and itself. These are the variances for that dimension. The other point is that sincecov(a,b) = cov(b,a), the matrix is symmetrical about the main diagonal.d. Eigenvectors and EigenvaluesIf we multiply a square matrix with any other vector then we will get another vector that istransformed from its original position. It is the nature of the transformation that the eigenvectorsarise from. Imagine a transformation matrix that,when multiplied on the left, reflected vectors inthe line y=x. Then we can see that if there were a vector that lay on the line y=x,it is reflection ofitself. This vector (and all multiples of it, because it wouldnt matter how long the vector was),would be an eigenvector of that transformation matrix. Eigenvectors can only be found forsquare matrices. And not every square matrix has eigenvectors. And given an n x n matrix thatdoes have eigenvectors, there are n of them. Another property of eigenvectors is that even if wescale the vector by some amount before we multiply it, we will still get the same multiple of it asa result. This is because if we scale a vector by some amount,all we are doing is making itlonger,
Lastly, all the eigenvectors of a matrix are perpendicular,ie. at right angles to each other, nomatter how many dimensions you have. By the way, another word for perpendicular,in math talk,is orthogonal. This is important because it means that we can express the data in terms of theseperpendicular eigenvectors, instead of expressing them in terms of the x and y axes. Everyeigenvector has a value associated with it,which is called as eigenvalue. Principal eigenvectorsare those which have the highest eigenvalues associated with them.5.2 PCA Algorithma. Eigen faces ApproachExtract relevant information in a face image [Principal Components] and encode that informationin a suitable data structure. For recognition take the sample image and encode it in the same wayand compare it with the set of encoded images. In mathematical terms we want to find eigenvectors and eigen values of a covariance matrix of images. Where one image is just a single point
in high dimensional space [n * n], where n * n are the dimensions of a image. There can be manyeigen vectors for a covariance matrix but very few of them are the principle ones. Though eacheigen vector can be used for finding different amount of variations among the face image. Butwe are only interested in principal eigen vectors because these can account for substantialvariations among a bunch of images. They can show the most significant relationship betweenthe data dimensions.Eigenvectors with highest eigen values are the principle component of the Image set. We maylose some information if we ignore the components of lesser significance. But if the eigen valuesare small then we wont lose much. Using those set of eigen vectors we can construct eigenfaces.b. FindingEigenFaces(1) Collect a bunch [say 15] of sample face images . Dimensions of all images should be same .An image can be stored in an array of n*n dimensions [ ] which can be considered as a imagevector.Where M is the number of images.(2) Find the average image of bunch of images.(3) Find the deviated [avg - img1 ,avg - img2, ......... , avg - img.n] images .(4) Calculate the covariance matrix .
whereBut the problem with this approach is that we may not be able to complete this operation for abunch of images because covariance matrix will be very huge. For Example Covariance matrix,where dimension of a image = 256 * 256, will consist of [256 * 256] rows and same numbers ofcolumns. So its very hard or may be practically impossible to store that matrix and finding thatmatrix will require considerable computational requirements.So for solving this problem we can first compute the matrix L.And then find the eigen vectors [v] related to itEigen Vectors for Covariance matrix C can be found bywhereare the Eigen Vectors for C.
(5) Using these eigenvectors , we can construct eigen faces . But we are interested in the eigenvectors with high eigenvalues . So eigen vectors with less than a threshold eigen value can bedropped .So we will keep only those images which correspond to the highest eigen values. Thisset of images is called as face space. For doing that in java , we have used colt algebra package.These are the steps involved in the implementation -->i) Find [from 4]Convert it in to a DoubleDenseMatrix2D by using colt matrix class.ii) Find the eigen vector associated with that by using class :-cern.colt.matrix.linalg.EigenvalueDecompositionThis will be a M by M [M = number of training images] matrix.iii) By multiplying that with A [Difference image matrix] well be able to get the actualeigenvector matrix [U] of covariance of A. It will be of M by X [Where X is the total number ofpixels in a image].c. Classifying Face ImagesThe eigenfaces derived from the previous section seem adequate for describing face imagesunder very controlled conditions, we decided to investigate their usefulness as a tool for facerecognition. Since the accurate reconstruction of the image is not a requirement, a smallernumber of eigenfaces are sufficient for the identification process. So identification becomes apattern recognition task.Algorithm:1. Convert image into a matrix [ ] so that all pixels of the test image are stored in a matrix of256*256[rows] by 1 [column] size.
2. Find weights associated with each training image. This operation can simply be performed by,Weight Matrix = TransposeOf (EigenVector-of-CovarianceMatrix) * DifferenceImageMatrix.This matrix will be of size N by N, where N is the total number of face images. Each entry in thecolumn will then represent the corresponding weight of that particular image with respect to aparticular eigenvector.2. Project into "face space" by a simple operation, this operation is same as defined above.But here we are projecting a single image and hence we will get a matrix of size N [rows] by 1[columns].Lets call this matrix as TestProjection matrix.for k=1,2.....N. Where N is the total number of training images.3. Find the distance between the each element of the testProjection matrix and the correspondingelement of Weight matrix. We will get a new matrix of N [rows] by N [columns].4. Find the 2-Norm for the above derived matrix. This will be a matrix of 1 [rows] by N[columns]. Find the minimum value for all the column values. If it is with in some thresholdvalue then return that column number. That number represents the image number. That numbershows that the test image is nearest to that particular image from the set of training images. If theminimum value is above the threshold value, then that test image can be considered as a newimage which is not in our training image set. And that can be stored in our training image set byapplying the same procedure [mentioned in section 5.2]. So the system is a kind of learningsystem which automatically increases its knowledge if it encounters some unknown image [ the 1which it couldnt detect ].
5. TestingIntroductionSoftware testing is a critical element of software quality assurance and represents the ultimateservice of specification design and coding. The increasing visibility of software as a systemelement and the attended costs associated with the software failure and motivating forces for wellplanned, thorough testing. It is not unusual for a software development to spend between 30 and40 percent of total project effort in testing. System Testing Strategies for this system integratetest case design techniques into a well planned series of steps that result in the successfulconstruction of this software. It also provides a road map for the developer, the quality assuranceorganization and the customer, a roadmap that describes the steps to be conducted as path oftesting, when these steps are planned and then undertaken and how much effort, time andresources will be required.The test provisions are follows.System testingSoftware Testing: As the coding is completed according to the requirement we have to test thequality of the software. Software testing is a critical element of software quality assurance andrepresents the ultimate review of specification, design and coding. Although testing is to uncoverthe errors in the software but it also demonstrates that software functions appear to be working asper the specifications, those performance requirements appear to have been met. In addition, datacollected as testing is conducted provide a good indication of software and some indications ofsoftware quality as a whole. To assure the software quality we conduct both White Box Testingand Black Box Testing.White Box Testing: White Box Testing is a test case design method that uses the control structure of theprocedural design to derive test cases. As we are using a non-procedural language, there is very
small scope for the White Box Testing. Whenever it is necessary, there the control structure aretested and successfully passed all the control structure with a very minimum error.Black Box Testing: Black Box Testing focuses on the functional requirement of the software. It enables toderive sets of input conditions that will fully exercise all functional requirements for a program.The Black Box Testing finds almost all errors. If finds some interface errors and errors inaccessing the database and some performance errors. In Black Box Testing we use mainly twotechniques Equivalence partitioning the Boundary Volume Analysis Technique.Equivalence Partitions:In the method we divide input domain of a program into classes of data from which test cases arederived. An Equivalence class represents a set of valid or invalid of a set of related values or aBoolean condition.The equivalence for these is: Input condition requires specific value-specific or non-specific twoclasses.Input condition requires a range or out of range two classes.Input condition specifies a number of a set-belongs to a set or not belongs to the set two classes.Input condition is Boolean-valid or invalid Boolean condition two classes.Boundary Values Analysis:Number of errors usually occurs at the boundaries of the input domain generally. In thistechnique a selection of test cases is exercised using boundary values i.e., around boundaries. Bythe above two techniques, we eliminated almost all errors from the software and checked fornumerous test values for each and every input value. The results were satisfactory. Flow ofTesting System testing is designated to uncover weakness that was not detected in the earliertests. The total system is tested for recovery and fallback after various major failures to ensure
that no data are lost. An accepted test is done to validity and reliability of the system. Thephilosophy behind the testing is to find error in project.There are many test cases designed with this is mind. The flow of testing is as follows.Code TestingSpecification testing is done to check if the program does with it should do and how it shouldbehave under various conditions or combinations and submitted for processing in the system andit’s checked if any overlaps occur during the processing. This strategy examines the logic of theprogram. Here only syntax of the code is tested. In code testing syntax errors are corrected, toensure that the code is perfect.Unit Testing:The first level of testing is called unit testing. Here different modules are tested against thespecifications produced during the design of the modules. Unit testing is done to test the workingof individual modules with test oracles. Unit testing comprises a set of tests preformed by anindividual programmer prior to integration of the units into a large system. A program unit issmall enough that the programmer who developed if can test it in a great detail. Unit testingfocuses first on the modules to locate errors. These errors are verified and corrected so that theunit perfectly fits to the project.System TestingThe next level of testing is system testing and acceptance testing. This testing is done to check ifthe system has its requirements and to find the external behavior of the system. System testinginvolves two kinds of activities:Integration testingAcceptance testing
Integration TestingThe next level of testing is called the Integration Testing. In this many tested modules arecombined into subsystems, which were tested. Test case data is prepared to check the controlflow of all the modules and to exhaust all possible inputs to the program. Situations like treatingthe modules when there is no data entered in the text box is also tested. This testing strategydictates the order in which modules must be available, and exerts strong influence on the order inwhich the modules must be written, debugged and unit tested. In integration testing, all themodules / units on which unit testing is performed are integrated together and tested.Acceptance Testing:This testing is performed finally by user to demonstrate that the implemented system satisfies itsrequirements. The user gives various inputs to get required outputs.Specification Testing:Specification testing is done to check if the program does what is should do and how it shouldbehave under various conditions or combination and submitted for processing in the system andit is checked if any overlaps occur during the processing.Testing Objectives:The following are the testing objectives….Testing is a process of executing a program with the intent of finding an error.A good test case is one that has a high probability of finding an as yet undiscovered error.A successful test is one that uncovers an as yet undiscovered error.The above objectives imply a dramatic change in view point. They move counter to thecommonly held view that a successful test is one in which no errors are found. Our objective isto design tests that systematically verify different clauses of errors and do so with minimumamount of time and effort. If testing is conducted successfully, it will uncover errors in the
software. As a secondary benefit, testing demonstrates that software functions appear to beworking according to specification and that performance requirements appear to have been met.In addition, data collected as testing is conducted provides a good indication of software. Testingcan’t show the absence of defects, it can only show that software errors are present. It isimportant to keep this stated in mind as testing is being conducted.Testing principles: Before applying methods to design effective test cases, a software engineer mustunderstand the basic principles that guide software testing.• All tests should be traceable to customer requirements.• Tests should be planned long before testing begins.• Testing should begin “in the small” and progress towards testing “in the large”.• Exhaustive testing is not possible.Test Plan: A test plan is a document that contains a complete set of test cases for a system, alongwith other information about the testing process. The test plan should be returned long before thetesting starts.Test plan identifies1. A task set to be applied as testing commences,2. The work products to be produced as each testing task is executed3. The manner, in which the results of testing are evaluated, recorded and reuse when regressiontesting is conducted. In some cases the test plan is indicated with the project plan. In others thetest plan is a separate document. The test report is a record of the testing performed. The testing
report enables the acquirer to assess the testing and its results. The test report is a record of thetesting performed. The testing report enables the acquirer to assess the testing and its results.Test casesTest cases for login page Sl no Task Expected result Obtained result Remarks 1 Using valid username Successful As expected success and authentication password(Image) 2 Using invalid Authentication As expected Invalid user username name failed 3 Using invalid Authentication As expected Username and password(Image) password are failed not correct
4 Without giving Authentication Please enter username and user name and failed As expected password password 5 Username and Authentication As expected Password without password cannot be failed emptyTest cases for registration page Sl no Task Expected result Obtained Remarks result 1 Capture four images Registration As expected success and register success
Register button is disabled if less than2 Capture three Should not allow As expected four images are images and register to register captured.3 Without giving port Connection failed As expected Please specify port number number4 Without selecting IP Connection failed As expected Ip has to be selected
6. SnapshotsLayoutThe layout contains two sections. Left section is used for placing web camera window. Rightsection is used to show capture images for login and registration.Web camera WindowThis is a separate window which is created using separate thread.
Register WindowFour images are shown which are captured during registration.Login ScreenThe image is captured for login is shown in this window. Success message is shown as below.
Login Screen and Web cameraWeb camera and captured image during login is as shown below.
7. Conclusion 1. The user will be authenticated not only with the username also with the image of the user 2. For the processing, some of the lines on the face will be used so that the image can be identified with the different angles. 3. The image processing process isgood enough to provide security for the website.8. Future Enhancements 1. The project can be enhanced for processing 3D images.
2. Authentication can be implemented by capturing video clip of a person.3. This can also be used to process the signatures of a person for providing the authentication.4. We can also use this in real time application.5. Authentication can be embedded into web application which will be an added advantage for providing the login for the websites.