Download as pdf or txt
Download as pdf or txt
You are on page 1of 59

PROJECT REPORT

On
ONLINE VOTING SYSTEM USING FACE RECOGNITON

Submitted in partial fulfillment for the award of the degree


Of

BACHELOR OF TECHNOLOGY
in
INFORMATION TECHNOLOGY
by
B.ARUN
(10803009)
V.K.GOUTHAMAN (10803021)
A.NAFEES RAJA
(10803040)

Under the guidance of

MS.DEEPA CHANDRA , B.Tech.,


(Lecturer, Department of Information Technology)

FACULTY OF ENGINEERING AND TECHNOLOGY


SRM UNIVERSITY
(Under section 3 of UGC Act, 1956)
SRM Nagar, Kattankulathur 603203
Kancheepuram Dist.
April 2007

BONAFIDE CERTIFICATE

Certified that this project report ONLINE VOTING SYSTEM USING


FACE

RECOGNITION

is

the

bonafide

work

of

B.ARUN, V.K.GOUTHAMAN and A.NAFEES RAJA who carried


out the project work under my supervision.

HEAD OF THE DEPARTMENT

INTERNAL EXAMINER

DATE:-

INTERNAL GUIDE

EXTERNAL EXAMINER

ABSTRACT

Online voting system:


In online voting system people can cast their vote through the internet. In order to
prevent voter frauds we use two levels of security. A user id and password are used as the
first level of security. The data entered by the user is verified with the contents of the
database, if the data is correct then the face of the voter is captured by a web camera and
sent to the database. The web page is designed using ASP.NET .The ASP page is then
connected to the Microsoft sql sever database. The ASP page is served from an IIS
server.
In the second level of security the face of the person is verified with the face
present in the database and validated using matlab. The comparison of the two faces is
done using Eigen face recognition algorithm.
The scheme is based on an information theory approach that decomposes face
images into a small set of characteristic feature images called eigenfaces, which are
actually the principal components of the initial training set of face images. Recognition is
performed by projecting a new image into the subspace spanned by the eigenfaces (face
space) and then classifying the face by comparing its position in the face space with the
positions of the known individuals.
Then the MATLAB coding is converted into a dll file by using a deploy tool
present in the MATLAB. Then the dll file is used in the ASP.NET page to call the
matlab program and display the result in the web page.

ACKNOWLEDGEMENT
Project is a test of not only technical skills but also team work and
performance

under

various

constraints.

This journey cannot be successfully

accomplished without help from experts.

At the outset we would like to thank our director Dr.T.P.Ganesan, and


principal Prof. R.Venkataramani for their support and encouragement. We are also
grateful to our Head of the Department Prof.Rajendran who was a great source
of inspiration to us during the project work and throughout the course.

Our heartfelt thanks to our project coordinator , Ms.Panbu M.E who gave
us valuable inputs and advice.

We will be ever grateful to our guide Ms. Deepa chandra, B.E., Lecturer
without whose guidance, this project would not have become successful.

Finally, we would like to thank our parents and mentors for the support
that they have been giving us.

ii

TABLE OF CONTENTS
CHAPTER NO.

1.

TITLE

PAGE NO.

ABSTRACT

iii

ACKNOWLEDGEMENT

TABLE OF CONTENT

vi

LIST OF FIGURES

viii

LIST OF ABBREVATIONS

viii

DEVELOPING THE APPLICATION

1.1 Problems with traditional ASP


1.2 Advantages of ASP.NET
1.3 The .NET architecture
1.4 Introduction to syntax used in ASP.NET

2.

FACE RECOGNITION

11

2.1 Problems of face recognition


2.2 Obtaining eigenface basis
2.3 Deriving eigenface basis
2.4 Thresholds for eigenface recognition
2.5 Averaging technique
2.6 Removal technique
2.7 Conclusion for eigenface detection

3.

INTERFACING THE ASP.NET PAGE WITH


MATLAB

23

3.1 Building the .NET component


3.2 Using the component in an application

iii

4.

DEVELOPMENT ENVIRONMENT

26

4.1 Hardware Environment


4.2 Software Environment

5.

TESTING

27

5.1. INTRODUCTION
5.2. IMPORTANT OF TESTING
5.3. TESTING DEFINITION
5.3.1. UNIT TESTING
5.3.2. INTEGERATION TESTING
5.3.3. SYSTEM TESTING
5.3.4. ACCEPTANCE TESTING

6.

CONCLUSION

31

7.

FUTURE ENHANCEMENT

32

8.

BIBLIOGRAPHY

33

9.

APPENDIX A: SOURCE CODE

34

10.

APPENDIX B: SCREEN SHOTS

45

iv

LIST OF FIGURES

Figure 3.1 Flowchart for the ASP.NET application

10

Figure 3.2 The process of face recognition

12

Figure 3.3 Images from the database

14

Figure 3.4 Average face

15

Figure 3.5 Mapping onto 3-dimentional space

16

Figure 3.6 Eigen faces from database

17

Figure 3.7 M-dimensional sphere

18

Figure 3.8 Flowchart to identify non face images:

19

LIST OF ABBREVATIONS

ABBREVIATION

NAME

ASP

Active server pages

MATLAB

Matrix laboratory

PCA

Principle component analysis

IIS

Internet information server

HTTP

Hypertext Transfer Protocol

vi

CHAPTER - 1

1. Developing the application


Microsoft Active Server Pages (ASP) is a server-side scripting technology. ASP is
a technology that Microsoft created to ease the development of interactive Web
applications. With ASP you can use client-side scripts as well as server-side scripts.
Maybe you want to validate user input or access a database. ASP provides solutions for
transaction processing and managing session state. ASP is one of the most successful
language used in web development.

1.1 Problems with Traditional ASP:


There are many problems with ASP if you think of needs for Today's powerful
Web applications.
Interpreted and Loosely-Typed Code:
ASP scripting code is usually written in languages such as JScript or VBScript.
The script-execution engine that Active Server Pages relies on interprets the code line by
line, every time the page is called. In addition, although variables are supported, they are
all loosely typed as variants and bound to particular types only when the code is run.
Both these factors impede performance, and late binding of types makes it harder to catch
errors when you are writing code.

Mixes layout (HTML) and logic (scripting code):


ASP files frequently combine script code with HTML. This results in ASP scripts
that are lengthy, difficult to read, and switch frequently between code and HTML. The
interspersion of HTML with ASP code is particularly problematic for larger web
applications, where content must be kept separate from business logic.
Limited Development and Debugging Tools:
Microsoft Visual InterDev, Macromedia Visual UltraDev, and other tools have
attempted to increase the productivity of ASP programmers by providing graphical
development environments. However, these tools never achieved the ease of use or the
level of acceptance achieved by Microsoft Windows application development tools, such
as Visual Basic or Microsoft Access. ASP developers still rely heavily or exclusively on
Notepad.
Debugging is an unavoidable part of any software development process, and the
debugging

tools

for

ASP

have

been

minimal.

Most

ASP

programmers

resort to embedding temporary Response. Write statements in their code to trace the
progress of its execution.
No real state management:
Session state is only maintained if the client browser supports cookies. Session
state information can only be held by using the ASP Session object. And you have to
implement additional code if you, for example, want to identify a user.
Update files only when server is down:
If your Web application makes use of components, copying new files to your
application should only be done when the Web server is stopped. Otherwise it is like

pulling the rug from under your application's feet, because the components may be in use
(and locked) and must be registered.
Obscure Configuration Settings:
The configuration information for an ASP web application (such as session state
and server timeouts) is stored in the IIS metabase. Because the metabase is stored in a
proprietary format, it can only be modified on the server machine with utilities such as
the Internet Service Manager. With limited support for programmatically manipulating or
extracting these settings, it is often an arduous task to port an ASP application from one
server to another.

1.2 ASP.NET:
ASP.NET was developed in direct response to the problems that developers had
with classic ASP. Since ASP is in such wide use, however, Microsoft ensured that ASP
scripts execute without modification on a machine with the .NET Framework (the ASP
engine, ASP.DLL, is not modified when installing the .NET Framework). Thus, IIS can
house both ASP and ASP.NET scripts on the same machine.
Advantages of ASP.NET:
Separation of Code from HTML:
To make a clean sweep, with ASP.NET you have the ability to completely
separate layout and business logic. This makes it much easier for teams of programmers
and designers to collaborate efficiently. This makes it much easier for teams of
programmers and designers to collaborate efficiently.

Support for compiled languages:


Developer can use VB.NET and access features such as strong typing and objectoriented programming. Using compiled languages also means that ASP.NET pages do
not suffer the performance penalties associated with interpreted code. ASP.NET pages
are precompiled to byte-code and Just In Time (JIT) compiled when first requested.
Subsequent requests are directed to the fully compiled code, which is cached until the
source changes.
Use services provided by the .NET Framework:
The .NET Framework provides class libraries that can be used by your
application. Some of the key classes help you with input/output, access to operating
system services, data access, or even debugging. We will go into more detail on some of
them in this module.
Graphical Development Environment:
Visual Studio .NET provides a very rich development environment for Web
developers. You can drag and drop controls and set properties the way you do in Visual
Basic 6. And you have full IntelliSense support, not only for your code, but also for
HTML and XML.
State management:
To refer to the problems mentioned before, ASP.NET provides solutions for
session and application state management. State information can, for example, be kept in
memory or stored in a database. It can be shared across Web farms, and state information
can be recovered, even if the server fails or the connection breaks down.

Update files while the server is running:


Components of your application can be updated while the server is online and
clients are connected. The Framework will use the new files as soon as they are copied to
the application. Removed or old files that are still in use are kept in memory until the
clients have finished.
XML-Based Configuration Files:
Configuration settings in ASP.NET are stored in XML files that you can easily
read and edit. You can also easily copy these to another server, along with the other files
that comprise your application.
ASP.NET Overview:
Here are some point that gives the quick overview of ASP.NET:

ASP.NET provides services to allow the creation, deployment, and execution of


Web Applications and Web Services.

Like ASP, ASP.NET is a server-side technology .

Web Applications are built using Web Forms. ASP.NET comes with built-in Web
Forms controls, which are responsible for generating the user interface. They
mirror typical HTML widgets like text boxes or buttons. If these controls do not
fit your needs, you are free to create your own user controls.

Web Forms are designed to make building web-based applications as easy as


building Visual Basic applications

1.3 The .NET architecture:


At the bottom of the Architecture is Common Language Runtime. NET
Framework common language runtime resides on top of the operating system services.
The common language runtime loads and executes code that targets the runtime. This
code is therefore called managed code. The runtime gives you, for example, the ability
for cross-language integration.

.NET Framework provides a rich set of class libraries. These include base classes,
like networking and input/output classes, a data class library for data access, and classes
for use by programming tools, such as debugging services. All of them are brought
together by the Services Framework, which sits on top of the common language runtime.
ASP.NET comes with built-in Web Forms controls, which are responsible for
generating the user interface. They mirror typical HTML widgets like text boxes or
buttons. If these controls do not fit your needs, you are free to create your own user
controls. Web Services brings you a model to bind different applications over the
Internet. This model is based on existing infrastructure and applications and is therefore
standard-based, simple, and adaptable. Web Services are software solutions delivered via
Internet to any device. Today, that means Web browsers on computers, for the most part,
but the device-agnostic design of .NET will eliminate this limitation.
One of the obvious themes of .NET is unification and interoperability between
various programming languages. In order to achieve this; certain rules must be laid and
all the languages must follow these rules. In other words we can not have languages
running around creating their own extensions and their own fancy new data types. CLS is
the collection of the rules and constraints that every language (that seeks to achieve .NET
compatibility) must follow.
The CLR and the .NET Frameworks in general, however, are designed in such a
way that code written in one language can be seamlessly be used by another language.
Hence ASP.NET can be programmed in any of the .NET compatible language whether it
is VB.NET, C#, Managed C++ or JScript.NET.

File name extensions:


Web applications written with ASP.NET will consist of many files with different
file name extensions. The most common are listed here. Native ASP.NET files by default
have the extension .aspx (which is, of course, an extension to .asp) or .ascx. Web
Services normally have the extension .asmx.Your file names containing the business
logic will depend on the language you use. So, for example, a C# file would have the
extension .aspx.cs. Another one worth mentioning is the ASP.NET application file is
Global.asax - in the ASP world formerly known as Global.asa. But now there is also a
code behind file Global.asax.vb, for example, if the file contains Visual Basic.NET code.
Global.asax is an optional file that resides in the root directory of your application, and it
contains global logic for your application.
The easiest way to start with ASP.NET is to take a simple ASP page and change
the file name extension to .aspx.

1.4 Introduction of syntax used in ASP.NET:


Directives:
We can use directives to specify optional settings used by the page compiler when
processing ASP.NET files. For each directive you can set different attributes. One
example is the language directive at the beginning of a page defining the default
programming language.
Code Declaration Blocks:
Code declaration blocks are lines of code enclosed in <script> tags. They contain
the runat=server attribute, which tells ASP.NET that these controls can be accessed on
the server and on the client. Optionally you can specify the language for the block. The
code block itself consists of the definition of member variables and methods.
7

Code Render Blocks:


Render blocks contain inline code or inline expressions enclosed by the character
sequences shown here. The language used inside those blocks could be specified through
a directive like the one shown before.
HTML Control Syntax:
You can declare several standard HTML elements as HTML server controls. Use
the element as you are familiar with in HTML and add the attribute runat=server. This
causes the HTML element to be treated as a server control. It is now programmatically
accessible by using a unique ID. HTML server controls must reside within a <form>
section that also has the attribute runat=server.
Custom Control Syntax:
There are two different kinds of custom controls. On the one hand there are the
controls that ship with .NET, and on the other hand you can create your own custom
controls. Using custom server controls is the best way to encapsulate common
programmatic

functionality.

Just specify elements as you did with HTML elements, but add a tag prefix, which
is an alias for the fully qualified namespace of the control. Again you must include the
runat=server attribute. If you want to get programmatic access to the control, just add an
Id attribute.
You can include properties for each server control to characterize its behavior.
For example, you can set the maximum length of a Textbox. Those properties might have
sub properties; you know this principle from HTML. Now you have the ability to specify,
for example, the size and type of the font you use (font-size and font-type).

The last attribute is dedicated to event binding. This can be used to bind the
control to a specific event. If you implement your own method MyClick, this method will
be executed when the corresponding button is clicked if you use the server control event
binding shown in the slide.
Data Binding Expression:
You can create bindings between server controls and data sources. The data
binding expression is enclosed by the character sequences <%# and %>. The databinding model provided by ASP.NET is hierarchical. That means you can create bindings
between server control properties and superior data sources.
The application was developed using the visual studio integrated development
environment. The application is first linked with the IIS server present in the host
system. The login form consists of two textboxes and a button. The first and second
textbox is used to enter the username and password respectively. The get and set
properties of these text boxes have to be modified accordingly. Then the coding for
connecting with the database is written inside the button Onclick ( ) module. The
connection with the database is established by using the sqlconnection class. The query to
the database is sent using the sqldataadapter class. Then authentication of the user is
verified by comparing the values entered in the textboxes with those in the database. If
the user name and password are valid the page is redirected to another page where the
user is prompted to send the picture of his face by using the web camera. The database
also has the information about the constituency of the particular person and the names of
the candidates contesting in it. The details of the candidates are displayed as radio buttons
in the voting page.

Flow chart for the asp.net application:

Figure 1 Flow chart for the asp.net application:

10

CHAPTER - 2

2. FACE RECOGNITION
2.1 The Problem of Face Recognition:
Face recognition is a very interesting quandary. Ideally a face detection system
should be able to take a new face and return a name identifying that person.
Mathematically, what possible approach would be robust and fairly computationally
economical? If we have a database of people, every face has special features that define
that person. Greg may have a wider forehead, while Jeff has a scar on his right eyebrow
from a rugby match as a young tuck. One technique may be to go through every person in
the database and characterize it by these small features. Another possible approach would
be to take the face image as a whole identity.
Statistically, faces can also be very similar. Walking through a crowd without
glasses, blurry vision can often result in misidentifying someone, thus yielding an
awkward encounter. The statistical similarities between faces gives way to an
identification approach that uses the full face. Using standard image sizes and the same
initial conditions, a system can be built that looks at the statistical relationship of
individual pixels. One person may have a greater distance between his or her eyes then
another, so two regions of pixels will be correlated to one another differently for image
sets of these two people.
From a signal processing perspective the face recognition problem essentially
boils down to the identification of an individual based on an array of pixel intensities.
Using only these input values and whatever information can be gleaned from other
images of known individuals the face recognition problem seeks to assign a name to an
unknown set of pixel intensities.

11

2.2 Obtaining the Eigenface Basis:


The eigenface face recognition system can be divided into two main segments:
creation of the eigenface basis and recognition, or detection, of a new face. The system
follows the following general flow:

Figure 2:The process of face recognition.

12

2.3 Deriving the Eigenface Basis


The eigenface technique is a powerful yet simple solution to the face recognition
dilemma. In fact, it is really the most intuitive way to classify a face. As we have shown,
old techniques focused on particular features of the face. The eigenface technique uses
much more information by classifying faces based on general facial patterns. These
patterns include, but are not limited to, the specific features of the face. By using more
information, eigenface analysis is naturally more effective than feature-based face
recognition.
Eigenfaces are fundamentally nothing more than basis vectors for real faces. This
can be related directly to one of the most fundamental concepts in electrical engineering:
Fourier analysis. Fourier analysis reveals that a sum of weighted sinusoids at differing
frequencies can recompose a signal perfectly! In the same way, a sum of weighted
eigenfaces can seamlessly reconstruct a specific persons face. Determining what these
eigenfaces are is the crux of this technique. Before finding the eigenfaces, we first need
to collect a set of face images. These face images become our database of known faces.
We will later determine whether or not an unknown face matches any of these known
faces. All face images must be the same size (in pixels), and for our purposes, they must
be grayscale, with values ranging from 0 to 255. Each face image is converted into a
vector n of length N (N=imagewidth*imageheight). The most useful face sets have
multiple images per person. This sharply increases accuracy, due to the increased
information available on each known individual. We will call our collection of faces
face space. This space is of dimension N.

13

Figure 3 Example Images from the Database

14

Next we need to calculate the average face in face space. Here M is the number of
faces

Figure 4 Average Face from Database

We then compute each faces difference from the average:


The eigenfaces that we are looking for are simply the eigenvectors of C.
However, since C is of dimension N (the number of pixels in our images), solving for the
eigenfaces gets ugly very quickly. Eigenface face recognition would not be possible if we
had to do this. This is where the magic behind the eigenface system happens.
Mathematically, principal component analysis approach will treat every image of
the training set as a vector in a very high dimensional space. The eigenvectors of the
covariance matrix of these vectors would incorporate the variation amongst the face
images. Now each image in the training set would have its contribution to the
eigenvectors (variations). This can be displayed as an eigenface representing its
contribution in the variation between the images. These eigenfaces look like ghostly
images and some of them are shown in figure 2.In each eigenface some sort of facial
variation can be seen which deviates from the original image.
The high dimensional space with all the eigenfaces is called the image space
(feature space). Also, each image is actually a linear combination of the eigenfaces. The
amount of overall variation that one eigenface counts for, is actually known by the
15

eigenvalue associated with the corresponding eigenvector. If the eigenface with small
eigenvalues are neglected, then an image can be a linear combination of reduced no of
these eigenfaces. For example, if there are M images in the training set, we would get M
eigenfaces. Out of these, only M eigenfaces are selected such that they are associated
with the largest eigenvalues. These would span the M-dimensional subspace face space
out of all the possible images (image space).
When the face image to be recognized (known or unknown), is projected on this
face space (figure 1), we get the weights associated with the eigenfaces, that linearly
approximate the face or can be used to reconstruct the face. Now these weights are
compared with the weights of the known face images so that it can be recognized as a
known face in used in the training set. In simpler words, the Euclidean distance between
the image projection and known projections is calculated; the face image is then
classified as one of the faces with minimum Euclidean distance.

Figure 5: Mapping on to three dimensional space


Based on a statistical technique known as Principal Component Analysis (PCA),
we can reduce the number of eigenvectors for our covariance matrix from N (the number
of pixels in our image) to M (the number of images in our dataset). This is huge! In
general, PCA is used to describe a large dimensional space with a relative small set of
vectors. It is a popular technique for finding patterns in data of high dimension, and is

16

used commonly in both face recognition and image compression.* PCA is applicable to
face recognition because face images usually are very similar to each other (relative to
images of non-faces) and clearly share the same general pattern and structure.PCA tells
us that since we have only M images, we have only M non-trivial eigenvectors. We can
solve for these eigenvectors by taking the eigenvectors of a new M x M matrix:It turns
out that only M-k eigenfaces are actually needed to produce a complete basis for the face
space, where k is the number of unique individuals in the set of known faces.
In the end, one can get a decent reconstruction of the image using only a few
eigenfaces (M), where M usually ranges anywhere from .1M to .2M. These correspond
to the vectors with the highest eigenvalues and represent the most variance within face
space.

Figure 6 Eigenfaces from Database

These eigenfaces provide a small yet powerful basis for face space. Using only a
weighted sum of these eigenfaces, it is possible to reconstruct each face in the dataset.
Yet the main application of eigenfaces, face recognition.

17

2.4 Thresholds for Eigenface Recognition


For a real system, where the pictures are of standard format like a drivers
license photo, the first two cases are useful. In general, the case where one tries to
identify a random picture, such a slice of pizza, with a set of faces images is pretty
unrealistic. Nonetheless, one can still define these threshold values to characterize the
images.
Looking back at the weight matrix of values using M eigenfaces, lets define the
face space as an M-dimensional sphere encompassing all weight vectors in the entire
database. A fairly approximate radius of this face space will then be half the diameter of
this sphere, or mathematically, half the distance between the furthest points in the sphere.

Figure 7:M-dimensional sphere


To judge whether a new image falls within this radius, let's calculate the
reconstruction error between the image and its reconstruction using M eigenfaces. If the
image projects fairly well onto the face space (image follows a face distribution), then the
error will be small. However a non face image will almost always lie outside the radius of
the face space.

18

Flowchart to identify non face images:

19

Given that the initial objective is a face recognition system, eigenfaces happen to
be a fairly easy, computationally economical, and successful method to determine if a
given face is a known person, a new face, or not a face at all. A set of eigenface vectors
can be thought of as linearly independent basis set for the face space. Each vector lives in
its own dimension, and a set of M eigenfaces will yield an M dimensional space.
It should also be noted that the eigenfaces represent the principal components of
the face set. These principal components are very useful in simplifying the recognition
process of a set of data. To make it simpler, suppose we had a set of vectors that
represented a persons weight and height. Projecting a given person onto these vectors
would then yield that persons corresponding weight and height components. Given a
database of weight and height components, it would then be quite easy to find the closest
matches between the tested person and the set of people in the database. A similar
process is used for face recognition with eigenfaces. First take all the mean subtracted
images in the database and project them onto the face space. This is essentially the dot
product of each face image with one of the eigenfaces. Combining vectors as matrices,
one can get a weight matrix (M*N, N is total number of images in the database)
An incoming image can similarly be projected onto the face space. This will yield
a vector in M dimensional space. M again is the number of used eigenfaces. Logically,
faces of the same person will map fairly closely to one another in this face space.
Recognition is simply a problem of finding the closest database image, or mathematically
finding the minimum Euclidean distance between a test point and a database point.
Due to overall similarities in face structure, face pixels follow an overall face
distribution. A combination of this distribution and principal component analysis allows
for a dimensional reduction, where only the first several eigenfaces represent the majority
information in the system. The computational complexity becomes extremely reduced,
making most computer programs happy. In our system, two techniques were used for
image recognition.

20

2.5 Averaging Technique:


Within a given database, all weight vectors of a like person are averaged together.
This creates a "face class" where an even smaller weight matrix represents the general
faces of the entire system. When a new image comes in, its weight vector is created by
projecting it onto the face space. The face is then matched to the face class that
minimizes the euclidean distance. A 'hit' is counted if the image matches correctly its own
face class. A 'miss' occurs if the minimum distance matches to a face class of another
person. For example, the ATT database has four hundred images total, composed of forty
people with ten images each. The averaging technique thus yields a weight matrix with
forty vectors (forty distinct face classes).

2.6 Removal Technique:


This procedure varies only slightly from the averaging technique in one key way.
The weight matrix represents the image projection vectors for images of the entire
database. For empirical results, an image is removed from the system, and then projected
onto the face space. The resulting weight vector is then compared to the weight vector of
all images. The image is then matched to the face image that minimizes the euclidean
distance. A 'hit' is counted if the tested image matches closest to another image of the
same person. A 'miss' occurs when the image matches to any image of a different person.
The main difference from the average technique is the number of possible images that the
test face can match to that will still result in a hit. For the ATT database, a weight matrix
with four hundred vectors is used, but a new image could potentially 'hit' to ten distinct
faces.

2.7 Conclusions for Eigenface Detection:


Analysis of the eigenface recognition technique using both averaging and removal
methods gives evidence that the methods prove, at best, 90% accurate. In both cases,
plateaus of recognition rates for a given number of eigenfaces are reached relatively
quickly. This indicates that in any implementation of such a recognition system there
21

does not exist a meaningful advantage to using more eigenfaces than first provide the
desired level of accuracy. Furthermore, measurements of accuracy with various vertical
and horizontal occlusions and two-dimensional boxcar blurs also demonstrate that excess
eigenfaces provide no benefit in sub-optimal conditions. In this way it becomes evident
that if higher success rates are to be assured in most reasonable conditions then
refinements to the eigenface concept must be made. Anecdotal experimentation with
acquired image sets indicates that profile size, complexion, ambient lighting and facial
angle play significant parts in the recognition of a particular image. Further research
could be conducted into the viability of using eigenfaces and weightings taken for
varying angles and lighting situations in order to allow for greater variability in both
input images and detection opportunities. Clearly the eigenface offers much promise for
the field of facial image recognition but not before some technical refinement.

22

CHAPTER - 3

3. Interfacing the ASP.NET page with MATLAB:


The matlab program usually has the extension .m. In order to display the output of
the matlab program in asp.net the file is converted into .dll by using a deploy tool. The
deploy tool converts the matlab file into a dll file. Once converted to dll the file can be
deployed in .net environment.
The steps to interface:

Building the .net component

Using the component in an asp.net application

First we create a .NET component that encapsulates a MATLAB function,


facerec. The component compares the faces and shows the result. The component is then
used in the application called voting.cs.

3.1 Building the .NET Component:


1.

Copy the files of the facerec to the work directory


The example assumes your work directory is D:\Work

2.

At the MATLAB command prompt, change directory to the new


facerec subdirectory in your work directory.

3.

Write the facerec function as you would any MATLAB function.

4.

Create a .NET component as follows:


a.

While in MATLAB, issue the following command to open


the Deployment Tool:
Deploytool

23

b. Create a new project by clicking the New Project button in the toolbar.
The New Deployment Project dialog box opens. Select the product you are
using in the left pane. Select the type of output desired in the right pane.
c. Specify the following settings for your project. Click the Settings button in
the toolbar to open the Settings dialog box.
Setting

Value

Component

face

name
Class name

facerec

Project directory

The name of your work directory followed by the


project name. In this example, that is
D:\Work\facerec\face

Show verbose

Selected

output
d. Add the facerec.m file to the project. Locate your work directory and
navigate to the face directory, which contains the M-file for the facerec
function.
e. Build the component by clicking the Build button

in the Deployment

Tool toolbar.
The build process begins, and a log of the build appears in the Output pane
of the Deployment Tool dialog box. The generated component files are placed in
two newly created directories, src and distrib, in the face directory. A copy of the
build log is placed in the src directory.

24

3.2 Using the Component in an Application:


1. The source code for an application that uses the .NET component is written
2. Although .NET Builder generates C# code for the facerec component and the
sample application is in C#, applications that use the component do not need to be
coded in C#. You can access the component from any CLS-compliant .NET
language.
3. Build the application using Visual Studio .NET.
a. Open the project file for the facerec.csproj) in Visual Studio .NET.
b. If necessary, add a reference to the facerec component (face), which is the
distrib subdirectory.
c. Build and run the application in Visual Studio .NET.

25

CHAPTER - 4

4. DEVELOPMENT ENVIRONMENT
4.1 Hardware Environment
The minimum configuration required to run this project are:
1. Main processor

: Pentium III

2. RAM

: 256 MB

3. Hard Disk

: 20 GB

4. Key Board

: standard 102 keys

5. Mouse

: 3 buttons

4.2 Software Environment


Language

: Matlab

Front End Tool

: ASP.NET

Back End Tool

: SQL Server

Operating System

: Windows

26

CHAPTER - 5
5. TESTING
5.1

Introduction
Information Processing has undergone major improvements in the past two decades

in both hardware and software. Hardware has decreased in size and price, while providing
more and faster processing power. Software has become easier to use, while providing
increased capabilities. There is an abundance of products available to assist both end-users
and software developers in their work. Software testing, however, has not progressed
significantly. It is still largely a manual process conducted as an art rather than a
methodology. It is almost an accepted practice to release software that contains defects.
Software that is not thoroughly tested is released for production. This is true for
both off-the-shelf software products and custom applications. Software vendor and inhouse systems developers release an initial system and then deliver fixes to the code. They
continue delivering fixes until they create a new system and stop supporting the old one.
The user is then forced to convert to the new system, which again will require fixes.
In-house systems developers generally do not provide any better level of support.
They require the users to submit Incident Reports specifying the system defects. The
Incident Reports are then assigned a priority and the defects are fixed as time and budgets
permit.

5.2 Importance of Testing


Testing is difficult. It requires knowledge of the application and the system
architecture. The majority of the preparation work is tedious. The test conditions, test data,
and expected results are generally created manually. System testing is also one of the final
activities before the system is released for production.

There is always pressure to

complete systems testing promptly to meet the deadline. Nevertheless, systems testing are
important.
27

In mainframe when the system is distributed to multiple sites, any errors or


omissions in the system will affect several groups of users. Any savings realized in
downsizing the application will be negated by costs to correct software errors and
reprocess information.
Software developers must deliver reliable and secure systems that satisfy the users
requirements. A key item in successful systems testing is developing a testing
methodology rather than relying on individual style of the test practitioner. The systems
testing effort must follow a defined strategy. It must have an objective, a scope, and an
approach. Testing is not an art; it is a skill that can be taught.

Testing is generally associated with the execution of programs. The emphasis is on


the outcome of the testing, rather than what is tested and how its tested. Testing is not a
one-step activity; execute the test. It requires planning and design. The tests should be
reviewed prior to execution to verify their accuracy and completeness. They must be
documented and saved for reuse.
System testing is the most extensive testing of the system. It requires more
manpower and machine processing time than any other testing level. It is therefore the
most expensive testing level. It is critical process in the system development. It verifies
that the system performs the business requirements accurately, completely, and within the
required performance limits. It must be thorough, controlled and managed.

5.3 Testing Definitions


Software development has several levels of testing.

Unit Testing

Systems Testing

Acceptance Testing

28

5.3.1 Unit Testing


The first level of testing is called unit testing which is done during the development
of the system. Unit testing is essential for verification of the code produced during the
coding phase. Errors were been noted down and corrected immediately. It is performed by
the programmer. It uses the program specifications and the program itself as its source.
Thus, our modules are individually tested here. There is no formal documentation required
for unit-testing program.

5.3.2Integration Testing
The second level of testing includes integration testing. Here different dependent
modules are assembled and tested for any bugs that may surface due to the integration of
modules. Thus, the administrator module and various visa immigration modules are
tested here.

5.3.3 Systems Testing


The third level of testing includes systems testing. Systems testing verify that the
system performs the business functions while meeting the specified performance
requirements. It is performed by a team consisting of software technicians and users. It
uses the Systems Requirements document, the System Architectural Design and Detailed
Design Documents, and the Information Systems Department standards as its sources.
Documentation is recorded and saved for systems testing.

5.3.4 Acceptance Testing


The final level of testing is the acceptance testing. Acceptance testing provides the
users with assurance that the system is ready for production use; it is performed by the
users. It uses the System Requirements document as its source. There is no formal
documentation required for acceptance testing.
Systems testing are the major testing effort of the project. It is the functional testing
of the application and is concerned with following,
29

1.

Quality/standards compliance

2.

Business requirements

3.

Performance capabilities

4.

Operational capabilities
Below are defined a few test cases which have been implemented for the various

screens. The outputs have been registered and the required changes have been
incorporated.

30

CHAPTER 6
6. CONCLUSION
At present our government is spending more than 125 crores for conducting a Lok
Sabha election. This money is spent on issues such as security, electoral ballots etc. The
average percentage of voting is a less than 60% .Moreover voting fraud can be easily done in
the present system. Also the percentage of literates coming to vote is very less. But with our
system the money spent on election can be reduced to less than 10 crores.
Also there is no chance of voter frauds and the money spent on security can be
drastically decreased. Persons who have an internet connection at home with a web camera
can vote without taking the strain to come to voting booths.

31

CHAPTER 7

7. FUTURE ENHANCEMENT
The same system can be extended to perform the function of counting the number of
votes casted and announcing the results immediately. We can include an administrator mode
in which the user details can be updated dynamically through the application only. In near
future we can even implement the system in mobile phones. The user can access the website
through mobile phone and cast the vote.

32

CHAPTER - 8

8. BIBLIOGRAPHY
Books referred:
1. Matthew A. Turk and Alex P. Pentland. Eigenfaces for recognisation. Journal of
cognitive nerosciences, Volume 3, Number 1, Nov 27, 2002.
2. Dimitri PISSARENKO. Eigenface-based facial recognition. Dec1, 2202.
3. Matthew A. Turk and Alex P. Pentland. Face recognition using eigenfaces. Proc.
CVPR , pp 586-591. IEEE, June 1991.
4. ASP.NET Bible by Mridula Parihar , Essam Ahmed , Jim Chandler , Bill Hatfield , Rick
Lassan , Peter MacIntyre , Dave Wanta
5. ASP.NET: The Complete Reference by Matthew MacDonald

Web sites referred:


www.vijaymukhi.com
www.15seconds.com
www.daniweb.com
www.mathworks.com
www.w3school.com

33

CHAPTER 9

9. Appendix A: Source Code


Mainpage.aspx
<%@ Page Language="VB" ClassName="SenderClass" %>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace = "MySql.Data.MySqlClient" %>
<script language="VB" runat="server">
//Set the properties of the textboxes
Public ReadOnly Property Name() As String
Get
Return TxtUser.Text
End Get
End Property
'Readonly Property for phone
Public ReadOnly Property Phone() As String
Get
Return TxtPass.Text
End Get
End Property
Sub Login_Click(Sender As Object, E As EventArgs)
Dim StrUser As String, StrPass As String
Dim BValid As Boolean
Dim ConVM As MySqlConnection

//initialize the connection

Dim CmdCoInfo As MySqlCommand

//initialize the command

Dim DrCoInfo As MySqlDataReader

//initialize the datareader


34

Dim StrSQL As String


StrUser = TxtUser.Text

//get inputs from the username textbox

StrPass = TxtPass.Text

//get inputs from the password textbox

BValid = False
ConVM = New MySqlConnection("server=localhost; user id=arun; password=project;
database=voting; pooling=false")
//pass the query
StrSQL = "SELECT * FROM ov WHERE id_no='" & StrUser & "' AND pin_no='" &
StrPass & "'"
CmdCoInfo = New MySqlCommand(StrSQL, ConVM)
ConVM.Open()
DrCoInfo = CmdCoInfo.ExecuteReader() //execute the query
//validate the username and password
While DrCoInfo.Read()
If DrCoInfo("id_no") <> "" And DrCoInfo("pin_no") <> "" Then
BValid = True
Else
End If
End While
ConVM.Close()

35

If BValid = True Then


'Event to transfer page control to Result.aspx
Server.Transfer("a1.aspx")
ElseIf BValid = False Then
Response.Redirect("a2.aspx")
End If
End Sub
</script>
<html>
<head>
<title>Standard Forms Authentication Login Form</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form runat="server">
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80">id_no : </td>
<td width="10"> </td>
<td><asp:TextBox Id="TxtUser" width="150" runat="server"/></td>
</tr>
<tr>
<td>Pin_no : </td>
<td width="10"> </td>
<td><asp:TextBox

Id="TxtPass"

width="150"

runat="server"/></td>
</tr>

36

TextMode="Password"

<tr>
<td><br></td>
</tr>
<tr>
<td> </td>
<td width="10"> </td>
<td><asp:Button Id="cmdLogin" OnClick="login_Click" Text="Login" runat="server"
/></td>
</tr>
</table>
<br>
<br>
<div id="ErrorMessage" runat="server" />
</form>
</body>
</html>
</body>
</html>
Second.aspx:
<%@ Page Language="VB" debug="true" %>
<%@ Reference Page="sample1.aspx" %>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace = "MySql.Data.MySqlClient" %>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)

37

Dim StrUser As String, StrPass As String,a As String,c As String


Dim BValid As Boolean
Dim ConVM As MySqlConnection

//initialize the connection

Dim CmdCoInfo As MySqlCommand //initialize the command


Dim DrCoInfo As MySqlDataReader

//initialize the datareader

Dim StrSQL As String


Dim myDataSet As DataSet
Dim myDataAdapter As MySqlDataAdapter
Dim myDataAdapter1 As MySqlDataAdapter
Dim result As SenderClass
Dim content As String
If Not IsPostBack Then
result = CType(Context.Handler, SenderClass)
content = result.Name
Else
Response.Redirect("two.aspx")
End If
// creating a new connection with the sql server
ConVM = New MySqlConnection("server=localhost; user id=arun; password=project;
database=voting; pooling=false")
StrSQL = "SELECT name,cons FROM ov WHERE id_no='" & Content & "'"

myDataAdapter = New MySqlDataAdapter(strSQL,ConVM )


myDataSet = New Dataset()
myDataAdapter.Fill(myDataSet, "ov")

38

MySQLDataGrid.DataSource = myDataSet
MySQLDataGrid.DataBind()
End Sub
sub Page_Load1(Sender As Object, E As EventArgs)
Server.Transfer("one.aspx")
End Sub
</script>
<html>
<head>
<title>Simple MySQL Database Query</title>
</head>
<body>
<form runat="server">
<asp:DataGrid id="MySQLDataGrid" runat="server" />
<br>
<asp:DataGrid id="MySQLDataGrid1" runat="server" />
<br>
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Value="rb1">karunanidhi</asp:ListItem>
<asp:ListItem Value="rb2">jayalalitha</asp:ListItem>
<asp:ListItem Value="rb3">vijayakanth</asp:ListItem>
<asp:ListItem Value="rb4">vaiko</asp:ListItem>
</asp:RadioButtonList>
<asp:Button ID="Button1" runat="server" on_click="Page_Load1" Text="submit" />

39

</form>
</body>
</html>
Error.aspx
<%@ language=VB %>
<form action="a1.aspx" >
your datas are incorrect
</form>
Final.aspx
<%@ language=VB %>
<form action="a1.aspx" >
You have successfully cast your vote
</form>

40

Matlab coding:
if exist('img')
ingresso=double(img(:));
if (exist('face_database.dat')==2)
load('face_database.dat','-mat');
% face_number is equal to "M" of Turk's paper
% i.e. the number of faces present in the database.
% These image are grouped into classes. Every class (or set) should include
% a number of images for each person, with some variations in expression
matrice=zeros(size(data{1,1},1),face_number);
for ii=1:face_number
matrice(:,ii)=double(data{ii,1});
end
somma=sum(matrice,2);
media=somma/face_number;
for ii=1:face_number
matrice(:,ii)=matrice(:,ii)-media;
end
matrice=matrice/sqrt(face_number);
% up to now matrix "matrice" is matrix "A" of Turk's paper
elle=matrice'*matrice;
% matrix "elle" is matrix "L" of Turk's paper
% eigenvalues and eigenvectors of the "reduced" matrix A'*A
[V,D] = eig(elle);
% the following multiplication is performed to obtain the
% eigenvectors of the original matrix A*A' (see Turk's paper)
% See also Karhunen-Loeve algorithm, for face recognition
if det(D)~=0
Vtrue=matrice*V*(abs(D))^-0.5;

41

else
Vtrue=matrice*V;
end
%Vtrue=matrice*V;
Dtrue=diag(D);
% the eigenvalues are sorted by order and only M' of them
% are taken. We impose M' equal to the number of classes
% (max_class-1)
[Dtrue,ordine]=sort(Dtrue);
Dtrue=flipud(Dtrue);
ordine=flipud(ordine);
Vtrue(:,1:face_number)=Vtrue(:,ordine);
Vtrue=Vtrue(:,1:max_class-1);
Dtrue=Dtrue(1:max_class-1);
% we calculate the eigenface components of
% the normalized input (mean-adjusted). I.e. the input
% image is projected into "face-space"
pesi=Vtrue'*(ingresso-media);
pesi_database

= zeros(max_class-1,max_class-1);

pesi_database_mediati = zeros(max_class-1,max_class-1);
numero_elementi_classe=zeros(max_class-1,1);
for ii=1:face_number
ingresso_database=double(data{ii,1});
classe_database=data{ii,2};
pesi_correnti=Vtrue'*(ingresso_database-media);

42

pesi_database(:,classe_database)=pesi_database(:,classe_database)+pesi_correnti;
numero_elementi_classe(classe_database)=numero_elementi_classe(classe_database)+1;
end
for ii=1:(max_class-1)
pesi_database_mediati(:,ii)=pesi_database(:,ii)/numero_elementi_classe(ii);
end
% pesi_database_mediati is a matrix with the averaged eigenface components
of the images
% present in database. Each class has its averaged eigenface.
% We want to find the nearest (in norm) vector to the input
% eigenface components.
distanze_pesi=zeros(max_class-1,1);
for ii=1:(max_class-1)
% distanze_pesi(ii)=norm(pesi-pesi_database_mediati(:,ii));
distanze_pesi(ii) = sum((abs(pesi-pesi_database_mediati(:,ii))));
end
[minimo_pesi,posizione_minimo_pesi]=min(distanze_pesi);
% now we are evaluating the distance of the mean-normalized
% input face from the "space-face" in order to detrmine if
% the input image is a face or not.
proiezione=zeros(size(data{1,1},1),1);
for ii=1:(max_class-1)
proiezione=proiezione+pesi(ii)*Vtrue(:,ii);
end
distanza_spazio_facce=norm((ingresso-media)-proiezione);

43

messaggio1='See Matlab Command Window to see matching result. The program has
just calculated the minimal distance from classes and the distance from Face Space. ';
messaggio2='You now should fix the two threshold-values to determine if this mathing is
correct. If both distances are below the threshold values it means that the input ';
messaggio3='face was correctly matched with a known face. If the distance from Face
Space is below the threshold value but the minimal distance from classes is above the
other threshold value, ';
messaggio4=' it means that the input image is an unknown face. See the cited article for
more informations.';
msgbox(strcat(messaggio1,messaggio2,messaggio3,messaggio4),'Matching
result','help');
disp('The nearest class is number ');
disp(posizione_minimo_pesi);
disp('with a distance equal to ');
disp(minimo_pesi);
disp('The distance from Face Space is ');
disp(distanza_spazio_facce);
else
warndlg('No image processing is possible. Database is empty.',' Warning ')
end
else
warndlg('Input image must be selected.',' Warning ')
end
end

44

CHAPTER - 10

10. Appendix B: screen shots

45

46

47

48

49

50

51

You might also like