Skip to content

LUNA SDK Examples#

Welcome to Example guide, which describes sample code for VisionLabs LUNA SDK. The presented examples are compatible with SDK version 4.0.0 and newer.

Please note that while these examples are released under MIT license, the SDK itself is not. Contact us via email (info@visionlabs.ru) for evaluation and/or licensing terms and conditions.

Aside from examples itself, there are some supplementary materials you may find useful. Look into cmake/ folder for a CMake find script for the SDK. CMake usage is not mandatory but we advise you to do it.

Currently we support 64 bit Windows and Linux. On Windows, everything should work with Visual Studio 2015. On Linux, we tested this code with GCC 4.8.5. The other versions may work as well. Note, that the SDK is officially supported on RedHat Linux families (RHEL, CentOS, Fedora).

Building Examples#

The build sequence for basic examples (example_extraction, example_estimation, example_descriptor_io, example_index) is presented below. The main dependency for basic examples is LUNA SDK, these examples should work out of the box. From Luna SDK root.

$ mkdir build && cd build
$ cmake -DCMAKE_BUILD_TYPE=Release -DFSDK_ROOT=.. ../examples
$ make

Optionally you can enable complementary examples, which require additionally installed 3rd party libraries:

Running Examples#

Note: Data folder is required at /data on Windows and on Linux.

# Detecting, Extracting, Matching
$ build/example_extraction/example_extraction examples/images/Cameron_Diaz.ppm examples/images/Cameron_Diaz_2.ppm 0.7
$ build/example_extraction/example_extraction examples/images/Cameron_Diaz.ppm examples/images/Jennifer_Aniston.ppm 0.7

# Detecting, Landmarks, Estimating (Attributes, Quality, Eyes, Head pose)
$ build/example_estimation/example_estimation examples/images/portrait.ppm

# Indexing
$ build/example_index_hnsw/example_index_hnsw examples/images/Cameron_Diaz.ppm examples/images/ examples/images_lists/list.txt 0.7

# Descriptor and batch saving/loading
$ build/example_descriptor_io/example_descriptor_io examples/images/portrait.ppm

Building Examples for Windows#

Building command (from "FSDK_ROOT\"):

$ mkdir build install && cd build
$ cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DFSDK_ROOT=.. -DCMAKE_INSTALL_PREFIX=..\install ../examples
$ cmake --build . --config Release --target install

Note: After this steps You can find examples is in 'FSDK_ROOT\install\bin\' directory.

Running on Windows#

Note: Manually register the necessary dynamic libraries (.dll) in the system (if needed).Or copy all necessary dynamic libraries (*.dll) in the directory with an example.

Run the command from "FSDK_ROOT\".

$ install\bin\example_estimation.exe examples/images/Jennifer_Aniston.jpg

LivenessEngineSDK.dll, FaceEngineSDK.dll, tbb.dll, flower.dll, *TrackEngineSDK.dll

Qt Example#

QT examples requirements#

To build this example Qt of version 5+ library and cmake DWITH_QT_EXAMPLE option is required to be installed.

Build with Qt example#

Run the command from "from FSDK_ROOT/build".

$ cmake -DFSDK_ROOT=.. -DWITH_QT_EXAMPLE=ON ../examples
$ make

If Qt is installed in non-system directory and can't be found by cmake automatically, you also need to specify path to Qt.

Example:

$ cmake -DFSDK_ROOT=.. -DWITH_QT_EXAMPLE=ON -DQt5Core_DIR=/usr/lib64/cmake/Qt5Core -DQt5Gui_DIR=/usr/lib64/cmake/Qt5Gui -DQt5_DIR=/usr/lib64/cmake/Qt5 ../examples

Note for Windows: when you build and install Qt example, qt dynamic libraries (QtCore.dll, QtGui.dll) are installed.

Run Qt example#

$ build/example_qt/example_qt examples/images/Jennifer_Aniston.jpg

Building Qt example on Windows#

Building command (from FSDK_ROOT/):

$ mkdir build install && cd build
$ cmake -G "Visual Studio 15 2017 Win64" -DFSDK_ROOT=.. -DCMAKE_INSTALL_PREFIX=..\install -DCMAKE_BUILD_TYPE=Release -DWITH_FREEIMAGE_EXAMPLE=ON -DWITH_QT_EXAMPLE=ON -DQT5_CMAKES=<absolute_path_to_Qt>\5.7\msvc2015_64\lib\cmake\ -DQt5Core_DIR=<absolute_path_to_Qt>\5.7\msvc2015_64\lib\cmake\Qt5Core -DQt5Gui_DIR=<absolute_path_to_Qt>\5.7\msvc2015_64\lib\cmake\Qt5Gui -DQt5_DIR=<absolute_path_to_Qt>\5.7\msvc2015_64\lib\cmake\Qt5  ../examples
$ cmake --build . --config Release --target install

Running on Windows (from FSDK_ROOT/):

Note: Manually register the necessary dynamic libraries (.dll) in the system (if needed).Or copy all necessary dynamic libraries (*.dll) in the directory with an example.

$ install\bin\example_estimation.exe examples/images/Jennifer_Aniston.jpg

LivenessEngineSDK.dll, FaceEngineSDK.dll, tbb.dll, flower.dll, *TrackEngineSDK.dll

Depth example#

Depth example performs liveness check based on depth frames captured from Intel Realsense Depth cameras.

Depth example requirements#

Software requirements:

The following 3rd-party dependencies are required in order to build and run depth example:

  • OpenCV
    • core
    • imgproc
    • highgui
  • Intel Realsense SDK

Hardware requirements:

  • Intel RealSense depth cameras either D400 series or the SR300 and compatible device drivers.

To verify that all realsense dependent libraries are installed correctly in the system, we recommend building librealsense SDK from source.

For build instructions please visit the following links:

  • Linux: https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md

  • Windows: https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_windows.md

For more information about RealSense SDK see https://github.com/IntelRealSense/librealsense.

Note: In order to run depth example on Windows make sure you have copied all example's dependent dlls into directory where example_depth binary is located, or just put them into OS system's default path.

Build depth example command#

Run the command from "FSDK_ROOT/examples".

$cmake -BBuild -H. -DCMAKE_INSTALL_PREFIX=./
    -DOpenCV_DIR=<absolute_path_to_opencv_install_directory>
    -Drealsense2_DIR=<absolute_path_to_realsense_sdk_install_directory>/lib/cmake/realsense2
    -DFSDK_ROOT=<absolute_path_to_luna_sdk_root_directory>
    -DWITH_DEPTH_EXAMPLE=ON
$ cmake --build Build --config Release --target install

Run depth example#

Run the command from "FSDK_ROOT/examples".

$ bin/example_depth <absolute_path_to_luna_sdk_data_directory>

Liveness Examples#

For these examples DLSDK_ROOT path should be specified. By default, LivenessEngine libraries are located near the FaceEngine libraries and DLSDK_ROOT same as DFSDK_ROOT.

Simple Liveness (example_liveness)#

Liveness example requirements#

To build this example OpenCV library (modules listed below) and cmake DWITH_LIVENESS_EXAMPLE option are required to be installed. By default, DWITH_LIVENESS_EXAMPLE option is disabled.

OpenCV should contain the next modules:

  • core
  • imgproc
  • highgui
  • videoio

Building Liveness example command#

Run the command from "FSDK_ROOT/build".

$ cmake ../examples -DCMAKE_BUILD_TYPE=Release -DWITH_LIVENESS_EXAMPLE=ON -DOpenCV_DIR=<path_to_opencv> -DFSDK_ROOT=.. -DLSDK_ROOT=..
$ make

Run Simple liveness example#

$ build/example_liveness/example_liveness <web_cam_id> <test_number>
Back to top