Log in or register to post comments

Vuforia TextRecognition runtime new words

May 16, 2016 - 6:39am #1

Hi all!

I am developing an app in which i am using Vuforia Text Recognition. I need to include new words in my FilterList at runtime, and i want the words will be in the list forever.

I am using this code;

 

TextTracker textTracker =
    (TextTracker)TrackerManager.Instance.GetTracker<TextTracker>();
// set the filter list mode to black listing and add the word "Orange to be blacklisted:
textTracker.WordList.SetFilterMode(WordFilterMode.WHITE_LIST);
textTracker.WordList.AddWordToFilterList("Orange");
 
But it doesn't work for me. Could you please help me to do this?

Vuforia TextRecognition runtime new words

May 23, 2016 - 8:03pm #4

Try adding this script to an empty GameObject in your scene and running on a device:

using UnityEngine;
using System.Collections;

using Vuforia;

public class AddWords : MonoBehaviour
{

void Awake()
{
  VuforiaBehaviour vb = GameObject.FindObjectOfType<VuforiaBehaviour>();
  vb.RegisterVuforiaStartedCallback(OnStarted);
}

void OnStarted()
{
  TextTracker t = TrackerManager.Instance.GetTracker<TextTracker>();
  if (t != null) {
   t.Stop();
   if (!t.WordList.ContainsWord("abcxyz")) {
    Debug.Log("Adding word: abcxyz");
    t.WordList.AddWord("abcxyz");
   }
   t.Start();
  }
}
}

Vuforia TextRecognition runtime new words

May 17, 2016 - 1:46am #3

Hi I have the same problem

Im trying to add words at runtime too. But cant make it work. Im using this code:

On the class TextEventHandler of the TextReco example 

     TextTracker textTracker = (TextTracker)TrackerManager.Instance.GetTracker<TextTracker>();
     if(!textTracker.WordList.ContainsWord("Sirea")){
          textTracker.WordList.AddWord("Sirea");
     }

I have following the instructions of here : https://developer.vuforia.com/library/articles/Solution/How-To-Implement-Text-Recognition-in-Unity

I have read:

Quote:

Changes to the word list are not allowed while the text tracker is running.

But if I add 

TextTracker textTracker = (TextTracker)TrackerManager.Instance.GetTracker<TextTracker>();
textTracker.Stop (); 
if(!textTracker.WordList.ContainsWord("Sirea")){ 
   textTracker.WordList.AddWord("Sirea"); 
}
textTracker.Start();

I cant recognize anything.

Im using Unity 5.3.4 And Vuforia 5.9

I really need a help on this.

Thank you in advance

Vuforia TextRecognition runtime new words

May 16, 2016 - 11:42am #2

Hello,

For adding words to be recognized, you are not using the correct API. Try this:

https://developer.vuforia.com/library/sites/default/api/java/classcom_1_1vuforia_1_1WordList.html#a7cd57d1427fddb2159619cc776a79770

Use of the black list and white list are specified here:

https://developer.vuforia.com/library/sites/default/api/java/classcom_1_1vuforia_1_1WordList.html#a63ad10df36fd88b7145e8aa6c631de88

"In black list mode, any word in the filter list will be prevented from being detected. In the white list mode, only words in the the filter list can be detected."

Thanks.

Log in or register to post comments