Marker Tracker

Related documentations
Marker
Tracker Coordinate System in Unity

1. Definition
2. Video See-Through
2.1. Make Marker Tracker Scene
2.2. Set Target Marker
2.3. Start / Stop Tracker
2.4. Use Tracking Information
2.5. Change Tracking Mode
3. Optical See-Through
3.1. Make Marker Tracker Scene


1. Definition

By recognizing and tracking the provided markers, you can augment images, 3D objects or videos especially when there are plenty of targets. 8,192 markers will be provided which were developed by MAXST itself.


2. Video See-Through

2.1. Make Marker Tracker Scene

  1. Install the MAXST AR SDK for Unity.

  2. Create the new scene.

  3. Delete the Main Camera(default) and add MarkerGroup at ‘Project Tab > Assets > MaxstAR > Prefabs > ARCamera, MarkerGroup’ to the Scene.

    markerPrefab

  4. Create an empty object and add 'Assets > MaxstARSamples > Scripts > MarkerTrackerSample’ as a component.

    markerSample

  5. Go to 'MarkerGroup > Inspector > Marker Size' and input the size of the actual marker in meters. If the marker size is 10cm, enter 0.1(If the markers' size is various, uncheck 'Apply All' under Marker Size and enter each size at MarkerTrackable). markerSize

  6. Copy the MarkerTrackable to the MarkerGroup as many markers as it is used in the AR. Then enter the Marker ID(0~8191) for each MarkerTrackable.

    markerID

  7. Create a content which will be augmented (eg. cube) as a child of ImageTrakable and adjust its size and position.

  8. After clicking 'play' button, the content will be augmented once you scan the target markers.
    *You can download target marker files from Marker.

  9. Connect the smart glasses to the PC to build, Select ARCamera > Configuration > Wearable Type to None and build.

    SmartGlasses_Unity_SetupGuide7_.png

2.2. Set Target Marker

Once you enter the target marker size (m) and call the AddTrackerData, you can track the marker in real scale. Refer to the following code to set a target marker.

>MarkerTrackerSample.cs

private void AddTrackerData()
	{
		foreach (var trackable in markerTrackableMap)
		{
			if (trackable.Value.TrackerDataFileName.Length == 0)
			{
				continue;
			}

			TrackerManager.GetInstance().AddTrackerData(trackable.Value.TrackerDataFileName);
TrackerManager.GetInstance().AddTrackerData("{\"marker\":\"set_scale\",\"id\":\"0\", \"scale\":0.042}", false);
		}

		TrackerManager.GetInstance().LoadTrackerData();
	}

2.3. Start / Stop Tracker

After setting the markers, refer to the following code to start / stop the tracker.

>MarkerTrackerSample.cs

void Update()
	{
…
	TrackerManager.GetInstance().StartTracker(TrackerManager.TRACKER_TYPE_MARKER);
…
	}
	void OnApplicationPause(bool pause)
	{
	…
			TrackerManager.GetInstance().StopTracker();
	…
	}
	void OnDestroy()
	{
…
		TrackerManager.GetInstance().StopTracker();
		TrackerManager.GetInstance().DestroyTracker();
	…
}

2.4. Use Tracking Information

Refer to the following code to use the tracking information.

>MarkerTrackerSample.cs

	void Update()
	{
	…
TrackingResult trackingResult = state.GetTrackingResult();

		for (int i = 0; i < trackingResult.GetCount(); i++)
		{
			Trackable trackable = trackingResult.GetTrackable(i);
          	  	int markerId = -1;
            		if (int.TryParse(trackable.GetName(), out markerId)) {
                			if (markerTrackableMap.ContainsKey(markerId))
                			{
                    			markerTrackableMap[markerId].OnTrackSuccess(
trackable.GetId(), trackable.GetName(), trackable.GetPose());
                			}
            		}
		}
	}

2.5. Change Tracking Mode

4 Tracking Modes of Marker Tracker:

NORMAL_TRACKING, ENHANCED_TRACKING, JITTER_REDUCTION_ACTIVATION, JITTER_REDUCTION_DEACTIVATION

  • NORMAL_TRACKING: Default Setting. Traceable multiple target image.
TrackerManager.GetInstance().SetTrackingOption(TrackerManager.TrackingOption.NORMAL_TRACKING);
  • ENHANCED_TRACKING: This feature tracks the marker intensively that recognizes the first.
TrackerManager.GetInstance().SetTrackingOption(TrackerManager.TrackingOption.ENHANCED_TRACKING);
  • JITTER_REDUCTION_ACTIVATION: Jitter reduction.
TrackerManager.GetInstance().SetTrackingOption(TrackerManager.TrackingOption.JITTER_REDUCTION_ACTIVATION);
  • JITTER_REDUCTION_DEACTIVATION: Disable the jitter reduction option.
TrackerManager.GetInstance().SetTrackingOption(TrackerManager.TrackingOption.JITTER_REDUCTION_DEACTIVATION);

3. Optical See-Through

When developing with Optical See-Through, the process is the same as developing with Video See-Through if you select the Wearable Type as Optical See-Through. See below for details.

3.1. Make Marker Tracker Scene

  1. Connect the smart glasses to the PC to build, Select ARCamera > Configuration > Wearable Type to Optical See Through and build.

    SmartGlasses_Unity_SetupGuide6_.png