Click here to Skip to main content
13,835,124 members
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 10 Oct 2017
Licenced CPOL

IoT Reference Implementation: How-to Build a Face Access Control Solution

, 10 Oct 2017
Rate this:
Please Sign up or sign in to vote.
The Face Access Control application is one of a series of IoT reference implementations aimed at instructing users on how to develop a working solution for a particular problem.

Editorial Note

This article is for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers


The Face Access Control application is one of a series of IoT reference implementations aimed at instructing users on how to develop a working solution for a particular problem. The solution uses facial recognition as the basis of a control system for granting physical access. The application detects and registers the image of a person’s face into a database, recognizes known users entering a designated area and grants access if a person’s face matches an image in the database.

From this reference implementation, developers will learn to build and run an application that:

  • Detects and registers the image of a person’s face into a database
  • Recognizes known users entering a designated area
  • Grants access if a person’s face matches an image in the database

How it Works

The Face Access Control system consists of two main subsystems:


  • cvservice is a C++ application that uses the Intel® Computer Vision SDK (Intel® CV SDK). It connects to a USB camera (for detecting faces) and then performs facial recognition based on a training data file of authorized users to determine if a detected person is a known user or previously unknown. Messages are published to a MQTT* broker when users are recognized and the processed output frames are written to stdout in raw format (to be piped to ffmpeg for compression and streaming). Here, the Photography Vision Library is used for facial detection and recognition.


  • webservice uses the MQTT broker to interact with cvservice. It's an application based on Node.js* for providing visual feedback at the user access station. Users are greeted when recognized as authorized users or given the option to register as a new user. It displays a high-quality, low-latency motion jpeg stream along with the user interface and data analytics.

In the UI, there are three tabs:

  • live streaming video
  • user registration
  • analytics of access history.

This is what the live streaming video tab looks like:

This is what the user registration tab looks like:

This is an example of the analytics tab:

Hardware requirements

  • 5th Generation Intel® Core™ processor or newer or Intel® Xeon® v4, or Intel® Xeon® v5 Processors with Intel® Graphics Technology (if enabled by OEM in BIOS and motherboard) [tested on NUC6i7KYK]
  • USB Webcam [tested with Logitech* C922x Pro Stream]

Software requirements

How to set up

Intel® CV SDK

Download and install OpenCL*

The Intel® CV SDK requires OpenCL*, which is available as a separate download. We provide a script that helps with the installation process here. Unpack the archive using:

tar xf install_OCL_driver2_sh.tgz

Then prepare a temporary workspace and run the script:

mkdir opencl-temp
./ install --workspace opencl-temp

For this application you do not need to recompile the Linux* kernel thus answer no when asked during the installation process. Additional details and instructions are provided in this article. The System Analyzer Utility mentioned in the article can be use to confirm proper installation.

Download and Install the Intel® CV SDK

The guide for installing the Intel® CV SDK is offered here. After completing the registration, download the archive for Ubuntu*, unpack it, and run the GUI installer:

tar xaf intel_cv_sdk_ubuntu_<version>.tgz
cd intel_cv_sdk_ubuntu_<version>

When prompted, install as the root user or as a user with root permissions. The rest of the guide assumes you will install the Intel® CV SDK under the default location.

After installation, don't forget to source the CV SDK environment variables:

source /opt/intel/computer_vision_sdk_<version>/bin/

This will be required for building and running cvservice. To automate this process, you can source the script from .profile or .bashrc. Alternatively, you can add the variables to /etc/environment.


This reference implementation uses ffmpeg to compress and stream video output from cvservice to the webservice clients. ffmpeg is installed separately from the Ubuntu repositories:

sudo apt update
sudo apt install ffmpeg


Install Paho* MQTT* C client libraries dependencies

This reference implementation uses MQTT to send data between services. To install the dependencies:

sudo apt update
sudo apt install libssl-dev

Building the executable (from cvservice directory):

mkdir build
cd build
cmake ..


Instructions on how to setup the Node.js services are provided in the webservice folder.

Running the application

  1. Start the webservice, both server and front-end components.

  2. Start ffserver with:

    sudo ffserver -f ./ffmpeg/server.conf
  3. Export the needed ENV vars:

    export MQTT_SERVER=localhost:1883
    export MQTT_CLIENT_ID=cvservice
    export FACE_DB=./defaultdb.xml
    export FACE_IMAGES=../../webservice/server/node-server/public/profile/
  4. From the cvservice/build directory start cvservice and pipe to ffmpeg:

    ./cvservice 0 2>/dev/null | ffmpeg -f rawvideo -pixel_format bgr24 -video_size vga -i - http://localhost:8090/fac.ffm
  5. Browse to:



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Intel Corporation
United States United States
You may know us for our processors. But we do so much more. Intel invents at the boundaries of technology to make amazing experiences possible for business and society, and for every person on Earth.

Harnessing the capability of the cloud, the ubiquity of the Internet of Things, the latest advances in memory and programmable solutions, and the promise of always-on 5G connectivity, Intel is disrupting industries and solving global challenges. Leading on policy, diversity, inclusion, education and sustainability, we create value for our stockholders, customers and society.
Group type: Organisation

43 members

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web05 | 2.8.190114.1 | Last Updated 10 Oct 2017
Article Copyright 2017 by Intel Corporation
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid