Windows QuickStart
Last updated
Last updated
Windows platform provides sample demos in C++ and Java. The sample file path is sdk\samples. Sample currently does not support Windows XP operating system. As the sample uses C++11 standard code, it is recommended to use Visual Studio 2012 version and above.
Note:Sample is only used to assist customers in understanding how to use the SDK interface, test basic functions and provide sample code. During actual development, customers can reference the code, change the sample code or rewrite the entire code.
Note:SDK itself does not rely on OpenCV. OpenCV is only used for sample demonstrations. Sample requires OpenCV 3.2 version library to operate.
From the OpenCV official website, download windows 3.2.0 version of OpenCV, download link
After the download is completed, open the file and select a directory to install. The program will allow you to choose which file path to extract the OpenCV folder. For example, to extract to E drive, the file path is E:\opencv.
Add OpenCV library file path to system environment variables and execute the following steps:
1) Right click My Computer --> Properties
2) Advanced System Settings
3) Advanced -> Environment Variable
4) Add Path Environment Variable:
As OpenCV 3.2.0 version exe installation package only provides 64 bit version library, it is required to use OpenCV source code to compile 32 bit version OpenCV library. please refer to the compilation steps in the link (It is recommended to use source code compilation for 64 bit OpenCV library as well.)
SDK package provides Visual Studio test program. As the sample uses C++11 standard code, it is recommended to use Visual Studio 2012 version and above. Using sample_face_detect_1vs1 as example, test program configuration steps are as follows:
Open Visual Studio 2012 version and above, select Tools --> Files --> Open --> Item\Solution, select sdk\samples\c++\sample_face_detect_1vs1\sample_face_detect_1vs1.vcxproj and click Open.
Edit the Include Directories and Library Directories sequentially. Operating procedure: Solution Plan Resource Manager --> select Project --> right click on Properties --> VC++ Directory --> Include Directories\Library Directories.
Select the down arrow in Include Directories or Library Directories --> Edit.
Step 1 Add SDK Header file directory. Can use corresponding file path, for example: ../and../../../include;
Step 2 Add OpenCV header file directory. At this point, please make sure to add OpenCV header file directory's actual location. For example: E:\opencv\build\include, E:\opencv\build\include\opencv and E:\opencv\build\include\opencv2.
Step 3 Add SDK library file directory (can use corresponding file path) for example: sdk\libs\windows-x86_64 (in 32 bit system please select windows-x86);
Step 4 Add OpenCV library file directory: for example: E:\opencv\build\x64\vc14\lib.
Operating procedure: Solution Explorer --> select Project --> right click on Properties --> Linker --> Enter --> Additional Dependencies.
SDK library files:
Add SDK library file, stidface_professional.lib.
OpenCV library files:
OpenCV library files: if you are using self-compiled OpenCV library, In Release version, add:
In Debug version, add:
Note:When running the program, save the dll library with the same file names as lib files corresponding to OpenCV under exe directory or system directory.
If you are directly using the OpenCV library extracted using exe, then in Debug version and Release version add:
When running the program save opencv_world320.dll under exe directory or system directory.
After completing the above configurations, you can build the project. When running the program, you need to save the SDK library file stidface_professional.dll and exe files under the same directory.
In this sample, you need to save the XXXXXX.lic authorization file into the license_filepath set in the sample configuration file (XXXXX.ini). When running the sample, the SDK authorization interface will load the authorization file XXX.lic in this file path. The authorization interface must be executed successfully first before any other interfaces can be used.
Special note: When running the sample, if the license file has been changed, please delete the senseid_facepro_sn folder (this folder corresponds to the activation_code_dir directory in the configuration file XXX.ini and can be customized) as well as all the activation code files in the folder. This is because the lic files and activation code files corresponds to each other.
Please reference the Authorization Interface Guide for authorization interface definitions. The sample below shows typical workflows for online activated license:
stid_face_professional_online_activate_license to load provided license content.
stid_face_professional_online_activate_license to connect to the web-activated license.
stid_face_professional_online_activate_license to output the newly-activated license content.
stid_face_professional_load_license_content to load new license content.
stid_face_professional_load_license_content to return to STID_OK and confirm successful authentication.
stid_license_release_content to release the license content and end the workflow.
To execute parameters, please reference the third section in this sample documentation - 'Introduction to Sample Functions and Test Walkthrough'.
From the official website, download Windows 3.2.0 version of OpenCV, download link.
After the download is completed, open the file and select a directory to install. The program will extract the OpenCV folder to the directory you selected. For example, to extract to E drive, the file path is E:\opencv.
For 32 bit system, copy E:\opencv\build\java\x86\opencv_java320.dll to C:\windows\system32. For 64 bit system, you need to copy twice: Copy E:\opencv\build\java\x86\opencv_java320.dll to C:\windows\syswow64, at the same time copy E:\opencv\build\java\x64\opencv_java320.dll to C:\windows\system32.
SDK package provides eclipse test program. Using Detect_OneVSOne as example, the test program steps are as follow:
Open eclipse, choose Tools -> File -> Import; select “General” -> “Existing Projects Into Workspace”, click Next; select “Select Root Directory” -> ”Browse..”, select Java sample in SDK file directory:SDK \samples\java\java_samples\Detect_OneVSOne and click confirm.
(1) Configure JRE System Library
Right click demo project name --> Properties -> Java Build Path -> Libraries, select all options, right click on "Remove"; right click on "Add Library", a dialog box will pop up, select "JRE System Library", click below "Next"; select "Workspace default JRE", click "Finish".
(2) Add jar files required for test program
When testing java sample, you need to first download and parse out the jar file gson-2.3.1.jar in json file, download link.
Right click on Demo Project Name -> Properties -> Java Build Path -> Libraries -> Add External JARs...;
Select the jar file under OpenCV installation directory: opencv\build\java\opencv-320.jar;
Select jar file under sdk directory: sdk\samples\java\StidFaceProfessional.jar, and parse out the jar file gson-2.3.1.jar in json file;
Click below "Apply and Close".
(3) Copy SDK library to system directory
When running a sample, you need to copy sdk\libs\windows-x86_64(windows-x86)\stidface_professional.dll和samples\java\jni_libs\x86(x86_64)\jni_facepro.dll to windows system directory:
For 32 bit system, copy to C:\windows\system32.
For 64 bit system, you need to copy twice (stidface_professional.dll和jni_facepro.dll): Copy 32 bit library to C:\windows\syswow64,at the same time copy 64 bit library to C:\windows\system32;
(4) After completing the above configurations you can build the project. To execute parameters, please reference the third section in this sample documentation - 'Introduction to Sample Functions and Test Walkthrough'.
In this sample, you need to save the XXXXXX.lic authorization file into the license_filepath set in the sample configuration file (XXXXX.ini). When running the sample, the SDK authorization interface will load the authorization file XXX.lic in this file path. The authorization interface must be executed successfully first before any other interfaces can be used.
Special note: When running the sample, if the license file has been changed, please delete the senseid_facepro_sn folder (this folder corresponds to the activation_code_dir directory in the configuration file XXX.ini and can be customized) as well as all the activation code files in the folder. This is because the lic files and activation code files corresponds to each other.
Please reference the Authorization Interface Guide for authorization interface definitions. The sample below shows typical workflows for online activated license:
stid_face_professional_online_activate_license to load provided license content.
stid_face_professional_online_activate_license to connect to the web-activated license.
stid_face_professional_online_activate_license to output the newly-activated license content.
stid_face_professional_load_license_content to load new license content.
stid_face_professional_load_license_content to return to STID_OK and confirm successful authentication.
stid_license_release_content to release the license content and end the workflow.
Note: 1. Parameters can be classified into command type parameters and parameters in configuration files. Command type parameters provide the required parameters for specially-defined functions in sample; parameters in configuration files provide the basic configurations in various samples such as authorization file paths and model file paths. 2.When executing a sample, if the license files have been changed, please delete the senseid_facepro_sn folder as well as all the activation files within the folder.
Verify configuration instruction set, face test, facial feature extraction and face comparison functions.
i).Command line:
[ini file path] [image A path] [image B path] ([image face orientation])
-ini file path: Configure file path
-image A path: File path of image A
-image B path: File path of image A
-image face orientation: Enable selection of parameters and input of face orientation in photos (by default it detects two photos with the same orientation). 0 represents up, 1 represents left, 2 represents right, 3 represents down; if no parameters exists, then it represents up orientation.
ii).Configuration files:
license_filepath: Authorization files
activation_code_dir: File path where the activation code is saved
alignment_model_filepath: Face test model file path
verify_model_filepath: Facial features extraction model file path
compare_model_filepath: Facial feature comparison model file path
detector_config: Face test model detector configuration: large face mode, small face mode or combination of large and small face mode
alignment_count: (can be selected) Key facial alignment iteration count. Increasing this count can raise the alignment accuracy but will decrease efficiency. Value range (0x1 ~ 0xff)
compare_threshold: Face comparison threshold. If the comparison score exceeds the threshold then evaluate the image as the same person. Value range (0,1)
Input: two sets of photos and photo orientation
Output: Face comparison score and evaluate if the photos show the same person
Verify face comparison. Facial feature extraction function. Save all the photo features in a particular folder as a json file. Provide face library for use by other face recognition sample.
i).Command line:
[ini file path] [search image dir] [output feature file name] ([image face orientation])
-ini file path: configuration file path
-search image dir: photo folder where facial features for extraction are saved
-output feature file name: json file name for photo features
-image face orientation: Enable selection of parameters and input of face orientation in photos (by default it detects two photos with the same orientation) 0 represents up, 1 represents left, 2 represents right, 3 represents down; if no parameters exists, then it represents up orientation.
ii).Configuration files:
license_filepath: Authorization files
activation_code_dir: File path where the activation code is saved
alignment_model_filepath: Face test model file path
verify_model_filepath: Facial features extraction model file path
detector_config: Face test model detector configuration - large face mode, small face mode or combination of large and small face mode
alignment_count: (can be selected) Key facial alignment iteration count. Increasing this count can raise the alignment accuracy but will decrease efficiency. Value range (0x1 ~ 0xff)
Input: Photo folder file name Output: Folder where photo feature json format files are saved
Verify monocular tracking. Frame selection based on facial quality assessment. Monocular face assessment. Facial feature extraction. Facial feature 1vsN search function. Monocular camera liveness check. Comparison with facial feature library. Facial identity recognition simulation.
i).Command line:
[ini file path] [feature file name]
-ini file path: Configuration file path
-feature file name: Facial feature json file name
ii).Configuration files:
license_filepath: Authorization files
activation_code_dir: File path where the activation code is saved
singleliveness_model_filepath: Monocular facial liveness model file path
calcpose_model_filepath: Model for calculation of face orientation
verify_model_filepath: Facial features extraction model file path
compare_model_filepath: Comparison model file path
singleliveness_track_config: Monocular tracking configuration. Only supports large face mode or small face mode.
rgb_camera_index: RGB camera index
camera_face_orientation: Camera and face orientation
hack_threshold: Liveness check threshold. If liveness score exceeds the threshold then evaluate the image as fake. Value range (0,1).
frame_selector_threshold: Face quality assessment configuration settings. Includes face quality and face orientation parameter range. For details of configuration info, please refer to header file and configuration file test.ini.
Input: Photo feature json file that provides N-comparison library Output: Returns monocular liveness check score to evaluate if person is real. Based on the comparison score, print out the names of photos with the highest scores compared to the photo being evaluated.
In the sample, you can designate function modules: 1. Frame selection: Face quality assessment and face orientation calculation. 2. Frame selection + liveness check function. 3. Frame selection + liveness check + 1vsN search function.
i).C++ sample:
Use macro definition to open different function modules. Frame selection: open macro TRACK_FRAMESELECTOR.
Frame selection + liveness check: open macro TRACK_FRAMESELECTOR and macro TRACK_FRAMESELECTOR_LIVENESS.
Frame selection + liveness check + 1vsN search: open macro TRACK_FRAMESELECTOR, macro TRACK_FRAMESELECTOR_LIVENESS, macro TRACK_FRAMESELECTOR_LIVENESS_1VSN.
ii).Java sample:
Use static variable definition to open different function modules. Frame selection: TRACK_FRAMESELECTOR set as 1.
Frame selection + liveness check: TRACK_FRAMESELECTOR set as 1. TRACK_FRAMESELECTOR_SINGLELIVENESS set as TRACK_FRAMESELECTOR & 1.
Frame selection + liveness check + 1vsN search: TRACK_FRAMESELECTOR set as 1, TRACK_FRAMESELECTOR_SINGLELIVENESS set as TRACK_FRAMESELECTOR & 1;TRACK_FRAMESELECTOR_SINGLELIVENESS_1VSN set as TRACK_FRAMESELECTOR_SINGLELIVENESS & 1;
Verify binocular tracking. Frame selection based on facial quality assessment. Binocular face assessment. Facial feature extraction. Facial feature 1vsN search function. Binocular camera liveness check. Comparison with facial feature library. Facial identity recognition simulation.
i).Command line:
[ini file path] [feature file name]
-ini file path: Configuration file path
-feature file name: Facial feature json file name
ii).Configuration files:
license_filepath: Authorization files
activation_code_dir: File path where the activation code is saved
binocularliveness_model_filepath: Binocular liveness check model file path
calcpose_model_filepath: Model for calculation of face orientation
verify_model_filepath: Facial features extraction model file path
compare_model_filepath: Comparison model filepath
binocularliveness_track_config: Binocular tracking configuration. Only support large face model or small face model.
rgb_camera_index: RGB camera index
infrared_camera_index: Infrared camera index
camera_face_orientation: Camera and face orientation
hack_threshold: Liveness check threshold. If liveness score exceeds the threshold then evaluate the image as fake. Value range (0,1)
frame_selector_threshold: Face quality assessment configuration settings. Includes face quality and face orientation parameter range. For details of configuration info, please refer to header file and configuration file test.ini.
In the sample, you can designate function modules: 1. Frame selection: Face quality assessment and face orientation calculation. 2. Frame selection + liveness check function. 3. Frame selection + liveness check + 1vsN search function.
i).C++ sample:
Use macro definition to open different function modules. Frame selection: open macro TRACK_FRAMESELECTOR.
Frame selection + liveness check: open macro TRACK_FRAMESELECTOR and macro TRACK_FRAMESELECTOR_LIVENESS.
Frame selection + liveness check + 1vsN search: open macro TRACK_FRAMESELECTOR, macro TRACK_FRAMESELECTOR_LIVENESS, macro TRACK_FRAMESELECTOR_LIVENESS_1VSN.
ii).Java sample:
Use static variable definition to open different function modules. Frame selection: TRACK_FRAMESELECTOR set as 1.
Frame selection + liveness check: TRACK_FRAMESELECTOR set as 1, TRACK_FRAMESELECTOR_BINOCULARLIVENESS set as TRACK_FRAMESELECTOR & 1.
Frame selection + liveness check+ 1vsN search: TRACK_FRAMESELECTOR set as 1, TRACK_FRAMESELECTOR_BINOCULARLIVENESS set as TRACK_FRAMESELECTOR & 1;TRACK_FRAMESELECTOR_BINOCULARLIVENESS_1VSN set as TRACK_FRAMESELECTOR_BINOCULARLIVENESS & 1;
Note: It is recommended to use notepad++ to edit ini configuration files and save as utf-8 code format.
Input: Photo feature json file that provides N-comparison library Output: Returns binocular liveness check score to evaluate if person is real. Based on the comparison score, print out the names of photos with the highest scores compared to the photo being evaluated.