#
Getting Started - C++ SDK
Quick start guide for integrating VerifEye C++ SDK into your native applications.
#
📋 Prerequisites
Before you begin, ensure you have:
- ✅ C++17 compatible compiler (GCC 7+, Clang 5+, MSVC 2017+)
- ✅ CMake 3.15 or higher
- ✅ A VerifEye account and API key
- ✅ Platform-specific build tools
#
Platform-Specific Requirements
- Visual Studio 2017 or later
- Windows 10 SDK
- vcpkg (recommended for dependencies)
- GCC 7+ or Clang 5+
- Build essentials:
sudo apt install build-essential cmake - OpenSSL development libraries
- Xcode 10 or later
- Xcode Command Line Tools
- Homebrew (recommended)
- Xcode 12 or later
- iOS 12.0+ deployment target
- CocoaPods or Swift Package Manager
- Android NDK r21 or later
- CMake 3.10+
- Android Studio (recommended)
#
📥 Installation
#
Option 1: Package Managers
vcpkg install verifeye-cpp-sdk
sudo add-apt-repository ppa:realeyes/verifeye
sudo apt update
sudo apt install libverifeye-dev
brew tap realeyes/verifeye
brew install verifeye-cpp-sdk
# Podfile
pod 'VerifEye', '~> 1.0'
dependencies {
implementation 'com.verifeye:cpp-sdk:1.0.0'
}
#
Option 2: Manual Installation
- Download the SDK from releases page
- Extract to your project directory
- Add include and library paths to your build system
#
🚀 Quick Start
#
Step 1: Include Headers
#include <verifeye/face_liveness.h>
#include <verifeye/face_match.h>
#include <verifeye/deepfake.h>
#include <verifeye/age_gender.h>
#
Step 2: Initialize SDK
#include <verifeye/face_liveness.h>
int main() {
// Initialize with your API key
verifeye::FaceLiveness liveness("YOUR_API_KEY");
// Optional: Configure settings
verifeye::Config config;
config.timeout = 5000; // 5 seconds
config.offline_mode = false;
liveness.configure(config);
return 0;
}
#
Step 3: Load an Image
// Load from file
auto image = verifeye::Image::load("path/to/image.jpg");
// Or from memory buffer
std::vector<uint8_t> buffer = /* your image data */;
auto image = verifeye::Image::from_buffer(buffer.data(), buffer.size());
// Or from OpenCV Mat (if using OpenCV)
cv::Mat mat = cv::imread("image.jpg");
auto image = verifeye::Image::from_opencv(mat);
#
Step 4: Perform Verification
// Face Liveness Detection
auto result = liveness.detect(image);
if (result.is_live) {
std::cout << "Live face detected!" << std::endl;
std::cout << "Confidence: " << result.confidence << std::endl;
} else {
std::cout << "Spoof detected!" << std::endl;
}
#
📝 Complete Example
#include <verifeye/face_liveness.h>
#include <iostream>
int main() {
try {
// Initialize SDK
verifeye::FaceLiveness liveness("YOUR_API_KEY");
// Load image
auto image = verifeye::Image::load("face.jpg");
// Perform liveness detection
auto result = liveness.detect(image);
// Process result
if (result.is_live) {
std::cout << "✓ Live face detected!" << std::endl;
std::cout << " Confidence: " << result.confidence << std::endl;
std::cout << " Face bounds: ("
<< result.face_rect.x << ", "
<< result.face_rect.y << ", "
<< result.face_rect.width << ", "
<< result.face_rect.height << ")" << std::endl;
} else {
std::cout << "✗ Spoof detected!" << std::endl;
std::cout << " Spoof type: " << result.spoof_type << std::endl;
}
} catch (const verifeye::Exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
return 1;
}
return 0;
}
#
🔧 CMake Integration
#
CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(MyVerifEyeApp)
set(CMAKE_CXX_STANDARD 17)
# Find VerifEye package
find_package(VerifEye REQUIRED)
# Add your executable
add_executable(myapp main.cpp)
# Link VerifEye library
target_link_libraries(myapp PRIVATE VerifEye::VerifEye)
#
Build Commands
mkdir build
cd build
cmake ..
cmake --build .
#
🐛 Troubleshooting
#
Linker Errors
Problem: Undefined reference to VerifEye symbols
Solution:
- Ensure library path is in your linker search path
- Check that you're linking the correct library variant (debug/release)
- Verify architecture matches (x64, ARM64, etc.)
#
Runtime Errors
Problem: Library not found at runtime
Solution:
- Add library directory to
PATH(Windows) orLD_LIBRARY_PATH(Linux) - On macOS, use
install_name_toolor setDYLD_LIBRARY_PATH - Copy DLL/SO files to executable directory
#
API Key Issues
Problem: Authentication failed
Solution:
- Verify API key is correct
- Check API key permissions in dashboard
- Ensure no extra whitespace in API key string
#
📚 Next Steps
Explore the C++ SDK features:
- Face Liveness Detection
- Face Match Verification
- DeepFake Detection
- Age/Gender Verification
#
🆘 Need Help?
Last updated: 2025-01-13