Cloud Metadata - How can I store my data on the Cloud

March 21, 2014 - 2:06am #1

The Vuforia Cloud Recognition Service enables new types of applications in retail and publishing. An application using Cloud Recognition will be able to query a Cloud Database with camera images (actual recognition happens in the cloud), and then handle the matching results returned from the cloud to perform local detection and tracking. 

Also, every Cloud Image Target can optionally have an associated Metadata; a target metadata is essentially nothing else than a custom user-defined blob of data that can be associated to a target and filled with custom information, as long as the data size does not exeed the allowed limits (up to 1MB per target).

Therefore, you can use the metadata as a way to store additional content that relates to a specific target, that your application will be able to process using some custom logic.

For example, your application may use the metadata to store:

  • simple text message that you want your app to display on the screen of your device when the target is detected, for example:
    • Hello, I am your cloud image target XYZ, you have detected me :-) !
  • a simple URL string (for instance “http://my_server/my_3d_models/my_model_01.obj”) pointing to a custom network location where you have stored some other content, like a 3D model, a video, an image, or any other custom data, so that for each different image target, your application may use such URL to download the specific content;
  • more in general, some custom string that your application is able to process and use to perform specific actions
  • a full 3D model (not just the URL pointing to a model on a server, but the model itself), for example the metadata itself could embed an .OBJ 3D model, provided that the size does not exceed the allowed limits (up to 1MB)
  • and more ...

 

How do I create/store metadata for a Cloud target ?

Metadata can be uploaded together with an image target at the time you create the target itself in your Cloud Database; or you can also update the metadata of an existing target, at a later time; in either case, you can use the online TargetManager, as explained here:

https://developer.vuforia.com/resources/dev-guide/managing-targets-cloud-database-using-target-manager

or you can proceed programmatically using the VWS API, as explained here:

https://developer.vuforia.com/resources/dev-guide/managing-targets-cloud-database-using-developer-api

 

How can I get the metadata of a Cloud target when it is recognized ?

The Vuforia SDK offers a dedicated API to retrieve the metadata of a target in your mobile application. When a Cloud target is detected (recognized), a new TargetSearchResult is reported to the application, and the metadata can be obtained using one of these methods:

  • Vuforia Native SDK - C++ API:        TargetSearchResult::getMetaData()  -  const char*
  • Vuforia Native SDK - Java API:        TargetSearchResult.getMetaData()  -  String
  • Vuforia Unity Extension - C# API:    TargetSearchResult.Metadata  - string

See also the API reference pages:

https://developer.vuforia.com/resources/api/classcom_1_1qualcomm_1_1vuforia_1_1_target_search_result

https://developer.vuforia.com/resources/api/unity/struct_target_finder_1_1_target_search_result

 

Sample code:

  • For a reference sample code in native Android, see the code in the Books.java in the "Books-2-x-y" sample project.
  • For a reference sample code in native iOS, see the code in the BooksEAGLView.mm file in the  "Books-2-x-y" sample project.
  • For a reference sample code in Unity, see the CloudRecoEventHandler.cs script (attached to theCloudRecognition prefab) in the Books sample; in particular, the OnNewSearchResult method shows how to get a targetSearchResult object (from which you can then get the metadata, as shown in the example code).
Topic locked