Search code examples
markervuforiarajawali

How to count found markers rajawali vuforia?


I am trying to get the number of found markers on rajawali vuforia.

while we have the methods:

1- protected void foundFrameMarker(final int markerId, Vector3 position,Quaternion orientation) {} // this method is called when found any marker until the marker disappeared

2- public void noFrameMarkersFound() {} // this method is called when no markers appeared or found

How to use these methods to get count of found markers? Or is there another way to get the count?


Solution

  • foundFrameMarker is called for each currently detected marker in a loop, every frame. In order to count found markers, you should add an int variable to your renderer for counting them. Reset it at the beginning of the render loop (onRenderFrame), and increment it inside foundFrameMarker:

    public void onRenderFrame(GL10 gl) {
       ... 
       mMarkerCount = 0;
       ...
     }
    
     protected void foundFrameMarker(int markerId, Vector3 position, Quaternion orientation) {
       mMarkerCount++;
       ...
     }