Like the ModelTrackingSetup
scene for all other platforms (see Using the Model Tracking Setup Scene), the corresponding scene on HoloLens 2 can be used to adjust parameters, observe the effect of the changes and save the adjusted configuration into a vl-file.
The scene can be found in our Mixed Reality Toolkit example. This has to be included in your Unity project manually. For more details see our corresponding Mixed Reality Toolkit page.
Note: Since this scene uses components which are only available on HoloLens 2, this example will not be usable on HoloLens 1.
This section outlines a workflow allowing you to customize the tracking parameters for a new model on HoloLens and consequently use these parameters in your own application. Each step in the workflow is described in its own subsection in the following.
As a first step, you must add the model you intend to track to the HoloLens2ModelTrackingSetup
scene and make it usable as a tracking target:
StreamingAssets/VisionLib/Examples/HoloLens/ModelTracking/Model
.HoloLensModelTrackingConfiguration.vl
located at StreamingAssets/VisionLib/Examples/HoloLens/ModelTracking
and modify the the modelURI
parameter: Replace the current parameter value (project-dir:Models/VLMiniCar.obj
) with project-dir:Models/YOUR_MODEL_FILE_NAME
.HoloLens2ModelTrackingSetup
scene and import your object.GameObject
VLMiniCar
(under MixedRealitySceneContent > VLSceneContent
in the scene hierarchy) with your model.GameObject
with your model is enabled at all times, keeping it visible and available as a guide, both for tracking as well as for adjustment of the initial pose (see the following section).In general, the default InitPose does not work for all objects and requires adjustment:
MixedRealitySceneContent > VLSceneContent
in the scene's hierarchy. Also ensure the GameObject
containing your model is enabled and visible.GameObject
containing your model in the hierarchy. This snaps the scene view to the model regardless of its location and size.VLHoloLensInitCamera
under VLTracking
in the hierarchy by single clicking it. An inset camera preview window becomes visible in the bottom right of the scene view.Align with view
button on the VLHoloLensInitCamera
component. This snaps the selected VLHoloLensInitCamera
to the view you are seeing.VLHoloLensInitCamera
again.Deployment and starting of a scene on HoloLens is described in the general tutorial (see HoloLens Model and Poster Tracker Tutorial).
Having started the scene, look at the palm of your hand. In the menu, press the Parameters On
button. Adjust the parameters so the tracking of your object works well. Our Optional Tracking Parameters page gives an overview over these parameters and their function.
After you finished adjusting your parameters, look at the palm of your hand again. In the menu, press the Save Configuration
button. A notification appears after the configuration has been saved.
To make use of the saved vl-file in your own scene you have to do the following steps:
Internal Storage/Videos/Captures/VisionLib/savedTrackingParameterConfiguration.vl
into the StreamingAssets
folder of your Unity project and give it an adequate name.StreamingAssetFolder
of your Unity project. Ensure the modelURI
parameter in the configuration file is correct. In the simplest case, place the model in the same folder as the configuration file and use the project-dir:
scheme (see File Access).StreamingAssetFolder
and drag it into the hierarchy of your scene as a child of the SceneContent
GameObject..vl
file in the VLTracking > TrackingConfiguration
script under the Tracking Configuration File
parameter.For details on setting up tracking for your own model on HoloLens see HoloLens Model and Poster Tracker Tutorial.
This section covers the purpose of the controls available in the HoloLens2ModelTrackingSetup
scene. The controls are linked with the hand menu, so you have to look at the palm of your hand in order to show this menu. The following image shows an overview of the available controls:
Legend:
The button in the top left of the menu (see (1) in the overview image above) toggles a window in the background showing the debug image. This greyscale image is the one on which tracking is performed. The line model is overlaid on top.
If you enable the parameters, the application will automatically enable the debug image. After finishing parameter adjustment and closing the parameter panel, the debug image will be disabled.
The Pause Tracking
button in the top right of the menu (see (2) in the overview image above) halts tracking. The object will then remain at the current position until you Resume
the tracking again. This feature might be useful, if you only want to position the object once and save processing power on HoloLens.
The Parameters On
button (see (3) in the overview image above) enables the parameter panel and the debug image. In this panel, you can see buttons for different parameters, which can be selected to adjust the corresponding parameter. An overview over these parameters and their meaning can be found at the Optional Tracking Parameters page. The debug image in the background should help to see the effect of the parameters on the tracking.
Selecting a parameter displays a slider for its adjustment. The line model will only be update after you finished setting the parameter.
The only parameter without a slider is the field of view. It is only used on HoloLens and not available on other platforms. In the following graphic, you can see the effect of this parameter: It adjusts the area covered by the camera image. A narrow field of view results in better tracking results, given that the user is looking directly at the target object and that the object fits entirely inside the camera image. A wide field of view helps stabilize the tracking in cases where the user is unable to see the object in its entirety. In other words: If the object is either very close or very large.
The Reset
button (see (4) in the overview image above) resets tracking and returns to initialization mode. In other words, the currently tracked pose is dropped and the tracking state switches to lost. Note for advanced users: This internally performs a Reset Hard
command.
The Save Configuration
button (see (5) in the overview image above) saves the current tracking parameters and init pose for the tracker into a .vl configuration file.
By default this file's URI is capture-dir:VisionLib/savedTrackingParameterConfiguration.vl
. This folder is accessible via the Windows File Explorer on the HoloLens device under the path Internal Storage/Videos/Captures/VisionLib/savedTrackingParameterConfiguration.vl
A custom URI can be set via Save Configuration URI
in the hierarchy on Model Tracker Parameters
on VLTracking
> VLModelTracker
. File schemes (see File Access) are supported. On the HoloLens, we recommended using the capture-dir
scheme to be able to access the file from the Windows File Explorer.