Marker Tracker Android Tutorial

1. Overview
2. Android Development
2.1 Start / Stop Tracker
2.2 Use Tracking Information
2.3 Set Target Marker
2.4 Change Tracking Mode
3. Reference
3.1 API Reference
3.2 Sample


1. Overview

Develop Marker Tracker on Android Platform. Refer to Marker Tracker Introduction for detailed information.

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.

Refer to Tracker Coordinate System to better understand 3D coordinate system of Marker Tracker.

Prerequisites
Marker Tracker Introduction
Marker
Tracker Coordinate System

2. Android Development

Start developing on Android Studio using Java. Please refer to Requirements & Supports to find out which devices are supported.

ARSDK has to properly integrate on Android Activity. Refer to Life Cycle documents for detail.


2.1 Start / Stop Tracker

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

※To change the tracker, destroyTracker() should be called before

MarkerTrackerActivity.java

@Override
protected void onResume() {
    ...
    TrackerManager.getInstance().startTracker(TrackerManager.TRACKER_TYPE_MARKER);
    ...
}

@Override
protected void onPause() {
    ...
    TrackerManager.getInstance().stopTracker();
    ...
}


2.2 Use Tracking Information

Refer to the following code to use the tracking information. You can choose the marker and augment the content by creating the conditional statement with trackable.getID ().

※ startTracker() should be called before

MarkerTrackerRenderer.java

@Override
public void onDrawFrame(GL10 unused) {
    ...
    TrackingState state = TrackerManager.getInstance().updateTrackingState();
    TrackingResult trackingResult = state.getTrackingResult();
    ...
    for (int i = 0; i < trackingResult.getCount(); i++) {
        Trackable trackable = trackingResult.getTrackable(i);
        texturedCube.setProjectionMatrix(projectionMatrix);
        texturedCube.setTransform(trackable.getPoseMatrix());
        texturedCube.setTranslate(0, 0, -0.05f);
        texturedCube.setScale(1.0f, 1.0f, 0.1f);
        texturedCube.draw();
    }
}


2.3 Set Target Marker

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

※Size of Marker ID: 0 is 4.2cm

MarkerTrackerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    ...
    TrackerManager.getInstance().addTrackerData("{"marker":"set_scale","id":"0", "scale":0.042}",false);
    TrackerManager.getInstance().loadTrackerData();
}

2.4 Change Tracking Mode

4 Tracking Modes for 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. References

These are additional references to develop Marker Tracker


3.1 API Reference

Following documents explain classes and functions used to run Marker Tracker.

MaxstAR Class

TrackerManager Class

CameraDevice Class


3.2 Sample

For information regarding sample build and run of Marker Tracker, refer to Samples

MarkerTrackerActivity.java

MarkerTrackerRenderer.java