EasyAR Target Configuration¶
Targets in EasyAR¶
EasyAR offers a flexible target management interface. It is easy to use. You can generate EasyAR targets at runtime, and do not need to login the website to upload and download a lot of stuffs.
EasyAR manages targets in two steps.
The first step is to load configuration and setup target. For C++, you can reference ImageTarget for target details and load/unload. And for Unity, you can reference ImageTargetBaseBehaviour for the same, and additional ImageTarget-Prefab for how to use it in the editor.
The second step is to load the target into the tracker for track. EasyAR load and unload target to the tracker in an async way, it will not block the calling thread so perform an incremental background loading.
A target loaded into the tracker will be passed by a Frame when Augmenter.newFrame called and finally form a part of the AugmentedTarget.
Target Json Configure¶
The flexibility of EasyAR target do not stop at the load/unload interface. You can also get flexibility in the configure file.
You can load a target from image only or with some detailed configurations. EasyAR use json format to store target configurations. The full data interface is like below.
ImageTarget
{
"images" :
[
{
"image" : "idback.jpg",
"name" : "idback",
"size" : [8.56, 5.4],
"uid" : "uid-string, should NOT duplicate",
"meta" : "what ever string you like."
}
]
}
ObjectTarget
{
"objects" :
[
{
"obj" : "hexagon.obj",
"name" : "hexagon",
"scale" : 1.0,
"uid" : "uid-string, should NOT duplicate",
"meta" : "what ever string you like."
},
]
}
The above json contains all fields that can be used by EasyAR: target path, target name, target size/scale, target uid and meta data. Only the target path is required among all the fields. So the following json is acceptable.
ImageTarget
{
"images" :
[
{
"image" : "argame00.jpg",
"name" : "argame"
}
]
}
ObjectTarget
{
"objects" :
[
{
"obj" : "hexagon.obj",
"name" : "hexagon"
}
]
}
And this is also acceptable.
ImageTarget
{
"images" :
[
{
"image" : "argame00.jpg"
}
]
}
ObjectTarget
{
"objects" :
[
{
"obj" : "hexagon.obj"
}
]
}
You can put multiple targets into the same json file and load them together or separately.
{
"images" :
[
{
"image" : "argame00.jpg",
"name" : "argame"
},
{
"image" : "idback.jpg",
"name" : "idback",
"size" : [8.56, 5.4],
"uid" : "uid-string"
}
]
}
{
"images" :
[
{
"image" : "sightplus/argame01.jpg",
"name" : "argame01"
},
{
"image" : "sightplus/argame02.jpg",
"name" : "argame02"
},
{
"image" : "sightplus/argame03.jpg",
"name" : "argame03"
}
]
}
Or put different type of target into one json,
{
"images" :
[
{
"image" : "argame00.jpg",
"name" : "argame"
},
{
"image" : "idback.jpg",
"name" : "idback",
"size" : [8.56, 5.4],
"uid" : "uid-string"
}
],
"objects" :
[
{
"obj" : "hexagon.obj"
}
]
}
Sometimes you do not actually care about detail configurations like size or name, and you just want to load a lot of images or obj files as targets. So we offer a simplified configuration.
ImageTarget
{
"images": [
"argame00.jpg"
]
}
ObjectTarget
{
"objects": [
"hexagon.obj"
]
}
Like above, all you have to write is just a line of path. With a lot of targets, you can write,
ImageTarget
{
"images": [
"argame00.jpg",
"argame01.jpg",
"argame02.jpg",
"argame03.jpg",
"argame04.jpg",
"argame05.jpg"
]
}
ObjectTarget
{
"objects": [
"object00.jpg",
"object01.jpg",
"object02.jpg",
"object03.jpg",
"object04.jpg",
"object05.jpg"
]
}
Or put them together
{
"images": [
"argame00.jpg",
"argame01.jpg",
"argame02.jpg",
"argame03.jpg",
"argame04.jpg",
"argame05.jpg"
],
"objects": [
"object00.jpg",
"object01.jpg",
"object02.jpg",
"object03.jpg",
"object04.jpg",
"object05.jpg"
]
}
Also, you can combine all above together. The following sample shows a combination with different ways to write the path. Make sure to write unix-like path (use / to seperate path components). EasyAR supports non-ASCII characters in the path string, but you have to save your json in UTF-8 format.
{
"images": [
"path/to/argame00.jpg",
"path/to/argame01.png",
"argame02.jpg",
{
"image" : "path/to/argame03.jpg"
},
{
"image" : "argame04.png",
"name" : "argame"
},
{
"image" : "idback.jpg",
"name" : "idback",
"size" : [8.56, 5.4],
"uid" : "uid-string"
},
"c:/win/absolute/path/to/argame05.png",
"/unix/absolute/path/to/argame06.jpg"
],
"objects": [
"path/to/argame00.obj",
"path/to/argame01.obj",
"argame02.obj",
{
"obj" : "path/to/argame03.obj"
},
{
"obj" : "argame04.obj",
"name" : "argame"
},
{
"obj" : "hexagon.obj",
"name" : "hexagon",
"scale" : 1.0,
"uid" : "uid-string, should NOT duplicate",
"meta" : "what ever string you like."
},
"c:/win/absolute/path/to/argame05.obj",
"/unix/absolute/path/to/argame06.obj"
]
}