Skip to content

Facial Recognition System using OpenCV and SQLite for real-time face detection and recognition. This system captures face images, trains a model to recognize individuals, and uses SQLite to manage user profiles and IDs.

License

Notifications You must be signed in to change notification settings

veendysuseno/Facial-Recognition-System-with-OpenCV-and-SQLite

Repository files navigation

Facial Recognition System with OpenCV and SQLite

This project implements a facial recognition system using OpenCV and SQLite. It includes three main components: face registration, model training, and face recognition. The system captures face images, stores user information in a SQLite database, trains a face recognizer, and then uses the trained model to recognize faces in real-time.

Project Components

  1. register.py:

    • Captures face images from the webcam and saves them to the dataSet directory.
    • Stores user information in an SQLite database (test.db).
    • Ensures that each user has multiple face images for better training.
  2. trainner.py:

    • Reads face images from the dataSet directory.
    • Trains the LBPH (Local Binary Patterns Histogram) face recognizer.
    • Saves the trained model to trainer/trainer.yml.
  3. facerec.py:

    • Loads the trained face recognizer model.
    • Performs real-time face recognition using the webcam.
    • Displays the recognized user's ID and name on the video feed.

Setup Instructions

  1. Install Dependencies: Install the required Python packages using pip:

    pip install -r requirements.txt
  2. Download Haar Cascade: Make sure you have the Haar Cascade XML file (haarcascade_frontalface_default.xml). You can download it from the OpenCV GitHub repository.

  3. Run Registration: Execute register.py to capture face images and store user information:

    python register.py
  4. Train the Model: Run trainner.py to train the face recognizer model:

    python trainner.py
  5. Run Face Recognition: Start facerec.py to perform real-time face recognition:

    python facerec.py
    

Troubleshooting

  • No Faces Detected: Ensure the face images are clear and properly lit. Adjust the detectMultiScale parameters in trainner.py and facerec.py if necessary.
  • Model Not Saving: Verify that the trainer directory exists and has write permissions.

@Copyright 2020 | Veendy

About

Facial Recognition System using OpenCV and SQLite for real-time face detection and recognition. This system captures face images, trains a model to recognize individuals, and uses SQLite to manage user profiles and IDs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages