Open Str0ss opened 4 years ago
Maybe I don't understand fully your problem, but I would guess that not the setting is the problem. What about to just stop aksing ARCore to look for trackable images?
I have a separate class to handle Augmented Images and there I have an onUpdate function with the current frame as a parameter.
```java
public void onUpdate(Frame frame) {
Collection<AugmentedImage> updatedAugmentedImages = frame.getUpdatedTrackables(AugmentedImage.class);
for (AugmentedImage augmentedImage : updatedAugmentedImages) {
if (augmentedImage.getTrackingState() == TrackingState.TRACKING) {
if (augmentedImage.getTrackingMethod() == AugmentedImage.TrackingMethod.FULL_TRACKING) {
// Do something
}
}
}
}
So if I don't want any tracking I simple don't call onUpdate.
SPECIFIC ISSUE ENCOUNTERED
It is impossible to disable the augmented image engine after we don't need it anymore. Tested on augmented_image_java example.
Why am I bothered with disabling the augmented image engine? Because it introduces a significant delay in ARCore image processing (both background image and camera pose are updated ~100 ms later when augmented image detection is on). A simple test can be done: point a phone on any stopwatch screen and take a picture of both screens with some other camera. The difference between two times will represent the delay. I got ~100 ms total delay when no image detection, and ~200 ms total delay with image detection, regardless of whether image was detected or not. For my app it's sufficient to detect image once, place an anchor on it's last position, and disable further image detection, so I wanted to switch it off to get rid of the +100 ms delay.
VERSIONS USED
STEPS TO REPRODUCE THE ISSUE
config.setAugmentedImageDatabase(augmentedImageDatabase);
in AugmentedImageActivity.java to disable augmented image detection. Launch the app, repeat the measurement, write down the delay. It should be ~100 ms less than the previous value.drawAugmentedImages
, tocase TRACKING:
This code will disable image detection immediately after the image was found (doc). Launch the app, point the camera on any of the images from
arcore-android-sdk\media\augmented_image_database
. Notice that after image was found, the image detection actually stopped working (the image frame will disappear quickly after the image was recognized, and the app will recognize no more images after that). Now measure the camera delay - it will still be big (as in p. 1). That means that something is left from the image detection engine, and this 'something' is causing the delay. And this is definitely not needed.WORKAROUNDS (IF ANY)
Any ideas will be welcome. I even tried to pause+resume the session when re-configuring, with no success.
Thanks in advance. Although I may have missed some obvious thing from the docs, I think this issue is real and must be addressed somehow.
P.S. photos to illustrate the experiments. Augmented image OFF: Augmented image ON: