Setup ImageTarget from a Texture2D or bytes[], representing a .png

0 votes
asked Jul 12, 2018 by sophour (520 points)
Hello everybody!
I'm trying to setup an ImageTarget in runtime with an image I get in runtime (user takes a photo, I cut a Texture2D from the photo). Are there no way to assign a Texture2D or bytes[], which I can get from this Texture2D, to a target? Do I have to save it in the storage of my Android anyway? Could anybody, please, give me a hint or - better - an example of how to solve it best way? If I have to save the texture, where should I save it on Android and how do I get it back, by which path, when I do "ImageTargetBehaviour().SetupWithImage()"? Thank you in advance

2 Answers

0 votes
answered Jul 17, 2018 by sophour (520 points)
 
Best answer
Well, it turns out that saving an img to some storage before making a makrer of it is unavoidable in EasyAR, that's a shame... So I had to use absolute paths in my quick and dirty prototype.
0 votes
answered Jul 12, 2018 by derzuomaia (1,190 points)

You can use an absolute path to create a target.

Check this guide, there says that it can be done at runtime:

https://www.easyar.com/doc_sdk/en/Guides/EasyAR-Target-Configure.html

Also, check the method of the HelloAt.java file at the HelloAr Sample Project:

private void loadFromImage(ImageTracker tracker, String path)

It creates a json at runtime.

Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...