QR Code Fusion Tracker Android Tutorial

1. Overview
2. Android Development
2.1 Start / Stop Tracker
2.2 Use Tracking Information
3. Reference
3.1 API Reference
3.2 Sample


1. Overview

Start developing MAXST ARSDK QR Code Tracker on Android Platform. Refer to QR Code Tracker Introduction for detailed information.

Refer to Tracker Coordinate System to better understand 3D coordinate system of QR Code Fusion Tracker.

After target recognition and initial poses are acquired through the MAXST SDK, use ARCore for tracking.

※To use the AR Core, you must enter the actual size. (See Start / Stop Tracker)

Prerequisite
QR Code Tracker Introduction
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

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.

To start / stop the tracker, refer to the following code.

QRCodeFusionTrackerActivity.Java


    @Override
    protected void onCreate() {
        ...
        TrackerManager.getInstance().startTracker(TrackerManager.TRACKER_TYPE_QR_FUSION);
TrackerManager.getInstance().addTrackerData("{"qr_fusion":"set_scale","content":
"wikipedia","scale":0.14}", false);
    TrackerManager.getInstance().loadTrackerData();
        ...
    }

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

You need to pass the exact actual size as a parameter of scale via addTrackerData. (Unit: m)
Content is a phrase included in the information of the QR code. SetScale is the actual size of the QR code. The shape of the QR code is square.
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 ().

QRCodeFusionTrackerRenderer.Java

@Override
Public void onSurfaceCreated(…){
   …
   …
   CameraDevice.getInstance().setARCoreTexture();
}

The setARCoreTexture () function call must be made from glThread.
setARCoreTexture () must be executed. If the function is not executed, no screen is displayed.


2.2 Use Tracking Information

Refer to the following code to use the tracking information. You can choose the QRcode including the special keyword and augment the content by creating the conditional statement with trackable.getName().

QRCodeFusionTrackerRenderer.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.1f);
            texturedCube.setScale(1.0f, 1.0f, 0.1f);
            texturedCube.draw();
        }
    }


3. References

These are additional references to develop QR Code Fusion Tracker


3.1 API Reference

Following documents explain classes and functions used to run QR Code Fusion Tracker

MaxstAR Class

TrackerManager Class

CameraDevice Class


3.2 Sample

For information regarding sample build and run of QR Code Fusion Tracker, refer to Sample

QRCodeFusionTrackerActivity.Java

QRCodeFusionTrackerRenderer.Java