Try MAXST AR Fusion Tracker Now ✨

Marker Tracker

Related documentations
Marker
Tracker Coordinate System in Unity

Make Marker Fusion Tracker Scene
Set Target Marker
Start / Stop Tracker
Use Tracking Information
Change Tracking Mode

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. After target recognition and initial poses are acquired through the MAXST SDK, use AR Core/AR Kit for tracking.
※To use the AR Core / AR Kit, you must enter the actual size. (See Start / Stop Tracker)

The biggest difference from the existing Marker Tracker is that the existing Marker Tracker tracks through the frame input from the RGB camera. Due to the nature of RGB cameras, tracking will be lost if the target deviates from the camera frame or if there are few feature points. Marker Fusion Tracker, on the other hand, tracks through the AR Core/AR Kit, which allows the target to deviate from the camera frame or keep the feature point at least without tracking, due to the nature of learning the environment in which the current target lies.

Make Marker Fusion 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.

    ARCamera.jpg

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

    Gameobject.jpg

  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). marker size.jpg

  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.

    marker id.jpg

  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 point the camera to the target marker.

*Target marker file is located at Marker.

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.

>MarkerFusionTrackerSample.cs

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

									TrackerManager.GetInstance().AddTrackerData(trackable.Value.TrackerDataFileName);
		}

		TrackerManager.GetInstance().LoadTrackerData();
	}

Start / Stop Tracker

TrackerManager.getInstance().IsFusionSupported ()
This function checks whether or not your device supports Fusion.
Return value is bool type. If true, it supports the device in use. If it is false, it does not support the device.

TrackerManager.getInstance().GetFusionTrackingState ()
Pass the tracking status of the current Fusion.
The return value is an int of -1, which means that tracking isn't working properly, and 1 means that it's working properly.

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

>MarkerFusionTrackerSample.cs

void Update()
	{
…
        CameraDevice.GetInstance().SetARCoreTexture();	TrackerManager.GetInstance().StartTracker(TrackerManager.TRACKER_TYPE_MARKER_FUSION);
AddTrackerData();
…
	}
private void AddTrackerData()
{
   ...
   TrackerManager.GetInstance().AddTrackerData("{\"marker_fusion\":\"set_scale\",\"id\":\"0\", \"scale\":0.042}", false);
   TrackerManager.GetInstance().LoadTrackerData();
}
	void OnApplicationPause(bool pause)
	{
	…
			TrackerManager.GetInstance().StopTracker();
	…
	}
	void OnDestroy()
	{
…
		TrackerManager.GetInstance().StopTracker();
		TrackerManager.GetInstance().DestroyTracker();
	…
}

id is the unique number of the marker.
scale is the actual size of the marker.
You must enter the actual size of the target. If you do not enter the correct actual size, the content will not be augmented properly.
It must be run in the following order: startTracker (), addTrackerData (), loadTrackerData ().

Use Tracking Information

Refer to the following code to use the tracking information.

>MarkerFusionTrackerSample.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());
                			}
            		}
		}
	}