Are you fed up of losing your room keys? Or are you fed up of remembering which key opens which lock?

To solve these problems, we present to you the face recognition door lock.

The main purpose of the project is to improve security systems in homes, offices etc. The idea is to unlock a door by recognizing the face of an authorized person.


The whole process can be divided in three major steps –

  1. The first step is to create a good database of faces of the authorised person.
  2. The next step is to supply images from the database and use them to train the system.
  3. The last step is to test the face recognizer to recognize faces it was trained for


For this, we will use a Database that contains 500 images of the authorized person. In each image, the individual has a different facial expression like happy, sad, normal, surprised, sleepy etc.These images are used to train the system.


We have to import the required modules to the program-

  1. cv2  – This is the OpenCV module and contains the functions for face detection and recognition.
  2. os  – This module will be used to maneuver with image and directory names. First, we will use this module to extract the image names in the database directory and then from these names we will extract the individual number, which will be used as a label for the face in that image.
  3. Image  – Since, the dataset images are in gif format and as of now, OpenCV does not support gif format, we will use Image module from PIL  to read the image in grayscale format.
  4. numpy  – Our images will be stored in numpy arrays.

Face Detection:

The first step is to detect the face in each image. Once, we get the region of interest containing the face in the image, we will use it for training the recognizer. For the purpose of face detection, we will use the Haar Cascade provided by OpenCV. The haar cascade is an xml file which contains information about the distinct features of a human face like the presence of eyes,ears,nose,chin etc.These features distinguishes the human faces from other objects.

  • Human face detection   ::

  • Capturing detected Face ::

Training via images:

The next step is creating the face recognizer . The face recognizer object has functions like FaceRecognizer.train to train the system to recognize the face of the authorized person

by using the various images from the database created earlier.

This can be achieved by defining a function  that takes the absolute path to the image in the database as input argument and returns tuple of 2 list, one containing the detected faces and the other containing the corresponding label for that face.

  • Trainer ::

Face recognition:

Finally, it analyses the detected human face and compare it with images from the database which is achieved by using some features like the distance between the eyes etc. And if it matches, the program passes the control over to the microcontroller (here the microcontroller used is Arduino) which in turn opens the door!

  • Recognition and lock control ::


  • Lock control on arduino ::







  • Tejas K. Atreya
  • Yashwanth Kumar
  • Nitesh Jindal
  • Tarun Kumar Yadav

Under mentorship of  :

Saumitra  Sharma , Abhishek Anand , Vamshi Krishna Reddy




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s