Topic locked

How to add additional words file in text recognition

June 25, 2013 - 12:10am #1

Hi!

I want to add my own word's file in text recognition.

plz provide me the procedure!

How to add additional words file in text recognition

June 30, 2014 - 4:37am #23

hiasyou,

if you read the developer guide here

https://developer.vuforia.com/resources/dev-guide/word-targets

  you will find out that the minimu number of letters is 2, and the maximum allowed number of characters is 24.

Therefore, single letters do not work.

Also, the same page contains a Table with the allowed characters. I warmly invite you to read the developer guide before posting in this Forum in the future. 

Thank you.

 

 

How to add additional words file in text recognition

June 30, 2014 - 3:54am #22

When I add 26 english single letters into the list of text, such as A;b;c;d;e, when I build it is come out an error: word length is not valid. 

  How can I just add 26 english letters into my list of text?

thanks.

How to add additional words file in text recognition

March 3, 2014 - 5:23am #21

Why did you not ask this in the Android forums?  This is iOS.

 

N

How to add additional words file in text recognition

March 3, 2014 - 4:10am #20

Hi, I want to add my own word list into TextReco (*.lst) file. Im using Java Eclipse. I followed the instuction from : 
https://developer.vuforia.com/resources/dev-guide/text-recognition-feature

There is no error but still doesnt work .. this is my code.
Am I made a mistaken?

 
@Override
    public boolean doLoadTrackersData()
    {
        TrackerManager tm = TrackerManager.getInstance();
        TextTracker tt = (TextTracker) tm
            .getTracker(TextTracker.getClassType());
        WordList wl = tt.getWordList();
        
        return wl.loadWordList("TextReco/Vuforia-English-word.vwl",
            WordList.STORAGE_TYPE.STORAGE_APPRESOURCE);
     }    
    

    public int addWordsFromFile(String path, int storageType)
    {
    TrackerManager tm = TrackerManager.getInstance();
       TextTracker tt = (TextTracker) tm
           .getTracker(TextTracker.getClassType());
       WordList wl = tt.getWordList();
       
        return wl.addWordsFromFile("TextReco/AdditionalWords.lst", 
                WordList.STORAGE_TYPE.STORAGE_APPRESOURCE);
    }

 

 

Thanks in Advanced

 

How to add additional words file in text recognition

January 6, 2014 - 2:50am #19

Try asking this in the Android forums.

N

How to add additional words file in text recognition

January 5, 2014 - 9:27pm #18

Hi AlessandroB,

The below method seems to be for IOS as QCARControl.mm is not android file. Can you tell how to do the same thing in Android?

Thank You,

Sushil

How to add additional words file in text recognition

August 9, 2013 - 11:25am #17

Number recognition is not supported in the current SDK, as stated in our developer guide:

https://developer.vuforia.com/resources/dev-guide/word-targets

But you can post your request in our Wish List:

https://developer.vuforia.com/forum/general-discussion/wish-list

 

How to add additional words file in text recognition

August 9, 2013 - 11:11am #16

I added new words in a .lst file as described below. It works fine when I add words but it does not work if I add numbers.

How can I make it detect numbers as well? How can I add numbers into the list of text?

Thanks.

 

How to add additional words file in text recognition

June 27, 2013 - 2:00am #15

Good to hear!

How to add additional words file in text recognition

June 26, 2013 - 10:12pm #14

Hi!

Thank you very much NalinS.

Its working now!

How to add additional words file in text recognition

June 26, 2013 - 6:56am #13

You are doing this incorrectly.

I was able to get the additonal words list specified here:

https://developer.vuforia.com/sites/default/files/AdditionalWords.zip

...integrated into the sample TR app by doing the following:

 

1 - download the file (add to it if required) and then drag it into XCode, best in the same place as the vwl

2 - update loadWordListInBackground() in QCARControl.mm as follows:

 

- (void)loadWordListInBackground:(id)obj

{

    // Background thread must have its own autorelease pool

    @autoreleasepool {

            

....existing code            

            // load additional word lists

            

            // Add custom words by loading from file

            wordList->addWordsFromFile("AdditionalWords.lst", QCAR::WordList::STORAGE_APPRESOURCE);

            

        }

        else {

            error = [[ErrorReport alloc] initWithMessage:"ERROR: failed to load word list"];

        }

.... existing code

}

 

3 - build and run.

 

HTH

N

 

How to add additional words file in text recognition

June 26, 2013 - 1:52am #12

Hi!

please help me on this!

i am unable to include additinal words

 in my appdelegate.mm file

if i call both file   [[QCARControl getInstance] loadTextTrackerWordList:@"Vuforia-English-word.vwl"];
    [[QCARControl getInstance] loadTextTrackerWordList:@"AdditionalWords.lst"];
in following method then only it goes in

if (false == wordList->loadWordList([wordListFile cStringUsingEncoding:NSASCIIStringEncoding], QCAR::WordList::STORAGE_APPRESOURCE)) {

This condition where i add additional.lst

- (void)initQCARComplete:(ErrorReport*)error
{
    // QCARControl is informing us that QCAR initialisation has completed
    
    if (nil != error) {
        [error log];
        [error release];
        return;
    }
    
    // Frames from the camera are always landscape, no matter what the
    // orientation of the device.  Tell QCAR to rotate the video background (and
    // the projection matrix it provides to us for rendering our augmentation)
    // appropriately
    QCAR::setRotation(QCAR::ROTATE_IOS_90);

    // Tell QCAR we've created a drawing surface
    QCAR::onSurfaceCreated();
    
    // Tell QCAR the size of the drawing surface
    QCAR::onSurfaceChanged(boundsEAGLView.size.width, boundsEAGLView.size.height);
    
    // We need n text tracker, which will track our target, so initialise it and
    // load its data now.  As we are QCARControl's delegate, it will call our
    // loadAndActivateTextTrackerDataSetComplete method when tracker
    // initialisation, loading and activation has completed
    [[QCARControl getInstance] loadTextTrackerWordList:@"Vuforia-English-word.vwl"];
    [[QCARControl getInstance] loadTextTrackerWordList:@"AdditionalWords.lst"];

     //[[QCARControl getInstance] :@"AdditionalWords.lst"];
    
    
    
    
  // [[QCARControl getInstance] lo:@"AdditionalWords.lst"];

}

How to add additional words file in text recognition

June 25, 2013 - 10:38pm #11

Hi!

Yes!

i placed both file in same dictionary

& also one thing in my appdelegate.mm file

if i call both file   [[QCARControl getInstance] loadTextTrackerWordList:@"Vuforia-English-word.vwl"];
    [[QCARControl getInstance] loadTextTrackerWordList:@"AdditionalWords.lst"];
in following method then only it goes in

if (false == wordList->loadWordList([wordListFile cStringUsingEncoding:NSASCIIStringEncoding], QCAR::WordList::STORAGE_APPRESOURCE)) {

This condition where i add additional.lst

- (void)initQCARComplete:(ErrorReport*)error
{
    // QCARControl is informing us that QCAR initialisation has completed
    
    if (nil != error) {
        [error log];
        [error release];
        return;
    }
    
    // Frames from the camera are always landscape, no matter what the
    // orientation of the device.  Tell QCAR to rotate the video background (and
    // the projection matrix it provides to us for rendering our augmentation)
    // appropriately
    QCAR::setRotation(QCAR::ROTATE_IOS_90);

    // Tell QCAR we've created a drawing surface
    QCAR::onSurfaceCreated();
    
    // Tell QCAR the size of the drawing surface
    QCAR::onSurfaceChanged(boundsEAGLView.size.width, boundsEAGLView.size.height);
    
    // We need n text tracker, which will track our target, so initialise it and
    // load its data now.  As we are QCARControl's delegate, it will call our
    // loadAndActivateTextTrackerDataSetComplete method when tracker
    // initialisation, loading and activation has completed
    [[QCARControl getInstance] loadTextTrackerWordList:@"Vuforia-English-word.vwl"];
    [[QCARControl getInstance] loadTextTrackerWordList:@"AdditionalWords.lst"];

     //[[QCARControl getInstance] :@"AdditionalWords.lst"];
    
    
    
    
  // [[QCARControl getInstance] lo:@"AdditionalWords.lst"];

}
 

How to add additional words file in text recognition

June 25, 2013 - 10:34pm #10

Have you placed the AdditionalWords file in the same directory where the VWL file is located ?

 

How to add additional words file in text recognition

June 25, 2013 - 9:46pm #9

Hi!

I used this,

 

- (void)loadWordListInBackground:(id)obj
{
    // Background thread must have its own autorelease pool
    @autoreleasepool {
        ErrorReport* error = nil;

        // Load the data set
        NSString* wordListFile = obj;
        
 
        // Get the QCAR tracker manager text tracker
        QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
        QCAR::TextTracker* textTracker = static_cast<QCAR::TextTracker*>(trackerManager.getTracker(QCAR::Tracker::TEXT_TRACKER));
       

        if (NULL != textTracker) {
            QCAR::WordList* wordList = textTracker->getWordList();
           
            // Load the word list
            if (false == wordList->loadWordList([wordListFile cStringUsingEncoding:NSASCIIStringEncoding], QCAR::WordList::STORAGE_APPRESOURCE)) {
                wordList->addWordsFromFile([@"AdditionalWords.lst" cStringUsingEncoding:NSASCIIStringEncoding],QCAR::WordList::STORAGE_APPRESOURCE);
                NSLog(@"number=%d", wordList->addWordsFromFile([@"AdditionalWords.lst" cStringUsingEncoding:NSASCIIStringEncoding],QCAR::WordList::STORAGE_APPRESOURCE));
                

             

                error = [[ErrorReport alloc] initWithMessage:"ERROR: failed to load word list"];
                //NSLog(@"addnumber=%d",wordList);

                
                
            }
        }
        else {
          //  WordList->addWordsFromFile([@"AdditionalWords.lst" cStringUsingEncoding:NSASCIIStringEncoding], QCAR::WordList::STORAGE_APPRESOURCE);
            error = [[ErrorReport alloc] initWithMessage:"ERROR: failed to load word list"];
        }

        // Inform the delegate that data set loading and activation has
        // completed (on the main thread)
        [self.delegate performSelectorOnMainThread:@selector(loadTextTrackerWordListComplete:) withObject:error waitUntilDone:NO];
    }
}
 

 

but file cant loaded it returns Zero

I used same .lst file given in vuforia sample i.e.@"AdditionalWords.lst"

I am unable to find what is the issue! Plz help!

How to add additional words file in text recognition

June 25, 2013 - 6:55am #8

When you call:

wordList->addWordsFromFile([additionalWordsFile cStringUsingEncoding:NSASCIIStringEncoding], QCAR::WordList::STORAGE_APPRESOURCE))

this should return a number, which represents the number of words added; you may want to check that number (if it is zero or negative, it means the file was not loaded)

 

How to add additional words file in text recognition

June 25, 2013 - 6:48am #7

AlessandroB wrote:

Hi,

if you look at the file QCARControl.mm, you will find this code:

- (void)loadWordListInBackground:(id)obj
{
    // Background thread must have its own autorelease pool
    @autoreleasepool {
        ErrorReport* error = nil;

        // Load the data set
        NSString* wordListFile = obj;

        // Get the QCAR tracker manager text tracker
        QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
        QCAR::TextTracker* textTracker = static_cast<QCAR::TextTracker*>(trackerManager.getTracker(QCAR::Tracker::TEXT_TRACKER));

        if (NULL != textTracker) {
            QCAR::WordList* wordList = textTracker->getWordList();

            // Load the word list
            if (false == wordList->loadWordList([wordListFile cStringUsingEncoding:NSASCIIStringEncoding], QCAR::WordList::STORAGE_APPRESOURCE)) {
                error = [[ErrorReport alloc] initWithMessage:"ERROR: failed to load word list"];
            }
        }
        else {
            error = [[ErrorReport alloc] initWithMessage:"ERROR: failed to load word list"];
        }

        // Inform the delegate that data set loading and activation has
        // completed (on the main thread)
        [self.delegate performSelectorOnMainThread:@selector(loadTextTrackerWordListComplete:) withObject:error waitUntilDone:NO];
    }
}

In particular, have a look at the line:

if (false == wordList->loadWordList([wordListFile cStringUsingEncoding:NSASCIIStringEncoding], QCAR::WordList::STORAGE_APPRESOURCE)) {

After that line, you could add a statement like:

wordList->addWordsFromFile([additionalWordsFile cStringUsingEncoding:NSASCIIStringEncoding], QCAR::WordList::STORAGE_APPRESOURCE))
 

Where additionalWordsFile should be a string containing the filename of the file where you have put your additional words (for instance @"My-Additional-words.lst")

For an example of additional words file (in ".lst" format), you can see here:

https://developer.vuforia.com/resources/dev-guide/word-targets

https://developer.vuforia.com/sites/default/files/AdditionalWords.zip

 

 

 

 

 

 

I do the same procedure but it cant recognize my words in my .lst file!

programm runs with no error & also shows name of file correctly but still it cant recognize  my custom words in .lst file!!

How to add additional words file in text recognition

June 25, 2013 - 5:59am #6

Hi, you cannot create your own VWL file by yourself; 

if you have a set of specific custom words that you want to use, you may add them on top of the default English VWL (i.e. loading the standard English VWL, like in the sample, and then add some words on top of it), using addWord() method of QCAR::WordList, or using the addWordsFromFile() and passing the name of the file where you have stored your additional words.

This is explained in detail here:

https://developer.vuforia.com/resources/dev-guide/word-targets

Also, in that same page  of the developer guide, it mentions that, if you really need to create your own VWL file (i.e. if you cannot go with the approach above of using the default VWL + adding additional words), then you should contact www.vuforia.com/contact

 

 

How to add additional words file in text recognition

June 25, 2013 - 5:18am #5

Hi!

plz tell me how to create my own .vwl file?

How to add additional words file in text recognition

June 25, 2013 - 3:40am #4

Hi,

if you look at the file QCARControl.mm, you will find this code:

- (void)loadWordListInBackground:(id)obj
{
    // Background thread must have its own autorelease pool
    @autoreleasepool {
        ErrorReport* error = nil;

        // Load the data set
        NSString* wordListFile = obj;

        // Get the QCAR tracker manager text tracker
        QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
        QCAR::TextTracker* textTracker = static_cast<QCAR::TextTracker*>(trackerManager.getTracker(QCAR::Tracker::TEXT_TRACKER));

        if (NULL != textTracker) {
            QCAR::WordList* wordList = textTracker->getWordList();

            // Load the word list
            if (false == wordList->loadWordList([wordListFile cStringUsingEncoding:NSASCIIStringEncoding], QCAR::WordList::STORAGE_APPRESOURCE)) {
                error = [[ErrorReport alloc] initWithMessage:"ERROR: failed to load word list"];
            }
        }
        else {
            error = [[ErrorReport alloc] initWithMessage:"ERROR: failed to load word list"];
        }

        // Inform the delegate that data set loading and activation has
        // completed (on the main thread)
        [self.delegate performSelectorOnMainThread:@selector(loadTextTrackerWordListComplete:) withObject:error waitUntilDone:NO];
    }
}

In particular, have a look at the line:

if (false == wordList->loadWordList([wordListFile cStringUsingEncoding:NSASCIIStringEncoding], QCAR::WordList::STORAGE_APPRESOURCE)) {

After that line, you could add a statement like:

wordList->addWordsFromFile([additionalWordsFile cStringUsingEncoding:NSASCIIStringEncoding], QCAR::WordList::STORAGE_APPRESOURCE))
 

Where additionalWordsFile should be a string containing the filename of the file where you have put your additional words (for instance @"My-Additional-words.lst")

For an example of additional words file (in ".lst" format), you can see here:

https://developer.vuforia.com/resources/dev-guide/word-targets

https://developer.vuforia.com/sites/default/files/AdditionalWords.zip

 

 

 

 

How to add additional words file in text recognition

June 25, 2013 - 3:17am #3

Hi!

 

in appdelegate.mm the wordlist can be accessed through this:-

 [[QCARControl getInstance] loadTextTrackerWordList:@"Vuforia-English-word.vwl"];

 

I want to add aditional word file here tell me how?
 

How to add additional words file in text recognition

June 25, 2013 - 1:57am #2

Hi, you may want to have a look at our Developer Guide:

here you can also find some code snippets to add custom words:

https://developer.vuforia.com/resources/dev-guide/text-recognition-feature

and this is the API reference of the QCAR::WordList class:

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

 

Topic locked