Skip to content

Getting Started

To use the OpenCV Face Recognition C++ SDK, first register at the OpenCV Face Recognition Developer Portal.

After registering, you can find your Developer Key on the Dashboard once you log in.

You will need your Developer Key to use this SDK.

The SDK code is available here

Install requirements

With your Developer Key handy, you can simply include include/opencvfr.h header file as shown below:

#include "opencvfr.h"

OpenCV Face Recognition C++ SDK is a single header library with few other libraries. Other single header libraries are included in the folder named include/external.

Apart from the single header file, the OpenCV Face Recognition SDK needs to have other dependencies as listed below:

  • OpenSSL
  • GoogleTest (for unit test)
  • OpenCV

The bash script and batch files for Windows and Linux platforms are provided in the respective subfolders of main SDK folder to automate the process of installing the dependencies.

The software needed to build with the SDK are as follows:

  1. C++ compiler (gnu C++ on Linux and Visual C++ on Windows)
  2. CMake
  3. Git

After installing the dependencies, change the directory to either windows or linux subfolder of the main sdk directory. The sample project can be built using CMake as follows:

mkdir build
cd build
cmake ..

The above commands will generate the build files necessary to compile the sample code.

Initializing the SDK

Since our SDK supports multiple regions, you need to initialize it with a BACKEND_URL indicating the region you would like to host your data in, and also with a DEVELOPER_KEY. Instantiation of the SDK class is done with the two parameters as follows:

// Define the region, and developer key
// SG: "https://sg.opencv.fr"
// US: "https://us.opencv.fr"
// EU: "https://eu.opencv.fr"

string BACKEND_URL {"https://sg.opencv.fr"};
string DEVELOPER_KEY {"8zt.......................................ZmQ2"};

// Initialize the SDK
SDK sdk {BACKEND_URL,DEVELOPER_KEY};

Now we are ready to use the SDK to perform various operations.