Log in or register to post comments

Tracking the same image twice in a row

November 5, 2012 - 6:22am #1

Hello.

I'm trying to edit the ImageTargets sample: my goal is simply to show a description (using a toast, or something like that) of an image when detected, instead of the teapot.

So I removed any method call related to the Teapot drawer and it's all working - my only problem is that now the same image can't be detected twice in a row. If I detect "stones", have my event with text and all, and then try to detect "stones" again... it doesn't work. I need to detect a different image first.

Is there any last_id variable I can reset somewhere in the code?  Looks like it won't update until a new tracker is found.

Seems like a very stupid problem but I still can't solve it.

Tracking the same image twice in a row

November 9, 2012 - 9:12am #6

OK, excellent.

Tracking the same image twice in a row

November 6, 2012 - 2:07am #5

Yes it works now, thanks.

Tracking the same image twice in a row

November 6, 2012 - 1:55am #4

OK, so does that code already work for you now ?

Tracking the same image twice in a row

November 6, 2012 - 12:56am #3

Of course I found it right after I posted here... gosh.

Here's the answer anyway: there's a int lastTrackableId = -1 in the ImageTargets.cpp, so I wrote two methods to get and set its value, and I updated the onDrawFrame method (ImageTargetsRenderer.java) in this way:

public void onDrawFrame(GL10 gl)
    {
        if (!mIsActive)
            return;
        // Call our native function to render content
        if(getLastTrackableId()!=-1){ //return lastTrackableId's value
                           renderFrame();
                           setLastTrackableId(); //reset lastTrackableId to -1
                          }
       else renderFrame();}

Tracking the same image twice in a row

November 5, 2012 - 8:01am #2

Hi, can you post the relevant code snippet by which you "detect" the trackables ? that would help.

 

Log in or register to post comments