3

I'm trying out detecting multiple augmented images with AR core, with

https://developers.google.com/ar/develop/java/augmented-images/guide

and other online tutorials. Currently, I have the database setup and loaded with images. However

Collection<AugmentedImage> augmentedImages = frame.getUpdatedTrackables(AugmentedImage.class);

did not seem to capture and match the feature points of my images in my db.

Can you advise me about what I need to do?

I have set up and loaded multiple images from db. The app is able to detect only 1 image previously. However, after tweaking my code to detect multiple images, it did not work properly.

Tried researching and debugging however, still unable to solve it.

private void onUpdateFrame(FrameTime frameTime)
{
    Frame frame = arFragment.getArSceneView().getArFrame();

    Collection<AugmentedImage> augmentedImages = frame.getUpdatedTrackables(AugmentedImage.class);

    for (AugmentedImage augmentedImage : augmentedImages)
    {
        int i =augmentedImages.size();
        Log.d("NoImage",""+i);
        if (augmentedImage.getTrackingState() == TrackingState.TRACKING)
        {
            if (augmentedImage.getName().contains("img1") && !modelAdded)
            {
                renderObject(arFragment, augmentedImage.createAnchor(augmentedImage.getCenterPose()),R.raw.car);
                modelAdded = true;
            }

            else if (augmentedImage.getName().contains("img2") && !modelAdded)
            {
                renderObject(arFragment, augmentedImage.createAnchor(augmentedImage.getCenterPose()), R.raw.car);
                modelAdded = true;
            }

            else if (augmentedImage.getName().contains("img3") && !modelAdded)
            {
                renderObject(arFragment, augmentedImage.createAnchor(augmentedImage.getCenterPose()), R.raw.car);
                modelAdded = true;
            }
        }
    }
}
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

0 Answers0