Cloud Recognition

Related documentations
Target Manager
Recommended Conditions for Target Images
Tracker Coordinate System

You can recognize and track 2D images registered at developer.maxst.com to enhance the 3D content, video images, and Chroma key images.

Apply Tracker secretID / secretKey
Start / Stop Tracker
Use the Tracking information

Apply Tracker secretID / secretKey

>CloudRecognizerActivity.java

protected void onResume() {
    ...
    String secretId = "32b41d66c392447795564eb.....";
    String secretKey = "c40d6fbca31e4d03baa677a550.....";
    TrackerManager.getInstance().setCloudRecognitionSecretIdAndKey(secretId, secretKey);
    TrackerManager.getInstance().startTracker(TrackerManager.TRACKER_TYPE_CLOUD_RECOGNIZER);

    ...
}

Start / Stop Tracker

Please refer to the following code to start/stop the Tracker.

>CloudRecognizerActivity.java

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

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

Use the Tracking Information

Print or display on the screen the images registered at Target Manager/Cloud on developer.maxst.com. You can retrieve the data through the Name or MetaData of the images.

In order to apply the tracking results to an augmented object, refer to the following codes.

>CloudRecognizerRenderer.java

public void onDrawFrame(GL10 unused) {
    ...
    TrackingState state = TrackerManager.GetInstance().UpdateTrackingState();
    TrackingResult trackingResult = state.GetTrackingResult(); 
    ...
    if(trackingResult.getCount() == 1) {
        Trackable trackable = trackingResult.getTrackable(0);
        String cloudName = trackable.getCloudName();
        String cloudMetaData = trackable.getCloudMetaData();

        if(!cloudName.equals(beforeCloudName)) {
            beforeCloudName = cloudName;
            if(listener != null) {
                listener.sendData(cloudName, cloudMetaData);
            }
        }

        switch (cloudName) {
            case "Lego":
                legoDetected = true;
                if (videoRenderer.getVideoPlayer().getState() == VideoPlayer.STATE_READY ||
                        videoRenderer.getVideoPlayer().getState() == VideoPlayer.STATE_PAUSE) {
                    videoRenderer.getVideoPlayer().start();
                }
                videoRenderer.setProjectionMatrix(projectionMatrix);
                videoRenderer.setTransform(trackable.getPoseMatrix());
                videoRenderer.setTranslate(0.0f, 0.0f, 0.0f);
                videoRenderer.setScale(0.11f, -0.065f, 1.0f);
                videoRenderer.draw();
                break;
            case "Glacier":
                texturedCubeRenderer.setProjectionMatrix(projectionMatrix);
                texturedCubeRenderer.setTransform(trackable.getPoseMatrix());
                texturedCubeRenderer.setTranslate(0, 0, -0.025f);
                texturedCubeRenderer.setScale(0.115f, 0.082f, 0.05f);
                texturedCubeRenderer.draw();
                break;

            default:
                coloredCubeRenderer.setProjectionMatrix(projectionMatrix);
                coloredCubeRenderer.setTransform(trackable.getPoseMatrix());
                texturedCubeRenderer.setTranslate(0, 0, -0.025f);
                coloredCubeRenderer.setScale(0.115f, 0.082f, 0.005f);
                coloredCubeRenderer.draw();
        }
    }

    if (!legoDetected) {
        if (videoRenderer.getVideoPlayer().getState() == VideoPlayer.STATE_PLAYING) {
            videoRenderer.getVideoPlayer().pause();
        }
    }
    …
}
  • If the name of the image registered on MAXST Developer Site is "Lego", the video will be augmented. "Lego" can retrieve the Meta data registered on site with MetaData. The image with the current name "Lego" contains the phrase "Welcome to Maxst" in MetaData.

  • On the Image of "Glacier", a box with image texture will be augmented. In MetaData, you can see the website address "developer.maxst.com".

  • You can find a white box on the image of "Blocks" and the MetaData has a Json phrase : { "success": true }

In regard to the scale of the content, if you registered RealWidth as '0.12m' on MAXST Developer Site you should apply '0.12' to Scale to view the contents as a whole image.