🏆
Trusted Engineering Publisher
Serving Researchers Since 2012

Real-Time Face Recognition Attendance System using OpenCV

DOI : https://doi.org/10.5281/zenodo.19854954
Download Full-Text PDF Cite this Publication

Text Only Version

Real-Time Face Recognition Attendance System using OpenCV

Dr. Mahmood Ali Mirza

Department of Computer Science and Engineering , Krishna University College of Engineering and Technology, Krishna University, Rudravaram, Andhra Pradesh, India.

T. Vignesh, P. Prasad, T. Manikanta Swamy, V. Mani Shankar Sai

Student, Department of Computer Science and Engineering , Krishna University College of Engineering and Technology, Krishna University, Rudravaram, Andhra Pradesh, India.

AbstractThis paper presents an automated face recognitionbased attendance system designed to enhance efficiency and reduce the possibility of proxy attendance in educational environments. Traditional attendance methods are often time-consuming and prone to human error, which motivates the need for a reliable automated solution. The proposed system utilizes computer vision techniques implemented through OpenCV, along with the Local Binary Patterns Histogram (LBPH) algorithm for real-time face detection and recognition. A dataset of facial images is collected, preprocessed, and used to train the model, enabling accurate identification under varying lighting conditions and facial expressions. The system automatically records attendance with minimal manual intervention, thereby improving operational efficiency. Experimental evaluation demonstrates approximately 85% accuracy, indicating a notable improvement over conventional methods in reliability and time management. The proposed solution is cost-effective, scalable, and easily deployable in real-world academic settings.

KeywordsFace Recognition, Automated Attendance System, OpenCV, LBPH Algorithm, Computer Vision, Real-Time Monitoring

  1. Introduction

    Attendance management plays a crucial role in educational institutions and organizations, as it directly impacts academic evaluation and administrative efficiency. Conventional attendance systems, such as manual roll calls and paper-based registers, are not only time-consuming but also susceptible to human errors and fraudulent practices like proxy attendance [7]. These limitations reduce the overall reliability and transparency of attendance records, especially in large classrooms or institutions with a high number of students.

    In recent years, rapid advancements in computer vision and machine learning have led to the development of intelligent and automated systems for various real-world applications. Among these, face recognition technology has emerged as a reliable and non-intrusive method for identifying individuals. Early work in face recognition, such as the Eigenfaces approach proposed by Matthew Turk and Alex Pentland [6], laid the foundation for modern recognition systems. Furthermore, robust object detection techniques like the ViolaJones algorithm introduced by Paul Viola and Michael Jones [1] enabled real-time face detection, significantly improving system performance.

    Recent approaches have increasingly utilized local feature descriptors for improved accuracy and computational efficiency. The Local Binary Patterns Histogram (LBPH) algorithm, proposed by Timo Ahonen and colleagues [2], has proven to be effective for face recognition tasks, particularly under varying lighting conditions and facial expressions. Several studies have also explored the application of face recognition in attendance systems, demonstrating improvements in automation and reliability [8]. However, many existing systems still face challenges related to accuracy, scalability, and implementation cost.

    To address these issues, this paper proposes an automated face recognitionbased attendance system using OpenCV and the LBPH algorithm. The system captures real-time facial images through a webcam, detects and recognizes faces, and matches them with a pre-trained dataset to mark attendance automatically. By minimizing human intervention, the proposed system enhances efficiency while maintaining accuracy and security in attendance management.

    The key contributions of this work include: (i) the design and development of a real-time face recognitionbased attendance system, (ii) the implementation of the LBPH algorithm for efficient and robust face recognition, (iii) the reduction of proxy attendance and manual errors, and (iv) the development of a cost-effective and scalable solution suitable for deployment in real-world academic environments.

  2. Literature Review

    Attendance management systems have undergone significant transformation with the evolution of digital technologies. Traditional methods, such as manual attendance recording using paper-based registers, are still commonly used in many institutions. However, these approaches are inefficient, time-consuming, and highly susceptible to human errors, including incorrect entries and proxy attendance [7]. Such drawbacks reduce the reliability and transparency of attendance records, especially in large-scale environments.

    To overcome these limitations, several automated attendance systems have been introduced. Radio Frequency Identification (RFID)-based systems automate attendance tracking by assigning unique identification cards to individuals. While these systems reduce manual effort, they still rely on physical cards, which can be lost, duplicated, or

    misused, thereby affecting system reliability [8]. Similarly, biometric systems such as fingerprint recognition offer improved accuracy by using unique physiological features. However, these systems require physical interaction, dedicated hardware, and regular maintenance, making them less suitable in terms of hygiene, scalability, and cost-effectiveness.

    In recent years, face recognitionbased attendance systems have gained considerable attention due to their contactless and non-intrusive nature. Face recognition is a subdomain of computer vision that identifies individuals by analyzing facial features from images or video streams. Early approaches such as the Eigenfaces method [6] utilized principal component analysis (PCA) to reduce dimensionality and extract essential facial features. Although effective, these methods were sensitive to variations in lighting and facial expressions.

    To address these challenges, more robust algorithms such as Fisherfaces and Local Binary Patterns Histogram (LBPH) have been developed. Among these, the LBPH algorithm [2] is widely used due to its simplicity and effectiveness in real-time applications. LBPH operates by dividing the face image into small regions and extracting local texture features using binary patterns. These patterns are then converted into histograms, which are used for face representation and comparison. This localized feature extraction makes LBPH less sensitive to illumination changes and facial variations, thereby improving recognition performance [2], [9].

    Several research works have demonstrated the application of face recognition techniques in automated attendance systems, showing improvements in efficiency, accuracy, and reduction of manual intervention [7], [8]. Despite these advancements, certain challenges still persist, including variations in lighting conditions, facial occlusions (such as masks or accessories), and changes in facial expressions. These factors can affect the accuracy and robustness of recognition systems in real-world scenarios.

    Therefore, there is a need for a system that balances accuracy, computational efficiency, and cost-effectiveness. In this context, the present work focuses on developing a real-time face recognition attendance system using OpenCV and the LBPH algorithm. The proposed approach aims to provide a reliable an scalable solution capable of operating effectively under practical conditions while minimizing human intervention.

  3. Proposed System

    The proposed system is designed to automate the attendance marking process using face recognition technology, thereby eliminating the need for manual intervention and significantly reducing the possibility of proxy attendance. By leveraging real-time image processing and machine learning techniques, the system ensures efficient and reliable attendance tracking in educational environments.

    The overall system operates in two primary phases: training and recognition.

    In the training phase, facial images of individuals are captured using a webcam and stored in a structured dataset. These images undergo preprocessing steps such asgrayscale conversion, resizing, and noise reduction to ensure uniformity and improve feature extraction. The processed images are then fed into the Local Binary Patterns Histogram (LBPH) algorithm, which extracts distinctive local texture features from facial regions. These features are used to train a recognition model, enabling it to distinguish between different individuals based on their facial characteristics.

    In the recognition phase, real-time video input is captured through a webcam. The system employs OpenCV for face detection, typically using Haar Cascade classifiers, to identify and isolate facial regions from each frame. Once a face is detected, the same preprocessing steps are applied to maintain consistency with the training data. The LBPH algorithm then generates a feature representation of the detected face, which is compared with the trained dataset using a similarity measure. If the similarity score exceeds a predefined threshold, the system recognizes the individual and marks their attendance automatically.

    To ensure accuracy and reliability, the system maintains a database where attendance records are stored along with timestamps. This enables efficient tracking and retrieval of attendance data while minimizing duplication and errors. The overall workflow is optimized for real-time performance, making the system suitable for practical deployment in classrooms and institutional environments.

    Working Procedure

    1. Facial images of individuals are captured using a webcam and stored in a dataset with appropriate labeling.

    2. The system detects faces from captured images using OpenCV-based face detection techniques (e.g., Haar Cascade).

    3. Detected facial regions are preprocessed (grayscale conversion, normalization) to ensure consistency.

    4. The Local Binary Patterns Histogram (LBPH) algorithm extracts local feature descriptors and generates feature vectors.

    5. A trained model compares these feature vectors with stored representations in the dataset.

    6. If a match is identified based on a confidence threshold, the system recognizes the individual.

    7. The attendance is automatically recorded along with the corresponding date and time in the database.

    Fig.1: The overall Working Procedure of the proposed

    system

  4. Dataset Description

    The dataset used in the proposed system consists of facial images collected from individuals for training and testing purposes. The images are captured in real time using a webcam under varying environmental conditions to improve the robustness of the system. Variations such as changes in lighting, facial expressions, and slight pose differences are intentionally included during data collection to simulate practical usage scenarios.

    For each individual, 200 facial images are collected, resulting in a total dataset of 800 images from 4 individuals. All collected images are primarily used for training the recognition model, as the system is designed to operate in a controlled prototype environment. The images are organized in a structured directory format, where each individual is assigned a unique numerical identifier. The labeling convention follows a sequential pattern (e.g., 102.1 to 102.200), which simplifies dataset management and model training.

    All images are resized to a uniform resolution of 200 × 200 pixels to ensure consistency and reduce computational complexity. This resolution provides a balance between processing efficiency and preservation of essential facial features required for accurate recognition.

    The dataset characteristics are summarized as follows:

    • Number of individuals: 4

    • Images per individual: 200

    • Total number of images: 800

    • Image format: JPG

    • Image resolution: 200 × 200 pixels

    Since the dataset is collected from project group members, it represents a limited but controlled sample set. While this is sufficient for demonstrating the functionality and feasibility of the proposed system, it may not fully capture large-scale real-world variations. Future work can focus on expanding the dataset with a greater number of individuals to improve scalability and generalization performance.

    Fig.2: Sample images from the Dataset

  5. Methodology

    The proposed system is implemented using the Python programming language combined with computer vision techniques for real-time face recognition. The system utilizes OpenCV for face detection and the Local Binary Patterns Histogram (LBPH) algorithm for face recognition [2]. The overall design focuses on achieving accurate, efficient, and automated attendance marking under practical conditions.

    The implementation consists of two primary stages: training and recognition.

    In the training stage, facial images collected from individuals are preprocessed and used to train the LBPH model. Preprocessing steps include grayscale conversion, resizing, and normalization to ensure consistency across all images. The LBPH algorithm extracts local texture features from these images and generates corresponding feature vectors, which are stored as part of the trained model.

    In the recognition stage, real-time video input is captured using a webcam. The system detects faces in each frame using Haar Cascade classifiers provided by OpenCV. Once a face is detected, it is preprocessed in the same manner as the training images. The LBPH algorithm then extracts features and compares them with the stored feature vectors. Based on a similarity measure (distance metric), the system identifies the closest match. If the confidence level satisfies a predefined threshold, the individual is recognized, and attendance is automatically recorded.

    A graphical user interface (GUI) is developed to enhance usability and provide an interactive platform for system operation. The attendance data is stored in a CSV file along with the corresponding date and time, enabling efficient record management. The system is designed to handle variations in lighting conditions and facial expressions, ensuring reliable performance in real-time scenarios.

    A. LBPH Algorithm Working:

    The Local Binary Patterns Histogram (LBPH) algorithm is a widely used method for face recognition due to its simplicity, computational efficiency, and robustness to illumination variations [2]. It operates by analyzing the local texture patterns of a grayscale image and encoding them into a compact representation.

    In this approach, each pixel in the image is compared with its neighboring pixels to generate a binary pattern that describes local texture information. The image is divided into multiple regions, and histograms are computed for each region. These histograms are then concatenated to form a feature vector that uniquely represents a face.

    During the recognition phase, the feature vector of he input image is compared with stored feature vectors using a distance-based metric such as Euclidean distance. The closest match determines the identity of the individual.

    Fig.3: workflow of the LPBH face recognition Attendance system

    LBP Algorithm working steps:

    1. Original Image (3×3 Grid): A small grayscale image patch is shown with pixel intensity values. The center pixel (value 52) is selected as the reference point.

    2. Thresholding: Each surrounding pixel is compared with the centre pixel :

      • If the neighbour pixel 52 assign 1

      • If the neighbour pixel < 52 assign 0 This converts the grayscale values into a binary pattern.

    3. Binary Pattern Formation: The binary values are arranged in a clockwise order forming an 8-bit binary number (e.g., 01100011)

    4. LBP Value (Decimal Conversion): The binary number is converted into a decimal value (e.g., 01100011 99) which represents the texture feature of that pixel.

    5. Feature Vector Formation: LBP values from all regions are aggregated into histograms, and these histograms are combined to form the final feature vector used for face recognition.

    Fig.4: This image explains the Local Binary Pattern (LBP) operation

  6. System Architecture

    The system architecture represents the overall design and workflow of the proposed face recognitionbased attendance system. It consists of multiple interconnected modules that collaboratively perform image acquisition, face detection, feature extraction, recognition, and attendance management. The architecture is designed to ensure efficient data flow and real-time system performance.

    The process begins with the image acquisition module, where a webcam captures real-time video streams of individuals entering the system. These video frames are continuously processed to extract relevant facial data. The captured frames are then passed to the face detection module, which utilizes techniques provided by OpenCV, such as Haar Cascade classifiers, to detect and localize facial regions within each frame.

    Once a face is detected, the extracted facial region is forwarded to the feature extraction module. In this stage, the Local Binary Patterns Histogram (LBPH) algorithm is applied to analyze local texture patterns of the face and generate a distinctive feature vector. This feature vector serves as a compact representation of the individuals facial characteristics.

    The generated feature vector is then passed to the recognition module, where it is compared with the pre-trained dataset stored in the system. A similarity measure is used to determine the closest match between the input feature vector and stored representations. If the matching confidence exceeds a predefined threshold, the system successfully identifies the individual.

    Upon successful recognition, the identified information is sent to the attendance management module, which automatically records the attendance details. The attendance data, including the individuals identity, date, and timestamp, is stored in a CSV file or database for future reference and analysis.

    Overall, the proposed architecture ensures a streamlined and efficient workflow, enabling accurate and real-time face recognitionbased attendance marking while minimizing manual intervention and system latency.

    Fig.5: The System Architecture of Face Recognition Attendance System

  7. Results and Discussion

    The proposed face recognitionbased attendance system was evaluated using a dataset collected from multiple individuals under varying environmental conditions. The dataset consisted of 4 individuals with a total of 800 images, of which 70% were used for training and 30% for testing. The system performance was analyzed based on its ability to accurately detect and recognize faces in real-time scenarios.

    The experimental results show that the system achieves an overall recognition accuracy of approximately 85%. The performance was tested under different lighting conditions and facial variations. It was observed that the system performs effectively under normal lighting conditions, while a slight reduction in accuracy occurs in scenarios involving low illumination, partial occlusion, or significant facial expression changes. This behavior is expected, as such variations affect feature extraction and matching accuracy in traditional algorithms.

    Compared to conventional attendance methods, the proposed system demonstrates significant improvements in efficiency and reliability. Manual attendance systems are prone to human errors and proxy attendance, while RFID-based systems depend on physical identification cards that can be misused. In contrast, the proposed face recognition system provides a contactless and automated solution, reducing manual effort and ensuring real-time processing.

    Table I. Performance Comparison

    Method

    Accuracy

    Manual

    70%

    RFID System

    80%

    Proposed System

    85%

    The results clearly indicate that the proposed system outperforms traditional methods in terms of accuracy and operational efficiency. The improvement is primarily due to the use of facial feature-based recognition, which eliminates dependency on external inputs such as manual entry or physical cards.

    The accuracy of the system is calculated as the ratio of correctly recognized faces to the total number of test samples. The system successfully detects and recognizes faces in real time, and attendance is automatically recorded without manual intervention. Output screenshots further validate the effectiveness of the system in practical scenarios.

    However, the system has certain limitations. The accuracy may decrease when facial images are not clearly visible or when there are extreme variations in lighting conditions. Additionally, the use of a relatively small dataset (limited to a few individuals) may affect the generalization capability of the model. Future improvements can focus on increasing the dataset size and incorporating advanced deep learningbased techniques to enhance robustness and accuracy under diverse real-world conditions.

    Fig.6: User interface of the attendance system

    Fig.7: Student Registration Interface with data entry, photo upload and details retrieve options

    Fig.8: Face detection output of the system

    Fig.9: The image shows the Attendance of a Student

    Fig.10: Help and support interface of the system

    Fig.11: This image shows the process of Trainig Dataset

    The system successfully detects and recognizes faces in real time, and attendance is automatically recorded without manual intervention. The output screenshots demonstrate the effectiveness of the system in practical scenarios.

    However, the system has some limitations. The accuracy may decrease when faces are not clearly visible or when there are significant variations in lighting conditions. Future improvements can focus on enhancing robustness using advanced deep learning techniques.

  8. Conclusion

    This paper presented an automated face recognitionbased attendance system developed using OpenCV and the Local Binary Patterns Histogram (LBPH) algorithm. The proposed system successfully automates the attendance process, thereby reducing manual effort and minimizing the possibility of proxy attendance.

    The system was evaluated under varying environmental conditions and achieved an accuracy of approximately 85%, demonstrating its effectiveness and reliability in real-time applications. The use of computer vision techniques

    enables contactless and efficient attendancemarking, making the system suitable for modern educational and organizational environments where automation and hygiene are important considerations.

    Despite its effectiveness, the system has certain limitations. Variations in lighting conditions, facial expressions, and partial occlusions can impact recognition accuracy. Additionally, the use of a relatively small dataset may limit the systems generalization capability in large-scale deployments.

    Future work can focus on improving system robustness by incorporating advanced deep learningbased face recognition techniques and expanding the dataset to include a wider range of individuals and environmental conditions. Enhancing the systems adaptability to real-world variations will further improve its accuracy and scalability.

    In conclusion, the proposed system offers a cost-effective, scalable, and user-friendly solution for automated attendance management, making it a practical and efficient alternative to traditional attendance systems.

  9. Acknowledgement

The authors would like to thank Krishna University Honourable Vice Chancellor Prof. Ramji Koona for his endless support. We also like to extend our thanks to Krishna University Start-up and Innovation Cell for their support in providing computing and other resources.

References

  1. P. Viola and M. Jones, Rapid object detection using a boosted cascade of simple features, in Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR), 2001, pp. 511518.

  2. T. Ahonen, A. Hadid, and M. Pietikainen, Face recognition with local binary patterns, IEEE Trans. Pattern Analysis and Machine Intelligence, vol. 28, no. 12, pp. 20372041, Dec. 2006.

  3. R. Brunelli and T. Poggio, Face recognition: Features versus templates, IEEE Trans. Pattern Analysis and Machine Intelligence, vol. 15, no. 10, pp. 10421052, Oct. 1993.

  4. S. Z. Li and A. K. Jain, Handbook of Face Recognition, 2nd ed. London, U.K.: Springer, 2011.

  5. OpenCV Documentation, Open Source Computer Vision Library,

    [Online]. Available: https://opencv.org

  6. M. Turk and A. Pentland, Eigenfaces for recognition, Journal of

    Cognitive Neuroscience, vol. 3, no. 1, pp. 7186, 1991.

  7. A. Kumar and K. V. Prasad, Automated attendance system using face recognition, International Journal of Engineering Research & Technology (IJERT), vol. 8, no. 5, pp. 15, 2019.

  8. S. Singh, R. Kumar, and N. Sharma, Face recognition based attendance system using machine learning, in Proc. Int. Conf. Advances in Computing, Communication and Control (ICAC3), 2020, pp. 15.

  9. D. Huang, C. Shan, M. Ardabilian, Y. Wang, and L. Chen, Local binary patterns and its application to facial image analysis: A survey, IEEE Trans. Systems, Man, and Cybernetics, vol. 41, no. 6, pp. 765781, Nov. 2011.

  10. A. S. Tolba, A. H. El-Baz, and A. A. El-Harby, Face recognition: A literature review, International Journal of Signal Processing, vol. 2, no. 2, pp. 88103, 2006.