Overview

1. initView

ArCamUIActivity.java

onCreate()

ObjRendererWrapper objRendererWrapper=
                ObjRendererWrapper.newInstance()
                        .setArObjectView(glRootView)
                        .setNativeHelper(nativeHelper)
                        .setContext(this)
                        .setObjPath(this.getExternalFilesDir("SLAM").getAbsolutePath()+"/patrick.obj")
                        .setTexturePath(this.getExternalFilesDir("SLAM").getAbsolutePath()+"/Char_Patrick.png")
                        .setInitSize(0.20f)
//                        .setObjPath("andy.obj")
//                        .setTexturePath("andy.png")
//                        .setInitSize(1.0f)
                        .init(touchHelper);
        nativeHelper.addOnMVPUpdatedCallback(objRendererWrapper);

Register the GL View Wrapper on first launch.

2. init Native

ArCamUIActivity.java

onResume()

String resDir = this.getExternalFilesDir("SLAM").getAbsolutePath()+"/";

Log.d(TAG, "onResume: "+resDir);
nativeHelper.initSLAM(resDir);

3. SLAM Detect

ArCamUIActivity.java

if(detectPlane){
    showHint("Request sent.");
    int detectResult=nativeHelper.detectPlane();
    detectPlane=false;
}

When SLAM tracking is active, tapping the "+" button at the top displays the registered patrick.jpg from objRendererWrapper on the camera frame along with the floor plan.

4. Camera Resolution

assets/CameraSettings.yaml

Supported Camera Resolution

320x240 640x360 1280x720

#params when image is 320x240
Camera.fx: 116.0
Camera.fy: 122.7
#cx cy : center of image
Camera.cx: 158.9
Camera.cy: 122.6

#params when image is 640x360
#Camera.fx: 640.0
#Camera.fy: 640.0
#cx cy : center of image
#Camera.cx: 320.0
#Camera.cy: 180.0

##params when image is 1280x720
#Camera.fx: 1280.0
#Camera.fy: 1280.0
##cx cy : center of image
#Camera.cx: 640.0
#Camera.cy: 360.0

GlobalConstant.java

public static final int RESOLUTION_WIDTH=320;
public static final int RESOLUTION_HEIGHT=240;

You need to modify the width and height to the supported Camera Resolution.

5. Diagram

Last updated