By soumodippaul
on Fri, 05/06/2016 - 15:19
Since Vuforia dosent allow to detect more than 10 image target in the same camera frame , so I thought of refreshing the dataset everytime whenever one Image target is detected . I am using the Android SDK Core sample that vuforia has provided . In ImageTargetRender.java , where we can verify the detection , I have tried to destroy the trackable from the dataset . Since it is active dataset , I am getting this error
com.vuforia.samples.VuforiaSamples E/AR: Failed to destroy the Trackable because the dataset is currently active.
I am including the code which does the following:
private void renderFrame() { GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); State state = mRenderer.begin(); mRenderer.drawVideoBackground(); GLES20.glEnable(GLES20.GL_DEPTH_TEST); // Set the viewport int[] viewport = vuforiaAppSession.getViewport(); GLES20.glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); // handle face culling, we need to detect if we are using reflection // to determine the direction of the culling GLES20.glEnable(GLES20.GL_CULL_FACE); GLES20.glCullFace(GLES20.GL_BACK); if (Renderer.getInstance().getVideoBackgroundConfig().getReflection() == VIDEO_BACKGROUND_REFLECTION.VIDEO_BACKGROUND_REFLECTION_ON) GLES20.glFrontFace(GLES20.GL_CW); // Front camera else GLES20.glFrontFace(GLES20.GL_CCW); // Back camera Log.i("Image-Log",""+state.getNumTrackableResults()); // did we find any trackables this frame? for (int tIdx = 0; tIdx < state.getNumTrackableResults(); tIdx++) { TrackableResult result = state.getTrackableResult(tIdx); Trackable trackable = result.getTrackable(); printUserData(trackable); Matrix44F modelViewMatrix_Vuforia = Tool .convertPose2GLMatrix(result.getPose()); float[] modelViewMatrix = modelViewMatrix_Vuforia.getData(); Log.i("Image-Log",trackable.getName()); //Here I cannot destroy the Trackable from Current Dataset currentDataset.destroy(trackable);
}
}
disable trackable from dataset after detection
You would need to first Deactivate the dataset, before you can make any operation such as detsroying a Trackable;