whatsapp

whatsApp

Have any Questions? Enquiry here!
☎ +91-9972364704 LOGIN BLOG
× Home Careers Contact
Back
Emotion Detection using Image Processing in Python
Emotion Detection using Image Processing in Python

 

 

Abstract

In this work,user’s emotion using its facial expressions will be detected. These expressions can be derived from the live feed via system’s camera or any pre-existing image available in the memory.Emotions possessed by humans can be recognized and has a vast scope of study in the computer vision industry upon which several researches have already been done. The work has been implemented using Python (2.7),

Open Source Computer Vision Library (OpenCV) and NumPy. The scanned image (testing dataset) is being compared to training dataset and thusemotion is predicted. The objective of this paper is to develop a system which can analyze the image and predict the expression of the person. The study proves that this procedure is workable and produces valid results.

Introduction to Image Processing

In order to get an enhanced image and to extract some useful information out of it, the method of Image Processing can be used. It is a very efficient way through which an image can be converted into its digital form subsequently performing various operations on it. This is a technique similar to signal processing, in which the input given is a 2D image, which is a collection of numbers ranging from 0 to 255 which denotes the corresponding pixel value. 

It consists of three basic steps :

1.)     Scanning the image: a raw image is acquired which has to be processed. It can be expressed in form of pixels as stated above.The aim of this step is to extract information which is suitable for computing.

2.)     Processing and Enhancing it: -the image is converted into digital form by using a digitizer which samples and quantizes the input signals. The rate of sampling should be high for good resolution and high quantization level for human perception of different shades using different using gray-scale

3.)     The obtained result describes the property of the image and further classifies the image.

FLOW CHART:

 

Steps involved in installing Python 2.7 and the necessary packages

Let’s begin with a sample of image in either .jpg or .png format and apply the method of image processing to detect emotion out of the subject in the sample image. (The word ‘Subject’ refers to any living being out of which emotions can be extracted).

A.    Importing Libraries

For successful implementation of this project, the following packages of Python 2.7 have to be downloaded and installed: Python 2.7.x, NumPy, Glob and Random. Python will be installed in the default location, C drive in this case. Open Python IDLE, import all the packages and start working.

B.    NumPy

    NumPy is one of the libraries of Python which is used for complex technical evaluation. It is used for implementation of multidimensional arrays which consists of various mathematical formulas to process. 

The array declared in a program has a dimension which is called as axis.

The number of axis present in an array is known as rank

For e.g. A= [1,2,3,4,5]

In the given array A 5 elements are present having rank 1, because of one-dimension property.

Let’s take another example for better understanding

B= [[1,2,3,4], [5,6,7,8]]

In this case the rank is 2 because it is a 2-dimensional array. First dimension has 2 elements and the second dimension has 4 elements. [10]

 

C.    Glob

On the basis of the guidelines specified by Unix Shell, the Glob module perceives the pattern and with reference to it, generates a file. It generates full path name. 

1)  Wildcards

These wildcards are used to perform various operations on files or a part of directory. There are various wildcards  which are functional out of which only two are useful: - 

List of all files/working material saved inside a directory named “direc”

 

direc/filename1List of all files/working material saved inside a directory named “direc”

direc/filename1

direc/filename2

direc/filename3

direc/filename4

direc/filename5

      direc/files

 

a) Asterisk(*): It represents any number of characters  with any combination

For eg.

                import glob

                for name in glob.glob(‘direc/file*’)

                print name

                Result=>

                direc/filename1

                direc/filename2

                direc/filename3

                direc/filename4

                direc/filename5

                direc/files

 

                b) Question Mark(?): It represents or finds a single missing character

For e.g

 

import glob

for name in glob.glob(‘direc/filename?’)

print name

Result=>

direc/filename1

direc/filename2

direc/filename3

direc/filename4

direc/filename5

This wildcard is limited to one specificdirectory and doesn’t extend itself. i.e., itdoesn’t find a file in a subdirectory.[5]

 

C.    Random

Random M+odule picks or chooses a random number or an element from a given list of elements. This module supports those functions which provide access to such operations.  

Classification of Random Module: -

1)    randint(m,n)

        It returns a value of x such that-

                m<=x<=n

 

2)    randrange(dog, cat, mouse, lion)

       It returns any random variable or element from the given range.

 

Steps involved to perform Emotion Detection using OpenCV-Python:

1)After successfully installing all the necessary softwares, we must start by creating a Dataset. Here, we can create our own dataset by analyzing group of images so that our result is accurate and there is enough data to extract sufficient information. Or we can use an existing database.

2)The dataset is then organized into two different directories. First directory will contain all the images and the second directory will contain all the information about the different types of emotions.

3)After running the sample images through the

python code, all the output images will be stored into another directory, sorted in the order of emotions and its subsequent encoding.

4) Different types of classes can be used in OpenCV for emotion recognition, but we will be mainly using Fisher Face one. 

5)Extracting Faces:OpenCV provides four predefined classifiers, so to detect as many faces as possible, we use these classifiers in a sequence 

6)The dataset is split into Training set and Classification set. The training set is used to teach the type of emotions by extracting information from a number of images and the classification set is used to estimate the classifier performance.

7)For best results, the images should be of exact same properties i.e. size.

8)The subject on each image is analyzed, converted to grayscale, cropped and saved to a directory 

9)Finally, we compile training set using 80% of the test data and classify the remaining 20% on the classification set. Repeat the process to improve efficiency .

Applications and Future Scope

      Computer Vision is a very vast field which is still under developmental phase. Research work in this field is going at a rapid phase.

Emotion detection is an inseparable part of computer vision. Loads of tasks and processes can be performed if one can become aware about the intricacies and endless possibilities offered under the field of emotion detection.

 

Note : Find the best solution for electronics components and technical projects ideas
keep in touch with our social media links as mentioned below
Mifratech websites : https://www.mifratech.com/public/
Mifratech facebook : https://www.facebook.com/mifratech.lab
mifratech instagram : https://www.instagram.com/mifratech/
mifratech twitter account : https://twitter.com/mifratech

latest engineering projects on data science

 

 

 

engineering projects on machine learning

 

latest engineering projects on data science

 

engineering projects on machine learning

 

 

 

best engineering projects on machine learning

 

best engineering projects on machine learning

 

best projects on machine learning

 

best projects in deep learning

 

best machine learning projects for resume

 

best machine learning projects for final year

 

best machine learning projects for beginners

 

best machine learning projects for portfolio

 

best machine learning projects for jobs

 

best machine learning projects github

 

best projects in machine learning

 

best machine learning projects with source code

 

best deep learning projects for resume

 

best deep learning projects github

 

best deep learning research projects

 

best machine learning project ideas

 

best machine learning projects

 

best ml projects for resume

 

top 5 machine learning projects for beginners

 

top 10 machine learning projects for beginners

 

best ai projects for beginners

best ml projects for final year students

 

best engineering projects on machine learning

 

best projects on machine learning

 

best projects in deep learning

 

best machine learning projects for resume

 

best machine learning projects for final year

 

best machine learning projects for beginners

 

best machine learning projects for portfolio

 

best machine learning projects for jobs

 

best machine learning projects github

 

best projects in machine learning

 

best machine learning projects with source code

 

best deep learning projects for resume

 

best deep learning projects github

 

best deep learning research projects

 

best machine learning project ideas

 

best machine learning projects

 

best ml projects for resume

 

top 5 machine learning projects for beginners

 

top 10 machine learning projects for beginners

 

best ai projects for beginners

 

best ml projects for final year students

 

best project for machine learning

 

best ml projects for beginners

 

best machine learning tutorial for beginners

 

mifra tech is the best place technical course learner

 

best project institute in bangalore  is the mifratech

 

best machine learning course with projects

 

best machine learning projects in python

 

best machine learning projects on github

 

mifratech is the best engineering project center for ece and cse

 

best machine learning programs online

 

top 10 machine learning projects for beginners in python

easy machine learning projects for beginners

 

 

 

Popular Coures