Вы находитесь на странице: 1из 58

ABSTRACT

Being one of the most successful applications of the image processing, face detection and recognition has
a vital role in technical field especially in the field of security purpose. Human face detection and
recognition is an important field for verification purpose especially in the case of attendance system.
Maintaining the attendance is very important in all the institutes for checking the presence of students.
Every institute has its own method in this regard. Some are taking attendance manually using the
traditional pen and paper or file based approach. This system is developed for deploying an easy and a
secure way of taking down attendance. The system first captures an image of all the students and stores
the information into database. The system then stores the image by mapping it into a face coordinate
structure. Next time whenever the registered student enters the premises the system recognizes the student
and marks his attendance along with the time. In this project, we come up with a new hardware system
for human face detection which makes use of Laptop.

Face detection and recognition has gained a lot of popularity in the domain of Image
Processing in the last few years and researchers have been able to implement it in various fields of our
daily life including security purposes, gender classification, human computer interaction, biometric
control etc. This concept aims toward another successful implementation of Attendance system using face
detection and recognition. Manually taking attendance by teachers cause a lot of manipulation and a lot of
confusion at times. The automated system for attendance designed by us prevents the extra proxies and
manipulation of the data. It also saves the time spent on counting the students and taking attendance,
which in turn can be used for betterment of students. Our Attendance system compromises of four steps
i.e. creating a database, taking a group photo of class, face segmentation, matching the face with the
database.
Table of Contents
CHAPTER 1

INTRODUCTION……...……………………………………………………………………………05

CHAPTER-2
LITERATURE SURVEY……………………………………………………….…………………..09

CHAPTER-3
METHODOLOGY…………………………………………...……………………………………...14
3.1 System Design…………………………………………………………………………………….14
3.2 System Architecture……………………………………………………………………………….15
3.3 System Approach………………………………………………………………………………….17

CHAPTER-4
PROPOSED SYSTEM………………………………………………………………………………19
4.1 Viola Jones Algorithm…………………………………………………………………………….19
4.1.1 Haar like features………………………………………………………………....................19
4.1.2 Creating Integral Images…………………………………………………………………….20
4.1.3 Adaboost training……………………………………………………………………………21
4.1.4 Cascade Classsifier…………………………………………………………………………..21
4.2 Local Binary Pattern ……………………………………………………………………………....22

CHAPTER-5
Haar CASCADES…………………………………………………………………………………...24

CHAPTER-6
ALGORITHMS……………………………………………………………………………………...25
6.1 Python IDE ……………………………………………………………………………………….25
6.2 Open CV ………………………………………………………………………………………….25
6.3 Open CV- Python…………………………………………………………………………………25
6.4 Open CV- Python Working……………………………………………………………………….26
6.5 Open CV needs us………………………………………………………………………………...26
6.5.1 Getting started with images………………………………………………………………....27
6.6 Using Open CV…………………………………………………………………………………...27
6.6.1 Read an image………………………………………………………………………………27
6.7 Display an image………………………………………………………………………………….27

CHAPTER -7
INTRODUCTION TO Open CV…………………………………………………………………..29
7.1 Open CV……………………………………………………………………………………….....29
7.1.1 Structure of Open CV……………………………………………………………………….30
7.1.2 General description………………………………………………………………………….31
7.1.3 Features……………………………………………………………………………………...31
7.1.4 Open CV modules…………………………………………………………………………...32
7.1.5 Open CV working with video capturing…………………………………………………….32.
7.1.6 Advantages of Open CV over……………………………………………………………….33

CHAPTER-8
IMAGE PROCESSING MODULES………………………………………………………………34
8.1 Propose of Image processing……………………………………………………………………..34
8.1.1 Haar Classifiers ……………………………………………………………………………34
8.1.2 Histogram Of Oriented Gradients (HOG)………………………………………………….35
8.1.3 Numpy……………………………………………………………………………………...35

CHAPTER-9
IMPLEMENTATION……………………………….……………………………….…………….37

CHAPTER -10
FLOWCHARTS…………………………………………………………………………………....39
10.1 Basic Structure………………………………………………………………………................39
10.2 System Requirements……………………………………………………………......................39

CHAPTER-11
PROGRAM CODE IMPLEMENTATION………………………………………………………41
11.1 Code for Datasets………………………………………………................................................41
11.2 Code for Face recognition……………………………………..……………………………….43

CHAPTER-12
RESULTS…………………………………………………………………………………………..48
12.1 Database Creation……………………………………………………………………………...49
12.2 Face detection of enrolled student……………………………………………………………..49
12.3 Face recognition of unknown student………………………………………………………….50
12.4 Message to the HOD…………………………………………………………………………...50
12.5 Attendance marking……………………………………………………………………………51

CHAPTER-13
ADVANTAGES AND DISADVANTAGES……………………………………………………...52
CHAPTER-14
APPLICATIONS…………………………..……………………………………………................53

CHAPTER-15
CONCLUSION AND FUTURE WORK………………………………………………………....54

REFERENCES………………………………………………………………………………….....55
List of Figures

Fig. No Description Page No.

3.1 Proposed work diagram of Face Detection and Recognition 14


3.2.2 Capturing image 16
4.1.4 Cascade classifier 22
7.1 Qt editor with Open CV 30
7.1.1 Structure of Open CV 30
10.1 Basic Structure 39
110.2 System requirements 40
11 Progtramming code implementation 47

List of Tables

Table. No Description Page No

Comparison of various methods


12.1 on the basis of recognition rate 48
and recognition time
SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

CHAPTER 1

INTRODUCTION

Organizations of all sizes use attendance systems to record when student or employees start
and stop work and the department where the work is performed. Some organizations also
keep detailed records of attendance issues such as who calls in sick and who comes in late. An
attendance system provides many benefits to organizations. Traditional approach for
attendance is professor calls student name & record attendance. It takes some time to record
attendance. Suppose duration of class of one subject is about 50 minutes & to record
attendance takes 5 to 10 minutes. For each lecture this is wastage of time. To avoid these
losses, we are about to use automatic process which is based on python using laptop as
module.

In this approach, we are using face detection & face recognition system. This face detection
differentiates faces from non-faces and is therefore essential for accurate attendance. The
other strategy involves face recognition for marking the students attendance.

The laptop module is used for face detection & recognition. The camera will be connected to
the laptop module. The database is collected. The database includes name of the person, their
images . One of the unique features of our brain is that it can think only in images not in
words. God has given everyone a unique face.

Face is the most important part of our body, so that it can reflect many emotions of a person.
There are traditional ways are being utilized even today but with vast resources wanted to be
more secured. There are two types of biometric as physiological characteristics (face,
fingerprint, finger geometry, hand geometry, palm, iris, ear and voice) and behavioral
characteristics (gait, signature and keystroke dynamics). Sometimes your behavioral traits
may change because of illness, fear, hunger etc. Face detection and recognition system is

Dept. Of TCE,Dr. AIT Page 5


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

more expensive, exact, easy to understand and non-intrusive process as compare to other
biometrics.

The system will fall into two categories as face detection (1:1) and face recognition (1: N). In
the face detection we have to classify between face versus non face region while in
recognition process we have to compare that single face image with multiple images from the
input image. While capturing an images from a webcam we have to come across some
problems like pose (position of camera), presence of structural components (spectacles and
beard), facial expression, occlusion (obstructed by someone), image orientation (variation in
rotation), imaging condition (lightning and camera characteristics) etc.

A Face Detection and Face recognition System is a system which automatically identifies
and/or verifies the identity of a person from digital images or a video frame from a video
source. A general statement of the face recognition problem (in computer vision) can be
formulated as follows: Given still or video images of a scene, identify or verify one or more
persons.

System Requirements for the project.

 Develop a system in which we can maintain and record the


attendance of students in a lecture.
 The attendance is recorded only after the lecture instructs the
software to do so.
 The faculty instructs the system twice; at the beginning and at the end.
 System should be smart enough to make sure that the student
remains in the lecture for the entire session.
 The system should work as a survelliance system as well.
 The entire report of the attendance of each lecture should be
reverted back to the attendance database.

Dept. Of TCE,Dr. AIT Page 6


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

Introduction to Haar Cascades:

Each feature is represented as a single value obtained from the difference of the sums of pixels
in white rectangle from the sum of all pixels in the black rectangle. All different possible sizes and
locations of classifier is used for calculating of plenty of features. As the number of classifiers
increase the arithmetic computations seems to take a long time. To avoid this, we use the
concept of Integral Image. In Image Processing Integral image is a data structure which is summed
area table and algorithm for quickly and efficiently generating sum of values in a rectangular grid
subset. Integral image is derived by using the formula. Integral image to solve the complexity of
the number of classifiers applied for calculation we use Ad boost machine learning algorithm,
which is inbuilt in OpenCV library that is cascade classifier, to eliminate the redundancy of the
classifiers. Any classifier which has a probability of 50% of more in detection is treated as weak
classifier.

Dept. Of TCE,Dr. AIT Page 7


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

CHAPTER 2

LITERATURE SURVEY

The review of many papers are done and are compared according to the above proposed
taxonomy, while their strengths and weaknesses are clearly stated. After the survey of these
papers only a few exploit the image processing techniques and some advantages are adapted
to our work and hence proposed a reference model which exploits image processing
techniques combining the strengths and eliminating the weaknesses of the surveyed models.

[1] “Web Based Student Information Management” by S.R .Bharamagoudar, Geeta


R.B., S.G.Totad.

This project assist in automating the existing manual system. It can be monitored and
controlled remotely. This project provides accurate information always. All years together
gathered information can be saved and can be accessed at any time. The purpose is to design a
college website which contains upto date information of the college. That should improve
efficiency of college record management.

[2] “Attendance Management System” by G. Gangagowri.

In this project, the system is used Way to SMS software. This software is used to send SMS
easily to their parent’s. This system can store their data about the students and those cares
absent student details. It is an efficient method to store the attendance in the Web Site rather
than wasting the paper. It also updates the student report directly on the server reducing the
faculty’s time on logging from the computer.

[3] “Online Student Attendance System”, by P. N. Garad.

In this project, we gave access to three user i.e. Admin, Student, Others. This project is based
on client-server. Here, the serve is Tomcat and client is JSP. In this project teachers or the
admin will be filling attendance and sending message to the student who is absent. They will

Dept. Of TCE,Dr. AIT Page 8


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

have privilege to fill attendance form, update attendance form, send message to the guardian’s
account whose child is absent, also those attendance is less than 75%, and they also have
privilege to send message to the students whose fees are pending. he staff can also view the
message whenever they want and also can modify the details of students. Parents have
privilege to view attendance and to view message sent by the teacher. Students also have their
account with the privilege to view message sent by the subject teacher and to view the
attendance.

[4] “Web Based Coaching Institute Management System”, by Mayuri Kamble.

“Coaching Institute Management System” software developed for an institute has been
designed to achieve maximum efficiency and reduce the time taken to handle the storing
activity. It is designed to replace an existing manual record system thereby reducing time
taken for calculations and for storing data. The system is strong enough to withstand
regressive daily operations under conditions where the database is maintained and cleared
over a certain time of span. The implementation of the system in the organization will
considerably reduce data entry, time and also provide readily calculated reports.

[5] “Classroom Attendance Application”, by Pranjul Khare.

The scope of the project is the system on which the software is installed, i.e. the project is
developed as an ANDROID application, and it will work for a particular institute. Android is
a mobile operating system (OS) based on the Linux kernel and currently developed by Google
with a user interface based on direct manipulation. RAD approaches to software development
have put less emphasis on planning tasks and more emphasis on development. It has revealed
that an online system for recording and reporting students ’attendances is indeed a needed
application in order to make the process more efficient and time-saving where more than 70%
of the sample group agreed to that matter.

[6] “Student Information Report System with SMS (SIRS)” by Isbudeen Noor
Mohamed, Ahmad Tasnim Syed Ajaz, S. Mohamed Idhris.

Dept. Of TCE,Dr. AIT Page 9


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

The project system has come up with many functionalities for educational institutions to track
the student progress and managing attendance. It helps both student and guardian to keep
track of student progress without visiting to the college. It also notifies student and guardian
during the time of important events which are happening in institution. One more feature is
guardian get alerted whenever student get failed in the exam or student not able to meet the
expected attendance average. Student Information Report System (SIRS) is application
software and which has intention to begin a conductive and direct interchanging the statistics
in a secure platform to coalesce with students, faculties, parents and the college/school
administration. The student information has the particulars (like register number sem, date-of-
birth, sex, parent phone number, address, parent name, etc.) invade to the system by the
faculties. All these particulars is stored in the database. SIRS application is trouble free to use
in schools, colleges, universities, and any other educational institutions. It can be customized
as per the need. It can be used in private and government educational institutions also. SIRS
application is an internet based application we can login to the system from anywhere
irrespective of geographical area it will give seamless navigation.

[7] “A Study of Student Information Management Software”, by FU Yue.

The project provides the particulars to carry out the performance, management and decision-
making functions of enterprises or organizations. Enormous grow of students is caused to
expand the functionality in the respective educational institutions. As student added to the
educational system it is difficult to manage and track student details. To overcome difficulties
we come up with this new approach student information management system with additional
features. This new approach will provide fast processing, efficient student tracking, and
produces desired result. This approach will allow students to save their personal details. It is
more secure, reliable and easy to use.

[8] “Android Based Mobile Attendance System” by Freya. J. Vora, Pooja. L. Yadav,
Rhea. P. Rai, Nikita. M. Yadav.

Attendance is part of any system to keep track of the particular person. It is mandatory
process in educational system which directly reflects the student progress. In educational

Dept. Of TCE,Dr. AIT Page 10


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

institutes attendance management is normally a manual process. There is enormous grow in


the software industry which has privileged colleges to maintain the attendance system by
using gadgets which is the best way. As we are using the smart phones we not require
maintaining attendance register. It can be easily done in mobile application. Faculty will be
going to take the attendance when class gets started. They will initially login to the system
through mobile application. Once attendance has been taken successfully for the class it will
sent to sever through GPRS. The faculties can also do the necessary functions like registering
new students, deleting the information about a particular student, modifying the information
regarding the student etc. The main intention of this process is to reduce the risk of manual
efforts. It also reduces the time consumption. Also we want to give importance to reduce the
paper wastage that daily happens.

[9]“College Student Management System Design Using Computer Aided System” by


Liangqiu Meng.

The project model utilizes computer aided system. The model plays main role in an institution
or in the college management. Initially, the system has developed with four layers based on
the hierarchy such as Web display layer where application is deployed and displayed for end
users. Business logic layer responsible for handling the functionality of the product. Data
access layer is responsible for viewing the data. Database layer responsible for storing the
student data. In Database layer ER diagram has been designed to provide data normalization.
The process provides complete information about student, faculties and educational
institution. Third thing in this project is to allowing user based on their categories.

[10] “computer vision and face recognition algorithms into attendance


management” by Visar Shehu and Agni Dika .

In this project, a system which introduces an attendance marking system, which integrates
computer vision and face recognition algorithms into the process of attendance management.
The system is implemented using a non-intrusive digital camera installed on a classroom,
which scans the room, detects and extracts all faces from the acquired images. After faces
have been extracted, they are compared with an existing database of student images and upon

Dept. Of TCE,Dr. AIT Page 11


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

successful recognition a student attendance list is generated and saved on a database. This
project addresses problems such as real time face detection on environments with multiple
objects, face recognition algorithms as well as social and pedagogical issues with the applied
techniques.[1]

[11] “RFID cards for attendance marking” by PAN Xiang.

In this project, the process of the system is when a person wants to enter the access control
system, he used the RFID card to swiping card by non-touch way. The system reads the
information in the card and meanwhile the video camera is started to take photos of the
person. Then the face can be detected in a short time. The identity information in the card is
compared to the information from the database and the corresponding face data will be
obtained. If the identity information and the face data are all matched to the information from
the database, the person will be passed. Else he can’t enter. The manager can do the manage
work such as query the records.[2]

[12] “Ear detection by using MATLAB for identity of the person” by Mr.
Jawale.

In this project, Mr. Jawale described a technique based on ear is also introduced that is a
photo of the subject’s ear is taken and fed into the computer. Edge detection is carried out on
this picture. From this detected edge, is separated a reference line with respect to which other
features are identified. These extracted features are stored in a database in the form of a
vector, each vector corresponding to a particular image in the database. The feature vector of
the test image obtained is compared with those in the vector database, For creating and
maintaining database for records of individuals and feature vectors, which are used for the
purpose of comparison and decision making, linking of MATLAB and some data base using
ODBC Drivers is carried out according to which a match is calculated. This match is
compared with a predecided threshold value, which decides the identity of the person.

Dept. Of TCE,Dr. AIT Page 12


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

[13] “ Embedded face detection system based on three modules” by Jian Xiao, Gugang
Gao, Chen Hu, Haidong Feng.

His project proposes a framework for fast embedded face detection system based on three
modules. One fast face detection method based on optimized AdaBoost algorithm with high
speed and high detection rate, one SOC hardware framework to speed up detection operations
and one software distribution strategy to optimize the memory sub-system.

Dept. Of TCE,Dr. AIT Page 13


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

CHAPTER 3

METHODOLOGY

3.1 System Design

The aim of our dissertation is to provide a attendances system using face detection and
recognition on laptop board and send an alert message to the authorized person via mobile
device or internet server This will increase the security of our Dissertation. Whatever the
system that we have to implement it should work in real time with low false detection rate.
Figure. 1 shows the block diagram for real time face detection and recognition system that
will contain various hardware and software components.

Fig 3.1 Proposed work diagram of Face Detection and Recognition

Dept. Of TCE,Dr. AIT Page 14


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

The proposed work follows:

The first part was booting the Laptop by installing the OpenCV software and installing the
essential libraries and packages.

1) Interfacing of camera module with laptop model. Capture face image using USB Webcam
i.e. image acquisition take place

2) Create a database of authorized person using face detection process. After created database
save into folder.

3) Capture current face, compare with data base image. Using face detection and face
recognition process. Algorithms are used for face detection and recognition.

4) If any person is not present then message will be send to absent person.

3.2. S YSTEM A RCHITECTURE

1. Creating the database


2. Capturing the image
3. Face detection and segmentation using Haar cascades
4. Face recognition using LBP
5. Attendance marker

1. Creating the database:

A database of all the students will be created using python and opencv. It is a onetime process
so that we will have a real time database to train our system and to match the captured faces.
For creating a person’s database ,the person has to sit in front of the camera around 80cms
away from the camera with light on the opposite side of the face. The camera must be at level
of the face of the person. When the code runs, the person has to give 8 poses with different
expressions so that a database of different types of photo gets made. The poses can be
looking sideways, up down or any direction in which face is visible. The expressions to be
recorded can be happy, sad, bored, yawning etc. Also the faces detected from the captured

Dept. Of TCE,Dr. AIT Page 15


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

images will be added to the database so that the database is updated continuously. Once the
database is done we are ready with our implementation part.

2. Capturing the image

A high definition camera will be installed in the classroom above the board so that it could
capture all the students present in the class. The camera can be manually controlled or
programmed as per the choice of the user. After capturing the image, it will be sent to the
system for further processing.

Fig 3.2.2: capturing image

3. Face detection and segmentation using Haar cascades

Once the system gets the input image, it will be processed and all the faces present will be
detected using the haar cascade feature of opencv. The image then will be segmented to all the
faces present and will be stored in a file for that particular date.

4. Face recognition using LBP

Dept. Of TCE,Dr. AIT Page 16


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

Once all the faces are segmented into different faces, we will run the face recognition code.
Each of the faces from the particular date folder will be checked with the database using the
local binary pattern algorithm and if similar face is found the photo will be added to the
database for better efficiency in future.

5. Attendance Marker

If a face from the particular date folder is matched with the database, then the particular
student will be marked present. Following the same procedure, we will have list of all
students who were present in the class. Rest of the class student will be marked absent.

WORKING

Above figure show the basic block diagram our dissertation system can be operated in two
different sections, i.e. one for capturing and creating a data base and the other section is to
capture the image and which is used for identifying or comparing the images in the database
for attendances mechanism.

3.3. System Approach

The total system is divided into 3 modules- Database creation, Training the dataset, Testing,
sending alert messages as an extension:

1. Database creation

a) Initialize the camera and set an alert message to grab the attention of the students.
b) Get user id as input
c) convert the image into gray scale, detect the face and
d) Store it in database by using given input as label up to 20 frames.

2. Training

Dept. Of TCE,Dr. AIT Page 17


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

a) Initialize LBPH face recognizer.


b) Get faces and Id’s from database folder to train the LBPH face recognizer.
c) Save the trained data as xml or yml file.

3. Testing

Load Haar classifier, LBPH face recognizer and trained data from xml or yml file.

a) Capture the image from camera,


b) Convert it into gray scale,
c) Detect the face in it and
d) Predict the face using the above recognizer.

This proposed system uses Viola Jones algorithm for face detection which uses modified
Haar Cascades for detection. Raspberry Pi is the main component in the project. We will be
using USB webcam to capture photos. We can access Raspberry Pi’s console either by using
SSH in laptop or by using Keyboard and mouse with the display device like TV connected to
Pi. Firstly, the algorithm needs a lot of positive images and negative images to train the Haar
cascades classifier. Positive images are images with clear faces where negative images are
those without any faces.

Dept. Of TCE,Dr. AIT Page 18


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

CHAPTER 4

PROPOSED SYSTEM

4.1 VIOLA JONES ALGORITHM

It is used for face detection.


The algorithm uses 4 techniques

4.1.1 Haar –like features.


4.1.2 Integral images.
4.1.3 Ada boost.
4.1.4 Cascading.

This algorithm trains a system to identify the difference between face images and non-facial
images. We extract the features of a face image and store it in a file, if a given input image
processes all the comparison in the file then it is recognized as a facial image. we are
classifying the image is whether a face or a non-face image, just by referring to the file, which
is already stored in the database

4.1.1 Haar –like features.

There is different type of haar feature which are applied on the image to see whether the
feature exists in the image. The 24X24 window is applied all over the image, in which for
each operation, we are subtracting the sum of pixels in white region with, sum of pixels in
black region which output an integer value, that determines the validation of the
corresponding feature.

Dept. Of TCE ,Dr.AIT Page 19


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

For every 24X24 window we end up calculating nearly 160,000 features, because in each
scale of image every feature is interpreted in all possible dimensions, positions and sizes.

4.1.2 Creating integral image.

This method reduces the cost of calculating sum of pixels while validating a feature. we are
doing the same by taking only the corner pixel values. For a given input image, or getting
integral image, we sum up all pixels that are falling to the left and top region of the pixel. The
advantage of the integral image is; it reduces the computation by 4 times.

Dept. Of TCE ,Dr.AIT Page 20


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

4.1.3 Adaboost training.

Calculating 160,000 feature’s validation for each 24X24 window is practically impossible and
computationally intensive. so, we are going to use only the features which are more effective
in face detection, rather than less effective haar-transforms. This is done by adaboost, it
narrows down to thousands of features that are redundant to use. Adaboost decides some set
of features and gives weight to each feature, and the linear combination of all these features,
is used to decide whether it is a face or not. Weak classifiers are some features which at least
perform better than random guessing, if we give hundred face images, it will be able to detect
more than fifty as face images. The output of the weak classifier is 1, if the feature is
recognized else 0. The sum of product of relevant weak classifiers and their weights gives the
strong classifier, whose value must be more than threshold for validation as a face image,
which is less for a
non-facial image.

4.1.4. Cascade classifier

If we have an input image say 640X480, we have to perform 2500 feature validations for each
24X24 window, and take the linear combination of all those classifiers for validation. In
cascading, we divide these 2500 features into set of stages in which the number of features

Dept. Of TCE ,Dr.AIT Page 21


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

increases in ascending order. The advantage is we can reject any non-face image with less
time, without processing for each and every feature.

4.1.4 Fig cascade classifier

4.2. Local Binary Pattern

Local Binary Pattern[6] is an algorithm which is based on the texture of the object. However,
unlike other texture based algorithms which generally uses a global threshold, this algorithm
computes the local representation of the texture.

The steps involved in the algorithm are:

1. Convert the image into gray scale image.


2. For each pixel in the image, take neighborhood of size = r(say 8) around the pixel
3. Calculation of the LBP value goes like this. Any value greater than the Centre
pixel(threshold) is assigned a value 0 whereas others lesser then the threshold are assigned 1.
4. They are then written in an array of length 8 in clockwise or anti-clockwise direction from
the first pixel.
5. Finally, the LBP value for the pixel is calculated by multiplying the values of the array with
values equal to 2 raise to the power the index of the array.
6. This LBP value for each pixel stored in a 2D array of size same as the size of the input
image
7. A histogram of the frequency of each number over the cell (the number greater and the
number smaller) is plotted.
8. The histogram is then normalized.
9. Thus, we get 256 bin histograms.

Dept. Of TCE ,Dr.AIT Page 22


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

10. Finally, the histograms corresponding to all the cells are concatenated to get the final
feature vector.

There is different neighbor size available for LBP [8] operator.


For instance, (LBP4, 1) uses 4 neighbors on a circle of radius

1. Similarly, (LBP16, 2) consists 16 neighbors on a circle of radius


2. Thus in general, LBPP, R refers to P pixels on a circle of radius R.

These fundamental patterns are as those with a small number of bitwise transitions from 0 to
1 and vice versa. For example, 00101110 and 10110001 contain 4 transitions while 00010110
and 01110110 contain 3 transitions and so on.

Dept. Of TCE ,Dr.AIT Page 23


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

CHAPTER 5

HAAR CASCADES

Each feature is represented as a single value obtained from the difference of the sums of
pixels in white rectangle from the sum of all pixels in the black rectangle. All different
possible sizes and locations of classifier is used for calculating of plenty of features. As the
number of classifiers increase the arithmetic computations seems to take a long time. To
avoid this, we use the concept of Integral Image. In Image Processing Integral image is a data
structure which is summed area table and algorithm for quickly and efficiently generating
sum of values in a rectangular grid subset. Integral image is derived by using the formula.
Integral image to solve the complexity of the number of classifiers applied for calculation we
use Ad boost machine learning algorithm, which is inbuilt in OpenCV library that is cascade
classifier, to eliminate the redundancy of the classifiers. Any classifier which has a probability
of 50% of more in detection is treated as weak classifier. The Sum of all weak classifier gives
a strong classifier which makes the decision about detection. Although it is very vague to
classify with one strong classifier we use the cascade of classifiers. Classification takes place
in stages, if the selected region fails in the first stage, we discard it. We don’t use the
classifiers on that region which is discarded. The region which passes all the stages i.e. all
strong classifiers is treated as the detected face. Detected Faces are passed to the Face
recognition phase. In this phase we use Local Binary Patterns algorithm for face recognition.
Local binary patterns are simple at the same time very efficient texture operator which assigns
the pixels of the image by comparing with the adjacent pixels as threshold and which results
in a binary result. The detected integral image is subjected to this Local binary pattern which
results in decimals are represented as histogram for every integral image. Face recognition is
extremely vulnerable to the environment changes like brightness, facial expressions and
position. Face pre-processing is the module which reduces the problems that makes the
picture unclear to recognize the face such as less brightness and contrast problems and noise
in the image and make sure the facial features always be in a constant position. In this project
we use histogram equalization for face pre-processing. For efficiency we use separate pre-
processing which is histogram equalization for left and right face. So histogram equalization
is done three times, firstly for the whole face and the other two for side faces.

Dept. Of TCE ,Dr.AIT Page 24


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

CHAPTER 6

ALGORITHMS

6.1 Python IDE

Python is an easy to learn, powerful programming language. It has efficient high-level data
structures and a simple but effective approach to object-oriented programming. Python’s
elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal
language for scripting and rapid application development in many areas on most platforms.
The Python interpreter is easily extended with new functions and data types implemented in C
or C++ (or other languages callable from C). Python is also suitable as an extension language
for customizable applications.

6.2 OpenCV

OpenCV is a library of programming functions mainly aimed at real-time computer vision. It


has a modular structure, which means that the package includes several shared or static
libraries. We are using image processing module that includes linear and non-linear image
filtering, geometrical image transformations (resize, affine and perspective warping, and
generic table-based remapping), color space conversion, histograms, and so on. Our project
includes libraries such as Viola-Jones or Haar classifier, LBPH (Lower Binary Pattern
histogram) face recognizer, Histogram of oriented gradients (HOG).

6.3 OpenCV-Python

Python is a general purpose programming started by GUIDO VAN ROSSUM, which became
very popular in the short time mainly because of its simplicity and code readability. It enables
the programmer to express his ideas in fewer lines of code without reducing any readability.

Compared to other languages like C,C++, python is slower. But another important feature of
python is that it can be easily extended with C.C++. This feature helps us to write
computationally intensive codes in C,C++ and create a python wrapper for it so that we can

Dept. Of TCE ,Dr.AIT Page 25


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

use these wrappers as python modules. This gives us two advantages: first, our code is as fast
as original C,C++ implementation. And the support of Numpy makes the task more
easier.Numpy is a highly optimized library for numerical operations. It gives a MATLAB-
style syntax. All the OpenCV array structures are converted to and from Numpy arrays. So
whatever operations you can do in Numpy, you can combine it with OpenCV which increases
number of weapons in your arsenal. Besides that, several other libraries like SciPY,
Matplotlib which supports Numpy can be used with this. So OpenCV-python is an
appropriate tool for prototyping of computer vision problems.

6.4 OpenCV-Python working

OpenCV introduces a new set of tutorials which will guide you through various functions
available in OpenCV-Python. This guide is mainly focused on OpenCV 3.x version (although
most of the tutorials will work with OpenCV 2.x also). A prior knowledge on Python and
Numpy is required before starting because they won’t be covered in this guide. Especially, a
good knowledge on Numpy is must to write optimized codes in OpenCV-Python. This tutorial
has been started by Abid Rahman K. as part of Google Summer of Code 2013 program, under
the guidance of Alexander Mordvintsev.

6.5 OpenCV Needs us.

Since OpenCV is an open source initiative, all are welcome to make contributions to this
library. And it is same for this tutorial also. So, if you find any mistake in this tutorial
(whether it be a small spelling mistake or a big error in code or concepts, whatever), feel free
to correct it. And that will be a good task for freshers who begin to contribute to open source
projects. Just fork the OpenCV in github, make necessary corrections and send a pull request
to OpenCV. OpenCV developers will check your pull request, give you important feedback
and once it passes the approval of the reviewer, it will be merged to OpenCV. Then you
become a open source contributor. Similar is the case with other tutorials, documentation etc.
As new modules are added to OpenCV-Python, this tutorial will have to be expanded. So
those who knows about particular algorithm can write up a tutorial which includes a basic

Dept. Of TCE ,Dr.AIT Page 26


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

theory of the algorithm and a code showing basic usage of the algorithm and submit it to
OpenCV.

6.5.1 Getting Started with Images

Goals

 Here, you will learn how to read an image, how to display it and how to save it
backYou will
 learn these functions : cv2.imread(), cv2.imshow() , cv2.imwrite()
 Optionally, you will learn how to display images with Matplotlib

6.6 Using OpenCV

6.6.1 Read an image


Use the function cv2.imread() to read an image. The image should be in the working
directory or a full path of image should be given.

Second argument is a flag which specifies the way image should be read.

 cv2.IMREAD_COLOR : Loads a color image. Any transparency of image will be


neglected. It is the default flag.
 cv2.IMREAD_GRAY SCALE : Loads image in gray scale mode.\
 cv2.IMREAD_UNCHANGED : Loads image as such including alpha channel

6.7 Display an image


Use the function cv2.imshow() to display an image in a window. The window automatically
fits to the image size.

First argument is a window name which is a string. Second argument is our image. You can
create as many windows as you wish, but with different window ncv2.waitKey() is a
keyboard binding function. Its argument is the time in milliseconds. The function waits for

Dept. Of TCE ,Dr.AIT Page 27


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

specified milliseconds for any keyboard event. If you press any key in that time, the program
continues. If 0 is passed, it waits indefinitely for a key stroke. It can also be set to detect
specific key strokes like, if key a is pressed etc which we will discuss below.

Cv2.destroyAllWindows() simply destroys all the windows we created. If you want to


destroy any specific window, use the function cv2.destroyWindow() where you pass the
exact window name as the argument.

Dept. Of TCE ,Dr.AIT Page 28


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

CHAPTER 7

INTODUCTION TO OpenCV

7.1 OpenCV (Open Source Computer Vision) is a library of programming functions


mainly aimed at real-time computer vision. Originally developed by Intel, it was later
supported by Willow Garage then Itseez (which was later acquired by Intel). The library is
cross platform and free for use under the open-source BSD license. OpenCV supports deep
learning frameworks Tensor Flow, Torch/PyTorch and Cafe.

It has C++, Python, Java and MATLAB interfaces and supports Windows, Linux, Android
and Mac OS. OpenCV leans mostly towards real-time vision applications and takes advantage
of MMX and SSE instructions when available. A full-featured CUDA and OpenCL interfaces
are being actively developed right now. There are over 500 algorithms and about 10 times as
many functions that compose or support those algorithms. OpenCV is written natively in C++
and has a templated interface that works seamlessly with STL containers.

In 1999, the OpenCV project was initially an Intel Research initiative to advance CPU
intensive applications, part of a series of projects including real-time ray tracing and 3D
display walls. The main contributors to the project included a number of optimization experts
in Intel Russia, as well as Intel‘s Performance Library Team. In the early days of OpenCV,
the goals of the project were described as:

 Advance vision research by providing not only open but also optimized code for basic
vision infrastructure. No more reinventing the wheel.
 Disseminate vision knowledge by providing a common infrastructure that developers
could build on, so that code would be more readily readable and transferable.
 Advance vision-based commercial applications by making portable, performance
optimized code available for free – with a license that did not require code to be open
or free itself.

Dept. Of TCE ,Dr.AIT Page 29


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

Fig 7.1. : Qt editor with Open CV

7.1.1 Structure of Open CV

Fig:7.1.1 Structure of Open CV

Once OpenCV is installed, the OPENCV_BUILD\install directory will be populated with


three types of files:

 Header files: These are located in the OPENCV_BUILD\install\includesubdirectory


and are used to develop new projects with OpenCV.
 Library binaries: These are static or dynamic libraries (depending on the option
selected with CMake) with the functionality of each of the OpenCV modules. They
are located in the bin subdirectory (for example, x64\mingw\bin when the GNU
compiler is used).

Dept. Of TCE ,Dr.AIT Page 30


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

 Sample binaries: These are executables with examples that use the libraries. The
sources for these samples can be found in the source package.

7.1.2 General description

 Open source computer vision library in C/C++.

 Optimized and intended for real-time applications.

 OS/hardware/window-manager independent.

 Generic image/video loading, saving, and acquisition.

 Both low and high level API.

7.1.3 Features

 Image data manipulation (allocation, release, copying, setting, conversion).

 Image and video I/O (file and camera based input, image/video file output).

 Matrix and vector manipulation and linear algebra routines (products, solvers,, SVD).

 Various dynamic data structures (lists, queues, sets, trees, graphs).

 Basic image processing (filtering, edge detection, corner detection, sampling and
interpolation, color conversion, morphological operations, histograms, image
pyramids).
 Structural analysis (connected components, contour processing, distance transform,
various moments, template matching, Hough transform, polygonal approximation, line
fitting, ellipse fitting, Delaunay triangulation).
 Camera calibration (finding and tracking calibration patterns, calibration, fundamental
matrix estimation, homography estimation, stereo correspondence).
 Motion analysis (optical flow, motion segmentation, tracking).

 Object recognition (eigen-methods, HMM).

Dept. Of TCE ,Dr.AIT Page 31


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

 Basic GUI (display image/video, keyboard and mouse handling, scroll-bars).

 Image labeling (line, conic, polygon, text drawing)

7.1.4 Open CV modules

 CV - Main OpenCV functions.

 cvaux - Auxiliary (experimental) OpenCV functions.

 cxcore - Data structures and linear algebra support.

 highgui - GUI functions.

7.1.5 OpenCV working with video capturing

OpenCV supports capturing images from a camera or a video file (AVI).

 Initializing capture from a camera:

CvCapture* capture = cvCaptureFromCAM(0); // capture from video device #0

 Initializing capture from a file:

CvCapture* capture = cvCaptureFromAVI("infile.avi");

 Capturing a frame: IplImage* img = 0; if(!cvGrabFrame(capture)){ //


capture a frame printf("Could not grab a frame\n\7"); exit(0); }
img=cvRetrieveFrame(capture); // retrieve the captured frame
To obtain images from several cameras simultaneously, first grab an image from each
camera. Retrieve the captured images after the grabbing is complete

 Releasing the capture source: cvReleaseCapture(&capture);

Dept. Of TCE ,Dr.AIT Page 32


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

7.1.6 Advantages of OpenCV over MATLAB

 Speed: Matlab is built on Java, and Java is built upon C. So when you run a Matlab
program, your computer is busy trying to interpret all that Matlab code. Then it turns it
into Java, and then finally executes the code. OpenCV, on the other hand, is basically
a library of functions written in C/C++. So ultimately you get more image processing
done for your computers processing cycles, and not more interpreting.

As a result of this, programs written in OpenCV run much faster than similar
programs written in Matlab. OpenCV is damn fast when it comes to speed of
execution. For example, we might write a small program to detect people smiles in a
sequence of video frames. In Matlab, we would typically get 3-4 frames analysed per
second. In OpenCV, we would get at least 30 frames per second, resulting in real-time
detection.

 Resources needed: Due to the high level nature of Matlab, it uses a lot of your
systems resources. And I mean A LOT! Matlab code requires over a gig of RAM to
run through video. In comparison, typical OpenCV programs only require ~70mb of
RAM to run in real-time.

 Cost: List price for the base (no toolboxes) MATLAB (commercial, single user
License) is around USD 2150. OpenCV (BSD license) is free.

 Portability: MATLAB and OpenCV run equally well on Windows, Linux and
MacOS. However, when it comes to OpenCV, any device that can run C, can, in all
probability, run OpenCV.

Dept. Of TCE ,Dr.AIT Page 33


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

CHAPTER 8

IMAGE PROCESSING MODULE

Purpose of Image processing

The purpose of image processing is divided into 5 groups. They are:


1. Visualization- Observe the objects that are not visible.
2. Image sharpening and restoration- To create a better image.
3. Image retrieval- Seek for the image of interest.
4. Measurement of pattern– Measures various objects in an image.
5. Image Recognition– Distinguish the objects in an image.

8.1 Haar Classifier

This object detection framework is to provide competitive object detection rates in real-time
like detection of faces in an image. A human can do this easily, but a computer needs precise
instructions and constraints. To make the task more manageable, Viola–Jones requires full
view frontal upright faces. Thus in order to be detected, the entire face must point towards the
camera and should not be tilted to either side. While it seems these constraints could diminish
the algorithm's utility somewhat, because the detection step is most often followed by a
recognition step, in practice these limits on pose are quite acceptable the characteristics of
Viola–Jones algorithm which make it a good detection algorithm are:
a) Robust – very high detection rate (true-positive rate) & very low false-positive rate always.
b) Real time – For practical applications at least 2 frames per second must be processed.
c) Face detection only (not recognition) - The goal is to distinguish faces from non-faces
(detection is the first step in the recognition process).

Dept. Of TCE ,Dr.AIT Page 34


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

8.2 Histogram of oriented gradients (HOG)

Histogram of oriented gradients (HOG) is a feature descriptor used to detect objects in


computer vision and image processing. The HOG descriptor technique counts occurrences of
gradient orientation in localized portions of an image - detection window, or region of interest
(ROI).
Implementation of the HOG descriptor algorithm is as follows:
1. Divide the image into small connected regions called cells, and for each cell compute a
histogram of gradient directions or edge orientations for the pixels within the cell.
2. Discretize each cell into angular bins according to the gradient orientation.
3. Each cell's pixel contributes weighted gradient to its corresponding angular bin.
4. Groups of adjacent cells are considered as spatial regions called blocks. The grouping of
cells into a block is the basis for grouping and normalization of histograms.
5. Normalized group of histograms represents the block histogram. The set of these block
histograms represents the descriptor.

8.3 Numpy

NumPy is the fundamental package for scientific computing with Python. NumPy is an
acronym for”Numeric Python” or “Numerical Python”. It is an open source extension module
for Python, which provides fast precompiled functions for mathematical and numerical
routines. Furthermore, NumPy enriches the programming language Python with powerful data
structures for efficient computation of multi-dimensional arrays and matrices. The
implementation is even aiming at huge matrices and arrays. Besides that the module supplies
a large library of high-level mathematical functions to operate on these matrices and arrays.
It contains other things like:
a) A powerful N-dimensional array object
b) Sophisticated (broadcasting) functions
c) Tools for integrating C/C++ and Fortran code
d) Useful linear algebra, Fourier transforms, and random number capabilities.

Dept. Of TCE ,Dr.AIT Page 35


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

Besides its obvious scientific uses, NumPy can also be used as an efficient multi-dimensional
container of generic data. Arbitrary data-types can be defined. This allows NumPy to
seamlessly and speedily integrate with a wide variety of databases.
In our project we need to convert images into multi-dimensional or 2D-array representation,
and also conversions from gray scale to color images which can be done easily by Numpy.

Dept. Of TCE ,Dr.AIT Page 36


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

CHAPTER 9

IMPLEMENTION

Step 1: Setting up Laptop Module

SD card into the SD card slot on the laptop module, which will only fit one way. Next, plug
the USB keyboard and USB mouse into the USB slots on the laptop. Make sure that the
monitor or TV is turned on, and that the right input is selected. Then Connect the HDMI cable
from your laptop to the monitor or TV. If the laptop is needed to be connected to the internet,
plug an Ethernet cable into the Ethernet port next to the USB ports. When all the required
cables and SD card are plugged then, plug in the micro USB power supply. First of all the
Linux OS is installed into the laptop board via Micro SD card and appropriate code is written
in Python language for the object detection using the Open CV libraries and is dumped in the
board. The USB Camera is interfaced; the GPIO pins are programmed using commands in
Linux and Python in this stage. The camera is interfaced to the laptop.

Step 2: Image Acquisition

Webcam connect to the laptop board. When person standing in front of camera then webcam
capture face image of that person. Resize the captured face image.

Step 3: Pre-processing

The data which is collected from Input unit that is captured Image and Video frames input is
fed into the processing unit in the processing unit. Here the processing unit is nothing but a
laptop board Along with code scripts of the implemented modules.

Step 4: Face detection

In face detection process haar cascade algorithms are used for face detection.

9 First capture face image by using webcam then resize the image.
10 Haar-like features are digital image features used in object detection.

Dept. Of TCE ,Dr.AIT Page 37


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

11 Initially, the algorithm needs a lot of positive images (images of faces) and negative
images (images without faces) to train the classifier. Then we need to extract features
from it. In this face detection process, captured colour face image is converted into black
and white image i.e. gray scale image. It reduce the number of pixel for simplification of
detection. Then selection of ROI take place i.e. face detection process is done.

Step 5: Create Data base of Authorized Person

In Face detection process first create database of authorized person. The captured face of
current poses creates a data base of the authorized person and stores this. At the next time
camera module will capture the current live face of the person. All this process is done in
laptop module. Create our own database. The images stored in a folder, storing database
images and store it as a train faces in the test 1 folder.

Step 6: Face Recognition

The most important step of our dissertation is face recognition. In Face recognition process
LBPH algorithms are used.

12 The image is divided into small connected regions called cells, and for the pixels within
each cell, a histogram of gradient directions is compiled.
13 For improved accuracy, the local histograms can be normalized by calculating a measure
of the intensity across a larger region of the image, called a block, and then using this
value to normalize all cells within the block.
14 The final step in object recognition using Local binary pattern(LBP) algorithm.

Step 7: Output

When captured face match with database face image i.e. face recognized successfully. When
person are absent then send absent message to person.

CHAPTER 10

Dept. Of TCE ,Dr.AIT Page 38


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

FLOWCHARTS

10.1. Basic Structure

Fig:10.1.Basic Structure

10.2 System Requirements

 Develop a system in which we can maintain and record the attendance of


students in a lecture.
 The attendance is recorded only after the lecture instructs the software to do
so.

Dept. Of TCE ,Dr.AIT Page 39


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

 The faculty instructs the system twice; at the beginning and at the end.
 System should be smart enough to make sure that the student remains in the
lecture for the entire session.

 The system should work as a survelliance system as well.


 The entire report of the attendance of each lecture should be reverted back to
the attendance database.

Fig:10.2. System Requirements

Dept. Of TCE ,Dr.AIT Page 40


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

CHAPTER 11

PROGRAMMING CODE IMPLEMENTATION

11.1 Code for Datasets

# Import OpenCV2 for image processing


import cv2
import time
# Start capturing video
vid_cam = cv2.VideoCapture(0)

# Detect object in video stream using Haarcascade Frontal Face


face_detector = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

# For each person, one face id


face_id = 4 # for multiple person different ids

# Initialize sample face image


count = 0

# Start looping
while(True):

# Capture video frame


_, image_frame = vid_cam.read()

# Convert frame to grayscale


gray = cv2.cvtColor(image_frame, cv2.COLOR_BGR2GRAY)

Dept. Of TCE ,Dr.AIT Page 41


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

# Detect frames of different sizes, list of faces rectangles


faces = face_detector.detectMultiScale(gray, 1.3, 5)

# Loops for each faces


for (x,y,w,h) in faces:

# Crop the image frame into rectangle


cv2.rectangle(image_frame, (x,y), (x+w,y+h), (255,0,0), 2)

# Increment sample face image


count += 1

# Save the captured image into the datasets folder


cv2.imwrite("dataset/User." + str(face_id) + '.' + str(count) + ".jpg", gray[y:y+h,x:x+w])

# Display the video frame, with bounded rectangle on the person's face
cv2.imshow('Frame', image_frame)

# To stop taking video, press 'q' for at least 100ms


if cv2.waitKey(100) & 0xFF == ord('q'):
break

# If image taken reach 100, stop taking video


elif count>300:
break

# Stop video
vid_cam.release()

# Close all started windows


cv2.destroyAllWindows()

Dept. Of TCE ,Dr.AIT Page 42


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

11.2 Code for Face Recognition:

# Import OpenCV2 for image processing


import cv2

# Import numpy for matrices calculations


import numpy as np
import time
import datetime

# Create Local Binary Patterns Histograms for face recognization


#recognizer = cv2.face.createLBPHFaceRecognizer()
recognizer = cv2.face.LBPHFaceRecognizer_create()

# Load the trained mode


recognizer.read('trainer/trainer.yml')

# Load prebuilt model for Frontal Face


cascadePath = "haarcascade_frontalface_default.xml"

# Create classifier from prebuilt model


faceCascade = cv2.CascadeClassifier(cascadePath);

# Set the font style


font = cv2.FONT_HERSHEY_SIMPLEX

# Initialize and start the video frame capture


cam = cv2.VideoCapture(0)

f=open("Database.txt", 'a')
f.write("\nDATE \t TIME \t \t \t TEACHER NAME \t \t STUDENT NAME\n ")

Dept. Of TCE ,Dr.AIT Page 43


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

print('Executing the script')


f.close()

# Local variable Declaration


lecture=0
count1=0
count2=0
count3=0
count4=0
count5=0
sample=0
take=1
# Loop
while True:
now = datetime.datetime.now()

# Read the video frame


ret, im =cam.read()

# Convert the captured frame into grayscale


gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)

# Get all face from the video frame


faces = faceCascade.detectMultiScale(gray, 1.2,5)

# For each face in faces


for(x,y,w,h) in faces:

# Create rectangle around the face


cv2.rectangle(im, (x-20,y-20), (x+w+20,y+h+20), (0,255,0), 4)

Dept. Of TCE ,Dr.AIT Page 44


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

# Recognize the face belongs to which ID


Id,i= recognizer.predict(gray[y:y+h,x:x+w])

print(i)
print(Id)

if i < 65:
sample=sample+1
# Check the ID if exist
if(Id == 1 and take ):
take =0
count1=1
Id = "chetan"
print('Take Attendance ')
lecture=1
##
sample =0
time.sleep(20)
#If not exist, then it is Unknown
elif(Id == 2):
count4=1
Id = "ayaz"
Id1=Id
elif(Id == 3):
count3=1
Id = "krishna"
Id2=Id
elif(Id == 4):
count5=1
Id = "manoj"
Id3=Id
else:

Dept. Of TCE ,Dr.AIT Page 45


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

print(Id)
Id = "Unknown"

# Put text describe who is in the picture


cv2.rectangle(im, (x-22,y-90), (x+w+22, y-22), (0,255,0), -1)
cv2.putText(im, str(Id), (x,y-40), font, 2, (255,255,255), 3)

# Display the video frame with the bounded rectangle


cv2.imshow('im',im)

# If 'q' is pressed, close program


if cv2.waitKey(10) & 0xFF == ord('q'):
break
if lecture == 1 or lecture == 2 or lecture == 3:

if sample > 50:


sample =0

f=open("Database.txt", 'a')
if lecture == 1 and count4 == 1 :
f.write(str(now)+'\t'+"chetan"+'\t' +str(count4)+'\t'+str(Id)+'\n')
if lecture == 1 and count3 == 1 :
f.write(str(now)+'\t'+"chetan"+'\t' +str(count3)+'\t'+str(Id2)+'\n')

# #if lecture == 1 and count1 == 1 :


## f.write(str(now)+'\t'+"chetan"+'\t' +str(count1)+'\t'+str(Id)+'\n')
f.close()
break
# Stop the camera
cam.release()

Dept. Of TCE ,Dr.AIT Page 46


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

# Close all windows


cv2.destroyAllWindows()

Fig 11: Programming code implimentation

Dept. Of TCE ,Dr.AIT Page 47


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

CHAPTER 12

RESULT

Five basic face recognition techniques are compared for different algorithms based on
recognition rates (percentage) and elapsed time is shown in table 12.1. The common training
data set and test data set is used for comparison in all four used techniques. In this work,
basically the comparison of various algorithms as stated above i. e; PCA, KPCA, LDA , LEM
and LBP is done on the basis of recognition time used in face recognition procedure.

Table No 12.1 Comparison of various methods on the basis of recognition rate and
recognition time:

Table 12.1

After executing all the step of implementation as discussed above we get following results as
shown in figures given below:
Dept. Of TCE ,Dr.AIT Page 48
SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

12.1 Database generation

In our project the main task is to create a database of students enrolled in a class and then to
compare these images with the live captured images. These captured images help in
identifying the known or unknown person. The face images get stored in a default folder.

Fig 12.1. Creating datasets

12.2 Face detection of enrolled student

Now live captured image is taken as a test face shown in figure 5.2 to identify whether the
student is enrolled or not.

Dept. Of TCE ,Dr.AIT Page 49


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

Fig 12.2 Face detection after entering a class

Fig 12.2 shows that captured imaged is detected and it is available in the database and hence
face is indicated by blue coloured rectangle and also shows name of the known person,
therefore attendance of present student is automatically marked.

12.3 face detection of unknown student

Figure.12..3 shows that the captured image is of unknown person. Because we have created
an enrolled students database in the system and this captured image is unknown to the system
after comparing with the database and hence indicated by unknown. Hence attendance can not
be marked.

12.4 Message to the HOD/Gaurdian.

Dept. Of TCE ,Dr.AIT Page 50


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

Fig 12.4 Message to the HOD/Gaurdian

12.5. Attendance Sheet

After completion of the lecture, attendance sheet is generated and stored in default folder.

This attendance sheet consists of name of student, roll number, date and time.

CHAPTER 13

Dept. Of TCE ,Dr.AIT Page 51


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

ADVANTAGES AND DISADVANTAGES

13.1. ADVANTAGES

• Proxy attendance is eliminated

• It saves there time and efforts.

• It stores the faces that are detected and automatically marks attendance.

• The system is convenient and secure for the user.

13.2. DISADVANTAGES

 It can only detect face from a limited distance with some specific angle

 The system don’t recognized properly in poor light so may give false results.

 Twins face recognition.

CHAPTER 14

APPLICATIONS

Dept. Of TCE ,Dr.AIT Page 52


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

14.1. APPLICATIONS

 Computer Human Interaction.

 Face ID cards.

 Safety and secure.

 Audio-visual observation.

CHAPTER 15

Dept. Of TCE ,Dr.AIT Page 53


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

CONCLUSION, SCOPE AND FUTURE WORK

15.1. CONCLUSION

Student Management System is very useful in an institution or in college or in


universities. There is no paper work in this proposed system. Supervision can be done
from anywhere. This project especially minimizes human effort necessary. This
application is handled by the college so there is no information leak and data will be
secured. Since it is a web based application anyone can use the system anywhere at any
time and it is very easy to get the necessary information without the latency. It is very
useful to the students to get their report on attendance and internal assessments. Parents
also get benefited more since college is going to send the notification of the student via
the SMS or email will be sent to get the recent activities happen in the college. Since this
application will be handled by the college whenever they need any changes in an
application they can make it without the upfront investment, and the system will be
more secure when it is handled by the own college.

15.2. SCOPE & FUTURE WORK

The same project can be utilized for several security applications where authentication is
needed to access the privileges of the respective system. It can be used in recognizing guilty
parties involving in unauthorized business. Face recognition algorithm can be improved with
respect to the utilization of resources so that the project can recognize more number of faces
at a time which can make the system far better. Many variants of the project can be developed
and utilized for home security and personal or organizational benefits. We can also trace a
particular student in an organization quickly with the help of this system.The speed of RAM
can improve. More features can be extracted or hybrid feature method can be used for face
recognition. Database management languages can be used for online availability of attendance
Dept. Of TCE ,Dr.AIT Page 54
SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

record which can be accessed by parents and students individually. Mobile application
software can be developed for easy assessment of records. Multi- cameras can be used so that
efficiency can be increased.

REFERENCES

Dept. Of TCE ,Dr.AIT Page 55


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

[1] M. Molina Shamanth G S ashwin Kashyap ,face detection using Raspberry pi and python,
.NCPD, 2016 July 2016.

[2] S. C. Gaddam, N. V. K. Ramesh and Hema Dsn International Journal of Scientific


Research in Science and Technology (www.ijsrst.com)

[3] hanekula,‟‟ Face Recognition Based Attendance Management System with Raspberry PI
2 using Eigen Faces Algorithm, ‟‟ARPN journal vol -11, NO.13, july 2016.

[4] Raspberry Pi Face Recognition Treasure Box Created by Tony Di Cola.

[5] MedakTeenaRavali, Prof. RangasaiKomaragiri “Image Processing Platform On Raspberry


Pi For Face Recognition” Global Journal of Advanced Technologies, ISSN 2277- 6370 Vol3,
Issue4- 2014.

[6] R.Pahune ,A.A.Chaudhuri,”Face Detection System for Security Purpose Using Raspberry
PI,”ICEIS-2016.

[7] Richard Mo Adnan Shaout, ‟‟Portable Facial Recognition Jukebox using Fisher Faces,
‟‟IJACSA Vol.7, No.3, 2016.

[8] Subhanishaik, Antomicheal,‟‟Automatic Age and Gender Recognition in Human face


Image Data Set Using Convolutional Neural Network System,‟‟IJARCSMS Vol 4, issue 2,
Feb 2016 .ISSN:2321-7782.

[9] Danwei, ‟‟Distributed Compressive Sensing Based Near Infrared and Visible Images
Fusion for Face Recognition,‟‟ IJSP, IPPR vol.9, No.4 (2016), pp.281-292.

[10] Unsoojang and Eui Chul lee, ‟‟Performance Analysis of Pixel Based Face Recognition
Method, ‟‟IJBSBT Vol.8, No. 2(2016), PP.197-206.

[11] Li yongqiang and panjin, „„one sample image Recognition algorithm based on improved
sub- pattern principle component analysis, ‟‟IJSP,IPPR vol.8,NO.9(2015),PP.77-84.

[12] Maryam Moghaddam, Saeed Meshgini,”Automatic face Recognition via Local


Directional Patterns,” journal of Artificial Intelligence in Electrical Engineering, vol.4,
NO.15, DEC 2015.

Dept. Of TCE ,Dr.AIT Page 56


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

[13] Navin Prakash, Dr. Y. singh, ‟‟Support vector Machines for Face Recognition ‟‟IRJET
Vol: 02 issue: 08|Nov-2015.

[14] JunLee, Jeong-Sik Park, Gil-Jin Jang and Yong- Hoseo,‟‟ Efficient Head Pose
Determination and its Application to face Recognition on Multi-Pose face DB,‟‟IJMUE
Vol.11.No2 (2016).

[15] G. Senthilkumar, K. Gopalakrishnan, V.S.Kumar,‟‟ Embedded Image Capturing System


Using Raspberry PI System,‟‟ IJETTCS Volume 3, Issue 2, March-April 2014.

[16] Gheorghita Ghinea ,Rajkumar Kannan and Suresh Kannaiyan, ”Gradient orientation-
based PCA Subspace for Novel Face Recognition ”in IEEE Access, Vol 2,2169-3536 2014.

[17] Mounika B.R Reddy N. Jand Reddy V.B.D,‟‟A Neural Network Based Face Detection
Using Gabor Filter Response, ‟‟IJNN ISSN:2249 -2763 &ESSN: 2249-2771, volume 2 ,Issue
1, 2012 ,PP.- 06-09.

[18] Tudor Barbu,‟‟Gabor Filter –Based Face Recognition Technique, ‟‟Processing of the
Domain Academy, Series A, Vol 11, No 31 2010,PP.277-283.

[19] H.R.Kanan and K.Faez,‟‟Adaptively Weighted Sub –Gabor Array for Single Model –
based human face Recognition‟‟. IJECE DEC 2010.

[20] P. Shih and, C. Liu, ‟‟Face Detection using Discriminating Feature Analysis and Support
Vector Machine, ‟‟.Pattern Recognition Vol.39.

[21] S.K.Nabeena. N. V. Narayana Rao,‟‟ Implementation of Video Surveillance Using


Raspberry PI 2,‟‟ IJMETMR ISSN No:2348-4845.

[22] Sumo .M.O, Rashmi .H.N, S.B.Seshadri.‟‟ Stand Alone Face Recognition System Using
Principle Component Analysis,‟‟ IJETCAS.

[23] Viola, P., & Jones, M. (2001). Rapid object detection using a boosted cascade of simple
features. In Computer Vision and Pattern Recognition, 2001. CVPR 2001. Proceedings of the
2001 IEEE Computer Society Conference on (Vol. 1, pp. I-511). IEEE.

Dept. Of TCE ,Dr.AIT Page 57


SMART ATTENDANCE SYSTEM USING IMAGE PROCESSING 2018-19

[24] Rohit, C., Baburao, P., Vinayak, F., &Sankalp, S. (2015). Attendance management
system using face recognition. International Journal for Innovative Research in Science and
Technology, 1(11), 55-58.

[25] NirmalyaKar, MrinalKantiDebbarma, AshimSaha, and DwijenRudra Pal,


“Implementation of Automated Attendance System using Face Recognition”, International
Journal of Computer and Communication Engineering, Vol. 1, No. 2, July 2012.

[26] BenfanoSoewito, Ford Lumban Gaol,” Attendance System on Android Smartphone”,


2015 International Conference on Control, Electronics, Renewable Energy and
Communications (ICCEREC).

[27] AparnaBehara, M.V.Raghunadh, “Real Time Face Recognition System for time and
attendance applications”, International Journal of Electrical, Electronic and Data
Communication, ISSN 2320-2084, Volume-1, Issue-4.

[28] KAWAGUCHI, Y., SHOJI, T., Weijane, L. I. N., KAKUSHO, K., & MINOH, M.
(2005). Face recognition-based lecture attendance system. In the 3rd AEARU Workshop on
Network Education (pp. 70-75).

Dept. Of TCE ,Dr.AIT Page 58

Вам также может понравиться