This application is used as reference code for developers to show how to use the C++ API to generate a runtime key. Once a runtime key is generated it must be activated to produce a token.
The SDK is developed in C++11 and you'll need glibc 2.27+ on Linux and Microsoft Visual C++ 2015 Redistributable(x64) - 14.0.24123 (any later version is ok) on Windows. You most likely already have these dependencies on you machine as almost every program require it.
To check if all dependencies are present:
- Windows x86_64: Use Dependency Walker on binaries/windows/x86_64/ultimateALPR-SDK.dll and binaries/windows/x86_64/ultimatePluginOpenVINO.dll if you're planning to use OpenVINO.
- Linux x86_64: Use
ldd <your-shared-lib>
on binaries/linux/x86_64/libultimate_alpr-sdk.so and binaries/linux/x86_64/libultimatePluginOpenVINO.so if you're planning to use OpenVINO.
- On x86-64, GPGPU acceleration is disabled by default. Check here for more information on how to enable it.
- On NVIDIA Jetson (AArch64), GPGPU acceleration is always enabled. Check here for more information.
If you don't want to build this sample by yourself then, use the pre-built versions:
- Windows x86_64: runtimeKey.exe under binaries/windows/x86_64
- Linux x86_64: runtimeKey under binaries/linux/x86_64. Built on Ubuntu 18. You'll need to download libtensorflow.so as explained here.
- Linux aarch64: runtimeKey under binaries/linux/aarch64.
- Raspberry Pi: runtimeKey under binaries/raspbian/armv7l
- Android: check android folder
- NVIDIA Jetson: runtimeKey under binaries/jetson/aarch64.
This sample contains a single C++ source file and is easy to build. The documentation about the C++ API is at https://www.doubango.org/SDKs/anpr/docs/cpp-api.html.
You'll need Visual Studio to build the code. The VS project is at runtimeKey.vcxproj. Open it.
- You will need to change the "Command Arguments" like the below image. Default value:
--assets $(ProjectDir)..\..\..\assets
- You will need to change the "Environment" variable like the below image. Default value:
PATH=$(VCRedistPaths)%PATH%;$(ProjectDir)..\..\..\binaries\windows\x86_64
You're now ready to build and run the sample.
Next command is a generic GCC command:
cd ultimateALPR-SDK/samples/c++/runtimeKey
g++ runtimeKey.cxx -O3 -I../../../c++ -L../../../binaries/<yourOS>/<yourArch> -lultimate_alpr-sdk -o runtimeKey
- You've to change
yourOS
andyourArch
with the correct values. For example, on Linux x86_64 they would be equal tolinux
andx86_64
respectively. - If you're cross compiling then, you'll have to change
g++
with the correct triplet. For example, on Linux host for Android ARM64 target the triplet would be equal toaarch64-linux-android-g++
.
To build the sample for Raspberry Pi you can either do it on the device itself or cross compile it on Windows, Linux or OSX machines. For more information on how to install the toolchain for cross compilation please check here.
cd ultimateALPR-SDK/samples/c++/runtimeKey
arm-linux-gnueabihf-g++ runtimeKey.cxx -O3 -I../../../c++ -L../../../binaries/raspbian/armv7l -lultimate_alpr-sdk -o runtimeKey
- On Windows: replace
arm-linux-gnueabihf-g++
witharm-linux-gnueabihf-g++.exe
- If you're building on the device itself: replace
arm-linux-gnueabihf-g++
withg++
to use the default GCC
After building the application you can test it on your local machine.
runtimeKey is a command line application with the following usage:
runtimeKey \
[--json <json-output:bool>] \
[--assets <path-to-assets-folder>]
Options surrounded with [] are optional.
--json
Whether to output the runtime license key as JSON string intead of raw string. Default: true.--assets
Path to the assets folder containing the configuration files and models. Default value is the current folder.--type
Defines how the license is attached to the machine/host. Possible values are aws-instance, aws-byol, azure-instance or azure-byol. Default: null. More info here.
- For example, on Raspberry Pi you may call the runtimeKey application using the following command:
LD_LIBRARY_PATH=../../../binaries/raspbian/armv7l:$LD_LIBRARY_PATH ./runtimeKey \
--json true \
--assets ../../../assets
- On NVIDIA Jetson you may use the next command:
LD_LIBRARY_PATH=../../../binaries/jetson/aarch64:$LD_LIBRARY_PATH ./runtimeKey \
--json true \
--assets ../../../assets
- On Linux x86_64 you may use the next command:
LD_LIBRARY_PATH=../../../binaries/linux/x86_64:$LD_LIBRARY_PATH ./runtimeKey \
--json true \
--assets ../../../assets
- On Linux aarch64 you may use the next command:
LD_LIBRARY_PATH=../../../binaries/linux/aarch64:$LD_LIBRARY_PATH ./runtimeKey \
--json true \
--assets ../../../assets
- On Windows x86_64, you may use the next command:
runtimeKey.exe ^
--json true ^
--assets ../../../assets
Please note that if you're cross compiling the application then you've to make sure to copy the application and both the assets and binaries folders to the target device.
Please read this if you're planning to run the SDK on Amazon AWS or Microsoft Azure.