Object Tracker
Related documentations |
---|
Map Manager |
Tracker Coordinate System |
Visual SLAM Learning Guide |
The Object Tracker loads the map file and renders 3D object on it.
Please refer Visual SLAM Learning Guide to create a map more precisely while scanning 3D space.
Start / Stop Tracker
Use Tracking Information
Set Map
Add / Replace Map
Change Tracking Mode
Start / Stop Tracker
To start / stop Tracker after loading the map, refer to the following code.
>ObjectTrackerActivity.java
@Override protected void onResume() { ... TrackerManager.getInstance().startTracker(TrackerManager.TRACKER_TYPE_OBJECT); ... } @Override protected void onPause() { ... TrackerManager.getInstance().stopTracker(); ... }
Use the Tracking Information
To use the Tracking information, refer to the following code.
>ObjectTrackerRenderer.java
@Override public void onDrawFrame(GL10 gl) { ... TrackingState state = TrackerManager.GetInstance().UpdateTrackingState(); TrackingResult trackingResult = state.GetTrackingResult(); if (trackingResult.getCount() > 0) { Trackable trackable = trackingResult.getTrackable(0); texturedCube.setTransform(trackable.getPoseMatrix()); texturedCube.setTranslate(0, 0, -0.1f); texturedCube.setScale(0.4f, 0.4f, 0.2f); texturedCube.setProjectionMatrix(projectionMatrix); texturedCube.draw(); } }
Set Map
By calling addTrackerData () to register the map file and calling loadTrackerData (), the space can be tracked. To set a map, refer to the following code.
>ObjectTrackerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { ... TrackerManager.getInstance().addTrackerData(mapFileName, false); TrackerManager.getInstance().loadTrackerData(); }
Add / Replace Map
Create a map file refer to Map Manager.
Copy the received map file to the desired path. The way to load map file in the assets folder and the external storage, is different.
- When copying to the assets folder, set the second parameter to true to indicate that it is a relative path and a file in the assets folder.
TrackerManager.getInstance().addTrackerData("MaxstAR/ImageTarget/Bricks.2dmap", true);
- If copying to external storage, enter the full path and set the second parameter to false.
TrackerManager.getInstance().addTrackerData(mapFile.getAbsolutePath(), false);
You must call loadTrackerData () after calling addTrackerData ().
If you have an existing map file, call addTrackerData () and loadTrackerData () after calling TrackerManager.getInstance (). RemoveTrackerData ("").
Change Tracking Mode
2 Tracking Modes of Object Tracker:
JITTER_REDUCTION_ACTIVATION, JITTER_REDUCTION_DEACTIVATION
- JITTER_REDUCTION_ACTIVATION: Default Setting. 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);