Face Recognization System - Grasshopper Network...
Transcript of Face Recognization System - Grasshopper Network...
FACE RECOGNIZATION SYSTEM
System EnvironmentThe system environment specifies the technical specification of requirements for the
developing software. The goal of this, it completely and consistently specifies the
requirements for the software products in a concise and unambiguous manner.
HARDWARE REQUIREMENT: Processor : Pentium IV
Memory : 32MB + RAM
Hard disk : 1 GB
Mouse : Scroll mouse
Monitor : Color monitor (preferable)
Key board : 102 keys
CD-ROM : Visual Studio is available only on CD-ROM
Webcam : Standard
2.2 SOFTWARE REQUIREMENT: Operating system : Ms-Windows98/2000/xp
Front end : VB 6.0 & VB.NET
Back end : Sql Server 2000
MINIMUM REQUIRMENT:Processor : Pentium IV
Memory : 512MB+RAM
Hard Disk : 80GB
Operating System : Ms-Windows xp
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 1
FACE RECOGNIZATION SYSTEM
System StudySystem study is a study about existing system. Here we will study in detail about the
existing system and its performance
Problem DefinitionFace Recognization System is used for biometric security. But for
recognized faces properly we required sophisticated face tracing cameras this camera are
quit expansive therefore in this project we developed a face recognized system which can
recognized the faces based on normal web camera by using igen values method
Existing System
Human guards.
Police.
Locks and keys.
Numeric keypads.
Magnetic cards / PINs.
Usernames / passwords.
Surveillance cameras.
Problems with the Traditional Security Approaches:
Human guards, police are expensive, prone to error and corruption.
Keys, PINs, passwords can be stolen, lost, or cracked.
PIN identifies a card and password identifies a username, not user.
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 2
FACE RECOGNIZATION SYSTEM
Proposed SystemThe Facial recognition system mainly consists of two phases: Enrollment
phase and the Authentification / verification phase. The organization of the system is shown
below diagrammatically through the figures.
Enrollment: Capture and processing of user biometric data for use by system in subsequent
authentication operations.
During the first phase, user enrollment as shown in the Fig. 3.1, features are extracted from
the input face given by the user by a process called Feature extraction, and are modeled as a
template. The modeling is a process of enrolling user to the verification system by
constructing a model of his/her face, based on the features extracted from his/her facial
sample. After the features are extracted and all the signal processing is done the system
checks for the quality of the templates that are extracted from face, if sufficient quality of
features are extracted then the templates are stored in the database else the system needs to
acquire new facial image. The collection of all such enrolled models is called facial
database.
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 3
FACE RECOGNIZATION SYSTEM
System AnalysisData flow diagram
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 4
Fig. a Level 0 Data flow diagram for the same system
FACE RECOGNIZATION SYSTEM
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 5
Fig. b Level 1 Data flow diagram for the same system
FACE RECOGNIZATION SYSTEM
4.3 UML Diagram:The UML does not include a specific notation for this database modeling as it
assumes an object oriented, development process and models data using objects and their
relationships. The UML diagram represent UML Diagrams to represent a semantic data
model.
Class Diagram:The UML methodology is being used extensively in software design and has many
types of diagram for various software design purposes. The class diagrams can be
considered as an alternative notation to ER diagrams, in UML class diagrams. A class is
displayed as a box
The top section gives the class name, middle section includes the attributes for individual
object of the class and the last section includes operations that can be applied to those object.
The designer of an optionally specify the domain of an attribute if desired by the domain
name or description.
A class represents an entity of a given system the provides an encapsulated implementation
of certain functionality of a given entity. The properties of a class are called attributes. A
class represents by a rectangle by a rectangle.
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 6
FACE RECOGNIZATION SYSTEM
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 7
Fig. a Class Diagram for the same system
FACE RECOGNIZATION SYSTEM
Sequential Diagram:UML Sequence diagrams are an easy and intuitive way of describing the behavior of
a system by viewing environment. A sequence diagram shows an interaction arranged in
time sequence.
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 8
Fig. b Sequence Diagram for the same system
FACE RECOGNIZATION SYSTEM
4.4. E-R DiagramR Diagram:
The most widely used data modeling technique is entity relationship diagram, which
shows the data entities, their associated attributes and the relations between the entities. It is
widely used in database design.
An approach to data modeling proposed by, p.chen in 1976. An Entity relationship diagram
Is specialized graphic that illustrate the relationships between entities in a database. The
most widely used data modeling technique is entity relationship diagram, which shows the
data entities, their associated attributes and the relations between the entities. It is widely
used in database design.
Entity
Attribute
Relation
Figure: ER Notation
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 9
FACE RECOGNIZATION SYSTEM
Methodology
The project will use the incremental and waterfall model. Incremental model will be
used to complete modules by module and testing the connected module. For example once
vendor and procurement is over, both will be tested. And will be released. Overall approach
will be waterfall where modules will be added to the system in top down order.
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 10
Fig. a E-R Diagram for the same system
FACE RECOGNIZATION SYSTEM
System Design
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 11
Camera Face ImagesFace Detection
Data Base
Features Extraction
Eigen Faces
Nearest Neighbor classifier
Recognization
Test Images
Fig. Block diagram of the face Recognization system
FACE RECOGNIZATION SYSTEM
Design of screens
Form1: Design of the screens
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 12
FACE RECOGNIZATION SYSTEM
Form2: Design of the screens
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 13
FACE RECOGNIZATION SYSTEM
5.2. Sample Output
Fig. a Picture saves in the form
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 14
FACE RECOGNIZATION SYSTEM
Fig. a Picture Training form
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 15
FACE RECOGNIZATION SYSTEM
Fig. c Picture Test & Verified in the form
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 16
FACE RECOGNIZATION SYSTEM
Fig. d Picture Test & Not Verified in the form
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 17
FACE RECOGNIZATION SYSTEM
CodingPrivate Sub cmdStart_Click()
Call init
cmdStart.Caption = "Training Complete"
cmdStart.Enabled = False
cmdTest.Enabled = True
End Sub
Private Sub loadFace(Index As Integer, instance As Integer, picbox As PictureBox)
On Error GoTo loadImages_err
Dim filename As String
filename = App.Path & "\face\face" & Trim(CStr(Index)) & Chr(instance + 97) & ".jpg"
'MsgBox (filename)
If (Dir$(filename) <> "") Then
picbox.Picture = LoadPicture(filename)
End If
loadImages_exit:
Exit Sub
loadImages_err:
MsgBox "frmMain/loadFace/" & Error$(Err)
Resume loadImages_exit
End Sub
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 18
FACE RECOGNIZATION SYSTEM
Private Sub init()
Dim i As Integer
Dim j As Integer
Call faces.init(image_Width, image_Height)
For j = 0 To 1
For i = 0 To 19
Call loadFace(i, j, pic(0))
Call faces.addFace(pic(0), Trim(Str(i)))
Next
Next
End Sub
Private Sub cmdTest_Click()
Static i As Integer
Dim closestImage As Integer
lblIdentity.Visible = True
pic(1).Visible = True
i = Text1
Call loadFace(i, 2, pic(0))
closestImage = Val(faces.Identify(pic(0)))
If closestImage = i Then
Call loadFace(closestImage, 0, pic(1))
MsgBox "Verified"
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 19
FACE RECOGNIZATION SYSTEM
Else
'pic(1).Visible = False
MsgBox "not Verified"
End If
'i = i + 1
'If (i > 19) Then
' i = 0
'End If
End Sub
Private Sub Command1_Click()
Dim i As Integer
i = Shell("D:\\Imran ali\\Face Recognition Expression Ultimate\\Face Recognition final\\
FaceBiometricFinal\\CamPart", vbNormalFocus)
End Sub
Private Sub Command2_Click()
Out 888, 0
End Sub
namespace i_rely_solely_on_god
{
class Face_Detection
{
//Define variable for Convert RGB 2 YCBCR
//double Y = 0;
//double Cb = 0;
double Cr = 0;
int R = 0;
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 20
FACE RECOGNIZATION SYSTEM
int G = 0;
int B = 0;
int r = 0;
int Testdetection, WPresentdetection = 0;
int BPresentdetection1 = 0;
AForge.Math.Histogram activeHistogram = null;
//Main function for face detection
int counter = 0;
public ArrayList al;
public int[] FaceDetection(Form1 Main, PictureBox PicFirst,
PictureBox Picresult,TextBox TWskin,PictureBox face,TextBox
TBskin,PictureBox picEye,TextBox txtEyeCount)
{
Testdetection = 0;
Graphics hh = PicFirst.CreateGraphics();
Bitmap PreResult = new Bitmap(PicFirst.Image);
Bitmap Result = new Bitmap(PicFirst.Width, Picresult.Height);
Bitmap HisResult = new Bitmap(PicFirst.Width,
Picresult.Height);
Bitmap Template50 = new Bitmap("sample50.bmp");
Bitmap Template25 = new Bitmap("sample25.bmp");
Bitmap facee = new Bitmap(face.Width, face.Height);
Bitmap eye = new Bitmap(40, 20);
for (int i = 0; i < PicFirst.Width; i++)
{
for (int j = 0; j < PicFirst.Height; j++)
{
//Getting red layer
R = PreResult.GetPixel(i, j).R;
//Getting green layer
G = PreResult.GetPixel(i, j).G;
//Getting blue layer
B = PreResult.GetPixel(i, j).B;
//Formula for convert RGB 2 YCBCR
//Y = 0.299 * R + 0.587 * G + 0.114 * B;
//Cb = -0.169*R - 0.332*G + 0.500*B;
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 21
FACE RECOGNIZATION SYSTEM
Cr = 0.500 * R - 0.419 * G - 0.081 * B;
//Ckeck for "-" values(Because we can't use "-" values
for RGB color)
if (Cr < 0)
//Convert to Positive values
Cr =0;
HisResult.SetPixel(i, j, Color.FromArgb((int)Cr,
(int)Cr, (int)Cr));
if (Cr > 10)
//Convert to Positive values
Cr = 255;
//if (Cr>20)
// //Convert to Positive values
// Cr = Cr+128;
//Set the pixel by cr value
Result.SetPixel(i, j, Color.FromArgb((int)Cr,
(int)Cr, (int)Cr));
}
}
//Create filter form my image
FiltersSequence processingFilter = new FiltersSequence();
//Detection the adges
processingFilter.Add(new Edges());
WPresentdetection=0;
BPresentdetection1= 0;
//Apply filter for my pic
Picresult.Image =processingFilter.Apply( Result);
//Detect face with big template
for (int d = 0; d <150-50; d+=20)
{
Testdetection = 0;
WPresentdetection = 0;
BPresentdetection1 = 0;
for (int c = 0; c <150-50; c+=20)
{
Testdetection = 0;
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 22
FACE RECOGNIZATION SYSTEM
WPresentdetection = 0;
BPresentdetection1 = 0;
for (int w = 0; w < Template50.Width; w++)
{
for (int h = 0; h < Template50.Height; h++)
{
if (Template50.GetPixel(w, h).B == 255)
{
if (Result.GetPixel(d + w, c + h).B ==
Template50.GetPixel(w, h).B)
{
WPresentdetection++;
}
}
//if (Template50.GetPixel(w, h).B == 255)
//{
// if (Result.GetPixel(d + w, c + h).B ==
Template50.GetPixel(w, h).B)
// {
// BPresentdetection1++;
// }
//}
}
}
TWskin.Text = WPresentdetection.ToString();
TBskin.Text = BPresentdetection1.ToString();
if (WPresentdetection >
377)//&&BPresentdetection1>1579)
{
hh.DrawRectangle(new Pen(Color.Green), d, c,60,
60);
hh.DrawRectangle(new Pen(Color.Red), d+20, c+20,
40, 20);
for (int i = 0; i < 60; i++)
{
for (int j = 0; j< 60; j++)
{
r = PreResult.GetPixel(i + d, j + c).R;
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 23
FACE RECOGNIZATION SYSTEM
facee.SetPixel(i, j,
Color.FromArgb((int)r, (int)r, (int)r));
face.Image = facee;
// al.Add(facee);
}
}
int eyeCount = 0;
Bitmap im = (Bitmap)PicFirst.Image;
TWskin.Text = WPresentdetection.ToString();
TBskin.Text = BPresentdetection1.ToString();
WPresentdetection = 0;
BPresentdetection1 = 0;
Testdetection = 1;
break;
}
// Detect face with small template
//else
//{
// Testdetection = 0;
// WPresentdetection = 0;
// for (int w = 0; w < Template25.Width; w++)
// {
// for (int h = 0; h < Template25.Height; h++)
// {
// if (Result.GetPixel(d + w, c + h).B ==
255)
// {
// if (Result.GetPixel(d + w, c + h).B
== Template25.GetPixel(w, h).B)
// {
// WPresentdetection++;
// }
// }
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 24
FACE RECOGNIZATION SYSTEM
// }
// }
// if (WPresentdetection > 50)
// {
// hh.DrawRectangle(new Pen(Color.Red), d, c,
30, 30);
// for (int i = 0; i < 30; i++)
// {
// for (int j = 0; j < 30; j++)
// {
// r = PreResult.GetPixel(i + d, j +
c).R;
// facee.SetPixel(i, j,
Color.FromArgb((int)r, (int)r, (int)r));
// face.Image = facee;
// }
// }
// TWskin.Text = WPresentdetection.ToString();
// WPresentdetection = 0;
111 // Testdetection = 2;
// break;
// }
//}
}
if (Testdetection == 1 || Testdetection == 2)
{
WPresentdetection = 0;
BPresentdetection1=0;
Testdetection = 0;
break;
}
}
//Draw histogram
AForge.Imaging.ImageStatistics stat =
new AForge.Imaging.ImageStatistics(HisResult);
if (stat != null)
{
//Do if the pic is gray
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 25
FACE RECOGNIZATION SYSTEM
if (stat.IsGrayscale)
{
activeHistogram = stat.Red;
}
//Do if the pic is colourful
if (!stat.IsGrayscale)
{
activeHistogram = stat.Red;
}
}
return (activeHistogram.Values);
}
}
}
namespace i_rely_solely_on_god
{
class Camera
{
//Variable of WebCamCapture class
private WebCamCapture Cam;
private Form1 Parent;
PictureBox PicFi;
//Initialize camera
public void Init_Cam(Form1 form, int W, int H, PictureBox
picFisrt)
{
Parent = form;
PicFi = picFisrt;
Cam = new WebCamCapture();
//Set camera height
Cam.CaptureHeight = H;
//Set camera width
Cam.CaptureWidth = W;
//Refresh picture after avery one milli seconds
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 26
FACE RECOGNIZATION SYSTEM
Cam.TimeToCapture_milliseconds = 1;
//Get picture from camera
Cam.ImageCaptured += new
WebCamCapture.WebCamEventHandler(Cam_ImageCaptured);
}
public void Start()
{
//Starting Capture
Cam.Start(0);
}
//Get Picture of camera
//Set picCam equal camera image
public void Cam_ImageCaptured(object source, WebcamEventArgs e)
{
//Set image to picturebox
PicFi.Image = e.WebCamImage;
}
}
}
namespace i_rely_solely_on_god
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Image.Save
("d:\\"+txtName.Text ,System.Drawing.Imaging.ImageFormat.Jpeg);
this.Close();
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 27
FACE RECOGNIZATION SYSTEM
}
}
}
namespace i_rely_solely_on_god
{
partial class Form2
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be
disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 28
FACE RECOGNIZATION SYSTEM
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.txtName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)
(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(55, 20);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(278, 254);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(113, 289);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(220, 20);
this.txtName.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(52, 292);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Name";
//
// button1
//
this.button1.Location = new System.Drawing.Point(55, 341);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(278, 23);
this.button1.TabIndex = 3;
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 29
FACE RECOGNIZATION SYSTEM
this.button1.Text = "SAVE";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new
System.EventHandler(this.button1_Click);
//
// Form2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(381, 416);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtName);
this.Controls.Add(this.pictureBox1);
this.Name = "Form2";
this.Text = "Form2";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public System.Windows.Forms.PictureBox pictureBox1;
public System.Windows.Forms.TextBox txtName;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
}
}
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 30
FACE RECOGNIZATION SYSTEM
Main Form:
Test Case
a. Training: a.Face1
Test b.Face1
b. Training: a.face12
Test b.face12
c. Observation: a. Valid
b.Invalid
d.Output: a. If it’s valid then the Display the face & Verified it. .
b. If it’s invalid then display it is not verified.
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 31
FACE RECOGNIZATION SYSTEM
List of abbreviations, Figures, Tables Table: user
FIELDS TYPE Size descriptionSlno Int To Enter the serial number
Name varchar 100 To enter the namePhone varchar 30 To enter the phone numberEmail varchar 100 To enter the email address
Address varchar 200 To enter the addressTable: images
Fields Type Size DescriptionSlno Varchar to enter the serial number
Imagea Varchar 20 To enter the a imagesImageb Varchar 20 To enter the b images
ASP -> Active server pages
SQL -> Structure query language
VWD-> Visual web developer
VB : Visual Basic
DFD : Data Flow Diagram.
CSS : Cascading Style Sheet.
RAM : Random Access Memory.
GB : Giga Byte.
XP : eXPerienced
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 32
FACE RECOGNIZATION SYSTEM
Figures
Figure 4.1 zero level DFD
Figure 4.1 first levels DFD
Fig. a Class Diagram for the same system
Fig. b Sequence Diagram for the same system
Fig. a E-R Diagram for the same system
Form1: Design of the screens
Form2: Design of the screens
Fig. a Picture saves in the form
Fig. a Picture Training form
Picture Test & Verified in the form
Picture Test & Not Verified in the form
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 33
FACE RECOGNIZATION SYSTEM
Conclusion
Even though face of a every persons is unique , the pose , the distance from the
cameras an light intensity where is which effect the performance of the system there fore in
the project of the pose in variant face recognized system is developed which can recognized
the faces even when such attributes changes. This system can be further inspect by
recognizing the faces directly in the video.
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 34
FACE RECOGNIZATION SYSTEM
Future Enhancement
The face Recognization algorithm here can detect the face i.e. irrespective of the
distance of the user from camera light intensity, pose of the user etc. But the algorithm has
an upper limit & can recognize up to 20 Faces.
As the number of faces increases, rates of misdetection also increase. This can be improved
by combining phase or frequency features like revealed transform alongside the Eigen
features. Further, stronger classified like neural network can be implemented which
increases which the efficiency further.
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 35
FACE RECOGNIZATION SYSTEM
Bibliography
Books
C# and .Net platform
By Andrew Troelsen.
Inside C#
By Tom Archer.
Fundamentals of database Systems
By Ramez Elmasri and S. B. Navathe
1] R. Brunelli and T. Poggio, “Face recognition: features versus templates,” IEEE PAMI,
vol.15. No 10, pp.1042-1052, Oct. 1993.
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 36
FACE RECOGNIZATION SYSTEM
Copyright from Integrated Ideas Consultancy services 2003-2011 Page 37