ARUWPMarker Options in HoloLensARToolKit v0.1

This post is part of documentation of HoloLensARToolKit, version v0.1.

ARUWPMarker

ARUWPMarker.cs is one of the main scripts used in HoloLensARToolKit. In this post, the options of this script are listed and discussed, along with common usecases.

In Unity project using HoloLensARToolKit package, each actual marker must have one corresponding ARUWPMarker script.

ARUWPMarker is very similar to ARMarker in ARToolKit. However, because currently HoloLensARToolKit does not support NFT (Natural Feature Marker) of ARToolKit, that part of attributes are not included in ARUWPMarker.

When ARUWPMarker script is attached to some Unity GameObject, its inspector window looks like this:

and the inspector behavior of ARUWPMarker.cs is controlled by ARUWPMarkerEditor.cs located at Assets/Editor/.

Type

This field configures the type of the current marker. Available options are: single, single_barcode, single_buffer, and multi.

  • single: single pattern marker, e.g. Hiro marker and Kanji marker. If single is selected, then the field File Name will appear. Root path of file name is Assets/StreamingAssets/.
  • single_barcode: single barcode marker (as known as single matrix marker). If it is selected, then the field Barcode ID will appear.
  • single_buffer: single pattern marker, but directly specified by a byte buffer. It should be set at runtime using function ARUWPMarker::setSingleBufferBuffer.
  • multi: multi marker consists of multiple barcode marker. If it is selected, then the field File Name will appear to ask for the configuration file. Root path of the configuration file is Assets/StreamingAssets/ as well.

Size in mm

You need to specify the size of the marker (outer border), when single or single_barcode marker is used.

Show Options

If it is checked, filtering options of marker tracking can be configured, including: Continuous Pose Estimation and Confidence Cutoff. Please refer to ARToolKit documentation for details about filtering.

Visualization Target

Marker pose provided by the algorithm contains position and orientation. This information should be applied to some object in the scene so that augmented reality experience is created. This field controls the target GameObject that receives the pose of marker.

Anchored to World

HoloLens is constantly localizing itself in the room.

The default augmented reality experience of HoloLens is creating an AR scenario within the room, and let the user explore it. Therefore, HoloLensARToolKit package takes advantage of its localization algorithm, to make the virtual object appear in the world coordinate system. The benefit of doing it is that, when the marker is occluded, it stays at the same position in the room. It is desired when the line-of-sight of the HoloLens camera is blocked, but the tracked object is not moving in the environment.

If this field is not checked, then all the pose update is achieved in the camera coordinate system. The virtual object stays at the same pose with respect to the camera, when the tracking is lost.

Apply Rotation

Whether rotation of tracked marker should be applied to the Visualization Target.

Apply Translation

Whether translation (position) of tracked marker should be applied to the Visualization Target.

Confidence Textbox and Confidence Colorbox

If the marker type is single, single_barcode or single_buffer, then ARToolKitUWP provides a score representing the confidence of tracking, ranging from 0 to 1. The score could be visualized in a textbox (Unity::UI::Text object) and in a colorbox (Unity::UI::Image object).

Examples

Hiro Marker

Matrix Marker (Number 0)

Cube Marker

Finally

You can access more articles describing the implementation details of HoloLensARToolKit in my blog, simply clicking on the tag: hololens-artoolkit.

Thanks for reading!


Coorindate Systems in HoloLensARToolKit v0.1

This post is part of documentation of HoloLensARToolKit, version v0.1.

Coordinate System of Unity3D

Unity3D uses left-hand coordinate systems to define transformations. Yes, it is.

The above is a screenshot of a Unity transformation. The x, y, z axis directions are visualized with different colors, and are following left-land rules. In addition, rotation along axis is applied clockwise, unlike counter-clockwise in right-hand coordinate systems. If you are accustomed to right-hand coordinate systems as I do, please pay more attention when working with raw 4x4 matrices.

Coordinate System of ARToolKit

ARToolKit uses right-hand coordinate systems. Since OpenGL is right-handed as well, it is very comfortable to visualize the tracking result of ARToolKit by OpenGL.

In the official Unity package of ARToolKit, arunity, there exists a utility function

public static Matrix4x4 LHMatrixFromRHMatrix(Matrix4x4 rhm)

that converts the tracking result of ARToolKit to Unity environment.

Coordinate System of HoloLensARToolKit

It took me a while to figure out the complicated conversions happened inside ARToolKit, inside Unity, and in-between.

In this project, left-hand coordinate system is applied everywhere. That means, the multi-marker configuration, the tracking algorithm, the returned tracking result from native code, and of course, the visualization inside Unity. It will be elaborated by the following examples.

Single Pattern Marker

Hiro marker and Kanji marker are examples of single pattern marker. They are defined using binary files.

The coordinate system associated with a single pattern marker looks like this:

Single Matrix Marker

Single matrix marker is pre-defined in ARToolKit. User is only required to provide the ID and type of matrix code associated when using them in applications. The coordinate system associated with a matrix marker looks like this:

Multi Matrix Marker

Multi matrix marker is defined by a configuration file, that contains

  • total number of matrix markers
  • the ID of each matrix marker
  • the transformation from the multi-matrix marker to individual matrix marker.

Multi-matrix marker is useful for robust tracking, thus is much more useful for accuracy-critical augmented reality applications. Iterative Closest Point (ICP) algorithm is the underlying method for the fusion of tracking information.

The transformation field in the configuration file is also left-handed, which is different from original ARToolKit. That is to say, you have to modify the marker configuration file you used before.

For example, for a multi-barcode-4x3 configuration, the coordinate system of the multi-marker looks like this:

Thus, the transformation field of marker 0 (top-left), will be:

1.0  0.0  0.0  -105.00
0.0  1.0  0.0  -70
0.0  0.0  1.0  0.0

instead of

1.0  0.0  0.0  -105.00
0.0  1.0  0.0  70
0.0  0.0  1.0  0.0

in original ARToolKit.

Finally

You can access more articles describing the implementation details of HoloLensARToolKit in my blog, simply clicking on the tag: hololens-artoolkit.

Thanks for reading!