Log in or register to post comments

API to display framerate

March 7, 2013 - 1:33am #1

Hii, Does anyone know whether Vuforia provides API to display the frame rate per second during rendering the 3D Object?

Thanks

API to display framerate

March 17, 2013 - 12:15pm #11

Just don't use a Toast;

the tutorial explains you how to display a Toast, as a simple example of how to trigger something on the Java UI, but you should then use the UI components that you find most appropriate;

for instance, you could show a TextView (e.g. create the TextView in the onCreate method of your ImageTargets.java and then update its text value during tracking, using TextView.setText("some message") at runtime)

 

 

API to display framerate

March 17, 2013 - 9:01am #10

Hi, I just realise that toast has  constant value for duration. Is there any suggestion how to display frame rate per second during tracking process?

Thanks

API to display framerate

March 8, 2013 - 3:21am #9

Thanks for clear explanations also. Now, I will try second issue. =D 

API to display framerate

March 8, 2013 - 3:04am #8

Thanks for the clarifications; now it looks clearer ;-)

the reason why the frame rate is higher when the target is detected (and the 3D augmentation is rendered) is most likely because the underlying Vuforia process to search and find a target in your image is rather expensive (thus impacting the frame rate),  compared to the processing of just tracking the object in space (when it has already been found);

in other words, Vuforia scans and process your image and makes quite a bit of heavy calculations until the target is "found";  then, once it is found (detected) from that moment on, the target does not need to be discovered anymore, it just needs to be tracked in space (which is a fairly inexpensive process for the CPU), so the CPU has to do less computations and the frame rate goes up.

 

About your second question, you can take inspiration from this article, which explains how to do someting in Java (for instance show a view) when a target is detected:

https://developer.vuforia.com/resources/dev-guide/open-web-site-and-display-toast-target-detection

 

 

 

API to display framerate

March 8, 2013 - 1:35am #7

Hii, Okay firstly I clarified my questions. I just realise that renderFrame() always get called as onDrawFrame() get called, am I right? what I found here is when my virtual object appear during tracking, its frame rate increases rather than decreases and I did not know what probably the cause is. And my second question, I intend to display frame rate only when my virtual object comes up.

 

API to display framerate

March 8, 2013 - 1:16am #6

Hi, concerning your first question, not sjure why the frame rate goes up (instead of going down as you would expect); but that could find its reason in how the rendering thread decides to update the view, I would not worry about that, unless you have specific concerns with that.

About your second question, I'm not sure to understand it; the renderFrame() method is called from within the onDrawFrame() in Java, so you can determine easily when that method is called the first time, just put some code in Java (for instance you can put an integer counter in Java, or similar solutions...)

 

 

 

API to display framerate

March 8, 2013 - 1:08am #5

Hi, thanks for your help. I have implemented as you said, however, I found out that the framerate during rendering frame is bigger than when renderFrame is not getting called (30 and 20 for each average frame rate) . do you have any idea why was it that?

second thing is, I want to start display framerate as renderFrame() get called, but the constraint is it return void value. How to check whenever a method get called or not?

Thanks

API to display framerate

March 7, 2013 - 12:28pm #4

You can use the function elapsedRealTime() to measure time deltas between consecutive calls to onDrawFrame() in ImageTargetsRenderer.java

see also here:

http://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()

Note, once you have the time-delta in milliseconds, you can obtain the frame rate as follows:

double deltaTimeSeconds = deltaTimeMilliseconds / 1000.0;

double frameRate = 1.0 / deltaTimeSeconds;

Then, you can display your measurements in a TextView, as I said.

API to display framerate

March 7, 2013 - 7:56am #3

Yeah, I would prefer to do this in Java in the onDrawFrame() method. But in this method, I want to start counting frame rate as the renderFrame() get called. The problem is renderFrame() method return void so that I did not know what value to compare to start counting as renderFrame() get called. Can you give a hint how to do that in Java?

Thanks

API to display framerate

March 7, 2013 - 6:43am #2

No, Vuforia does not have such API; however, implementing time measurement between consecutive frames can be done easily (you can do it either in CPP in the renderFrame() method, or in Java in the onDrawFrame() method of the Renderer class); the way you display the number on the screen is then up to your coding preferences (for instance you could use a TextView on the Java side)

 

 

Log in or register to post comments