In order to configure and manage the tracking pipeline, VisionLib uses specific tracking configuration files. For instance, here you can set the reference to the tracking target (e.g. the file of a 3D model), control and tweak initial tracking parameters, specify an image source (which can be a live video or an image stream), or define an init pose for the model tracker. In essence, the configuration files define algorithms, parameters and sources and tell the VisionLib tracking engine what to do.
The tracking configuration file format has a .vl
extension and a similar structure as the JSON text. Including additional support for comments using //
and no support for unicode characters.
NOTE: If you plan to use .vl or .json files within your own code, beware that not all JSON parsers understand the use of comments (//
).
The following sections contain a detailed explanation of the example above.
Tracking configurations contain a header with a file type
and a corresponding file version
:
This allows the tracking system to identify the used file format.
"VisionLibTrackerConfig" files with version 1 contain three sections:
The tracker
section is mandatory and describes the tracker. There will be different tracker types in the future, so the tracker section contains a header similar to the file header:
The type
contains a string with the tracker type. The version
contains a version number for the used tracker. This version number makes sure that existing tracking configurations still work the same after updating the VisionLib plugin.
The tracker
section also contains a list with parameters:
The available parameters depend on the tracker type and version:
The input
section is an optional section. It allows you to specify the source of the input images for the tracking:
The example above defines three image sources:
deviceID
, position
and unit
are all optional. If no matching camera was found, the first available camera will be used.deviceID
to the value of the recording device (in this case SurfacePro4
). While the other image sources use the initial pose specified inside the "tracker" section, this instance will use a custom initial pose.The useImageSource
attribute contains the name of the image source which should be used. This simplifies switching between image sources.
If the input
section is not defined, the first available camera will be used.
Each image source in the imageSources
array has the following structure:
The available attributes for data
depend on the type
of the image source:
Parameter | Type | Default Value | camera | inject | imageSequence | uEye | video |
---|---|---|---|---|---|---|---|
calibration | Camera Calibration | yes | yes | yes | yes | yes | |
Specifies the calibration for the given image source. It contains the current resolution and the focal length in x and y direction. It can also contain the parameter for undistortion and extrinsicData for this camera. | |||||||
calibrationURI | string | yes | yes | yes | yes | yes | |
URI of a file containing the camera calibration parameter for the current camera. | |||||||
device | string | yes | yes | yes | no | yes | |
DEPRECATED. Please use | |||||||
deviceID | string | yes | yes | yes | yes | yes | |
Can be used to prefer a specific camera by a name. The camera with the correct | |||||||
ignoreImageSequenceIntrinsics | bool | false | no | yes | no | no | no |
If this parameter is set to | |||||||
initPose | extrinsicData | yes | yes | yes | no | yes | |
Can be used to specify an init pose for an input source. This is useful for testing different input sources inside the same tracking configuration. It will only be set in the tracker, if the tracker does not specify an init pose itself. Please take a look at modelTracker for a more detailed description of the init pose property. | |||||||
position | string | yes | no | no | no | no | |
Can be used to prefer a specific camera by its position on the device. Possible values are "front" and "back". This has a lower priority than | |||||||
resolution | string | "default" | yes | no | no | no | no |
Requests a specific resolution for the camera. A detailed description can be found at the "Setting up a higher resolution" section. | |||||||
scale | float | 1.0 | no | yes | no | no | no |
DEPRECATED: Use | |||||||
simulateMobileRecording | bool | false | no | yes | no | no | yes |
Should be set to | |||||||
SmartDownsamplingDisabled | bool | false | yes | no | yes | yes | no |
Disables the automatic downsampling algorithm. If this parameter is | |||||||
trackingImageSize | int | 640 | yes | yes | yes | yes | yes |
The image will be downsampled for tracking to improve performance. This parameter specifies the maximal size of the image for tracking. If the used image is smaller than the specified | |||||||
undistort | bool | false | yes | yes | yes | yes | yes |
The undistort parameter k1 - k5 of the Camera Calibration will be used to remove the distortion of the input image. The parameters are equivalent to the first five | |||||||
unit | int | 0 | yes | no | no | no | no |
Index of the camera, which should be used for image capturing. This has a lower priority than | |||||||
uri | string | no | yes | no | no | yes | |
URI specifying the source of the image sequence or video. For videos, a lot of formats are supported under non-UWP Windows using the provided ffmpeg dll. | |||||||
useColor | bool | true | yes | yes | no | yes | no |
This option allows VisionLib to recognize edges between pixels with the same intensity value, if they differ in hue or saturation. It can increase the tracking quality, while having the drawback of needing more resources and processing power. Turn this setting on, if the object can not be distinguished from the background just by intensity or if internal edges should be used, that are easily separated by their hue. |
This feature is currently only available on iOS, Android and Windows.
By default, VisionLib uses a quiet low resolution (960x540 on iPhone and 640x480 on iPad/Android devices). In order to change the resolution, we introduced the resolution
field in the data
section of the camera image source. Please add the following lines to your tracking configuration in order to influence the resolution:
Possible values for resolution
are:
default
- Would be the same as not setting the resolution
at all (will use the above described resolutions).auto
- Will find the resolution, which suits the performance of the device best. For example, an iPad Air 1/2 will yield in a 640x480 resolution, while devices shipping an A9 processor will use a 1024x768 resolution.low
- Will force the lowest resolutionmedium
- Will force not to use a low resolutionhigh
- Will use a very high resolutionIn general, we recommend to set the resolution
to auto
to preserve the transportability character of tracking configuration files in future.
Note: The auto
setting will be defaulted in more future versions and is preserved for unified backwards compatibility right now.
VisionLib tries to separate the image to be displayed and processed. Using high resolution camera images on devices. VisionLib might decide to downsample the image on certain processes. This leads to a more performant user experience on the costs of tracking quality. A high frame rate is usually a good compensator, on the other hand. In order to force VisionLib to NOT allow downsampling on the tracking pipeline, you can set the SmartDownsamplingDisabled
parameter to true
(by default false
) in the input section. Exceptions that do not downsample by default are loading video or image sequences, and any type of camera calibration.
You can use several integrated schemes when passing URIs to VisionLib. E.g. a common way to reference files in the tracking configuration using schemes is "modelURI": "project-dir:VLMiniCar.obj"
.
Have a look at File Access for a list of available schemes and more information on the use of URIs with VisionLib.
The VisionLib SDK allows you to overwrite JSON parameters when initializing with a tracking configuration.
Parameters are passed at the end of the URI like in the following example:
scheme:/pathToVL.vl?parameter1=value¶meter2=value
You can address the keys using a dot separated notation or change values inside arrays by using brackets []
(see examples below).
You can overwrite nearly all parameters. Some useful examples are given below:
Show line model and enable extendible tracking:
Open the tracking configuration from a web server, select a specified camera and use it:
Please check the tracking configuration file section for more information on the parameters.