documentation

Building the UWP Example
Level: Basic

For UWP you can find one example. We provide a CMakeLists.txt to generate the solutions to build the examples. The example can work with Assimp to load a model and display it with DirectX. This will render the model at the tracked position (contours in red: Tracking is lost, contours in green: object is tracked, contours in yellow: tracking is critical). Alternatively, you can use the example without Assimp. This will just show the debug image in which you can find the position of the model to track.

Requirements

For building the example, we use CMake and Visual Studio. For the simple example, which only displays the debug image, there are no additional requirements. If you want the model to be rendered, it must be linked to Assimp. You can download Assimp here

Building the Example

  1. Download and extract the vlSDK_Package.zip to your development folder.
  2. Unblock the vlSDK.dll if necessary (downloaded files might be seen as a security risk on Windows and might be blocked by default):
vlSDK_UWP_Example_UnblockExternalDLL.png
  1. Use CMake to generate a Visual Studio solution (in this tutorial we use cmake-gui):
    • Open cmake-gui
    • Enter your source and build path and click Configure
vlSDK_UWP_Example_01_CMakeGUI.png
  • Select the generator for this project according to your build system (we used Visual Studio 15 2017 Win64)
vlSDK_UWP_Example_02_SelectGenerator.png
.
  • The example requires the location of the license file. You have to add it to the solution via CMake (specify the VLSDK_LICENSE_PATH variable).
vlSDK_UWP_Example_03_AddLicense.png
  • After the generation process has finished, you probably encounter the error message, that Assimp has not been found. This is not a major problem. You will still be able to build and run the vlSDK example. The camera image will be visible, but no 3D model will be shown. To overcome the latter, the ASSIMP_DIR variable has to be specified.
vlSDK_UWP_Example_04_AddAssimp.png
  • Press Generate and afterwards press Open Project. In the Solution Explorer, you should see the vlSDK_SimpleModelTrackerExample.
vlSDK_UWP_Example_05_BuildSolutions.png
  • If you want to use a different .vl file and model, you have to add these into the vlSDK_SimpleModelTrackerExample/Resources folder and change the loading code inside vlSDK_SimpleModelTrackerExample/SimpleModelTrackerMain.cpp. The code needs to be changed in the constructor of vlSDK_SimpleModelTrackerExample:
    • std::string vlFilePath = "resources/car.vl"; should be the relative path of the .vl file.
    • std::string modelFilePath = "resources/car.obj.txt"; should be the relative path of the model. Important: The model should not end with .obj, because this leads to problems with Visual Studio.
  • After adjusting all variables, CMake has to be re-configured and you should be able to build the example.

Testing the Example

To run the example, you just need to deploy and start it. For the debug image, it is important, that your tracking configuration contains the parameter.

"showLineModel": true 

If this is enabled, you can see the camera image containing contours of the object to track (contours in red: tracking is lost, contours in green: object is tracked, contours in yellow: tracking is critical).

vlSDK_UWP_Example_07_TrackingDebugImage.png

If you build the example with Assimp, you can see the camera image containing the 3D object to track.

vlSDK_UWP_Example_08_Tracking3DModel.png