Face Tracking System Using Raspberry-Pi

08.02.23 06:23 AM By AKB

Face Tracking System Using Raspberry-Pi

In this article we will learn and build a Face Tracking System using Raspberry-Pi with help of its Open CV library.

Face tracking or face recognition is a modern day evolving technology that can identify or track an individual using only their face.

Face tracking system is very secure when compared with fingerprint and typed passwords. Most new smartphones are coming up with the feature of face unlock which makes our personnel's very secure.  There is a huge scope in facial recognition and face tracking technology as well many applications we can see in our day to day working life like:

  1. Mobile phone security

  2. Automobile/vehicle security

  3. Immigration checkpoints

  4. Fleet management

  5. Access control

  6. Educational purpose

  7. Healthcare, and many more

                                                                                                  Raspberry Pi face tracking system


In this article we will make a Face Tracking system, where we will be using Open CV library for Raspberry-pi. Before getting to start building our face tracking system lets get to know about our requirements i.e. Raspberry-Pi and Open CV library in depth.

Raspberry-Pi :

Raspberry Pi is also called as a minicomputer which is size of a credit card that is interoperable with any input and output hardware device like a monitor, a television, a mouse, or a keyboard it effectively converts the set-up into a full-fledged Personal computer at a low cost.

Till now there are 6 Models of Raspberry Pi available in market, these are listed below:

Top Models of Raspberry Pi :

  1. Raspberry Pi Zero

  2. Raspberry Pi 1

  3. Raspberry Pi 2 B

  4. Raspberry Pi 3

  5. Raspberry Pi 4B

  6. Raspberry Pi 400

Features of Raspberry PI:

  • 512 MB SDRAM memory

  • Broadcom BCM2835 SoC full high definition  multimedia processor

  • Dual Core Video Core IV Multimedia coprocessor

  • Single 2.0 USB connector

  • HDMI (rev 1.3 and 1.4) Composite RCA (PAL & NTSC) Video Out

  • 3.5 MM Jack, HDMI Audio Out

  • MMC, SD, SDIO Card slot on board storage

  • Linux Operating system

  • Dimensions are 8.6cm*5.4cm*1.7cm

  • On board 10/100 Ethernet RJ45 jack

                                                                                                   Raspberry Pi Pin diagram

Open CV:

OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning(ML) software library. OpenCV is built to provide a base infrastructure for computer vision applications and to boost the use of machine learning in the commercial applications. Open CV is an Apache 2 licensed product that is why OpenCV makes it easy for businesses to utilize and modify the code as per requirements.

Using OpenCV library, you can −

  • Read and write images

  • Capture and save videos

  • Process images (filter, transform)

  • Perform feature detection

  • Detect specific objects such as faces, eyes, cars, in the videos or images.

  • Analyze the video, i.e., estimate the motion in it, subtract the background, and track objects in it.

Check more details on Open CV

As we have seen about our Requirements let’s now start to buid a project where we will Track and detect the face:

Process:

  1. Power your Raspberry Pi with an adapter and connect it to a display monitor via HDMI cable.

  2. Install dlib : Open Terminal of Raspberry Pi and Run the Command “pip install dlib” This will install toolkit for real-world Machine Learning and data analysis applications.

  1. Install pillow: After installing dlib , Run the command “pip install pillow” which stands for Python Imaging Library which is known to open, manipulate and save images in an exceedingly different format,

  2. Install face recognition: Run the command “pip install face recognition –no –cache-dir” we'll be using this library to coach and recognize faces.

  3. After running all these commands you will get “success” message on terminal which denotes that your Libraries have been successfully installed.

Now lets Train and compile our System:

  1. Download the given github repository and save in the folder named as “Face_Recog” “Github Repository”. This program will open all the pictures within the Face Images directory and seek faces.

  2. After this compile the project within the folder with the command “python Face_Trainer.py”.

Final results:

After successful compilation, the program will launch the system camera/USB webcam, and will start feeding the library the input video.

In the response you will find a window popping up with name preview and your video feed in it like shown below:

                                                                                                                 Raspberry Pi face tracking system

This program will exactly track the face in the video feed and you will find a box around it and if your program could recognize the face it will also display the name of the person at the top of the box.

Conclusion:

In this tutorial, we got to learn on how to make a face detection system with a raspberry pi using its Open CV Library.

There are many use cases which you can explore using this Face Tracking System. There are different modules of Raspberry Pi available at Campus Component from best in the market.

As the use of Raspberry Pi in making IoT products is increasing, this opens a huge range of products and technology which want to incorporate Machine Learning and Artificial Intelligence. We can easily make industrial level projects using Raspberry Pi and its libraries.

If you are looking for Best in class Raspberry Pi and other microcontrollers, reach out Campus Component today!

Added to cart
- There was an error adding to cart. Please try again.
Quantity updated
- An error occurred. Please try again later.
Deleted from cart
- Can't delete this product from the cart at the moment. Please try again later.