Reputation: 3748
I got some list of images . Instead of loading images at runtime in ARCore Augmented images , I created myImges.imgdb database at compile time. How to use the already created db in the code. I see creating image database at runtime in google ARCore documentation ,but how to use already compiled and existing .imgdb.
Can anyone help regarding this.
Thanks in Advance.
Upvotes: 0
Views: 3375
Reputation: 540
Checkout the ARCore SDK examples. They provide a sample of loading a precompiled imgdb file at runtime.
Place your .imgdb
file in your project's assets folder, then do something like:
// Assuming this is defined within an Activity class.
private boolean setupAugmentedImageDatabase(Session session, Config config) {
AugmentedImageDatabase augmentedImageDatabase = new AugmentedImageDatabase(session);
try (InputStream is = getAssets().open("sample_database.imgdb")) {
augmentedImageDatabase = AugmentedImageDatabase.deserialize(session, is);
} catch (IOException e) {
Log.e(TAG, "IO exception loading augmented image database.", e);
return false;
}
}
config.setAugmentedImageDatabase(augmentedImageDatabase);
return true;
}
Upvotes: 1