Skip to main content
Version: 3.24.1 (latest)

Face identification/verification on camera video stream

The bin directory contains the executable file video_recognition_demo:

video_recognition_demo

The program is an example of using pbio::VideoWorker and demonstrates tracking and identification/verification of faces on several video streams. It also allows you to test the active (scripted) verification of a face belonging to a real person.

To quickly run the sample with default parameters and test face recognition on Windows:

  1. Create a database that will be used for face search. To create a database, go to the bin/base folder and create a new folder, for example, person0. Place a photo of the person you want to find in the database in the folder, and also create a file name.txt, which should be located in the same folder and contain the person's name, written in Latin letters on one line.

Contents of the bin/base/person0 folder

  1. Go to the bin folder and double-click the demo_web_m_last_v30.bat, demo_web_m_last_v300.bat, demo_web_m_last_v1000.bat or demo_web_m6v7.bat script. It does not matter which script you use to run this sample, since they differ only in the recognition method (9.30, 9.300, 9.1000 and 6.7 respectively). For more information on the methods, see Face Recognition section.

Location of C++ video_recognition_demo

  1. The results of tracking and identification are displayed in windows (one for each source). Found faces are highlighted with a green circle. The upper right part of the window displays the recognition results: on the left - the face found in the video, on the right - the face from the database and the name.

Result of running C++ video_recognition_demo

You can also run the video_recognition_demo sample by specifying certain parameters (for example, if you have an online license).

Launch parameters:

  • one or more sources, each source is a number (webcam number) or text (URL of the video stream or path to the video file);
  • and then parameters named in random order:
    • config_dir – path to the conf/facerec directory
    • dll_path – path to the library file libfacerec.so or facerec.dll
    • database_dir – path to the database directory, where each person has a folder containing their photos and a text file name.txt with their name in Latin script. A sample database can be found in bin/base
    • frame_fps_limit – FPS limit
    • fullscreen – fullscreen mode
    • license_dir – path to the license directory (specify if you need to change the default directory license)
    • vw_config_file – name of the VideoWorker configuration file
    • method_config – name of the recognizer configuration file
    • recognition_far_threshold – recognition threshold (floating-point number)
    • enable_active_liveness – enable active (scripted) liveness verification to confirm that the face belongs to a real person

Examples of launch scripts:

Linux:

  • demo_web_m_last_v30.sh – launch by method 9.30 from webcam 0
  • demo_web_m_last_v300.sh – launch by method 9.300 from webcam 0
  • demo_web_m_last_v1000.sh – launch by method 9.1000 from webcam 0
  • demo_web_m6v7.sh – launch by method 6.7 from webcam 0
  • demo_web_active_liveness_v30.sh – launch with active (scripted) liveness check enabled, by method 9.30 from webcam 0

Windows:

  • demo_web_m_last_v30.bat – launch by method 9.30 from webcam 0
  • demo_web_m_last_v300.bat – launch by method 9.300 from webcam 0
  • demo_web_m_last_v1000.bat – launch by method 9.1000 from webcam 0
  • demo_web_m6v7.bat – launch by method 6.7 from webcam 0
  • demo_web_active_liveness_v30.bat – launch with active (scripted) liveness check enabled, using method 9.30 from a webcam 0

The console displays the database loading status and error messages when they occur.

Source code: examples/cpp/video_recognition_demo

The OpenCV and boost libraries are required for assembly.