Development of a secured room access system based on face recognition using Raspberry Pi and Android based smartphone

. Security issues are an important part of everyday life. A vital link in security chain is the identification of users who will enter the room. This paper describes the prototype of a secured room access control system based on face recognition. The system comprises a webcam to detect faces and a solenoid door lock for accessing the room. Every user detected by the webcam will be checked for compatibility with the database in the system. If the user has access rights then the solenoid door lock will open and the user can enter the room. Otherwise, the data will be sent to the master user via Android-based smartphone that installed certain applications. If the user is recognized by the master user, then the solenoid door lock will be opened through the signal sent from the smartphone. However, if the user is not recognized, then the buzzer will alert. The main control circuit on this system is Raspberry pi. The software used is OpenCV Library which is useful to display and process the image produced by webcam. In this paper, we employ Haar Cascade Classifier in an image processing of user face to render the face detection with high accuracy.


Introduction
The security aspect is needed in many areas of life today.The privacy factor also influences the importance of a security system.Advances in electronics technology helped to develop a reliable security system.A vital link in security chain is the identification of users who will enter the room.This paper describes the prototype of a secured room access control system based on face recognition.Face recognition has been one of the hot fields in computer vision and biometrics, since it is a challengeable work to identify a face image with varying expression, occlusion, disguise, and illumination [1].Along with fingerprint match and eye retina match, they become a prominent method in biometric technology [2].
The task of face recognition is to compare a query face against multiple faces in the database in order to identify whether it belongs to a person in a database [3].In some identification applications, one needs to find the most similar face.In a more advanced applications, the requirement is not only finding the most similar faces, but also the data associated with detected person as well as the notification system in terms of showing a suspicious person.In the face recognition systems, the facial detection is an initial step to capture an image of the user to be processed.The facial detection usually uses a light proximity sensor that consists of photodiode components.However, these sensors can only detect faces horizontally to the line.For a wider view of the face image, the use of webcam can provide more capability than the proximity sensor.The proposed system employs the webcam to capture the facial image.Then, the image will be processed further by a certain algorithm to get the best results.In the security systems, that image will be compared to the user database in the system.If the user entered the room is recognized by the system, then the door lock will switch off the door and the user can enter the room.Otherwise, the door lock stays close unless the master user makes a decision to switch on the door lock due to a certain condition.Such mechanism was made to assure that only authorized user can access the room to improve the security aspect.
The proposed system employs Raspberry Pi as the main control unit and OpenCV as an open source library for processing the image produced by webcam.Raspberry Pi is a powerful credit-card sized single board computer that can be used for many applications due to functionality, small size, and its extension to support internet-of-things based systems.Pal et al. [4] employed Raspberry Pi to control a conformal beam-steering antenna for optimizing the throughput in a scattered and a poor Signal to Noise Ratio (SNR) environment.Filho et al. [5] utilized Raspberry Pi to realize the NPi-Cluster, a low-power consumption cluster architecture with energy proportionality, capable of automatically scaling the number of running machines according to the current processing demand.Pasolini et al. [6] developed a Raspberry Pi-based platform for signal processing education.In face recognition, Gupta et al. [7] explored a feasibility of implementing Raspberry Pi based face recognition system using conventional face detection and recognition techniques.The latter is in line with the proposed system described in our paper.
While OpenCV is a library of programming functions mainly aimed at real-time computer vision [8].Initially developed by Intel, recently it becomes a platform library in image processing as it can be customized by the user.Some related works regarding the OpenCV application in image processing include Green [9], Shen et al. [10], Sharma and Shah [11], Mustafa and Khairul [12], and Emami and Suciu [13], for name a few.Green [9] enriched library in OpenCV to implement the median filtering for noise removal in images.Shen et al. [10] benchmarked the face recognition algorithm in OpenCV in order to realize the sparse representation classification for rendering face recognition accurately and efficiently on smartphones.Sharma and Shah [11] employed OpenCV library to implement a simple and a low-cost approach for automatic animal detection on highways for preventing animal-vehicle collision.Mustafa and Khairul [12] installed the OpenCV library into Raspberry Pi to identify color and size for accurate mature classification of fruits.While, Emami and Suciu [13] described facial recognition in OpenCV which uses a type of face detector called a Haar cascade classifier.
The rest of the paper is structured as follows.Section 2 describes a framework of the proposed system includes block diagram, flowchart, and schematic diagram respectively.Experimental results and discussion are given in Section 3. Finally, some concluding remarks and further recommendation for future research are summarized in Section 4.

System framework
A framework of a secured room access system is depicted in Fig. 1.When the user of the room wants to enter the room, webcam installed on the door of the room will take the user's face of the room.If the face is recognized, then Raspberry Pi will give the command via relay to open the solenoid door lock attached to the door of the room.However, if the face is not recognized, then the main controller will give the command to buzzer and make a notification and send the image of the face to Telegram installed on an android based smartphone.Telegram is a cloud-based mobile and desktop messaging application with a certain performance especially on security, speed, and connectedness to another interface.This application is very popular to enhance the communication between persons and recently between human and machine.If the face which sent to Telegram can be recognized by the master user of the room, then the door will open after the master user sent the command signal into the solenoid door lock.Once the room user enters, the solenoid door lock will automatically close the door again.
While, a flowchart adopted in the proposed system is shown in Fig. 2. As shown in Fig. 2, user identification that will enter the room comprises two steps.If user is confirmed as authorized user, then solenoid door lock will switch on to let the user enters the room.Conversely, if someone is not confirmed as authorized user then buzzer will alert.It might happen for authorized user due to lack of recognition by system in terms of incompleteness of facial detection, lesser intensity of light, and so forth.To overcome such situation, face image will be sent to master user via Telegram.Further, master user will decide to switch on or off the door lock based on recognition to face image.If it is recognized, then master user sends a signal to switch the buzzer off as well as open the door lock.Otherwise, buzzer remains alert for a while and the door lock stays in its initial state.Schematic diagram of the proposed system is illustrated in Fig. 3.It comprises webcam, Raspberry Pi, solenoid door lock, and a smartphone installed Telegram application.A webcam is usually a video camera that can be used to capture, feed, and stream an image of the user entered the room.The captured facial image will be sent to Raspberry Pi to be compared with the facial image stored in the database.Raspberry Pi proceeds the facial data using algorithms that have been compiled in the OpenCV library.Facial detection method in OpenCV based on Haar cascade classifier proposed by Viola and Jones [14].This approach extracts the image based on the features instead of pixels by pixels so that the image processing is very efficient and achieves the high detection rate.To implement the face recognition using OpenCV library installed in Raspberry Pi, the initial step is to collect and record all the image of user into a database.In this step, we capture 15 images and denote the identity of respective image.We use an editor what so called Geany Programmer's Editor to connect the recorded image with Raspberry Pi.This step is shown in Fig 4.  For each user who stored in the database, we take 15 facial images respectively.Those images represent the facial expression, light condition around circumstance, larger part of facial, and so forth.Each image which related with the same user is stored in the database.It is also given an identity that will appear on the monitor along with the image.
Based on the flowchart depicted in Fig. 2, if the captured image which processed further by Raspberry Pi is conformed to the authorized user that is suitable within the database, then solenoid door lock will open the door.Otherwise, the captured image will be sent to the smartphone and verified by the master user via Telegram.Telegram is a cloud-based instant messaging and voice over IP service developed by the Russian entrepreneur Pavel Durov which has many advantages compared to other messenger services [15].Nowadays, many applications have been developed to gain the advantages of Telegram including a monitoring of hydroponic smart farming system [16], digital forensic analysis [17], internet-of-things based application [18], and so forth.Integration between Telegram and the other hardware such as Raspberry Pi is possible due to Telegram provides bots: an automatic answering account that can respond to specific text command by giving preformatted answer [15,19].

Results and discussion
In the experiments, we registered nine users as authorized user and their images are stored in the database.For respective users, we take 15 facial images with different pose and expression.The experiments are carried out by capturing the user with some conditions include normal, low light intensity, tilted face, and obstructed face.Normal condition means the face is straight to the camera so that the all parts of the face are captured by the camera clearly.At the second condition, the light intensity around user is less such that the image tends to be dark.Then, each user tilted their head around 15 degree to the Y-axis in the third pose.In last condition, an object was put in the front of user face and hence it causes the obstructed face.The authorized users include Arif, Jodi, Ahmad , Tiara, Tedi, Ninin, Ibu, Teh Nisa, and Teh Neng respectively.The experimental results are tabulated in Table 1-Table 4. Table 1 shows the result of face recognition by the proposed system for normal condition.Due to clarity of the captured image, all authorized user are recognized by the proposed system as well as unauthorized user.Identity of the user can be classified exactly as it is stored in the database.When the authorized user is detected, the solenoid door lock will open.Such condition is displayed in Fig. 6.The results of second experiment are listed in Table 2.In this experiment, light intensity around the user is less.The captured images are darker than normal condition.In such cases, classifier in OpenCV is able to classify and recognize some the captured image.However, there is some false identification of the user.It could happen due to features of some captured image is no longer suitable with the related database.To alleviate the effect of illumination variation on face recognition, we could adopt a method of directional illumination estimation to extract directional illumination invariant sets from a facial image as proposed by Cheng et al. [20].In that approach, the directional illumination invariant sets not only better preserve essential features of the face, but also largely reduce adverse effects of rapid light changes.

Fig. 4 .
Fig. 4. Main view of Geany Programmer's Editor.After compilation of previous step, we could get the result as shown in Fig 5.

Fig. 5 .
Fig. 5. Captured image that was recorded and connected to Raspberry Pi.

Table 1 .
The face recognition for normal condition.

Table 2 .
The face recognition for lesser light intensity.