Face Recognition Based Intelligent Door Control System

This paper presents the intelligent door control system based on face detection and recognition. This system can avoid the need to control by persons with the use of keys, security cards, password or pattern to open the door. The main objective is to develop a simple and fast recognition system for personal identification and face recognition to provide the security system. Face is a complex multidimensional structure and needs good computing techniques for recognition. The system is composed of two main parts: face recognition and automatic door access control. It needs to detect the face before recognizing the face of the person. In face detection step, Viola Jones face detection algorithm is applied to detect the human face. Face recognition is implemented by using the Principal Component Analysis (PCA) and Neural Network. Image processing toolbox which is in MATLAB 2013a is used for the recognition process in this research. The PIC microcontroller is used to automatic door access control system by programming MikroC language. The door is opened automatically for the known person according to the result of verification in the MATLAB. On the other hand, the door remains closed for the unknown person.


INTRODUCTION
Nowadays, automatic personal identification in access control has become popular by using biometrics data instead of using fingerprint, pattern, signature etc, because the target objects have to touch with the required hardware in the stage of data collection. The advantage of this system is that face recognition does not require to be touched with any hardware. When a person stands at a certain distance from the camera, face is detected by using face detection technique and face recognition is completed without touching any hardware. These systems can be used for crime prevention, person verification, and similar security activities.
In this system, the first portion is the face recognition system and the second one is the intelligent door access control system. MATLAB software installed on PC is used to implement face recognition system. The USB to RS232 serial converter is used as the interface between the PC and PIC16F887 microcontroller. The process of lighting and alarm system are mainly works with an algorithm which is loaded in microcontroller and on the basis of serial port data which is sent by PC after verifying the face by MATLAB s. The overall block diagram of this system is shown in Figure 1

FACE DETECTION AND RECOGNITION
Face recognition is implemented by using MATLAB installed on Personal Computer (PC). In this system, firstly connect webcam with MatLab to capture photos and save in the database for training and testing images. In real time, the image of human in front of the door with a certain distance is acquired through web cam. Firstly, the image data acquisition is performed and detected the facial part of the image by using Viola Jones algorithm. The detected facial part is cropped and resized to the same size to all images for both training and testing processes. The facial features are extracted from the detected human face using Neural Network. PCA method is used to match the features of trained image and test image for face classification or recognition [1]. The block diagram of face recognition system is described in Figure 2. The door control system starts after recognition process in this research.  Figure 3.
The integral image can be computed from an image by using a few operations per pixel. The integral image at location x, y contains the sum of the pixels above and to the left of x, y. It can be calculated by the following equation, where, ii(x ,y) is the integral image and i(x ,y) is the original image [3].
The sum of the pixels within rectangle D can be calculated with four array references. The value of the integral image at location 1 is the sum of the pixels in rectangle A. The value at location 2 results in A + B, at location 3 is A + C, and at location 4 is A + B + C + D. The sum within D can be achieved as 4 + 1 -(2 + 3).

Figure3. Six Types of Haar-like Rectangle Features [3]
The second part is a method for constructing a classifier by selecting a small number of important features using AdaBoost learning algorithm. Within any image sub-window the total number of Harr-like features is very large, far larger than the number of pixels. In Adaboost, although the weak learner is nothing, it is a feature selector. By combining a collection of weak classification functions, a stronger classifier can be formed [5]. A weak classifier h(x) contains a feature f, a thresholdθ, and a parity p indicating the direction of inequality sign: In the third part more complex classifiers are combined in a cascade structure, increasing the speed of the detector by moving the most complex processing on promising regions of the image. By combination of cascaded classifiers, most of true negatives are rejected very fast at the first few stages. The cascade combination classifier is shown in Figure 4. High detection rate and low false positive rate can be kept in this system.

Neural Network
A Neural Network is an interconnected group of biological neurons. In modern usage, the term can also refer to artificial neural networks, which are constituted of artificial neurons. A Neural Network is an immensely parallel distributed processor that has a natural propensity for storing experiential knowledge and making it available for use. It looks like the brain. It performs in two respects: knowledge is attained by the network through a learning process and the knowledge is stored by using interneuron connection strengths known as synaptic weights.
Neural Networks are made of input units, output units and hidden units called nodes. There is a threshold in each node. If this threshold is reached, the node will "fire", that means that all its connections will get activated. There is also strength in each connection. The strength is represented by a weight. A node adds up the weights of the its connections to determine its response and then compares it to its threshold [7]. Neural Network models in artificial intelligence are usually referred to as Artificial Neural Networks (ANNs).

PCA Feature Extraction
There are two main steps in PCA: Initialization process and Recognition process. The Initialization process involves face image acquisition, the Eigenfaces calculation, and calculation of distribution of training face space [6]. Firstly, it acquires the initial set of face images called as training set. Then, it calculates the Eigenfaces from the training set by keeping only the highest Eigen values. These M images define the face space. The Eigenfaces can be updated or recalculated because the new faces are experienced. And then, distribution is calculated in this training face space for each known person by projecting face images onto this face-space. Recognition process involves the following operation. A set of weights can be calculated based on the input image and the M Eigenfaces by projecting the input image onto each of the Eigenfaces. The result is determined if the image is a face at all (known or unknown) by checking that the image is sufficiently close to a "free space". If it is a face, then it classifies the calculated eigenface as either a known person or an unknown person [8].

Classification or Recognition
Classification is the finding the minimum distance between the training image and the test images. The face with minimum Euclidian distance shows the similarity to test image. Euclidean distance is the distance of test image Ω to each training image and it is defined by, By choosing a threshold value that is the maximum acceptable value for known images and comparing it with the minimum Euclidian distance ઽk, test image can be recognized as known or unknown face image.
If ઽk (min) ≥ , the test image is recognized an unknown face. If ઽk (min) < , the test image is a known face [2].

PIC 16F887 Microcontroller
This system used PIC 16F887 microcontroller because of its good features and integrated peripherals. The microcontroller is used to receive the signal sent from PC and to send a command back either to the door motor circuit or to the alarm circuit. The PIC 16F887 microcontroller which is utilized in this door control system is depicted in Figure 5.

USB to RS232 Converter
This converter is used to interface the personal computer and PIC microcontroller. It adjusts the voltage between the personal computer and microcontroller. The USB to RS232 serial converter is illustrated in Figure 6.

RS232 to TTL Serial Port Converter Module DB9
Connector The RS232 serial port to TTL converter module is a board with the MAX3232 transceiver integrated circuit (IC), which facilitates serial communication between TTL and RS232 ports by providing the necessary electrical signal conversion. It is necessary to place in between USB to RS232 serial converter and PC. The RS232 to TTL serial module is described in Figure 7.

IMPLEMENTATION
The implementation of face detection and face recognition system is using by MATLAB 2013a for coding. To build the database, take photos for 10 persons, 10 different facial images of each person were taken by using external webcam. In the database folder, 70 different facial photos of ten persons are used as the training images and 30 for testing images.

Implementation of Face Detection and Recognition
While making the database folder, the captured images are applied with 640x480 resolutions and RGB color (red, green, blue).
All the detected face are resized into 238x268 images by using imresize MATLAB built-in function and save in the train folder for training images. For instance, nine training images of three person with different facial images are shown in Figure 8. The eigenvectors corresponding to the covariance matrix or so-called the "Eigenfaces" which look like ghostly faces.
ome Eigenfaces of the training images are described in Figure 10. The trained and test images are projected onto the facespace where the Eigenfaces are the coordinates or dimensions to find their respective Euclidian distance. By comparing the Euclidian distance of all projected trained images with the projected test image, minimum distance between them which shows similarity to test image is obtained. By this way, the facial image recognition was done.

Implementation of Door Control System Based on Face Recognition
There are two parts in this system. The first is the implementation of face detection and recognition system. The entire face detection and recognition system is accomplished by using Matlab. And the second is MikroC program implementation for door control system.
The hardware implementation of this system is composed of PIC 16F887 microcontroller, USB to RS232 converter, LEDs, buzzer and DC motor. USB to RS232 converter is used as the interface between personal computer and the microcontroller.
It is necessary to select port number which is used in controller and connect the available baud rate between the MATLAB and microcontroller control device (PIC) via USB cable to RS232 serial converter. In order to adjust the voltage level between PC and the microcontroller, the converter of USB to RS232 is used. It needs to install the driver on PC that converts the USB connection into a Virtual Communications Port, which makes the USB connection that looks like a serial port on the PC.
In microcontroller process, the command from Matlab to identify the detected person is vital. When the detected person's face is 'Known' face which included in database, the microcontroller starts to run DC motor to open the door and the room lighting process performs one by one opening. After the delay times, the DC motor rotated in reverse direction. When the face is not included in database, the buzzer is ringing to alarm the unidentified face detection. If the entire person who wants to go out from the room will need to press the Exit button in GUI, the door is opened again with the delay times. The Flow Chart of Microcontroller Process is shown in Figure 11.

TESTS AND RESULTS
In classification, to determine known or unknown person the detected face from the face detection step by using PCA method and neural network. Face is recognized as known image by comparing the images present in the training database.
The graphical user interface (GUI) is implemented to perform the face recognition process and to connect the microcontroller. The detection the face of applying the test image to the GUI is shown in Figure 12 The detected area is cropped as shown in Figure 13.

Figure13. Cropped Image of Detected Area
The features of the cropped and resized image are extracted to distinguish the different people. The extracted image is shown in Figure 14.

Figure14. Extracted Image By Using Eigen Face
If the test image is known person, Matlab sends a signal to the microcontroller. According to the input signal, microcontroller sends a command to the door's motor driver to drive the door motor for opening the door during the delay 3 second. When the person entered into the room, the lighting processes are operated automatically. The door open condition for known person is shown in Figure 15 and Figure 16. If the face of the person is hidden by something or unidentified facial condition, he or she cannot pass through the door. Although that person wants to enter the door in this condition, the door opening operation is not performed and the alarm is operated. The result of this condition is illustrated in Figure 17.

Figure17. Door Closing and Alarm Ringing Condition Test for No Face Detection
The person whose face is not included in the training database, the door cannot open in this contidion. The result shows 'Unknown' and the buzzer is alarming. Figure 18 shows the testing of door closing and alarm ringing contidion for unknown person.

Figure18. Testing The Door Closing and Alarm Ringing Condition for Unknown Person
When the person who want to exit, she need to press the 'Exit'. If the 'Exit' is pressed in GUI, the door will open during delay times. After that, the door is closed and lighting system is still opened. Therefore, the light off button must be clicked before exiting the system operation. Figure 19 shows exiting condition of the room control system from Matlab GUI.
Figure19. Exiting Condition of The Room Control System from Matlab GUI