Search code examples
unity-game-enginevuforiaarcorevuforia-cloud-recognition

How to get vuforia cloud recognition kind of feature in Arcore(unity)


I have created a prototype application in unity using vuforia where I upload an image to myserver the server then sends the image (and associated assetbundle's link in metadata) to vuforia cloud to add it to the image target database. then in unity when camera tracks the image target I download the asset bundle to augment it.

public void OnNewSearchResult(TargetFinder.TargetSearchResult targetSearchResult)
{
    TargetFinder.TargetSearchResult cloudRecoSearchResult =
        (TargetFinder.TargetSearchResult)targetSearchResult;

    mTargetMetadata = cloudRecoSearchResult.MetaData;
    Debug.Log(mTargetMetadata);

    mCloudRecoBehaviour.CloudRecoEnabled = false;

    // Build augmentation based on target
    if (ImageTargetTemplate)
    {
        Debug.Log("Image target activated");
        // enable the new result with the same ImageTargetBehaviour:
        ObjectTracker tracker = TrackerManager.Instance.GetTracker<ObjectTracker>();
        ImageTargetBehaviour imageTargetBehaviour =
         (ImageTargetBehaviour)tracker.TargetFinder.EnableTracking(
         targetSearchResult, ImageTargetTemplate.gameObject);
        JsonData jd = JsonMapper.ToObject(mTargetMetadata);
        string url = jd["content-url"].ToString();
        Debug.Log("video url :"+ "http://192.168.2.92/arads/" + url);
        vidPlayer.url = "http://192.168.2.92/arads/"+url;
        vidPlayer.Prepare();
        if(!vidPlayer.isPlaying)
        vidPlayer.Play();
    }
}

the above code is to get associated video from the server. Can I get similar functionality with arcore or arfoundation, I read that arcore's refrence image database can have 1000 images,

  1. what if the image I am tracking is not in the current database, can I switch to different db in that case ?

  2. do I have to download and add the image to database in the applicatoin whenever I upload a new image on the server ?

  3. can these images in arcore have meta data like in vuforia ?


Solution

  • The difference between ARCore and Vuforia is in ARCore you can add images to database in run time so you do not have to use any server.

    1. You can switch to a different database by modifying Session config using this: GoogleARCore.ARCoreSessionConfig.AugmentedImageDatabase
    2. As i said you can add images to database in run time so as long as you have the image in your project hierarchy you can add images to database.
    3. I do not think having a meta data is possible only information you can get is database index of the image.

    Good Luck!