**Library Reservation System Using Face detection**

Nik Ruslawati Nik Mustapa<sup>1</sup>\*, Nur Athikah Fatehah Binti Rosli<sup>2</sup>

<sup>1,2</sup> *Faculty of Computer and Mathematic Science,*

*University Teknologi Mara, Tapah Campus, Perak Branch, 35400 Tapah Road, Perak, Malaysia*

Corresponding author: \* <nrnm@uitm.edu.my>

Received Date: \*date

Accepted Date: \*date

Published Date: \*date

**HIGHLIGHTS**

  - The new era of Covid-19 has changed our everyday life.

  - Covid 19 caused a change in the room booking process at the library.

  - The system helps users make reservations more effectively by using face recognition

ABSTRACT

*Today, Covid-19 has completely changed our way of life. The new generation has made people stay at home, instead of going on vacation. The users are not allowed in a close place, especially in a building or room. The library that used to be packed with people reading books, studying, and using the computer is now becoming empty. The room in the library has been limited only to a certain number of people to prevent any dangerous situation regarding the Covid-19 virus to spread. The room needs to be reserved beforehand for the user to use. This situation has become a problem for users as the user’s desired room may be occupied by other users. Thus, Reservation System using face recognition for the library was developed to overcome this situation. In this paper, the researcher will use the Haar Cascade Algorithm to scan the face and MySQL as a database to detect the room and time slot for a reservation. Phyton language and Visual Studio Code were used to develop the system. The limitation of this project is that the face registration took a long time for some users because of the lightning that makes it the system hard to recognize the face. The recommendations for future work are to use a high technology camera to scan the face and construct an admin page because the system does not have an admin page.*

*Keywords: Haar cascade Algorithm, reservation system, face recognition, library*

# INTRODUCTION 

Nowadays, because of Covid-19, people cannot go to the library often. This is because the library is a tight space, and it is not a suitable place for people to gather in one place. The room in the library also can’t be open to many people. Only a limited amount of people may enter. This issue has caused the number of people who have been using the library has become lesser. Another issue users are facing right now is that users who want access to the room at a specific time need to come much sooner to reserve the room sooner than other users. Most times, the earliest user will get the space, but the others will have to wait until the room is available (Atkinson & Lee, 2018). The difficulty in reserving the rooms causes inefficiency and is time-consuming for the user in a rush. For instance, booking rooms will require the user to go to the library.

It is inconvenience for the library to provide a room reservation system that includes a manual system. This is because, in many cases, libraries always lack librarians to provide the services.

Currently, manual system usage which is done by hand, without using technology has been decreases (Kumar et al., 2018). The traditional way of reserving a room can be quite hard for students since most of the students are busy. In addition, the students have assignments to do or other work that require them to spend more time on it. Besides, the usage of paper and pens also increases, due to a large number of papers and pens consumptions during reservation. Therefore, room reservation systems still using the manual system need to be banished, considering it is inconvenient for the students. The reservation system should be conveniently accessible for users while booking rooms (Atkinson & Lee, 2018). Hence, a reservation system that can see the rooms for the user to reserve needs to be developed. The users can easily reserve the rooms without going to the library.

Face recognition embraces a variety of services and applications, beginning from human identification and surveillance and coming as far as e-marketing and advertising for the interested customers (Evangelos, 2020). Face recognition is often utilized, within ubiquitous computing realms, that embrace livestream feeds from installed cameras, which deliver snapshots of human faces under noisy real-life conditions and varying lighting conditions and physical surroundings uncertainties (Evangelos, 2020).

# Thus, a reservation system using face recognition is recommended because of these issues. People can save time by reserving a room beforehand. The cost of paper and pen also can be decreased because of the reservation system. Image Processing is a method to convert an image into digital form and perform some operation to get an enhanced image or extract some helpful information. However, by using image processing, the user did not have exchange skin contact with each other. Therefore, this project aims to develop a reservation system using face recognition for the library. 

**LITERATURE REVIEW**

Image Processing is a method to convert an image into digital form and perform some operation on it, in order to get an enhanced image or to extract some useful information from it (Damodhar et al., 2016).

There is some technique for image processing such as Haar Cascade, Linear Discriminant Analysis and Principal Component Analysis (PCA). The Principal Component Analysis (PCA) uses the idea of representing a vector as a weighted sum of basis vectors. The number of dimensions is equal to number of pixels in the image. The set of training images form a cluster in the high dimensional space. The directions corresponding to maximum data variations are the eigenvectors of the covariance matrix for the cluster (Ebied, 2012). Recognition of images using Principal Component Analysis (PCA) takes three basic steps (Ye et al., 2009). The covariance matrix is first created using the training images. Next, the eigenvectors and corresponding eigenvalues are computed. Finally, the test images are identified by projecting these into the subspace and comparing them with the trained images in the subspace domain.

Linear Discriminant Analysis make use of fischer space method to achieve maximum discrimination of classes and to achieve dimensionality reduction. In LDA within class and between-class scatter matrices are defined (Sandeep Mishra, 2015). Linear Discriminant Analysis (LDA) has two phases which is training phase and classification phase. This algorithm is a widely used method for feature extraction and dimensionality reduction in pattern recognition. LDA tries to find the best project direction in which training samples belonging to different classes are best separated. In the training phase, the Fisherspace is established from the training samples using LDA and the training images are mapped to the fisherspace for classification. In the classification phase, an input image is projected to the same Fisherspace and classified by an appropriate classifier.

The other method is Haar Cascade that will be used in this project. Haar **C**ascade Algorithm is an object detection algorithm that used to identify faces in an image or a real time video. Patil (2021) explained that Haar cascade is an effective way of object detection. The language for the project was decided which is Programming Python Language, the database is OpenCV and MySQL Workbench and for the developer is Visual Studio Code. Python was selected for building the system because of its ease of learning and implementation. It is also the most popular language for implementing machine learning and data science (Patil, 2021). OpenCV, a robust library for computer vision, was used to implement the face detection and recognition algorithms. The study by researcher concludes that OpenCV proves to be more efficient and productive than dlib for face detection and recognition problems (Boyko, 2018; Patil, 2021). OpenCV provides Haar Cascades for face detection and Eigenfaces, Fisherfaces and LBPH algorithm for face recognition (Patil, 2021).

The algorithm is given a lot of positive images consisting of faces, and a lot of negative images not consisting of any face to train on them. The repository has the models stored in XML files and can be read with the OpenCV methods. These include models for face detection, eye detection, upper body and lower body detection and license plate detection. Figure1 shows the Haar features. Haar-like features are used and calculated extremely efficiently with integral images.

# ![](623a908364c97_media/media/image1.png)

# 

# 

# 

# 

# 

# 

# Figure 1: Haar features (Sources: https://towardsdatascience.com)

Haar cascades classifier provided by OpenCV are used. Haar features are used to detect faces. It uses Ada-boost learning algorithm. This pre-trained classifier has 6000+ features. Next, Adaboost Training trains the weak classifiers to create strong classifiers for the algorithm to detect the objects. Weak learners are created by moving a window over the input image, and computing Haar features for each subsection of the image. This difference is compared to a learned threshold that separates non-objects from objects. Because these are weak classifiers, many Haar features is needed for accuracy to form a strong classifier. Figure 2 shows the Adaboost.

# ![](623a908364c97_media/media/image3.jpeg)

# 

# 

# 

# 

# 

# 

**Figure 2**: Adaboost (Sources: http://www.medium.com)

# The last step combines these weak learners into a strong learner using cascading classifiers. The cascade classifier is made up of a series of stages, where each stage is a collection of weak learners. Weak learners are trained using boosting, which allows for a highly accurate classifier from the mean prediction of all weak learners. Based on this prediction, the classifier either decides to indicate an object was found (positive) or move on to the next region (negative). Stages are designed to reject negative samples as fast as possible, because most of the windows do not contain anything of interest. It’s important to maximize a low false negative rate, because classifying an object as a non-object will severely impair your object detection algorithm.

# SYSTEM IMPLEMENTATION 

1)  **Haar Cascade Algorithm**

Haar Cascade Algorithm is an algorithm that help detecting life images. In the library reservation system, the system will capture user’s face when they register their face. The system will capture the face until 100 milliseconds before save the image. The image will be using Haar Cascade classifier and save in the XML file which is haarcascade\_frontalface\_default.xml. The Figure 3 shows the coding using Haar Cascade Algorithm to save the captured image.

![Graphical user interface, text, application, email Description automatically generated](623a908364c97_media/media/image5.png)  
**Figure 3**: Coding to Train Image

The Haar Cascade file that save the trained images will be used to compare the face that being scan and the trained images. Figure 4 shows the Haar Cascade file that contain the trained images

![Text Description automatically generated with low confidence](623a908364c97_media/media/image6.png)

**Figure 4**: Haar Cascade file

Next, the image that has been trained also save in the separate file. The file that has been used to save the trained image is called Training Image. The data of the user such as name, matric number and phone number that has been taken when user register face also has been kept in the MySQL Workbench in the table named student. Figure 5 shows the training image file that contain the images that has been trained.

![Graphical user interface, text, application Description automatically generated](623a908364c97_media/media/image7.png)

**Figure 5**: Trained Image

Each image that has been trained will be used when the users scan their faces to reserve room in the library. When the face is being scan, the system will compare the live image with the trained image in the Haar Cascade file. Figure 6 shows the coding used to compare the images.

![Text Description automatically generated](623a908364c97_media/media/image8.png)

**Figure 6**: Coding to Compare Images

2)  **System Interface**

> The system was build using Python programming language and Tkinter package to build the Graphic User Interface (GUI). Figure 7 shows the Registration Page and Reservation Page.

![](623a908364c97_media/media/image9.png)

**Figure 7**: Registration Page and Reservation Page

The Registration Page is for the user who did not register the face. The user needs to fill in the name, matric number and phone number and click the Register Face button. The user’s information will be saved in the database, and the face will be kept in the XML file, which is haarcascade\_frontalface\_default.xml. Reservation Page is for the registered user to reserve the room by scanning the faces. The user needs to write the class and choose the time slot and room. Then click the Reserve button to start scanning the face. The user can view the reserved slot by clicking the View Reservation Slot button.

After that, when the new user registers their face, they will fill in the registration form and scan their faces. When the face has been saved in the system, the system will tell that the profile has been saved. If the system already has their information, it will show a message to the user that their data has been registered. Figure 8 shows the face-scanning for registration, Figure 9 shows the profile has been saved in the system, and Figure 10 shows the student who existed in the system

![](623a908364c97_media/media/image11.png)

**Figure 8**: Face Scanning for Registration

![](623a908364c97_media/media/image12.png)

**Figure 9**: Profile saved

![](623a908364c97_media/media/image13.png)

**Figure 10**: User existed

Next, when the user makes the reservation, they will enter the class name and scan their faces that have been registered. Then the user can proceed with the face scanning. The information of the user will be displayed. Figure 11 shows the reservation process when scanning the faces.

![](623a908364c97_media/media/image14.png)

**Figure 11**: Reservation process

The reserved slot will show the user's information that has reserved the room and time slot, including the room, time slot, and reservation. Figure 12 shows that reservation slot.

![](623a908364c97_media/media/image15.png)

**Figure 12**: Reserved slot

**FINDINGS AND DISCUSSIONS**

**Usability Testing**

Usability is considered as a determinant factor for the success or failure of applications (Ammar, 2019). The concept of usability is divided into four sub-characteristics:

  - Learnability: the ability of the software system to allow users to learn its application.

  - Understandability: the ability of the software system to allow users to understand its application and to easily perform tasks.

  - Operability: the capability of the software system to allow users to operate and control it.

  - Attractiveness: the capability of the software system to be attractive to the user

The user’s feedback is collected using Google Form, UiTM Tapah students have been selected to test the system using usability testing technique. Based on the testing that has been conducted, the selected students are required to answer the question in the Google Form provided by the system developer

**Table 1:** Percentage score of Usability Test

| **Sub-Characteristics** | **Description**                                              | **Value** |              |          |
| ----------------------- | ------------------------------------------------------------ | --------- | ------------ | -------- |
|                         |                                                              | **Good**  | **Moderate** | **Poor** |
| **Understandability**   | **Easy to understand the flow of system**                    | **100%**  | **0**        | **0**    |
| **Operability**         | Time duration for the user to register the face into system. | **70%**   | **20%**      | **10%**  |
|                         | System well function during registration                     | **70%**   | **30%**      | **0**    |
|                         | Easy for user make registration                              | **80%**   | **20%**      | **0**    |
| **Learnability**        | Usefulness of the system                                     | **100%**  | **0**        | **0**    |

Based on table 1, the result show that 100% of the respondent understand the system’s flow and the system. 70% of respondent answered good for the time taken for the respondent to register the face into system. Some respondent answered 10% for poor. The system conducted using webcam in the laptop to scan the face using live images. However, due to the light and color effect, the time taken for the system to register the face become longer. The system took quite a long time to register the images. Thus, some of the respondents need to register longer than others.

The system functionalities are based on the recognition of the faces, registering the faces and using the faces to make reservation. In term of functionalities of the system, 70% of the respondent answered good and the others 30% answered moderate. Some of the respondent answered moderate, due to the system need to scan real-time images using webcam, the functionality become decreases. This is because of the respondents moving when the system detecting their faces. Thus, some of the respondent’s faces can’t be detected by the system. The respondents need to stay still for the system to recognize them. Meanwhile, 80% of the respondent answered good for easiness in making registration using face detection. The last component asked selected respondent about the usefulness of the system. The respondents rate based on their opinion whether the system will be useful for them to use or not. The result shows that 100% of the respondent answered good. This is due to the Covid-19 cases, the respondents can’t go to the library. Some of the room only open to limited amounts of students. Therefore, the system that allow the students to reserve the room in library beforehand is recommended.

In a conclusion, the system able to create easiness among users on reserving rooms in library*.* By inventing this system, the time consuming for the users in locating the available room and reserve it will be less because the users do not need to go to the library anymore to reserve the room.

Furthermore, users can identify the room and time slot available in the library by using the system. The users able to see about the room's information before they reserve the room such as maximum capacity and name of the room. The cost of the reservation also will be lesser than before. This is because the price is dedicated to paper, and pen usage is no longer needed since there will be no more paper and pens. Thus, the users are capable of reserving rooms on their own.

**CONCLUSION AND RECOMMENDATIONS**

This paper proposes an Image processing-based library reservation system that can provide information about room availability to help user to reserve an available room slot from their respective homes in order to reduce the cost and saving time. The system will detect the face of the person who is reserving the room and use it to match the face with faces stored in the database at the time of slot booking.

The main motive of our study is to revamp the reservation process by reducing the time that is demanded to reserve a library room.

The limitation of choosing image processing is some of the images are hard to be detected. Because this project uses a laptop’s camera to detect real-time images, the faces detected might be shaking or un-focus. The lighting and color effect are also some of the reasons the system can’t detect faces. Therefore, it is recommended to use a high technology camera when capturing the images to get a better resolution.

Furthermore, facial recognition algorithms can be further facilitated and be extended to various other sectors if personal identification is required.

**REFERENCES**

Ammar, L. B. (2019). A Usability Model for Mobile Applications Generated with a Model-Driven

Approach. *International Journal of Advanced Computer Science and Applications*, 10(2) : 140-

146\.

Atkinson, S., & Lee, K. (2018). Design and implementation of a study room reservation system: Lessons from a pilot program using google calendar. *College and Research Libraries*, *79*(7), 916–930. <https://doi.org/10.5860/crl.79.7.916>

Behera, G. S. (2020, 12 24). *Face Detection with Haar Cascade.* Retrieved from https://towardsdatascience.com/face-detection-with-haar-cascade-727f68dafd08Boyko, N. B. (2018). Performance Evaluation and Comparison of Software for Face Recognition Based on Dlib and Opencv library. *IEEE second International Conference On Data Stream Mining \&Processing (DSMP)*, (pp. 478-482).Damodhar, K., Vanathi, B., & Shanmugam, K. (2016). *A Surveillance Robot For Real Time Monitoring And Capturing Controlled Using Android Mobile*. *24*, 155–166. https://doi.org/10.5829/idosi.mejsr.2016.24.S1.33Ebied, H. M. (2012). Feature extraction using PCA and Kernel-PCA for face recognition. *2012 8th International Conference on Informatics and Systems, INFOS 2012*, *January 2012*.Evangelos, M. S. (2020). On the Extension of the Haar Cascade Algorithm for Face Recognition: Case Study and Results. *24th Pan-Hellenic Conference on Informatics (PCI 2020)* (pp. 53-56). Athens, Greece.: ACM, New York.Hern, A. (n.d.). *What is facial recognition- and fhow do police use it?* Retrieved from www.theguardian.com/technology/2020/jan/24/whatis-facial-recognition.Kumar, A., Kumar, A., Chakraborty, D., Abhishek, P., & Rao, P. (2018). Analyzing Consumer Preference for Online Booking of Tourism and Hospitality in India. *Atithya: A Journal of Hospitality*, *volume 3*(February), 12–20.Mittal, A. (2020, 12 21). *Face Detection with Haar Cascade.* Retrieved from https://medium.com/analytics-vidhya/haar-cascades-explained-38210e57970dPatil, S. T. (2021). Digitized railway ticket verification using facial recognition. *5th International Conference on Intelligent Computing and Control Systems (ICICCS)* (pp. 1556-1563). IEEE.Sandeep Mishra, A. D. (2015). Face Recognition System based on Subspace Linear Discriminant Analysis. *International Journal of Engineering Research & Technology (IJERT), 3*(20), 1-4.Ye, F., Shi, Z., & Shi, Z. (2009). A comparative study of PCA, LDA and kernel LDA for image classification. *Proceedings - 2009 International Symposium on Ubiquitous Virtual Reality, ISUVR 2009*, 51–54. https://doi.org/10.1109/ISUVR.2009.26
