Log in or register to post comments

Frame Marker Issues in Android

November 30, 2012 - 5:13am #1

I have created 512 Frame Markers in my android application,

and this application will output the marker id when It recongize the marker.

 

However, I found that when I  snap marker 7, the getMarkerId() returns 6.

For number 140 ~ 146, those numbers also return wrong number.

 

I want to ask, does the Frame Marker recognition is accurate for large number of frame markers?

 

 

Testing Environment:

Galaxy Nexus with Android 4.1.2

 

Building Environment:

Android-NDK-r8c

Android API-15

Mac OS X 10.8.2

 

sorry for my poor english.

 

 

Frame Marker Issues in Android

November 30, 2012 - 7:25am #5

You're welcome.

Frame Marker Issues in Android

November 30, 2012 - 7:21am #4

Thanks a lot!!!!!!!

And Looks like I have to learn more about C++ programming.

 

 

Frame Marker Issues in Android

November 30, 2012 - 7:14am #3

Hi,

I think the problem could be in the way you determine the marker name in the createFrameMarker() function;

you shoud set the marker name as follow:

char name[20];

sprintf(name, "Marker%d", i);

 

Frame Marker Issues in Android

November 30, 2012 - 5:53am #2

My Testing is based on the "FrameMarkers" Project in the sample folder include in vuforia SDK.

and I only modified these two methods in FrameMarkers.cpp ,

other files are unchanged.

The Vuforia SDK vuforia-sdk-android-1-5-9 on the mac platform.

 

JNIEXPORT int JNICALL
Java_com_qualcomm_QCARSamples_FrameMarkers_FrameMarkers_initTracker(JNIEnv *, jobject)
{
    LOG("Java_com_qualcomm_QCARSamples_FrameMarkers_FrameMarkers_initTracker");

    // Initialize the marker tracker:
    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
    QCAR::Tracker* trackerBase = trackerManager.initTracker(QCAR::Tracker::MARKER_TRACKER);
    QCAR::MarkerTracker* markerTracker = static_cast<QCAR::MarkerTracker*>(trackerBase);
    if (markerTracker == NULL)
    {
        LOG("Failed to initialize MarkerTracker.");
        return 0;
    }
    LOG("Successfully initialized MarkerTracker.");

    // Create frame markers:
    for(int i= 0;i<512;i++) {
       
        if (!markerTracker->createFrameMarker(i, "MarkerC"+i, QCAR::Vec2F(50,50))) {
            LOG("Failed to create frame markers.");
            return 0;
        }
    }
    LOG("Successfully created frame markers.");

    return 1;
}

 

JNIEXPORT void JNICALL
Java_com_qualcomm_QCARSamples_FrameMarkers_FrameMarkersRenderer_renderFrame(JNIEnv *, jobject)
{
    //LOG("Java_com_qualcomm_QCARSamples_FrameMarkers_GLRenderer_renderFrame");

    // Clear color and depth buffer
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Get the state from QCAR and mark the beginning of a rendering section
    QCAR::State state = QCAR::Renderer::getInstance().begin();

    // Explicitly render the Video Background
    QCAR::Renderer::getInstance().drawVideoBackground();

    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);

    // Did we find any trackables this frame?
    for(int tIdx = 0; tIdx < state.getNumActiveTrackables(); tIdx++)
    {
        // Get the trackable:
        const QCAR::Trackable* trackable = state.getActiveTrackable(tIdx);
        QCAR::Matrix44F modelViewMatrix =
        QCAR::Tool::convertPose2GLMatrix(trackable->getPose());

        // Choose the texture based on the target name:
        int textureIndex = -1;

        // Check the type of the trackable:
        assert(trackable->getType() == QCAR::Trackable::MARKER);
        const QCAR::Marker* marker = static_cast<const QCAR::Marker*>(trackable);

        textureIndex = marker->getMarkerId();

    //    assert(textureIndex < textureCount);
        const Texture* const thisTexture = textures[textureIndex];

        // Select which model to draw:
        const GLvoid* vertices = 0;
        const GLvoid* normals = 0;
        const GLvoid* indices = 0;
        const GLvoid* texCoords = 0;
        int numIndices = 0;

        char buf[50];
        sprintf(buf, ":Total:%d marker:%d",state.getNumActiveTrackables(), marker->getMarkerId());
        LOG(buf);

    }

    glDisable(GL_DEPTH_TEST);
    glDisableVertexAttribArray(vertexHandle);
    glDisableVertexAttribArray(normalHandle);
    glDisableVertexAttribArray(textureCoordHandle);

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

 

 

 

 

Log in or register to post comments