List
How to Implement of Instant training functionally for Image Tracker
Posted Date: 2018-10-04 4:30     Edited Date: 2018-10-04 7:52     Writer: inactive

1. SDK Version: MAXST AR SDK 4.0.x
2. Development Environment: Unity-Android (Unity 5.6.6f2(64bit)) on Windows 10 Pro(64bit) 1703
3. Tracker/Scanner: Image Tracker
4. License Type(Free / Pro-One Time Fee / Pro-Subscription / Enterprise): Free
5. Target Device(Optional): MOVERIO BT350

I develop AR application used Instant training functionally for Image Tracker.
But, my application don’t implement it.
Please help me !

My actions are belows:

1. I create New Unity Project and import “MAXSTARSDK_Unity_4.0.0.unityPackage”.
2. I select sample scene “ImageTracker.unity” and change code “ImageTrackerSample.cs”.
3. I reference https://developer.maxst.com/MD/doc/4_0_x/unity/ex/image#train-target-image-instantly

  if (trackable.Value.StorageType == StorageType.AbsolutePath)
{
//TrackerManager.GetInstance().AddTrackerData(trackable.Value.TrackerDataFileName);
TrackerManager.GetInstance().AddTrackerData("{\"image\":\"add_image\",\"image_path\":\"ImageTarget/TrainMarker01.png\",\"image_width\":0.27}", true);
} else {
・・・
   }

#TrainMarker01.png is same folder with Block.2dmap, Lego.2dmap, Glacier.2dmap.
#TrainMarker01.png is 640 wide pixel size.
#TrainMarker01_resized.jpg save same folder with Block_resized, …

4. I can’t replace Glacier.2dmap with TrainMarker01.png.
  "Just drag&drop a *.2dmap file with tracking data from your project view here"
5. Next, I change code “ImageTrackerEditor.cs”.

  if (oldDataObject != newDataObject)
{
string trackerDataFileName = AssetDatabase.GetAssetPath(newDataObject);
trackableBehaviour.TrackerDataFileName =trackerDataFileName.Replace("Assets/StreamingAssets/", "");
trackableBehaviour.TrackerDataFileObject = newDataObject;
isDirty = true;
}

6. One more time I replace Glacier.2dmap with TrainMarker01.png.
  TrainMarker01.png get scale = -6.23434E+18.
  (Block.2dmap, Lego.2dmap, Glacier.2dmap get scale = 0.26.)

7. Next, I change code “AbstractImageTrackerBehavor.cs”.

  ・・・
  private void ChangeObjectProperty(string textureName, float scale){
              scale = 0.26f;
  ・・・

8. Now my application don’t have error but the application can’t recognize TrainMarker01.png as ImageTracker.

Best Regards,

Posted Date: 2018-10-04 7:52     Edited Date: 2018-10-04 7:52     Writer: slkim

We made github sample for instant training.

https://github.com/maxstdev/MaxstARSDK_Unity_Sample

you can take scene 'ExtraSample/Scenes/IntantTraining.unity. that is how to use instant training.

i think your problem is android path. because Unity streamingAsset path is can't access directly at Android.

thank you.