1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
ABSTRACT ...........................................................................................................1
INTRODUCTION ..................................................................................................2
FEASIBILITY STUDY ..........................................................................................4
SYSTEM PROFILE ...............................................................................................5
System analysis.......................................................................................................9
TOOLS AND TECHNOLOGY............................................................................17
Architecture Diagram ...........................................................................................18
Data Flow Diagram and Use case Diagram..........................................................20
DEVELOPMENT PROCESS AND DOCUMENTATION..................................25
SCREEN SHOOT .............................................................................................30
CODEING.........................................................................................................38
CONCLUSION AND FUTURE WORK..........................................................46
Future Enhancements........................................................................................47
SCREENSHOTS...............................................................................................48
REFERENCES .................................................................................................49
1 ABSTRACT
CHAPTER 1
2 INTRODUCTION
2.1 A Brief Description
Virtual learning is increasing day by day, and Human Computer Interaction is a
necessity to make virtual learning a better experience. The emotions of a person play
a major role in the learning process. Hence the proposed work, detects the emotions of
a person, by his face expressions.
For a facial expression to be detected face location and area must be known;
therefore in most cases, emotion detection algorithms start with face detection, taking
into account the fact that face emotions are mostly depicted using the mouth.
Eventually, algorithms for eye and mouth detection and tracking are necessary,
in order to provide the features for subsequent emotion recognition. In this project we
propose a detection system for natural emotion recognition.
2.2
video surveillance, human computer interface, face recognition and face database
management. Most face recognition algorithms assume that face location is known.
Similarly, face-tracking algorithms often assume that initial face location is known. In
order to improve the efficiency of the face recognition systems, an efficient face
detection algorithm is needed.
their requirement by voice or by other means and especially to those who are confined
to bed.
biosensors.
Facial actions are imaged through still or video cameras. From still
images, taken at discrete times, the changes in eye and mouth areas can be exposed.
Measuring and analysing such changes will lead to the determination of human
emotions.
3 FEASIBILITY STUDY
In the feasibility study, we studied various feasibility studies performed i.e
technical feasibility whether existing equipment, software were sufficient for
completing the project. The economic feasibility determines whether the doing of
project is economically beneficial. This seems to be beneficial because the company
need not spend any amount on the project. Trainees because they work at a less
amount and only machine time are burden.The outcome of first phase was that the
request and the various studies were approved and it was decided that the project
taken up will serve the end user. On developing and implementation this software
saves a lot of amount and Sharing of valuable company time.
The key considerations involved in the feasibility analysis are
Economical feasibility
Technical feasibility
Social feasibility
4 SYSTEM PROFILE
4.1 Overview of the Algorithm
Our project proposes an emotion detection system where in the facial
emotions namely - happy, sad and surprised are detected. First the face is detected
from an image using the skin colour model. This is then followed by feature
extraction such as eyes and mouth. This is used for further processing to detect the
emotion. For detecting the emotion we take into account the fact that emotions are
basically represented using mouth expressions. This is done using the shape and
colour properties of the lips.
4.2
Video Fragmentation
The input video of an e-learning student is acquired using an image
acquisition device and stored into a database. This video is extracted and fragmented
into several frames to detect the emotions of the e-leaning student and to thereby
improve the virtual learning environment. By the video acquisition feature which is
used to record and register the on-going emotional changes in the e-learning student,
the resulting emotions are detected by mapping the changes in the eye and lip region.
The videos are recorded into a database before processing, thereby making it useful to
analyse the changes of emotion for a particular subject or during a particular time of
the day.
Frame rate and motion blur are important aspects of video quality. This
demo helps to show the visual differences between various frame rates and motion
blur.
convinced that the contents of the movie are continuous, and the movie will appear to
jump (also called strobing).
The human eye and its brain interface, the human visual system, can
process 10 to 12 separate images per second, perceiving them individually, but the
threshold of perception is more complex, with different stimuli having different
thresholds: the average shortest noticeable dark period, such as the flicker of
a cathode ray tube monitor or fluorescent lamp, is 16 milliseconds, while singlemillisecond visual stimulus may have a perceived duration between 100ms and 400ms
due to persistence of vision in the visual cortex. This may cause images perceived in
this duration to appear as one stimulus, such as a 10ms green flash of light
immediately followed by a 10ms red flash of light perceived as a single yellow flash
of light.
Detection
4.1.3 FEATURE EXTRACTION
After the face has been detected the next step is feature extraction where the
eyes and mouth are extracted from the detected face .For eye extraction, this is done
by creating two eye maps, a chrominance eye map and a luminance eye map. The
two maps are then combined to locate the eyes in a face image, as shown in Figure
4.2.
Architectural Design
The architectural diagram shows the overall working of the system, where
captured colour image sample is taken as the input and it is processed using
image processing tools and is analysed to locate the facial features such as eyes
and mouth, which will be further processed to recognize the emotion of the
person. After the localization of the facial features the next step is to localize the
characteristic points on the face. Followed by this is the feature extraction process
where the features are extracted such as eyes and mouth.
Based on the variations of eyes and mouth, emotion of a person is detected
and recognized. For a person who is happy, the eyes will be open and the lips will be
closed upwards whereas for a person who is sad, the eyes will be open and the lips
will be closed facing downwards. Similarly for a person who is surprised the eyes will
be wide open and there will be a considerable displacement of the eye brows from the
eyes and the mouth will be wide open. Based on the above measures mood exhibited
by a person is detected and it is recognized.
The Figure 4.4 shows the overall working of the system where the input is the
image and the output is the emotion recognized such as happy, sad or surprised.
5 System analysis
5.1 Existing Face Detection Approaches
Feature Invariant Methods
These methods aim to find structural features that exist even when the pose,
viewpoint, or lighting conditions vary, and then use these to locate faces. These
methods are designed mainly for face localization.
TEXTURE
Human faces have a distinct texture that can be used to separate them
from different objects. The textures are computed using second-order statistical
features on sub images of 16X16 pixels. Three types of features are considered: skin,
hair, and others. To infer the presence of a face from the texture labels, the votes of
occurrence of hair and skin textures are used. Here the colour information is also
incorporated with face-texture model. Using the face texture model, a scanning
scheme for face detection in colour scenes in which the orange like parts including the
face areas are enhanced. One advantage of this approach is that it can detect faces
which are not upright or have features such as beards and glasses.
SKIN COLOUR
Human skin colour has been used and proven to be an effective feature in
many applications from face detection to hand tracking. Although different people
have different colour, several studies have shown that the major difference lies largely
between their intensity rather than their chrominance. Several colour spaces have been
utilized to label pixels as skin including RGB, Normalized RGB, HSV, YCbCr, YIQ,
YES, CIE XYZ and CIE LUV.
TEMPLATE MATCHING METHODS
In template matching, a standard face pattern is manually predefined or
parameterized by a function. Given an input image, the correlation values with the
standard patterns are computed for the four contours, eyes, nose, and mouth
independently. The existence of a face is determined based on the correlation values.
This approach has the advantage of being simple to implement. However, it has
proven to be inadequate for face detection since it cannot effectively deal with
variation in scale, pose, and shape. Multiresolution, multiscale, sub templates, and
deformable templates have subsequently been proposed to achieve scale and shape
invariance.
PREDEFINED FACE TEMPLATE
In this approach several sub templates for nose, eyes, mouth and face contour
are used to model a face. Each sub template is defined in terms of line segments.
Lines in the input image are extracted based on greatest gradient change and then
matched against the sub templates. The correlations between sub images and contour
templates are computed first to detect candidate location of faces. Then, matching
with the other sub templates is performed at the candidate positions. In other words,
the first phase determines focus of attention or region of interest and second phase
examines the details to determine the existence of a face.
APPEARANCE BASED METHODS
In the appearance based methods the templates are learned from examples in
images. In general, appearance based methods rely on techniques from statistical
analysis and machine learning to find the relevant characteristics of face and non face
images. The learned characteristics are in the form of distribution models that are
consequently used for face detection.
5.2
GENETIC ALGORITHM
The eye feature plays a vital role in classifying the face emotion using Genetic
Algorithm. The acquired images must go through few pre-processing methods such as
grayscale, histogram equalization and filtering. A Genetic Algorithm methodology
estimates the emotions from eye feature alone. Observation of various emotions lead
to a unique characteristic of eye, that is, the eye exhibits ellipses of different
parameters in each emotion. Genetic Algorithm is adopted to optimize the ellipse
characteristics of the eye features. Processing time for Genetic Algorithm varies for
each emotion.
NEURAL NETWORK
Neural networks have found profound success in the area of pattern
recognition. By repeatedly showing a neural network, inputs are classified into
groups, the network can be trained to discern the criteria used to classify, and it can do
so in a generalized manner allowing successful classification of new inputs not used
during training. With the explosion of research in emotions in recent years, the
application of pattern recognition technology to emotion detection has become
increasingly interesting. Since emotion has become an important interface for the
communication between human and machine, it plays a basic role in rational decision-
apparent properties of face such as face geometry, skin colour, and motion. Even
feature-based technique can achieve high speed in face detection, but it also has
problem in poor reliability under lighting condition.
2. IMAGE BASED TECHNIQUE:
The image based approach takes advantage of current advance in
pattern recognition theory. Most of the image based approach applies a window
scanning technique for detecting face, which requires large computation.
To achieve high speed and reliable face detection system, we propose
the method which combines both feature-based and image-based approach using SSR
Filter.
TEMPLATE
MATCHING.
Template matching is a technique in digital image processing for finding small
parts of an image which match a template image or as a way to detect edges in
images.
The basic method of template matching uses a convolution mask (template),
tailored to a specific feature of the search image, which we want to detect.
This technique can be easily performed on grey images or edge
images. The convolution output will be highest at places where the image structure
matches the mask structure, where large image values get multiplied by large mask
values
5.4
The common BTE area on human face resembles a hyperbolic surface. The
proposed work uses this hyperbolic model to describe the BTE region, the centre of
the BTE is thus the saddle point on the surface.
BLOBS
Blobs provide a complementary description of image structures in terms of
regions, as opposed to corners that are more point-like. Nevertheless, blob descriptors
often contain a preferred point (a local maximum of an operator response or a centre
of gravity) which means that many blob detectors may also be regarded as interest
point operators. Blob detectors can detect areas in an image which are too smooth to
be detected by a corner detector.
consists of two steps: the hierarchic and reliable selection of specific blocks of the
image and subsequently the use of a standardized procedure for the detection of the
required benchmark points. In order for the former of the two processes to be
successful, the need of a secure method of approach has emerged. The detection of a
block describing a facial feature relies on a previously, effectively detected feature.
By adopting this reasoning, the choice of the most significant characteristic -the
ground of the cascade routine- has to be made. The importance that each of the
commonly used facial features, regarding the issue of face recognition, has already
been studied by other researchers. The outcome of surveys proved the eyes to be the
most dependable and easily located of all facial features, and as such they were used.
The techniques that were developed and tried separately, utilize a combination of
template matching and Gabor filtering.
S.No
Feature
Configuration
CPU
Main memory
1 GB RAM
Hard Disk
60 GB Disk size
Software
Version
Windows
Picasa
visual studio
2010
7 Architecture Diagram
Main Page
Contains
Input Image
Exit
File
Restore
Image
Save
Next
Pre-Process
Skin Color
Binary Image
Connected
Segmentation
Face
Segmentation Process
Result
Mouth
Eye
EyeBrow
Options
Contrast
Sharpen
Image
Preview
Brightness
Help
Launch
start
Login Page
Login Fail
Check
User
name&
Password
Login
Successfully
After
Successfully
Login in Main
Page
Home Page
Select Images
(.jpeg,.bng,.tiff
Convert to
Binary Image
21
Registratio
n
UserLogin
User
Select Image
Pre Process
Segmentatio
n
22
Registatio
n
+Detail
+registatio
n()
User
+details
+Login()
+Registration()
User Login
+UserName
+Password
+Login()
Select Image
+Open File
dialog
+Upload
Image()
Pre Process
+result
color_
segmentation
+
Segmentatio
n
+Image
+
+
+
eyelocal ()
range ()
black white
()
Emotion
Result
+Databsae image
+Connection
+emotion ()
+Calculate Distance()
+compare Image()
+bezier_position
+displayResult()
Position
Id
lip1_x
lip1_y
lip2_x
lip2_y
lip3_x
lip3_y
lip4_x
lip4_y
Per son
RecI d
lip5_x
Name
UserName
lip5_y
Smile
Pwd
lip6_x
Normal
lip6_y
Surprise
lef t _eye1_x
Sad
lef t _eye1_y
lef t _eye2_x
lef t _eye2_y
lef t _eye3_x
lef t _eye3_y
lef t _eye4_x
lef t _eye4_y
lef t _eye5_x
lef t _eye5_y
lef t _eye6_x
lef t _eye6_y
right _eye1_x
right _eye1_y
right _eye2_x
right _eye2_y
right _eye3_x
right _eye3_y
right _eye4_x
right _eye4_y
right _eye5_x
right _eye5_y
right _eye6_x
right _eye6_y
lip_h1
lip_h2
lip_h3
lip_h4
lef t _eye_h1
lef t _eye_h2
lef t _eye_h3
lef t _eye_h4
right _eye_h1
right _eye_h2
right _eye_h3
right _eye_h4
24
SAMPLE COLLECTION
25
Cb and low-Cr values can be found around the eyes. The following formula presented
helps us to construct the map:
Happy:
Surprised:
27
i.
10 SCREEN SHOOT
30
31
32
33
34
35
36
37
11 CODEING
11.1 code for sobel filter Sobel Filter
namespace sobel_filtering
{
partial class Form1
{
/// <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()
{
this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.contextMenuStrip1 = new
System.Windows.Forms.ContextMenuStrip(this.components);
this.sharpenImageToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new
System.Windows.Forms.ToolStripSeparator();
this.contrastToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new
System.Windows.Forms.ToolStripSeparator();
this.brightnessToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new
System.Windows.Forms.ToolStripSeparator();
this.restoreImageToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new
System.Windows.Forms.ToolStripSeparator();
this.previewToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
38
this.toolStripSeparator1 = new
System.Windows.Forms.ToolStripSeparator();
this.SaveImagetoolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.button_connected = new System.Windows.Forms.Button();
this.button_skincolor = new System.Windows.Forms.Button();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button2 = new System.Windows.Forms.Button(); this.richTextBox1
= new System.Windows.Forms.RichTextBox(); this.richTextBox2 = new
System.Windows.Forms.RichTextBox(); this.richTextBox3 = new
System.Windows.Forms.RichTextBox(); this.richTextBox4 = new
System.Windows.Forms.RichTextBox(); this.label1 = new
System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.contextMenuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// button1
//
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif",
12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((byte)(0)));
this.button1.Location = new System.Drawing.Point(255, 346);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(124, 43);
this.button1.TabIndex = 1; this.button1.Text =
"Select Image";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
this.openFileDialog1.FileOk += new
System.ComponentModel.CancelEventHandler(this.openFileDialog1_FileOk);
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.sharpenImageToolStripMenuItem,
this.toolStripMenuItem2,
this.contrastToolStripMenuItem,
this.toolStripMenuItem5,
this.brightnessToolStripMenuItem,
this.toolStripMenuItem4,
this.restoreImageToolStripMenuItem,
this.toolStripMenuItem1,
this.previewToolStripMenuItem,
this.toolStripSeparator1,
this.SaveImagetoolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(154, 166);
//
// sharpenImageToolStripMenuItem
//
this.sharpenImageToolStripMenuItem.Name
= "sharpenImageToolStripMenuItem";
this.sharpenImageToolStripMenuItem.Size = new
System.Drawing.Size(153, 22);
this.sharpenImageToolStripMenuItem.Text = "Sharpen Image";
this.sharpenImageToolStripMenuItem.Click += new
System.EventHandler(this.sharpenImageToolStripMenuItem_Click);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(150, 6);
//
// contrastToolStripMenuItem
//
this.contrastToolStripMenuItem.Name = "contrastToolStripMenuItem";
this.contrastToolStripMenuItem.Size = new System.Drawing.Size(153,
22);
this.contrastToolStripMenuItem.Text = "Contrast";
this.contrastToolStripMenuItem.Click += new
System.EventHandler(this.contrastToolStripMenuItem_Click);
//
// toolStripMenuItem5
//
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
this.toolStripMenuItem5.Size = new System.Drawing.Size(150, 6);
//
// brightnessToolStripMenuItem
//
this.brightnessToolStripMenuItem.Name =
"brightnessToolStripMenuItem";
this.brightnessToolStripMenuItem.Size = new
System.Drawing.Size(153, 22); this.brightnessToolStripMenuItem.Text
= "Brightness"; this.brightnessToolStripMenuItem.Click
+= new
System.EventHandler(this.brightnessToolStripMenuItem_Click);
//
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(150, 6);
//
// restoreImageToolStripMenuItem
//
this.restoreImageToolStripMenuItem.Name
= "restoreImageToolStripMenuItem";
this.restoreImageToolStripMenuItem.Size = new
System.Drawing.Size(153, 22);
this.restoreImageToolStripMenuItem.Text = "Restore Image";
this.restoreImageToolStripMenuItem.Click += new
System.EventHandler(this.restoreImageToolStripMenuItem_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(150, 6);
//
// previewToolStripMenuItem
//
this.previewToolStripMenuItem.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Text;
22);
// pictureBox2
//
this.pictureBox2.BorderStyle =
System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox2.ContextMenuStrip = this.contextMenuStrip1;
this.pictureBox2.Location = new System.Drawing.Point(627, 129);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(155, 175);
this.pictureBox2.SizeMode =
System.Windows.Forms.PictureBoxSizeMode.StretchImag
e; this.pictureBox2.TabIndex = 5;
this.pictureBox2.TabStop = false;
this.pictureBox2.MouseEnter += new
System.EventHandler(this.pictureBox_MouseClick);
//
// pictureBox1
//
this.pictureBox1.BorderStyle =
System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.ContextMenuStrip = this.contextMenuStrip1;
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Cross;
this.pictureBox1.Location = new System.Drawing.Point(291, 129);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(155, 175);
this.pictureBox1.SizeMode =
System.Windows.Forms.PictureBoxSizeMode.StretchImag
e; this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new
System.EventHandler(this.pictureBox1_Click);
this.pictureBox1.MouseDown += new
System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
this.pictureBox1.MouseEnter += new
System.EventHandler(this.pictureBox_MouseClick);
this.pictureBox1.MouseMove += new
System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
this.pictureBox1.MouseUp += new
System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseUp);
//
// button2
//
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif",
12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((byte)(0)));
this.button2.Location = new System.Drawing.Point(741, 345);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(125, 44);
this.button2.TabIndex = 29;
this.button2.Text = "Next";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new
System.EventHandler(this.button2_Click_1);
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(255, 397);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.Size = new System.Drawing.Size(124, 75);
this.richTextBox1.TabIndex = 30;
this.richTextBox1.Text = "";
//
// richTextBox2
//
this.richTextBox2.Location = new System.Drawing.Point(419, 396);
this.richTextBox2.Name = "richTextBox2";
this.richTextBox2.ReadOnly = true;
13 Future Enhancements
The future work includes enhancement of the system so that it is able to detect
emotions of the person even in complex backgrounds having different illumination
conditions and to eliminate the lip colour constraint in the coloured images. The other
criterion that can be worked upon is to project more emotions other than happy, sad
and surprised.
14 SCREENSHOTS
SCREEN 8: The above screen is the result screen which displays the end
result of the system, the emotion portrayed by the person in the image.
15 REFERENCES
[1] J. Jarkiewicz, R. Kocielnik and K. Marasek, Anthropometric
Facial Emotion Recognition, Novel Interaction Methods and
Techniques -Lecture Notes in Computer Science, Volume
5611,
2009.
[2] L. Zhao, X. LinSun, J. Liu and X.Hexu, Face Detection Based on
Skin Colour, Proceedings of the third international conference on
machine learning and cybernetics, Shanghai, 2004.
[3] I. Maglogiannis, D. Vouyioukas and C. Aggelopoulos, Face
Detection and Recognition of Natural Human Emotion Using
Markov Random Fields, Pers Ubiquit Comput, 2009.
[4] M.H Yang, D. J. Kriegman, N. Ahuja,
Detecting Faces