OpenCV (Facial Recognition)

OpenCV is the library ResourceSpace uses for facial recognition capability. You can install OpenCV from the system's repository:

sudo apt-get install libopencv-dev python-opencv


To install OpenCV from source, on either Linux or Windows please check OpenCV's documentation.

We've also found useful the following shell scripts to help you install from source. See Install-OpenCV.

Version requirements

  • Python - 2.7.6
  • OpenCV - 2.4.13

Check Python and OpenCV versions

To check Python version, type the following in your terminal:

python --version

To check what opencv you have installed run Python in interactive mode (type python on command line), then run the following:

>>> import cv2
>>> print cv2.__version__

The output of the above commands should be 2.4.13. Press Ctrl + D to exit from interactive mode.

Configure facial recognition feature in ResourceSpace

All the configuration mentioned below should happen in config.php

  • Set path to Python (adjust accordingly to your setup - be it system wide or Python virtual environment)
  • Set the field used to store the name of the person suggested/ detected (MUST be a dynamic keyword list)
  • Set the location for the face recogniser model state(s) and data
  • Enable facial recognition
$python_path = '/usr/bin';
$facial_recognition = true;
$facial_recognition_tag_field = 20;
$facial_recognition_face_recognizer_models_location = '/var/faceRecogniserData';

Configure trainer

Create a cron job (Linux) or a new scheduled task (Windows) and make sure to run pages/tools/facial_recognition_trainer.php.