Log in or register to post comments

Read Multiple Tractables From more than one XML

July 8, 2012 - 2:51am #1

Dear all,

i know that i can read multiple trackbles from xml file

but i need to read more than one xml without using the overlay menu 

how can i active all needed XML in the runtime without using the overlay menu

Thank you

Read Multiple Tractables From more than one XML

July 16, 2012 - 9:12am #7

This is probably a good application for the upcoming Vuforia Web Service, which will enable the handling of much larger sets of Trackables.

Read Multiple Tractables From more than one XML

July 16, 2012 - 3:18am #6

Hi Khaled1989

I am not sure that what you are trying to do is actually possible, because fundamentally only one dataset (XML) can be active at any one time.

If you think about how Vuforia is working, it takes the camera feed and builds up a picture of what it thinks it has scanned over the course of several frames.  When it finds a trackable, based on the current active dataset, it presents it to the application so it can get its pose etc.

What you cannot do is change the active dataset every frame, and expect Vuforia to track accurately - this is not how it works.

You need to rethink why you need multiple datasets and your approach to how this should be developed.

HTH

N

Read Multiple Tractables From more than one XML

July 11, 2012 - 6:20am #5

Thank you,

i used a continues incremental variable to swap the Datasets in each frame ... i can read that it has been activated successfully in the NSLog but it is still not working (deosn't perform the for loop) or we can say that it can't see the trackbles in the new activated Dataset

this my code for (renderFrameQCAR) function:

int k = 0;

- (void)renderFrameQCAR

{

    DataSetItem *targetEntry = [qUtils.targetsList objectAtIndex:k];

    [qUtils activateDataSet:targetEntry1.dataSet]; // Activate the Next dataset

    [self setFramebuffer];

    // Clear colour and depth buffers

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Render video background and retrieve tracking state

    QCAR::State state = QCAR::Renderer::getInstance().begin();

    QCAR::Renderer::getInstance().drawVideoBackground();

    

    //NSLog(@"active trackables: %d", state.getNumActiveTrackables());

    

    if (QCAR::GL_11 & qUtils.QCARFlags) {

        glEnable(GL_TEXTURE_2D);

        glDisable(GL_LIGHTING);

        glEnableClientState(GL_VERTEX_ARRAY);

        glEnableClientState(GL_NORMAL_ARRAY);

        glEnableClientState(GL_TEXTURE_COORD_ARRAY);

    }

    glEnable(GL_DEPTH_TEST);

    glEnable(GL_CULL_FACE);


    ////////////////////////////////////// Print in NSLog /////////////////////////////

    NSLog(@"K=");

    NSLog([[NSString alloc] initWithFormat:@"%i",k]);

    //NSLog([NSString stringWithUTF8String:state.getTrackable(0)->getName()]);

    NSLog([[NSString stringWithUTF8String:state.getTrackable(0)->getName()] stringByAppendingString:targetEntry.name]);

    ///////////////////////////////////////////////////////////////////////////////////

 

    bool getmarker = NO;

    for (int i = 0; i < state.getNumActiveTrackables(); ++i) {

        getmarker = YES;

        // Get the trackable

        const QCAR::Trackable* trackable = state.getActiveTrackable(i);

        QCAR::Matrix44F modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackable->getPose());

 

        // Choose the texture based on the target name

                    const char *charname = [targetEntry.name UTF8String]; // Convert the Marker Name from string to char

                    if (!strcmp(trackable->getName(), charname))

                    {

                        //Do Things

                    }

        }

/////////////////////////////// To Check if it is read trackble or not ///////////////////////////

        if (!getmarker)

        {

            if(k<[qUtils.targetsList count]-1)

            {

            k++; //Increment the variable to activate the next dataset

            }

            else

            {

                k=0; //Return to the First the dataset

            }

        }

///////////////////////////////////////////////////////////////////////////////////////////////////

    glDisable(GL_DEPTH_TEST);

    glDisable(GL_CULL_FACE);

    

    if (QCAR::GL_11 & qUtils.QCARFlags) {

        glDisable(GL_TEXTURE_2D);

        glDisableClientState(GL_VERTEX_ARRAY);

        glDisableClientState(GL_NORMAL_ARRAY);

        glDisableClientState(GL_TEXTURE_COORD_ARRAY);

    }

#ifndef USE_OPENGL1

    else {

        glDisableVertexAttribArray(vertexHandle);

        glDisableVertexAttribArray(normalHandle);

        glDisableVertexAttribArray(textureCoordHandle);

    }

#endif

    

    QCAR::Renderer::getInstance().end();

    [self presentFramebuffer];

}

 

is there a problem with state.getTrackable(0)->getName()????

is there any another way to swap the Datasets???

Thank you

Read Multiple Tractables From more than one XML

July 8, 2012 - 9:04am #4

The iOS version of this code is presented in QCARUtils.mm starting at line 647. You can find QCARUtils in the iOS sample applications.

 

Read Multiple Tractables From more than one XML

July 8, 2012 - 8:29am #3

Thank you,

but i develop on iphone

is there any example for ios???

Read Multiple Tractables From more than one XML

July 8, 2012 - 7:18am #2

There is a 1:1 relationship between datasets and their XML configuration files. And only 1 dataset can be active at any time. So you'd need to merge your XML files into a single file if you need for all of their Trackables to be active simultaneously.

But you can also change datasets at runtime, which may be another way to accomplish what you are trying to do. Take a look at the Swappable Datasets section of the SDK documentation - https://ar.qualcomm.at/qdevnet/sdk/android/Using%20Trackables%20-%20Android

Log in or register to post comments