Log in or register to post comments

Cloud Recognition Tutorial Scripts

June 24, 2013 - 8:00am #14

Hi Moderators, 

Thank you for posting a new tutorial on creating Cloud Recognition Apps in Unity. My question is regarding the Simple Cloud Reco Event Handler script which replaces the existing, more complicated Event Handler in the tutorial. It seems similar, but a bit different from the Simple Event Handler script described in this post: https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/please-explain-step-step-how-use-vuforia-cloud , which may explain some of the problems that I'm having following the tutorial. Would it be possible to include the script in a new package for the existing Cloud Reco sample, or to provide a package for the tutorial project to run through? 

When I tried to follow the tutorial, I managed to make an app which recognized cloud targets and their metadata, but somehow the script for closing out of the augmentation and reintitiating scanning didn't make it to the app. I'm not sure if this is a product of the wrong event handler, or if this has to do with the way I built out of Unity.

Cloud Recognition Tutorial Scripts

June 29, 2013 - 12:14pm #13

 Would it be possible to include the script in a new package for the existing Cloud Reco sample, or to provide a package for the tutorial project to run through? 

Thank you for the suggestion.

We are considering this possibility for the future, but I cannot give any confirmation at the moment.

 

Cloud Recognition Tutorial Scripts

July 24, 2013 - 12:48pm #12

Hi, i dowloaded the Tutorial package that is linked to the ''Creating Cloud Recognition Apps in Unity....'' but down to two third of the tutorial the speaker mentioned that he replaced the CloudRecoEventHandler.cs by the SimpleCloudRecoEventHandler.cs which should been found under Asset/Script directory. Would it be possible to let me know where can i find this because it is not in the package that was out on line. Thanks Richard

Cloud Recognition Tutorial Scripts

July 24, 2013 - 1:36pm #11

Here you go - copy this to a file and name that file SimpleCloudRecoEventHandler.cs

 

/*==============================================================================
Copyright (c) 2012 QUALCOMM Austria Research Center GmbH.
All Rights Reserved.
Qualcomm Confidential and Proprietary
==============================================================================*/

using System;
using UnityEngine;

/// <summary>
/// This MonoBehaviour implements the Cloud Reco Event handling for this sample.
/// It registers itself at the CloudRecoBehaviour and is notified of new search results.
/// </summary>
public class SimpleCloudRecoEventHandler : MonoBehaviour, ICloudRecoEventHandler
{
    #region PRIVATE_MEMBER_VARIABLES

    // CloudRecoBehaviour reference to avoid lookups
    private CloudRecoBehaviour mCloudRecoBehaviour;
    // ImageTracker reference to avoid lookups
    private ImageTracker mImageTracker;
	
	private GameObject dragon, teapot;

    #endregion // PRIVATE_MEMBER_VARIABLES



    #region EXPOSED_PUBLIC_VARIABLES

    /// <summary>
    /// can be set in the Unity inspector to reference a ImageTargetBehaviour that is used for augmentations of new cloud reco results.
    /// </summary>
    public ImageTargetBehaviour ImageTargetTemplate;

    #endregion
	
    #region UNTIY_MONOBEHAVIOUR_METHODS

    /// <summary>
    /// register for events at the CloudRecoBehaviour
    /// </summary>
    void Start()
    {
        // register this event handler at the cloud reco behaviour
        CloudRecoBehaviour cloudRecoBehaviour = GetComponent<CloudRecoBehaviour>();
        if (cloudRecoBehaviour)
        {
            cloudRecoBehaviour.RegisterEventHandler(this);
        }

        // remember cloudRecoBehaviour for later
        mCloudRecoBehaviour = cloudRecoBehaviour;
		
		/*
		teapot = GameObject.Find("teapot");
		dragon = GameObject.Find("Dragon");
		
		Hide( teapot );
		Hide( dragon );
		*/
		
		//teapot.SetActive( false );
		//dragon.SetActive( false );
		
    }

    #endregion // UNTIY_MONOBEHAVIOUR_METHODS


    #region ICloudRecoEventHandler_IMPLEMENTATION

    /// <summary>
    /// called when TargetFinder has been initialized successfully
    /// </summary>
    public void OnInitialized()
    {
        // get a reference to the Image Tracker, remember it
        mImageTracker = (ImageTracker)TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER);
    }

    /// <summary>
    /// visualize initialization errors
    /// </summary>
    public void OnInitError(TargetFinder.InitState initError)
    {
    }

    /// <summary>
    /// visualize update errors
    /// </summary>
    public void OnUpdateError(TargetFinder.UpdateState updateError)
    {
    }

    /// <summary>
    /// when we start scanning, unregister Trackable from the ImageTargetTemplate, then delete all trackables
    /// </summary>
    public void OnStateChanged(bool scanning)
    {
    }

    /// <summary>
    /// Handles new search results
    /// </summary>
    /// <param name="targetSearchResult"></param>
    public void OnNewSearchResult(TargetFinder.TargetSearchResult targetSearchResult)
    {
        // duplicate the referenced image target
        GameObject newImageTarget = Instantiate(ImageTargetTemplate.gameObject) as GameObject;
		
		GameObject augmentation = null;
		
		string model_name = targetSearchResult.MetaData;
		
		
		if( augmentation != null )
			augmentation.transform.parent = newImageTarget.transform;

        // enable the new result with the same ImageTargetBehaviour:
        ImageTargetBehaviour imageTargetBehaviour = mImageTracker.TargetFinder.EnableTracking(targetSearchResult, newImageTarget);
		
		Debug.Log("Metadata value is " + model_name );
		
		
		
		switch( model_name ){
		 	
			case "teapot" :
			    
				Destroy( imageTargetBehaviour.gameObject.transform.Find("Dragon").gameObject );
			   
				break;
			
			case "dragon" :
			    
				Destroy( imageTargetBehaviour.gameObject.transform.Find("teapot").gameObject );
			
				break;
			
		}

        if (imageTargetBehaviour != null)
        {
            // stop the target finder
            mCloudRecoBehaviour.CloudRecoEnabled = false;
        }
    }
	
	

    #endregion // ICloudRecoEventHandler_IMPLEMENTATION

	private void Hide( GameObject model ){
		
		Debug.Log( "Hiding "+ model.name );
		
        Renderer[] rendererComponents = model.GetComponentsInChildren<Renderer>();
        Collider[] colliderComponents = model.GetComponentsInChildren<Collider>();

        // Disable rendering:
        foreach (Renderer component in rendererComponents)
        {
            component.enabled = false;
        }

        // Disable colliders:
        foreach (Collider component in colliderComponents)
        {
            component.enabled = false;
        }

        //Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost");
	}



}

 

Cloud Recognition Tutorial Scripts

July 24, 2013 - 3:41pm #10

Thanks David, I just realize that the prefab called CloudRecoTarget part of example projet is missing. I tried to create from the standard ImageTarget. I desabled the DefaultTrackbleEventHandle as it seems to be part of the prefab. I compiled the app on ipad but my model don' t desappear when the tracker is away. I don't know if i have to desable the models that i put under CloudRecognition structure. Thanks Richard

Cloud Recognition Tutorial Scripts

March 14, 2016 - 7:40am #9

Hi Rickb ,

I am new in vuforia unity. I want video play in cloud recoganization target. Please guide me for this task. I am using latest vuforia sdk 5-5-9. Give any tutorial url or sample project. In cloud recoganization Sample scene only contains 3d object. Please guide me..

 

Cloud Recognition Tutorial Scripts

March 21, 2016 - 9:15pm #8

would it be possible to also post the meta file that works with the dragon and teapot? I realize now that the way I'm entering the switch case should be corrrect but maybe my formatting in the metafile isn't working.

 

 

Cloud Recognition Video Playback

January 23, 2021 - 6:59pm #7

I tried to use cloud recognition to play a video from the url that is present in  the metadata of image target. the metadata(url) is successfully read and assigned to the videoplayer component. But still it does not play the video. Where am i going wrong.I used unity 2019.4 and vuforia 9.3 .please help.... thanks in advance

 

Cloud Recognition Tutorial Scripts

March 24, 2021 - 9:59pm #6

Hello All

Someone please guide me how to use Vuforia Cloud Recognition for Vuforia 9.8  & Unity 2019.4.

Please!

Cloud Recognition Tutorial Scripts

March 25, 2021 - 3:50am #5

Hi @khanhabib,

We demo in the the Core sample apps available in the Unity Asset Store: https://assetstore.unity.com/packages/templates/packs/vuforia-core-samples-99026 the Clour Reco functionality.

Please go over our scene.

In addition we have following articles available going over the Unity implementation: https://library.vuforia.com/articles/Solution/How-To-Implement-Cloud-Reco.html#unity

Hope it helps.

Vuforia Engine Support

 

Cloud Recognition Tutorial Scripts

August 19, 2021 - 11:27pm #4

hello thanks

is it available for vuforia version 10?

 

Cloud Recognition Tutorial Scripts

August 20, 2021 - 5:49am #3

Yeah, the core samples are also available for v10.0.12!

 

Kind regards,

Patrick Scheper

Technical Community Manager

Cloud Recognition Tutorial Scripts

August 21, 2021 - 10:59pm #2

Hello all, was following the tutorial for how to implement cloud reco and have experienced a builtime error on unity.

Tutorial: https://library.vuforia.com/articles/Solution/How-To-Implement-Cloud-Reco.html

 

 

This is the error below:

Assets/SimpleCloudRecoEventHandler.cs(30,32): error CS0246: The type or namespace name 'TargetFinder' could not be found (are you missing a using directive or an assembly reference?)

 

Does anyone here know how to resolve this issue? some help would be awesome :)

Cloud Recognition Tutorial Scripts

August 23, 2021 - 3:00am #1

Hey there,

 

Are you currently running v9.8 or v10.0? The documentation can be a little confusing at the moment since the API changed with v10.

You linked the cloud recognition article for v9.8. You can find the v10 version here.

Hope that helps!

 

Kind regards,

Patrick Scheper

Technical Community Manager

Log in or register to post comments