Слишком много времени для дополненного изображения. Я тестирую проект, используя пример ARCore.https://github.com/google-ar/sceneform-android-sdk/releases
private boolean setupAugmentedImageDatabase(Config config, Session session) {
AugmentedImageDatabase augmentedImageDatabase;
AssetManager assetManager = getContext() != null ? getContext().getAssets() : null;
if (assetManager == null) {
Log.e(TAG, "Context is null, cannot intitialize image database.");
return false;
}
// There are two ways to configure an AugmentedImageDatabase:
// 1. Add Bitmap to DB directly
// 2. Load a pre-built AugmentedImageDatabase
// Option 2) has
// * shorter setup time
// * doesn't require images to be packaged in apk.
if (USE_SINGLE_IMAGE) {
Bitmap augmentedImageBitmap = loadAugmentedImageBitmap(assetManager);
if (augmentedImageBitmap == null) {
return false;
}
augmentedImageDatabase = new AugmentedImageDatabase(session);
augmentedImageDatabase.addImage(DEFAULT_IMAGE_NAME, augmentedImageBitmap);
// If the physical size of the image is known, you can instead use:
// augmentedImageDatabase.addImage("image_name", augmentedImageBitmap, widthInMeters);
// This will improve the initial detection speed. ARCore will still actively estimate the
// physical size of the image as it is viewed from multiple viewpoints.
} else {
// This is an alternative way to initialize an AugmentedImageDatabase instance,
// load a pre-existing augmented image database.
try (InputStream is = getContext().getAssets().open(SAMPLE_IMAGE_DATABASE)) {
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;
}
private Bitmap loadAugmentedImageBitmap(AssetManager assetManager) {
try (InputStream is = assetManager.open(DEFAULT_IMAGE_NAME)) {
return BitmapFactory.decodeStream(is);
} catch (IOException e) {
Log.e(TAG, "IO exception loading augmented image bitmap.", e);
}
return null;
}
При отслеживании он находит изображение, которое настроено в базе данных.
augmentedImageDatabase.addImage(DEFAULT_IMAGE_NAME, augmentedImageBitmap);
, но помещает некоторые из изображений, например, 10 изображений, это занимает много временизагрузить.Я хочу уменьшить время загрузки.Как я могу сократить время загрузки?